:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142641;
  background: #f3f6fb;
  --ink: #142641;
  --muted: #53657d;
  --border: #dce4f0;
  --blue: #214ebe;
  --dark-blue: #193b91;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #406ce6; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.12; letter-spacing: -.035em; }
h2 { font-size: 1.15rem; line-height: 1.25; letter-spacing: -.01em; }
p { line-height: 1.5; }

.site-header { background: #fff; border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1480px; margin: auto; padding: 13px 30px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 11px; align-items: center; font-size: .99rem; font-weight: 700; }
.brand-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; background: #e8efff; color: var(--dark-blue); border-radius: 9px; font-size: 1.1rem; }
.shell { max-width: 1480px; margin: auto; padding: 37px 30px 40px; display: grid; gap: 24px; }
.page-title { display: grid; gap: 8px; }
.page-title p, .muted, small { color: var(--muted); }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.auth { width: min(100%, 430px); padding: 32px; margin: clamp(6px, 6vh, 70px) auto 0; }
.auth h1 { font-size: 1.85rem; margin-bottom: 23px; }
.auth > .link { margin-top: 8px; }
.auth > .muted { margin-top: 10px; font-size: .92rem; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: .88rem; font-weight: 650; }
input, select, textarea { background: #fff; width: 100%; min-width: 0; min-height: 44px; color: var(--ink); border: 1px solid #b9c8df; border-radius: 8px; padding: 9px 11px; font-size: 1rem; font-weight: 400; }
input:disabled, select:disabled { background: #f3f6fb; color: var(--muted); }
textarea { resize: vertical; }
small { font-weight: 400; }
.primary, .quiet { border-radius: 8px; padding: 10px 15px; min-height: 44px; font-weight: 650; line-height: 1.2; }
.primary { color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.primary:hover { background: var(--dark-blue); }
.quiet { background: #fff; border: 1px solid #c7d4e7; color: var(--dark-blue); }
.quiet:hover { background: #eff4ff; }
.link { min-height: 36px; background: none; border: 0; color: var(--dark-blue); padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.status { color: var(--muted); font-size: .87rem; overflow-wrap: anywhere; }
.status:empty { display: none; }
.error { color: #9e253b; }

.balance-card { display: grid; gap: 11px; padding: 29px 32px 32px; color: #fff; background: #173976; border-radius: var(--radius); }
.balance-card h2 { color: #e0ebff; font-weight: 550; }
.amount { font-size: clamp(2.1rem, 5vw, 3.6rem); font-weight: 720; line-height: 1.1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.history { overflow: hidden; }
.section-heading { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 19px 20px; }
.section-heading .muted { font-size: .8rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .87rem; }
th, td { text-align: left; padding: 12px 13px; vertical-align: top; border-top: 1px solid var(--border); }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th { color: var(--muted); background: #f6f8fc; font-weight: 650; }
.note { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 120px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.increase { color: #13634c; font-weight: 650; }
.decrease { color: #9b334a; font-weight: 650; }
.history-status, .more { margin: 0 20px 16px; }
.more { margin-top: 12px; }
.op-id { display: block; color: var(--muted); margin-top: 5px; font-size: .76rem; }
.actions .link { min-height: 28px; padding-top: 0; }

.people { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.person-card { display: grid; gap: 5px; min-width: 0; padding: 15px; background: #fff; border: 1px solid var(--border); color: var(--ink); border-radius: 12px; text-align: left; }
.person-card span { color: var(--muted); overflow-wrap: anywhere; }
.person-card strong { font-size: clamp(1.05rem, 2vw, 1.45rem); white-space: normal; overflow-wrap: anywhere; }
.person-card:hover, .person-card[aria-pressed=true] { border-color: #3867d1; background: #eef3ff; }
.admin-grid { display: grid; grid-template-columns: minmax(280px, 345px) minmax(0, 1fr); align-items: start; gap: 18px; }
.operation { padding: 19px; }
.operation h2 { margin-bottom: 15px; }
.fields { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); gap: 10px; }
.detail-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 12px; }
.detail-heading h2 { overflow-wrap: anywhere; }
.detail-heading p { font-size: .82rem; }
.correction { padding: 10px 12px; margin-bottom: 13px; background: #eef3ff; border: 1px solid #cfdcff; border-radius: 8px; font-size: .89rem; }
.release { font-size: .82rem; }

dialog { border: 1px solid var(--border); background: #fff; color: var(--ink); border-radius: var(--radius); width: min(440px, calc(100% - 26px)); padding: 24px; }
dialog::backdrop { background: #11234099; }
dialog h2 { margin: 8px 42px 14px 0; }
dialog p + .stack { margin-top: 15px; }
.dialog-close { float: right; }
.dialog-close button { font-size: 1.4rem; padding: 5px 12px; }
dl { display: grid; gap: 4px; margin-bottom: 0; }
dt { color: var(--muted); font-size: .87rem; }
dd { margin: 0 0 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1130px) {
  .admin-grid { grid-template-columns: 1fr; }
  .operation form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .operation textarea { min-height: 64px; }
  .operation .primary, .operation .status { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .header-inner { padding: 9px 15px; }
  .brand { font-size: .87rem; gap: 7px; }
  .header-inner .quiet { padding-inline: 10px; }
  .shell { padding: 24px 14px 32px; gap: 19px; }
  .auth { padding: 22px; }
  .auth h1 { font-size: 1.55rem; }
  .balance-card { padding: 22px; }
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .person-card { padding: 12px; }
  .operation form { grid-template-columns: 1fr; }
  .section-heading { padding: 15px; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table, tbody, tr { display: block; }
  tr { border-top: 1px solid var(--border); padding: 8px 15px; }
  td, td:first-child, td:last-child { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr); gap: 8px; padding: 5px 0; border: 0; overflow-wrap: anywhere; white-space: normal; }
  td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 500; }
  td.note { display: block; white-space: pre-wrap; }
  td.note::before { display: block; margin-bottom: 4px; }
  td.actions { display: block; }
  .history-status, .more { margin-left: 15px; margin-right: 15px; }
}
