/* iView HRMS – corporate design system */
:root {
  --navy: #0b1f3a;
  --navy-2: #12305a;
  --brand: #0b2545;
  --primary: #1f4fbf;
  --primary-600: #1a43a3;
  --primary-50: #eef3fd;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e7ef;
  --border-strong: #cfd6e2;
  --text: #1b2433;
  --text-2: #4a5568;
  --muted: #6b7686;
  --success: #157f3d; --success-bg: #e7f6ec;
  --warning: #a85b06; --warning-bg: #fdf3e3;
  --danger: #b42318; --danger-bg: #fdecea;
  --info: #1f4fbf; --info-bg: #eaf0fc;
  --neutral-bg: #eef1f5;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 14px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 50px rgba(11, 31, 58, .22);
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p { margin: 0 0 8px; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--navy); color: #c9d4e5; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .22s ease; padding-top: var(--safe-top); }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar .brand img { max-height: 30px; max-width: 120px; background: #fff; border-radius: 4px; padding: 2px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #3b6fe0, #1f4fbf); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.brand-name { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: #8fa3c0; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-group { margin-top: 14px; }
.nav-group > .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #7187a8; padding: 4px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: #c9d4e5; font-size: 13.5px; text-decoration: none; margin-bottom: 1px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: #1d3a66; color: #fff; box-shadow: inset 3px 0 0 #5b8cf0; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .count { margin-left: auto; background: #3b6fe0; color: #fff; font-size: 11px; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.sidebar-foot { padding: 12px 18px calc(12px + var(--safe-bottom)); border-top: 1px solid rgba(255,255,255,.07); font-size: 11px; color: #7187a8; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { height: calc(var(--topbar-h) + var(--safe-top)); padding-top: var(--safe-top); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding-left: 24px; padding-right: 20px; position: sticky; top: 0; z-index: 30; }
.topbar .title { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 38px; height: 38px; border-radius: 8px; border: 1px solid transparent; background: transparent; display: inline-grid; place-items: center; color: var(--text-2); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--neutral-bg); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; text-align: center; padding: 0 4px; }
.menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 22px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.user-chip .nm { font-size: 13px; font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 24px; max-width: 1360px; width: 100%; margin: 0 auto; padding-bottom: calc(40px + var(--safe-bottom)); }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.scrim { display: none; }
.bottom-nav { display: none; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { flex: 1; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------- Stats ---------- */
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat .ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.stat .ic svg { width: 22px; height: 22px; }
.stat .v { font-size: 22px; font-weight: 650; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 12.5px; }
.stat a { color: inherit; }
.tone-blue .ic { background: var(--info-bg); color: var(--info); }
.tone-green .ic { background: var(--success-bg); color: var(--success); }
.tone-amber .ic { background: var(--warning-bg); color: var(--warning); }
.tone-red .ic { background: var(--danger-bg); color: var(--danger); }
.tone-slate .ic { background: var(--neutral-bg); color: var(--text-2); }
.progress { height: 8px; background: var(--neutral-bg); border-radius: 6px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #3b6fe0, #1f4fbf); border-radius: 6px; transition: width .4s; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b span.bar { width: 100%; max-width: 34px; background: #3b6fe0; border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .b small { font-size: 10.5px; white-space: nowrap; }
.bars .b em { font-style: normal; font-size: 11px; color: var(--text-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: #b8c2d3; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.95); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-50); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--danger); }
.input, select.input, textarea.input { height: 38px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; font: inherit; color: var(--text); width: 100%; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31, 79, 191, .14); }
.input[readonly], .input:disabled { background: var(--surface-2); color: var(--text-2); }
.input.invalid { border-color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 0 12px; height: 34px; font: inherit; cursor: pointer; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--primary); color: #fff; }
.readonly-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.ro .k { font-size: 12px; color: var(--muted); }
.ro .v { font-weight: 500; word-break: break-word; }
.lock-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.lock-note svg { width: 14px; height: 14px; }
.repeat-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-2); position: relative; }
.repeat-row + .repeat-row { margin-top: 12px; }
.repeat-row .rm { position: absolute; top: 8px; right: 8px; }
.file-box { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 12px; display: flex; align-items: center; gap: 12px; background: #fff; }
.file-box.has { border-style: solid; border-color: #b9d9c3; background: #f6fbf8; }
.file-box .nm { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-box svg { width: 22px; height: 22px; color: var(--muted); flex: none; }

/* ---------- Badges & alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.green { background: var(--success-bg); color: var(--success); }
.badge.amber { background: var(--warning-bg); color: var(--warning); }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.blue { background: var(--info-bg); color: var(--info); }
.badge.plain::before { display: none; }
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 13.5px; align-items: flex-start; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.info { background: var(--info-bg); border-color: #c9d8f6; color: #173b8f; }
.alert.warn { background: var(--warning-bg); border-color: #f2d6a8; color: #7a4205; }
.alert.error { background: var(--danger-bg); border-color: #f4c7c2; color: #8a1c12; }
.alert.success { background: var(--success-bg); border-color: #bfe3cb; color: #0f5e2d; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Tables ---------- */
.table-tools { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.table-tools .search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.table-tools .search svg { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; color: var(--muted); }
.table-tools .search .input { padding-left: 34px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:hover { background: #fafbfd; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sub { font-size: 12px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: #b6c0cf; margin-bottom: 8px; }
.empty h3 { color: var(--text-2); margin-bottom: 4px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; font: inherit; padding: 11px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; display: inline-flex; gap: 7px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button .badge { font-size: 10.5px; padding: 0 7px; }

/* ---------- Steps / timeline ---------- */
.steps { display: flex; gap: 0; counter-reset: s; }
.steps .s { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--muted); padding-top: 34px; min-width: 0; }
.steps .s::before { counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid var(--border-strong); display: grid; place-items: center; font-weight: 600; color: var(--muted); z-index: 1; line-height: 22px; }
.steps .s::after { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: var(--border-strong); }
.steps .s:first-child::after { display: none; }
.steps .s.done::before { content: "✓"; background: var(--success); border-color: var(--success); color: #fff; }
.steps .s.done::after, .steps .s.cur::after { background: var(--success); }
.steps .s.cur::before { border-color: var(--primary); color: var(--primary); }
.steps .s.cur { color: var(--text); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .t { font-size: 11.5px; color: var(--muted); }

/* ---------- Section list (profile) ---------- */
.section-nav { display: flex; flex-direction: column; gap: 4px; }
.section-nav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid transparent; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--text-2); }
.section-nav button:hover { background: var(--surface-2); }
.section-nav button.on { background: var(--primary-50); color: var(--primary); border-color: #d5e0f8; font-weight: 600; }
.section-nav button svg { width: 18px; height: 18px; }
.section-nav .badge { margin-left: auto; }
.profile-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }

/* ---------- Modal / drawer / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(11, 31, 58, .48); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.modal { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .16s ease-out; }
.modal.wide { max-width: 880px; }
.modal.full { max-width: 1100px; height: calc(100vh - 40px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.pdf-frame { width: 100%; height: 100%; border: 0; min-height: 60vh; background: #525659; border-radius: 6px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; right: 20px; bottom: calc(20px + var(--safe-bottom)); z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; animation: pop .2s; }
.toast.error { background: #8a1c12; }
.toast.success { background: #0f5e2d; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 240px; z-index: 60; padding: 6px; animation: pop .12s; }
.dropdown a, .dropdown button.di { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; text-decoration: none; }
.dropdown a:hover, .dropdown button.di:hover { background: var(--surface-2); }
.dropdown svg { width: 16px; height: 16px; color: var(--muted); }
.dropdown .hd { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.notif-list { max-height: 420px; overflow-y: auto; width: 360px; max-width: calc(100vw - 30px); }
.notif { padding: 10px; border-radius: 6px; cursor: pointer; display: block; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--primary-50); }
.notif .t1 { font-weight: 600; font-size: 13px; }
.notif .t2 { font-size: 12px; color: var(--muted); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-side { background: radial-gradient(1200px 600px at -10% -20%, #2a5bd0 0%, transparent 55%), linear-gradient(160deg, #0b1f3a 0%, #12305a 100%); color: #dfe7f5; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h1 { color: #fff; font-size: 32px; line-height: 1.2; max-width: 460px; margin: 24px 0 14px; }
.auth-side p { color: #b8c6de; max-width: 440px; font-size: 15px; }
.auth-side ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-side li { display: flex; gap: 10px; align-items: center; color: #dfe7f5; }
.auth-side li svg { width: 18px; height: 18px; color: #7fa6ff; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: 24px; margin-bottom: 6px; }
.auth-box .sub { color: var(--muted); margin-bottom: 24px; }
.auth-box form > * + * { margin-top: 14px; }
.wizard { max-width: 760px; margin: 40px auto; padding: 0 16px; }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 16px; background: var(--neutral-bg); font-size: 12.5px; }
.doc-tile { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.doc-tile + .doc-tile { margin-top: 10px; }
.doc-tile .ic { width: 42px; height: 48px; border-radius: 6px; background: #fdecea; color: #b42318; display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
.doc-tile .meta { flex: 1; min-width: 0; }
.doc-tile .meta b { display: block; }
.code-area { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; min-height: 380px; }
.hide-sm { }
.show-sm { display: none !important; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0 !important; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb16 { margin-bottom: 16px; }
.loading-page { display: grid; place-items: center; min-height: 50vh; color: var(--muted); gap: 12px; }
.skeleton { background: linear-gradient(90deg, #eef1f5 25%, #f6f8fb 37%, #eef1f5 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 6px; height: 14px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readonly-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(11,31,58,.45); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding-left: 10px; padding-right: 10px; }
  .content { padding: 16px; padding-bottom: calc(86px + var(--safe-bottom)); }
  .g2, .g3, .form-grid, .form-grid.g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .profile-layout { grid-template-columns: minmax(0, 1fr); }
  .section-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 6px; }
  .section-nav button { white-space: nowrap; border-color: var(--border); background: #fff; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .user-chip .nm { display: none; }
  .hide-sm { display: none !important; }
  .show-sm { display: initial !important; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--border); z-index: 30; padding-bottom: var(--safe-bottom); box-shadow: 0 -2px 10px rgba(16,24,40,.05); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: 10.5px; color: var(--muted); text-decoration: none; }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a.active { color: var(--primary); font-weight: 600; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal, .modal.wide, .modal.full { max-width: none; border-radius: 14px 14px 0 0; max-height: 94vh; }
  .modal.full { height: 94vh; }
  .modal-foot { padding-bottom: calc(12px + var(--safe-bottom)); }
  .modal-foot .btn { flex: 1; }
  .page-head h1 { font-size: 19px; }
  .steps .s { font-size: 10.5px; }
  /* responsive tables become cards */
  table.tbl.cards thead { display: none; }
  table.tbl.cards, table.tbl.cards tbody, table.tbl.cards tr, table.tbl.cards td { display: block; width: 100%; }
  table.tbl.cards tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  table.tbl.cards td { border: 0; padding: 3px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  table.tbl.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  table.tbl.cards td.primary-cell { font-weight: 600; text-align: left; justify-content: flex-start; font-size: 14px; }
  table.tbl.cards td.primary-cell::before { display: none; }
  .table-tools .search { max-width: none; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .btn { display: none !important; }
  .main { margin: 0; }
}
