:root {
  color-scheme: light;
  --paper: #f3f6f4;
  --white: #fff;
  --surface: #f7f9f8;
  --ink: #192d25;
  --muted: #53675d;
  --line: #dbe4de;
  --control-line: #b8c8be;
  --pine: #153d35;
  --jade: #215b48;
  --jade-hover: #174b3a;
  --mint: #eaf3ee;
  --focus: #2a7657;
  --danger: #963b30;
  --radius: 8px;
  --panel-radius: 12px;
  --control-height: 40px;
  --panel-inset: 24px;
  --gutter: clamp(24px, 3vw, 48px);
  --workspace-width: 1520px;
  --personal-width: 1168px;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select, a[href] { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea { color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex: none; stroke-width: 1.65; }
.skip { position: absolute; inset-inline-start: -10000px; }
.skip:focus { inset: 8px auto auto 8px; z-index: 5; padding: 8px 16px; border-radius: var(--radius); background: var(--white); }

/* Workspace rails */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky;
  inset-block-start: 0;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  background: var(--pine);
  color: #edf5ef;
  --focus: #bfe0ca;
}
.brand { display: flex; align-items: center; gap: 8px; margin: 0 0 24px; padding-inline: 8px; font-size: 18px; font-weight: 700; }
.mark { display: inline-flex; width: 32px; height: 32px; flex: none; align-items: center; justify-content: center; gap: 3px; border-radius: var(--radius); background: #cae9b8; color: var(--pine); }
.mark i { width: 4px; background: currentColor; border-radius: 1px; transform: skewY(-14deg); }
.mark i:nth-child(1) { height: 9px; }
.mark i:nth-child(2) { height: 15px; }
.mark i:nth-child(3) { height: 21px; }
.nav { display: grid; gap: 4px; margin-bottom: 16px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #d1e3d8;
  text-align: start;
  font-weight: 550;
}
.nav button:hover { background: #254d41; color: var(--white); }
.nav button.on { background: #d8eddd; color: var(--pine); font-weight: 700; }
.profile { display: flex; align-items: center; gap: 8px; margin-top: auto; border-top: 1px solid #46675b; padding: 12px 4px 0; }
.avatar { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: var(--radius); background: #365e50; font-weight: 650; }
.profile > div { min-width: 0; }
.profile strong, .profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile small { color: #c1d6c9; font-size: 12px; }
.signout { display: grid; place-items: center; flex: none; width: 40px; height: 40px; margin-inline-start: auto; border-radius: var(--radius); color: #d1e3d8; }
.signout:hover { background: #254d41; color: var(--white); }
.mainCol { min-width: 0; }
.main, .personal-main { width: 100%; margin-inline: auto; padding: 32px var(--gutter) 48px; }
.main { max-width: var(--workspace-width); }
.top, .personal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.top { padding-inline: max(var(--gutter), calc((100% - var(--workspace-width)) / 2 + var(--gutter))); }
.crumb { display: flex; align-items: center; flex: none; gap: 8px; color: var(--muted); font-size: 13px; }
.crumb .icon { width: 14px; height: 14px; }
.crumb b { color: var(--ink); font-weight: 650; }
.topright, .actions, .quicklinks { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.topright, .pagehead .actions, .sectionhead .actions { justify-content: flex-end; }
.mobilebrand { display: none; }

.personal-header { padding-inline: max(var(--gutter), calc((100% - var(--personal-width)) / 2 + var(--gutter))); }
.personal-identity, .personal-actions { display: flex; align-items: center; gap: 8px; }
.personal-identity { min-width: 0; }
.personal-identity strong { white-space: nowrap; }
.personal-identity span:not(.mark) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.personal-actions { flex: none; }
.personal-main { max-width: var(--personal-width); }
.personal-period { display: flex; justify-content: flex-end; margin-bottom: 16px; }

.pagehead, .sectionhead { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; }
.pagehead { margin-bottom: 24px; }
.pagehead > div:first-child, .sectionhead > div:first-child { min-width: 0; }
.pagehead h1 { font-size: clamp(26px, 2.4vw, 34px); line-height: 1.25; letter-spacing: -.03em; font-weight: 720; overflow-wrap: anywhere; }
.pagehead h1:focus, .dialoghead h2:focus { outline: none; }
.pagehead p, .sectionhead p, .dialoghead p { max-width: 65ch; margin-top: 4px; color: var(--muted); font-size: 13px; text-wrap: pretty; }
.sectionhead { padding: 16px var(--panel-inset); }
.sectionhead h2, .dialoghead h2 { font-size: 18px; line-height: 1.35; font-weight: 700; }
.workspace-back { margin-bottom: 8px; }
.workspace-back .textbtn, .sectionhead > .textbtn { padding-inline: 0; }

/* Shared controls */
.btn, .textbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}
.btn { border-color: var(--control-line); background: var(--white); color: var(--ink); }
.textbtn { border: 0; padding-inline: 8px; background: transparent; color: var(--jade); }
.btn:hover:not(:disabled), .textbtn:hover:not(:disabled) { background: var(--mint); }
.btn.primary { border-color: var(--jade); background: var(--jade); color: var(--white); }
.btn.primary:hover:not(:disabled) { border-color: var(--jade-hover); background: var(--jade-hover); }
.btn.danger { border-color: #dfc3be; color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: #fcf1ee; }
.btn.danger-fill { border-color: var(--danger); background: var(--danger); color: var(--white); }
.btn.danger-fill:hover:not(:disabled) { background: #783024; }
.btn.icononly, .personal-signout { width: var(--control-height); padding-inline: 0; }

.monthbox, .filter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-height);
  min-width: 0;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  padding-inline: 8px;
  background: var(--white);
  color: var(--muted);
  font-size: 13px;
}
.topright .monthbox { max-width: 224px; }
.monthbox .icon, .filter .icon { width: 16px; height: 16px; }
.monthbox select, .filter :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: calc(var(--control-height) - 2px);
  padding: 4px 0;
  border: 0;
  outline: 0;
  background: transparent;
  text-overflow: ellipsis;
}
.monthbox select { font-weight: 600; }
.monthbox:focus-within, .filter:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 var(--panel-inset) 16px; }
.search { flex: 1 1 152px; max-width: 304px; }
.filter select { max-width: 176px; }
.filterline { margin-inline-start: auto; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

/* Overview and summary tables */
.stats, .panel { border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--white); }
.stats { display: grid; grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(0, 1fr)); margin-bottom: 24px; overflow: hidden; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; padding: 16px var(--panel-inset); }
.stat + .stat { border-inline-start: 1px solid var(--line); }
.stat.primary { background: var(--mint); }
.stat .label { font-size: 13px; font-weight: 650; color: var(--muted); }
.stat .num {
  font-size: clamp(24px, 2.6vw, 38px);
  font-weight: 670;
  line-height: 1.1;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums lining-nums;
}
.stat.primary .num { color: var(--jade); }
.stat .num small, .stat .moneylabel { font-size: .55em; font-weight: 600; letter-spacing: 0; }
.stat .num small { margin-inline-start: 4px; }
.stat .moneylabel { margin-inline-end: 4px; }
.stat .note { color: var(--muted); font-size: 12px; }
.stat .meter { order: 1; width: 100%; }
.meter, .tinybar { height: 4px; border-radius: 4px; background: #dee9e1; overflow: hidden; }
.meter i, .tinybar i { display: block; height: 100%; border-radius: inherit; background: #5f9778; }

.panel { margin-bottom: 16px; overflow: hidden; }
.tablewrap { max-width: 100%; overflow: auto; scrollbar-color: #8ea699 transparent; scrollbar-width: thin; }
.tablewrap:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); text-align: start; font-size: 12px; font-weight: 650; white-space: nowrap; }
thead { background: var(--surface); }
th:first-child, td:first-child { padding-inline-start: var(--panel-inset); }
th:last-child, td:last-child { padding-inline-end: var(--panel-inset); }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: #f8fbf9; }
.numcell { text-align: end; white-space: nowrap; }
.numcell, .progress, .calc strong { font-variant-numeric: tabular-nums lining-nums; }
.nobr, .personname { white-space: nowrap; }
.strong, .personname { font-weight: 650; }
.rowtitle, .identity, .progress { display: flex; align-items: center; gap: 8px; }
.companyname { min-height: 36px; padding: 4px 0; border: 0; background: transparent; color: var(--jade); font-weight: 650; text-align: start; overflow-wrap: anywhere; }
.companyname:hover { text-decoration: underline; text-underline-offset: 3px; }
td:first-child > .textbtn, .actioncell .textbtn { padding-inline-start: 0; text-align: start; }
td:first-child > .textbtn { white-space: normal; overflow-wrap: anywhere; }
.actioncell .textbtn { justify-content: flex-start; }
.progress { min-width: 76px; color: var(--muted); white-space: nowrap; }
.tinybar { width: 40px; flex: none; }
.ledgerfoot { padding: 10px var(--panel-inset); border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; }
.empty { padding: 32px var(--panel-inset); color: var(--muted); line-height: 1.65; }
.pill { display: inline-flex; flex: none; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 20px; background: #eef2ef; color: #485c51; font-size: 12px; font-weight: 650; line-height: 1.3; white-space: nowrap; }
.pill i, .legend i { display: inline-block; width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.pill.good, .pill.open { color: var(--jade); background: var(--mint); }
.pill.wait { color: #765017; background: #faf0dc; }
.pill.dark { color: #e1f0e2; background: #ffffff15; border: 1px solid #ffffff24; }
.category, .sub, .subtle, .muted, .hint, .amount-missing { color: var(--muted); font-size: 12px; }
.amtpositive { color: var(--jade); }
.mobiletag { display: none; }
.access-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.access-actions [data-action=revoke] { color: var(--muted); }
.access-actions [data-action=delete-account] { color: var(--danger); }
.perm { display: inline-flex; margin: 2px 4px 2px 0; padding: 2px 6px; border-radius: 4px; background: var(--mint); color: var(--jade); font-size: 12px; }

/* Company entry sheet */
.company-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(272px, 100%), 1fr)); gap: 12px; padding: 16px var(--panel-inset); }
.company-choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-align: start; }
.company-choice:hover { background: var(--mint); border-color: var(--focus); }
.company-choice strong, .company-choice small { display: block; }
.company-choice strong { font-size: 15px; overflow-wrap: anywhere; }
.company-choice small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.company-entry { white-space: nowrap; color: var(--jade); font-size: 13px; font-weight: 650; }
.grid-savebar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 8px var(--panel-inset); border-block: 1px solid var(--line); background: var(--mint); }
.grid-savebar .actions { justify-content: flex-end; margin-inline-start: auto; }
.grid-savebar [role=status] { color: var(--jade); font-size: 13px; font-variant-numeric: tabular-nums; }
.grid-error { padding: 8px var(--panel-inset); background: #fcf1ee; color: var(--danger); font-size: 13px; }
.grid-error:empty { display: none; }
.gridwrap {
  --name-column: 112px;
  --grid-cell-inline: 8px;
  --amount-inset: 8px;
  max-height: 58dvh;
  isolation: isolate;
  scroll-padding-inline-start: calc(var(--name-column) + 8px);
  scroll-padding-inline-end: 8px;
  scroll-padding-block: 44px 42px;
}
.company-grid { border-collapse: separate; border-spacing: 0; }
.company-grid th, .company-grid td { padding: 6px var(--grid-cell-inline); }
.company-grid thead th { position: sticky; inset-block-start: 0; z-index: 2; height: 40px; border: 0; box-shadow: 0 1px 0 var(--line); background: var(--surface); }
.company-grid th:first-child {
  position: sticky;
  inset-inline-start: 0;
  width: var(--name-column);
  min-width: var(--name-column);
  max-width: var(--name-column);
  padding-inline-start: var(--panel-inset);
  box-shadow: 1px 0 0 var(--line);
}
.company-grid thead th:first-child { z-index: 3; }
.company-grid tbody th { z-index: 1; background: var(--white); color: var(--ink); font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
.company-grid tbody th .textbtn { width: 100%; justify-content: flex-start; min-height: 36px; padding: 4px 2px 4px 0; white-space: normal; text-align: start; overflow-wrap: anywhere; }
.company-grid tbody tr:is(:hover, :focus-within), .company-grid tbody tr:is(:hover, :focus-within) th { background: #f6faf7; }
.company-grid td { text-align: end; }
.company-grid :is(thead th:not(:first-child), .grid-calculated, tfoot td) {
  padding-inline-end: calc(var(--grid-cell-inline) + var(--amount-inset) + 1px);
}
.grid-amount { width: min(100%, 192px); min-width: 88px; height: 36px; padding: 4px var(--amount-inset); border: 1px solid var(--control-line); border-radius: 6px; background: var(--white); text-align: end; font-variant-numeric: tabular-nums lining-nums; }
.grid-amount:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.grid-amount.changed { border-color: #6c9a7f; background: var(--mint); }
.grid-amount:disabled { background: var(--surface); color: var(--muted); }
.grid-amount[aria-invalid=true], .field input[aria-required=true]:placeholder-shown { border-color: #b97970; }
.grid-amount[aria-required=true][aria-invalid=true]::placeholder, .field input[aria-required=true]::placeholder { color: var(--danger); }
.grid-conflict { margin-top: 4px; color: var(--danger); font-size: 12px; white-space: nowrap; }
.grid-conflict .textbtn { min-height: 32px; padding: 4px; font-size: 12px; }
.grid-heading-number { margin-inline-end: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }
.required-label { margin-inline-start: 4px; color: var(--danger); font-size: 11px; font-weight: 650; }
.company-grid .grid-calculated { min-width: 96px; background: var(--surface); color: var(--ink); font-weight: 650; }
.company-grid .grid-calculated, .company-grid tfoot td { font-variant-numeric: tabular-nums lining-nums; }
.company-grid tfoot th, .company-grid tfoot td { position: sticky; inset-block-end: 0; z-index: 2; height: 38px; border-top: 1px solid var(--line); background: var(--mint); color: var(--jade); font-weight: 700; }
.company-grid tfoot th:first-child { z-index: 3; }

/* Dialogs, forms and gate */
dialog { width: min(560px, calc(100% - 24px)); max-height: 88dvh; padding: 0; overflow: auto; scroll-padding-block: 96px 76px; border: 1px solid var(--line); border-radius: var(--panel-radius); color: var(--ink); background: var(--white); box-shadow: 0 16px 48px rgb(21 61 53 / 16%); }
dialog::backdrop { background: rgb(19 38 31 / 42%); }
.dialoghead, .dialogfoot { position: sticky; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 12px var(--panel-inset); background: var(--white); }
.dialoghead { inset-block-start: 0; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialoghead > div { min-width: 0; overflow-wrap: anywhere; }
.dialog-return { flex: none; color: var(--jade); }
.dialogbody { padding: 16px var(--panel-inset); }
.dialogfoot { inset-block-end: 0; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
.dialog-start { margin-inline-end: auto; }
.dialogbody h3 { margin: 0 0 8px; font-size: 14px; }
.dialogbody hr { margin: 16px 0; border: 0; border-top: 1px solid var(--line); }
.formgrid, .checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--ink); font-size: 13px; font-weight: 650; }
.field :is(input, select, textarea), .codebox { width: 100%; min-height: var(--control-height); padding: 8px 12px; border: 1px solid var(--control-line); border-radius: var(--radius); background: var(--white); font-size: 14px; font-weight: 450; }
.field :is(input, select, textarea):focus { border-color: var(--focus); }
.field small { color: var(--muted); font-size: 12px; font-weight: 400; }
.field + .field.stack, .mt { margin-top: 12px; }
.full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; min-height: var(--control-height); padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; overflow-wrap: anywhere; }
.check input { flex: none; accent-color: var(--jade); }
.calc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; padding: 12px; border-radius: var(--radius); background: var(--mint); }
.calc span, .calc strong { display: block; }
.calc span { color: var(--muted); font-size: 12px; }
.calc strong { margin-top: 4px; color: var(--jade); font-size: 16px; overflow-wrap: anywhere; }
.dialogmsg { margin-bottom: 12px; padding: 8px 12px; border: 1px solid #e4c4be; border-radius: var(--radius); background: #fcf1ee; color: var(--danger); font-size: 13px; }
.dialogmsg:empty { display: none; }
.codebox { background: var(--surface); font-family: ui-monospace, monospace; user-select: all; }
dialog:has(.carry-preview) { width: min(816px, calc(100% - 24px)); }
.carry-preview { max-height: 36dvh; margin-top: 8px; }
.carry-preview:empty { display: none; }
.carry-preview th { position: sticky; inset-block-start: 0; background: var(--surface); }
.carry-preview :is(td, th) { padding: 8px 12px; }
.review-group { margin-bottom: 16px; }
.review-project { margin-top: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.review-project summary, .review-filled > summary { min-height: 24px; cursor: pointer; }
.review-project summary span { margin-inline-start: 8px; color: var(--muted); }
.review-project p { margin-block: 8px; overflow-wrap: anywhere; }
.review-filled { padding-top: 12px; border-top: 1px solid var(--line); }
.review-filled > summary { margin-bottom: 8px; font-weight: 650; }
.boot, .gate { display: grid; align-content: center; justify-items: center; gap: 12px; min-height: 100dvh; padding: 16px; }
.boot p, .gatecard p { color: var(--muted); }
.gatecard { width: min(424px, 100%); padding: 24px; border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--white); }
.gatecard .brand { padding: 0; margin-bottom: 20px; }
.gatecard h1 { font-size: 24px; line-height: 1.35; }
.gatecard p, .gatecard .field, .gatecard .btn, .gatecard details { margin-top: 12px; }
.gatecard details { color: var(--muted); font-size: 13px; }
.gatecard summary { cursor: pointer; }
#notice { position: fixed; z-index: 4; inset: auto auto max(16px, env(safe-area-inset-bottom)) 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: var(--radius); background: var(--pine); color: var(--white); font-size: 13px; white-space: pre-wrap; }
#notice:empty { display: none; }
.split { justify-content: space-between; }
.labelrow { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.rosterform { white-space: pre; }
.backup-status, .backup-list + .backup-list { margin-top: 16px; }
.backup-status { margin-bottom: 16px; padding: 14px var(--panel-inset); }
.backup-status dl { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 0; }
.backup-status dl div { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.backup-status dt { color: var(--muted); }
.backup-status dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.backup-warning { margin-top: 8px; color: var(--danger); }
.backup-status .btn { margin-top: 8px; }
.backup-table tbody th { color: var(--ink); font-size: inherit; }
.backup-table :is(th, td) { font-variant-numeric: tabular-nums; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 6px; }
dialog:has(.recovery-scope, .recovery-preview) { width: min(760px, calc(100% - 24px)); }
.recovery-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; border: 0; }
.recovery-people { min-inline-size: 0; margin: 16px 0 0; padding: 0; border: 0; }
.recovery-people legend { padding: 0; margin-bottom: 8px; font-weight: 650; }
.recovery-people .checks:empty { display: none; }
.recovery-people .checks:not(:empty) + p { margin-top: 8px; }
.recovery-person { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.recovery-preview > * + * { margin-top: 12px; }
.recovery-whole-person { width: fit-content; margin: 8px 0 10px; color: var(--jade); font-weight: 650; }
.recovery-values { border: 1px solid var(--line); border-radius: var(--radius); }
.recovery-values table { min-width: 360px; }
.recovery-values :is(th, td) { padding: 8px 10px; }
.recovery-values .numcell { font-variant-numeric: tabular-nums; }
.recovery-field-check { display: flex; align-items: center; gap: 8px; min-height: 24px; color: var(--ink); }
.recovery-field-check input { accent-color: var(--jade); }

@media (max-width: 1060px) {
  .shell { grid-template-columns: 176px minmax(0, 1fr); }
  .topright .monthbox { max-width: 184px; }
}
@media (max-width: 800px) {
  :root { --gutter: 16px; --panel-inset: 16px; --control-height: 44px; }
  .shell { display: block; }
  .side { position: static; display: block; height: auto; padding: 8px var(--gutter); }
  .side :is(.brand, .profile) { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 0; }
  .nav button { justify-content: center; gap: 6px; padding: 6px 4px; font-size: 13px; white-space: nowrap; }
  .nav .icon { width: 16px; height: 16px; }
  .top { min-height: 60px; gap: 8px; }
  .crumb { display: none; }
  .mobileaccount { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; min-height: var(--control-height); padding: 6px 8px; border: 1px solid var(--control-line); border-radius: var(--radius); background: var(--white); color: var(--jade); font-size: 13px; font-weight: 650; }
  .mobileaccount:hover { background: var(--mint); }
  .main, .personal-main { padding-top: 20px; }
  .pagehead { margin-bottom: 16px; }
  .stats { margin-bottom: 16px; }
  .gridwrap { --name-column: 96px; max-height: 54dvh; }
  .grid-amount { min-width: 84px; height: 40px; }
  .grid-amount, .field :is(input, select, textarea), .search input { font-size: 16px; }
  td, th { padding-inline: 8px; }
}
@media (max-width: 600px) {
  .nav button { flex-direction: column; gap: 2px; font-size: 12px; }
}
@media (max-width: 520px) {
  .top:has(.companybox):has(.periodbox) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "account status" "company period";
  }
  .top:has(.companybox):has(.periodbox) .topright { display: contents; }
  .top:has(.companybox):has(.periodbox) .mobileaccount { grid-area: account; justify-self: start; }
  .top:has(.companybox):has(.periodbox) .topright .pill { grid-area: status; justify-self: end; }
  .top .companybox { grid-area: company; }
  .top .periodbox { grid-area: period; }
  .topright .monthbox { max-width: none; }
  .pagehead .actions, .sectionhead .actions, .grid-savebar .actions { justify-content: flex-start; margin-inline-start: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding-block: 12px; }
  .stat.primary { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .stat:nth-child(2) { border-inline-start: 0; }
  .stat .num { font-size: 27px; }
  .stat.primary .num { font-size: 32px; }
  .search { max-width: none; }
  .hide-sm { display: none; }
  .mobiletag { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
  .companypanel .hide-sm { display: table-cell; }
  .companypanel .companyname { min-width: 6em; }
  .personal-header .personal-identity span:not(.mark) { display: none; }
  .personal-header .mark { width: 28px; height: 28px; }
  .dialoghead { align-items: flex-start; }
  .dialog-return .icon { display: none; }
  .calc strong { font-size: 14px; }
}
@media (max-width: 380px) {
  .nav button { padding-inline: 1px; font-size: 10.5px; }
  .topright .monthbox { gap: 4px; padding-inline: 6px; }
  .topright .monthbox .icon { width: 14px; height: 14px; }
  .backup-table tbody th { white-space: normal; }
  dialog:has(.carry-preview) .checks { grid-template-columns: 1fr; }
  .recovery-controls, .recovery-people .checks { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .textbtn, .nav button, .company-choice, .mobileaccount { transition: background-color .14s ease, border-color .14s ease, color .14s ease, transform .14s ease; }
  :is(.btn, .textbtn, .company-choice, .mobileaccount):active:not(:disabled) { transform: translateY(1px); }
  dialog[open] { animation: dialog-enter .16s cubic-bezier(.23, 1, .32, 1); }
  @keyframes dialog-enter {
    from { transform: translateY(4px); opacity: .8; }
    to { transform: translateY(0); opacity: 1; }
  }
}
