:root {
  color-scheme: light;
  --ink: #202933;
  --muted: #546474;
  --brand: #7d2231;
  --line: #dce1e6;
  --surface: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f6f8;
  color: var(--ink);
  font: 1rem/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;
}

header {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.bar,main {
  max-width: 84rem;
  margin: auto;
  padding: 0 clamp(1rem,3vw,3rem);
}

.bar {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.brand {
  font-size: 1.25rem;
  font-weight: 720;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
}

.section-name {
  border-left: 1px solid var(--line);
  padding-left: 1.1rem;
  color: var(--muted);
}

main {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

h1,h2,p {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem,3vw,2.4rem);
  letter-spacing: -.04em;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.18rem;
  letter-spacing: -.02em;
  margin-bottom: 1rem;
}

a {
  color: var(--brand);
  text-underline-offset: .2em;
}

button,input {
  font: inherit;
}

button {
  color: var(--ink);
  background: white;
  border: 1px solid #aeb8c2;
  border-radius: .45rem;
  padding: .52rem 1rem;
  cursor: pointer;
  font-weight: 600;
  min-height: 2.65rem;
}

button:hover {
  background: #f1f3f5;
}

button.primary,button.destructive {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

button.primary:hover,button.destructive:hover {
  background: #601625;
}

.quiet {
  font-size: .875rem;
  min-height: 2rem;
  padding: .32rem .8rem;
}

:focus-visible {
  outline: 3px solid #346aa0;
  outline-offset: 2px;
}

.logout,.search,.heading,.table-head,.grant-line,.pagination {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.logout {
  margin-left: auto;
  font-size: .875rem;
  color: var(--muted);
}

.heading {
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.heading:has(+.subtitle) {
  margin-bottom: .3rem;
}

.subtitle,.hint,.muted,small {
  color: var(--muted);
}

.subtitle {
  margin-bottom: 1.4rem;
}

.hint,.muted {
  margin: .5rem 0 1rem;
}

.hint,small,.date {
  font-size: .875rem;
}

.back {
  display: inline-block;
  margin-bottom: 1rem;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0,2fr) minmax(17rem,1fr);
  gap: 1.25rem;
  align-items: start;
}

.panel {
  padding: clamp(1rem,2vw,1.55rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .7rem;
  min-width: 0;
}

.stack,label {
  display: grid;
  gap: .9rem;
}

.stack {
  align-content: start;
}

.stack>button {
  justify-self: start;
}

label {
  gap: .3rem;
  font-size: .9rem;
  font-weight: 600;
  min-width: 0;
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid #aeb8c2;
  border-radius: .4rem;
  padding: .55rem .65rem;
  background: white;
  color: var(--ink);
}

.login {
  max-width: 26rem;
  margin: clamp(2rem,10vh,7rem) auto;
}

.login h1 {
  margin-bottom: 1.4rem;
}

.login p {
  margin-bottom: 1rem;
}

.search {
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}

.search label {
  flex: 1;
  min-width: 10rem;
}

.table-head {
  justify-content: space-between;
  margin-bottom: .75rem;
}

.table-head h2 {
  margin: 0;
}

.table-head>span,.status {
  font-size: .875rem;
  color: #364f46;
  background: #eaf1ee;
  border-radius: .35rem;
  padding: .18rem .5rem;
  white-space: nowrap;
}

.status.off {
  background: #f2eaec;
  color: #6b3640;
}

.balance {
  font-size: .95rem;
  color: var(--brand);
}

.scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: .92rem;
  text-align: left;
}

th,td {
  border-bottom: 1px solid var(--line);
  padding: .65rem .5rem;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  background: #f5f7f8;
  font-size: .875rem;
  color: var(--muted);
}

tbody tr:last-child td {
  border-bottom: none;
}

.userlink {
  font-weight: 600;
}

.date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.notice,.error {
  background: #edf5ee;
  border-radius: .4rem;
  padding: .7rem 1rem;
  margin-bottom: 1rem;
}

.error {
  background: #fae9eb;
}

.fields {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: .6rem;
}

details {
  border-top: 1px solid var(--line);
  padding: .7rem 0;
}

summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
}

details[open]>summary {
  margin-bottom: .65rem;
}

details p {
  margin: .5rem 0 .85rem;
  font-size: .875rem;
}

.grant-line {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .45rem .8rem;
}

.grant-line>span:not(.status) {
  color: var(--muted);
  font-size: .875rem;
  font-weight: 400;
}

.divided {
  margin-top: 1.2rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.pagination {
  margin-top: 1rem;
}

@media(max-width:50rem) {
  .columns {
    grid-template-columns: 1fr;
  }
  .section-name {
    display: none;
  }
  .logout span {
    display: none;
  }
}

@media(max-width:36rem) {
  main {
    padding-top: 1.2rem;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .table-head {
    flex-wrap: wrap;
  }
  .date {
    white-space: normal;
  }
}
