/* Nominal Roll — "Registry": warm paper, deep ink-green, one accent. Trust-first, calm, dense. */
:root {
  --paper: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --ink: #15201a;
  --ink-2: #3d4a43;
  --muted: #6a756e;
  --line: #e4e0d5;
  --line-2: #d6d1c3;
  --brand: #0d5c3b;
  --brand-ink: #0a4a2f;
  --brand-wash: #e7f0ea;
  --side: #0f1d16;
  --side-2: #182a21;
  --side-text: #c9d4cd;
  --warn: #9a5b00;
  --warn-wash: #fbf1df;
  --danger: #a3271c;
  --danger-wash: #fbe9e7;
  /* sequential ramp, single hue (magnitude) */
  --seq-0: #eeebe2;
  --seq-1: #d9e8de;
  --seq-2: #a9cdb7;
  --seq-3: #6aa684;
  --seq-4: #2f7a53;
  --seq-5: #0b4a2e;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(21, 32, 26, 0.06), 0 1px 0 rgba(21, 32, 26, 0.03);
  --shadow-lg: 0 18px 50px -12px rgba(15, 29, 22, 0.28), 0 2px 6px rgba(15, 29, 22, 0.08);
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
img { display: block; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--side);
  color: var(--side-text);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 4px 8px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(160deg, #1b7a52, #0b4a2e);
  display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
  flex: none;
}
.brand-name { color: #fff; font-weight: 650; font-size: 15px; line-height: 1.2; }
.brand-org { font-size: 12px; color: #8fa197; line-height: 1.25; margin-top: 2px; max-width: 170px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #6f8378; padding: 10px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--side-text); font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.active { background: #1e3a2c; color: #fff; box-shadow: inset 2px 0 0 #5fd19b; }
.nav a svg { opacity: 0.85; flex: none; }
.nav .count { margin-left: auto; font-size: 12px; color: #8fa197; }
.side-foot { margin-top: auto; font-size: 12px; color: #6f8378; padding: 0 10px; line-height: 1.5; }
.side-foot b { color: #a9bab0; font-weight: 600; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 32px;
  background: rgba(243, 241, 234, 0.86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.search {
  flex: 1; max-width: 460px; position: relative;
}
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 92, 59, 0.14); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; background: var(--surface-2); }
.topbar .spacer { flex: 1; }
.today { color: var(--muted); font-size: 13px; }

.view { padding: 28px 32px 64px; max-width: 1360px; }
.view.enter { animation: enter 0.22s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 650; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: inline-flex; gap: 6px; align-items: center; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.btn:hover { background: var(--surface-2); border-color: #c6c0ae; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(21, 32, 26, 0.05); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; gap: 10px; padding: 16px 18px 4px; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .link { margin-left: auto; font-size: 13px; font-weight: 550; }
.card-body { padding: 12px 18px 18px; }

.grid { display: grid; gap: 16px; }
.dash-grid { grid-template-columns: repeat(12, 1fr); }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-family: var(--font-display); font-size: 32px; font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.1; }
.kpi .value small { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi .note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kpi.warn .value { color: var(--warn); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--brand-wash); color: var(--brand); }
.pill.warn { background: var(--warn-wash); color: var(--warn); }
.pill.neutral { background: #efede6; color: var(--ink-2); }

/* ---------- Bar list (single series) ---------- */
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row {
  display: grid; grid-template-columns: minmax(120px, 42%) 1fr 34px; align-items: center; gap: 10px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer; position: relative;
}
.bar-row:hover { background: var(--surface-2); }
.bar-row .name { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: block; height: 10px; position: relative; }
.bar-fill { display: block; height: 100%; background: var(--seq-4); border-radius: 0 4px 4px 0; min-width: 2px; transition: width 0.5s var(--ease), background 0.15s; }
.bar-row:hover .bar-fill { background: var(--seq-5); }
.bar-row .num { text-align: right; font-size: 13px; font-weight: 600; color: var(--ink); }

/* ---------- Tile map ---------- */
.tilemap-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 18px; align-items: start; }
.tilemap { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.tile {
  border-radius: 6px; display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 1 / 0.86; min-width: 0;
  padding: 5px 6px; font-size: 11px; font-weight: 650; cursor: pointer; border: 0;
  transition: transform 0.12s var(--ease), box-shadow 0.12s; text-align: left;
  color: var(--ink-2); line-height: 1;
}
.tile .n { font-size: 12px; align-self: flex-end; font-weight: 700; }
.tile:hover { transform: translateY(-1px); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); z-index: 2; }
.tile.dark { color: #fff; }
.tile.zero .n { opacity: 0; }
.legend-seq { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend-seq .sw { display: flex; }
.legend-seq .sw span { width: 22px; height: 10px; }
.legend-seq .sw span:first-child { border-radius: 3px 0 0 3px; }
.legend-seq .sw span:last-child { border-radius: 0 3px 3px 0; }
.zone-list { display: flex; flex-direction: column; gap: 10px; }
.zone-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 13px; cursor: pointer; padding: 6px 8px; margin: -6px -8px; border-radius: 6px; }
.zone-item:hover { background: var(--surface-2); }
.zone-item .z { color: var(--ink-2); }
.zone-item .v { font-weight: 650; }
.zone-item .t { grid-column: 1 / -1; height: 6px; background: #efede6; border-radius: 99px; overflow: hidden; }
.zone-item .t i { display: block; height: 100%; background: var(--seq-4); border-radius: 99px; }

/* ---------- Tooltip ---------- */
.tip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--side); color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 12.5px;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(2px);
  transition: opacity 0.1s, transform 0.1s; max-width: 240px;
}
.tip.on { opacity: 1; transform: none; }
.tip b { font-weight: 650; }
.tip .m { color: #a9bab0; }

/* ---------- People list ---------- */
.people { display: flex; flex-direction: column; }
.person-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 9px 6px; border-radius: 8px; border-top: 1px solid var(--line);
}
.person-row:first-child { border-top: 0; }
.person-row:hover { background: var(--surface-2); }
.person-row .nm { font-weight: 600; color: var(--ink); }
.person-row .meta { font-size: 12.5px; color: var(--muted); }
.person-row > .meta:last-child { white-space: nowrap; font-size: 12px; }

/* ---------- Passport photos ---------- */
.ph {
  aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; background: #e9e6dc; flex: none;
  box-shadow: inset 0 0 0 1px rgba(21, 32, 26, 0.08);
}
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph.xs { width: 30px; border-radius: 5px; }
.ph.sm { width: 40px; }
.ph-ph { width: 100%; height: 100%; }

/* ---------- Directory ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.select, .input {
  height: 36px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface);
  padding: 0 10px; min-width: 0;
}
.select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236a756e' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.select:focus, .input:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 92, 59, 0.14); }
.seg { margin-left: auto; display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; height: 34px; padding: 0 10px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.seg button.on { background: var(--brand-wash); color: var(--brand); }
.chip-active { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 99px; background: var(--brand-wash); color: var(--brand); font-size: 12.5px; font-weight: 600; border: 0; cursor: pointer; }
.toolbar .select { max-width: 170px; }
.result-count { color: var(--muted); font-size: 13px; margin-left: auto; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.staff-card {
  display: flex; flex-direction: column; padding: 12px; gap: 12px; color: inherit;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s;
}
.staff-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.staff-card .ph { width: 100%; border-radius: 8px; }
.staff-card .nm { font-weight: 650; font-size: 14.5px; line-height: 1.25; }
.staff-card .rk { font-size: 12.5px; color: var(--brand); font-weight: 600; margin-top: 2px; }
.staff-card .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; gap: 6px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.tbl th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.tbl th button:hover { color: var(--ink); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .who { display: flex; gap: 10px; align-items: center; }
.tbl .who b { font-weight: 600; }
.tbl .sn { font: 12px var(--mono); color: var(--muted); }
.tbl-wrap { overflow: auto; border-radius: var(--r-lg); }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* ---------- Profile ---------- */
.profile { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.id-card { padding: 18px; position: sticky; top: 86px; }
.id-card .ph { width: 100%; border-radius: 10px; }
.id-card .nm { font-size: 19px; font-weight: 650; margin-top: 14px; line-height: 1.25; }
.id-card .rk { color: var(--brand); font-weight: 650; margin-top: 4px; }
.id-card .sn { font: 12.5px var(--mono); color: var(--muted); margin-top: 6px; }
.id-card .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.fact { padding: 12px 18px; border-top: 1px solid var(--line); }
.fact:nth-child(-n+3) { border-top: 0; }
.fact .k { font-size: 12px; color: var(--muted); font-weight: 550; }
.fact .v { font-weight: 600; margin-top: 3px; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding: 4px 0 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -21px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl-item .when { font-size: 12px; color: var(--muted); font-weight: 600; }
.tl-item .t { font-weight: 650; margin-top: 2px; }
.tl-item .i { color: var(--ink-2); font-size: 13px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--warn-wash); color: #6b4000; font-size: 13px; margin-bottom: 16px; }
.notice svg { flex: none; margin-top: 1px; }

/* ---------- Form ---------- */
.form-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.form-sec { padding: 18px; }
.form-sec + .form-sec { border-top: 1px solid var(--line); }
.form-sec h3 { font-size: 14px; font-weight: 650; margin-bottom: 2px; }
.form-sec .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field label .req { color: var(--danger); }
.field .input, .field .select { width: 100%; }
.field.err .input, .field.err .select { border-color: var(--danger); }
.field .msg { font-size: 12px; color: var(--danger); }
.course-rows { display: flex; flex-direction: column; gap: 10px; }
.course-row {
  display: grid; grid-template-columns: 1.6fr 1.3fr 130px 130px 36px; gap: 8px; align-items: end;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.course-row .field label { font-size: 12px; }
.form-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); position: sticky; bottom: 0; }

.photo-panel { padding: 18px; position: sticky; top: 86px; }
.photo-drop {
  width: 100%; aspect-ratio: 3 / 4; border-radius: 10px; border: 1.5px dashed var(--line-2);
  display: grid; place-items: center; text-align: center; color: var(--muted); cursor: pointer;
  background: var(--surface-2); transition: border-color 0.15s, background 0.15s; overflow: hidden; position: relative; padding: 0;
}
.photo-drop:hover, .photo-drop.drag { border-color: var(--brand); background: var(--brand-wash); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-drop .cta { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; padding: 16px; }
.photo-drop .cta b { color: var(--ink); }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.photo-rules { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.55; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 29, 22, 0.42); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: 92vh; overflow: auto; animation: pop 0.2s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(6px); } }
.modal-head { padding: 18px 20px 4px; }
.modal-head h3 { font-size: 17px; }
.modal-head p { color: var(--muted); margin: 6px 0 0; }
.modal-body { padding: 14px 20px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px 18px; }
.cropper { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: center; }
.crop-stage { width: 240px; height: 320px; border-radius: 10px; overflow: hidden; position: relative; background: #ddd; cursor: grab; touch-action: none; }
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { width: 100%; height: 100%; display: block; }
.crop-guide { position: absolute; inset: 0; pointer-events: none; }
.range { width: 100%; accent-color: var(--brand); }
.cam video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
textarea.input { padding: 10px; height: auto; min-height: 220px; resize: vertical; line-height: 1.6; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.data-actions { display: grid; gap: 10px; }
.data-actions .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.data-actions .row:first-child { border-top: 0; padding-top: 0; }
.data-actions .row p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 120; }
.toast { background: var(--side); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; gap: 9px; align-items: center; animation: toastIn 0.25s var(--ease); }
.toast svg { color: #5fd19b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ---------- Federal character return ---------- */
.fc-top { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 16px; margin-bottom: 16px; }
.fc-zone-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; margin-top: 10px; }
.fz { display: grid; grid-template-columns: 92px 1fr 44px; gap: 8px; align-items: center; font-size: 12.5px; }
.fz-n { color: var(--ink-2); white-space: nowrap; }
.fz-t { display: block; height: 8px; background: #efede6; border-radius: 99px; overflow: hidden; }
.fz-t i { display: block; height: 100%; background: var(--seq-4); border-radius: 99px; }
.fz-v { text-align: right; font-weight: 650; }
.fc-tbl th.num, .fc-tbl td.num { text-align: right; }
.fc-tbl tbody tr { cursor: pointer; }
.fc-tbl .dim { color: #b9b4a6; }
.fc-tbl tr.nil td:first-child { color: var(--muted); }
.fc-tbl tr.zone-head td { background: var(--surface-2); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand); padding-top: 14px; cursor: default; }
.fc-tbl tr.zone-head { cursor: default; }
.fc-tbl tr.subtotal td { font-weight: 650; border-bottom: 1px solid var(--line-2); }
.fc-tbl tfoot td { font-weight: 700; background: var(--brand-wash); border-top: 2px solid var(--brand); padding: 11px 12px; }
.fc-tbl tfoot td.num { text-align: right; }
@media (max-width: 1180px) { .fc-top { grid-template-columns: 1fr 1fr; } .fc-zones { grid-column: 1 / -1; } }

/* ---------- Import ---------- */
.map-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--line); }
.map-row:first-child { border-top: 0; }
.map-sample { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--brand); width: 15px; height: 15px; }
.imp-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.imp-sum div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.imp-sum b { display: block; font-family: var(--font-display); font-size: 26px; }
.imp-sum span { color: var(--muted); font-size: 12.5px; }

/* ---------- Staff ID card (true CR80 size: 85.6 x 54 mm) ---------- */
.idc {
  width: 85.6mm; height: 54mm; border-radius: 3mm; background: #fff; position: relative; overflow: hidden; flex: none;
  border: 0.25mm solid var(--line-2); box-shadow: 0 6px 18px -8px rgba(15, 29, 22, 0.35); color: var(--ink); line-height: 1.2;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.idc-band { height: 12mm; background: linear-gradient(120deg, #0f6b45, #0a4a2f); color: #fff; display: flex; align-items: center; gap: 2.5mm; padding: 0 4mm; }
.idc-mark { width: 7mm; height: 7mm; border-radius: 1.6mm; background: rgba(255, 255, 255, 0.15); display: grid; place-items: center; flex: none; }
.idc-mark svg { width: 4.2mm; height: 4.2mm; }
.idc-org { font-size: 2.55mm; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; max-width: 66mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idc-title { font-size: 1.9mm; opacity: 0.82; letter-spacing: 0.16em; text-transform: uppercase; margin-top: 0.5mm; }
.idc-body { display: flex; gap: 3.5mm; padding: 3.2mm 4mm 0; }
.idc-photo { width: 20mm; height: 26.7mm; border-radius: 1.4mm; overflow: hidden; flex: none; background: #e9e6dc; box-shadow: inset 0 0 0 0.2mm rgba(21, 32, 26, 0.12); }
.idc-photo img, .idc-photo svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.idc-info { min-width: 0; flex: 1; padding-right: 13mm; }
.idc-name { font-size: 3mm; line-height: 1.22; }
.idc-name b { font-weight: 800; letter-spacing: 0.01em; }
.idc-rank { font-size: 2.4mm; color: var(--brand); font-weight: 700; margin-top: 0.9mm; }
.idc dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.7mm 2mm; margin: 2.2mm 0 0; font-size: 2mm; }
.idc dt { color: var(--muted); }
.idc dd { margin: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idc dd.mono { font-family: var(--mono); font-size: 1.9mm; }
.idc-qr { position: absolute; right: 4mm; bottom: 4.6mm; width: 13mm; height: 13mm; }
.idc-qr svg { width: 100%; height: 100%; display: block; }
.idc-flag { position: absolute; left: 0; right: 0; bottom: 0; height: 1.5mm; display: flex; }
.idc-flag i { flex: 1; background: #0d5c3b; }
.idc-flag i:nth-child(2) { background: #fff; }
.idc.back { padding: 4.2mm 4.5mm; }
.idc-terms { font-size: 2.15mm; line-height: 1.5; color: var(--ink-2); margin: 0; }
.idc-dates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2mm; margin-top: 3mm; font-size: 2.3mm; font-weight: 650; }
.idc-dates span { display: block; font-size: 1.7mm; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 0.5mm; }
.idc-sigs { position: absolute; left: 4.5mm; right: 4.5mm; bottom: 4.8mm; display: flex; gap: 6mm; }
.idc-sigs div { flex: 1; border-top: 0.25mm solid var(--ink-2); padding-top: 0.8mm; font-size: 1.8mm; color: var(--muted); }
.idc-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; zoom: 1.45; padding: 4px 0; }
#print-area { display: none; }

/* ---------- Print record ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .side, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .print-only { display: block; }
  .profile { grid-template-columns: 200px 1fr; }
  .id-card { position: static; }
  .print-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 16px; }
  .print-head h1 { font-size: 16pt; }
  .print-sign { display: flex; gap: 40px; margin-top: 40px; }
  .print-sign div { flex: 1; border-top: 1px solid #000; padding-top: 6px; font-size: 10pt; }
  .tbl th { position: static; }
  .tbl-wrap { break-inside: auto !important; overflow: visible; } .fc-tbl thead { display: table-header-group; } .fc-tbl tfoot { display: table-row-group; } .fc-tbl tr { break-inside: avoid; } .fc-tbl { font-size: 8.5pt; } .fc-tbl td, .fc-tbl th { padding: 3px 8px; } .fc-top { grid-template-columns: 1fr 1fr 2fr; } .fc-top .kpi { padding: 8px 12px; } .fc-top .value { font-size: 18pt; }
  #print-area { display: none; }
  body.printing-cards .shell, body.printing-cards .modal-bg, body.printing-cards .tip { display: none !important; }
  body.printing-cards #print-area { display: block; }
  .card-sheet { display: flex; flex-direction: column; gap: 8mm; break-after: page; }
  .card-sheet:last-child { break-after: auto; }
  .card-pair { display: flex; gap: 8mm; break-inside: avoid; }
  .card-pair .idc { box-shadow: none; border: 0.25mm dashed #9a9a9a; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
  .settings { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 14px; gap: 10px; }
  .nav { flex-direction: row; }
  .nav-label, .side-foot, .brand-org { display: none; }
  .view, .topbar { padding-left: 16px; padding-right: 16px; }
  .profile, .form-layout { grid-template-columns: 1fr; }
  .id-card, .photo-panel { position: static; }
  .fields { grid-template-columns: 1fr 1fr; }
  .course-row { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .tilemap-wrap { grid-template-columns: 1fr; }
  .today { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
