/* SCENYQ ELYSIA — design system
   Dark, restrained, warm-metal accent. No neon, no glow spam.
   Status is always icon + text + shape, never colour alone (spec §58). */

:root {
  --bg:          #08090D;
  --surface:     #0F1218;
  --surface-2:   #151922;
  --surface-3:   #1C212C;
  --border:      #232936;
  --border-soft: #1A1F29;

  --text:        #E8EBF2;
  --text-2:      #A8B1C2;
  --muted:       #6E7789;
  --faint:       #454C5C;

  --accent:      #C9A961;
  --accent-2:    #E0C489;
  --accent-dim:  rgba(201, 169, 97, 0.12);

  --success:     #3FB984;
  --success-dim: rgba(63, 185, 132, 0.13);
  --warn:        #E0A02E;
  --warn-dim:    rgba(224, 160, 46, 0.13);
  --danger:      #E5544D;
  --danger-dim:  rgba(229, 84, 77, 0.13);
  --info:        #5B8DEF;
  --info-dim:    rgba(91, 141, 239, 0.13);
  --progress:    #9B7BE0;
  --progress-dim:rgba(155, 123, 224, 0.13);

  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 14px;

  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.55);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --sidebar-w: 244px;
  --header-h: 60px;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2A303D; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ========================================================== boot ========= */

.app-boot { display: grid; place-items: center; height: 100vh; }
.boot { text-align: center; }
.boot-mark {
  font-size: 15px; letter-spacing: .42em; font-weight: 600;
  color: var(--accent); margin-bottom: 20px; padding-left: .42em;
}
.boot-bar { width: 180px; height: 2px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.boot-bar span {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: boot-slide 1.1s var(--ease) infinite;
}
@keyframes boot-slide { from { transform: translateX(-100%); } to { transform: translateX(350%); } }

/* ========================================================= login ========= */

.login-wrap {
  height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1000px 500px at 50% -10%, rgba(201,169,97,.07), transparent 65%),
    var(--bg);
  overflow-y: auto;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px 30px;
  box-shadow: var(--shadow-lg);
  animation: rise .45s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.login-brand { text-align: center; margin-bottom: 6px; }
.login-brand .mark {
  font-size: 17px; font-weight: 650; letter-spacing: .38em;
  color: var(--text); padding-left: .38em;
}
.login-brand .rule {
  width: 44px; height: 2px; background: var(--accent);
  margin: 12px auto 10px; border-radius: 2px;
}
.login-brand .sub {
  font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted); padding-left: .22em;
}
.login-question {
  text-align: center; font-size: 15px; font-weight: 550;
  margin: 26px 0 16px; color: var(--text);
}

.role-grid { display: grid; gap: 9px; }
.role-btn {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 16px; text-align: left; cursor: pointer;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .18s, background .18s, transform .18s var(--ease);
}
.role-btn:hover { border-color: var(--accent); background: var(--surface-3); transform: translateY(-1px); }
.role-btn .ico {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 8px; background: var(--accent-dim); color: var(--accent); font-size: 15px;
}
.role-btn .lbl { font-weight: 550; font-size: 14px; }
.role-btn .hint { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.login-back {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 12.5px; padding: 0; margin-bottom: 16px;
}
.login-back:hover { color: var(--text-2); }

.login-role-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 100px; font-size: 11.5px; font-weight: 550;
  background: var(--accent-dim); color: var(--accent-2);
  border: 1px solid rgba(201,169,97,.24); margin-bottom: 18px;
}

/* ========================================================= forms ========= */

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11.5px; font-weight: 550; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.field .req { color: var(--danger); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .16s, background .16s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface-3);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .5; cursor: not-allowed; }
.textarea { min-height: 78px; resize: vertical; font-family: inherit; }
.select { appearance: none; cursor: pointer; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.field-error { font-size: 11.5px; color: var(--danger); margin-top: 5px; }

.checkbox-row { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.checkbox-row label { font-size: 13px; color: var(--text-2); cursor: pointer; margin: 0; text-transform: none; letter-spacing: 0; }

/* ======================================================= buttons ========= */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 550; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  transition: background .16s, border-color .16s, transform .12s var(--ease), opacity .16s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: #2C3342; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #14100A; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }

.btn-danger { background: transparent; border-color: rgba(229,84,77,.45); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-dim); border-color: var(--danger); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 14.5px; }
.btn-sm { padding: 6px 11px; font-size: 12px; }

.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  color: var(--text); animation: spin .6s linear infinite;
}
.btn-primary.is-loading::after { color: #14100A; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================================== shell ======== */

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border-soft); }
.sidebar-head .mark {
  font-size: 12.5px; font-weight: 650; letter-spacing: .28em;
  color: var(--text); padding-left: .28em;
}
.sidebar-head .sub {
  font-size: 9.5px; letter-spacing: .17em; text-transform: uppercase;
  color: var(--muted); margin-top: 4px; padding-left: .17em;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 8.5px 11px; margin-bottom: 1px; border-radius: var(--radius-sm);
  color: var(--text-2); background: none; border: none; cursor: pointer;
  font-size: 13px; text-align: left; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-dim); color: var(--accent-2); font-weight: 550; }
.nav-item .nav-ico { width: 16px; text-align: center; flex: none; opacity: .85; font-size: 13px; }
.nav-item.active .nav-ico { opacity: 1; }
.nav-badge {
  margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 100px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 650; display: grid; place-items: center;
}

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border-soft); }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px 9px;
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 650;
  background: var(--accent-dim); color: var(--accent-2);
  border: 1px solid rgba(201,169,97,.22);
}
.user-chip .who { min-width: 0; flex: 1; }
.user-chip .nm { font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .rl { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ========================================================== main ========= */

.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  height: var(--header-h); flex: none;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -.005em; }
.topbar .crumb { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.topbar-spacer { flex: 1; }

.searchbox { position: relative; width: 260px; }
.searchbox .input { padding-left: 32px; font-size: 13px; }
.searchbox .mag { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 380px; overflow-y: auto; padding: 5px;
}
.search-group-label {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px 4px;
}
.search-hit {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  border-radius: var(--radius-sm); background: none; border: none;
  cursor: pointer; color: var(--text);
}
.search-hit:hover { background: var(--surface-3); }
.search-hit .t { font-size: 13px; font-weight: 550; }
.search-hit .s { font-size: 11.5px; color: var(--muted); }

.clock {
  text-align: right; font-variant-numeric: tabular-nums; line-height: 1.25;
  white-space: nowrap;
}
.clock .t { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.clock .d { font-size: 10.5px; color: var(--muted); }

.icon-btn {
  position: relative; width: 34px; height: 34px; flex: none;
  display: grid; place-items: center; border-radius: var(--radius-sm);
  background: none; border: 1px solid transparent; color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 5px; right: 5px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 100px; background: var(--danger); color: #fff;
  font-size: 9.5px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--surface);
}

.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 100px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  background: var(--success-dim); color: var(--success); border: 1px solid rgba(63,185,132,.25);
}
.live-pill.off { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.live-pill .beacon {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: pulse 2s var(--ease) infinite;
}
.live-pill.off .beacon { animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .28; } }

.view { flex: 1; overflow-y: auto; padding: 22px; }
.view-inner { max-width: 1500px; margin: 0 auto; }

/* ========================================================== cards ======== */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border-soft);
}
.card-head h2 { font-size: 13.5px; font-weight: 600; margin: 0; }
.card-head .sub { font-size: 11.5px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

.section-title {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 0 0 11px;
}

.grid { display: grid; gap: 14px; }
.grid-kpi  { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.grid-card { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-2    { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-form { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

/* KPI */
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px;
  transition: border-color .18s, transform .18s var(--ease);
}
.kpi:hover { border-color: #2C3342; transform: translateY(-1px); }
.kpi .k-label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.kpi .k-value {
  font-size: 27px; font-weight: 650; margin-top: 7px;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1;
}
.kpi .k-foot { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.kpi[data-tone=success] .k-value { color: var(--success); }
.kpi[data-tone=warn]    .k-value { color: var(--warn); }
.kpi[data-tone=danger]  .k-value { color: var(--danger); }
.kpi[data-tone=active]  .k-value { color: var(--accent-2); }
.kpi[data-tone=progress].k-value,
.kpi[data-tone=progress] .k-value { color: var(--progress); }

/* Status card (site board) */
.status-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 15px; cursor: pointer;
  text-align: left; width: 100%; color: inherit;
  transition: border-color .18s, background .18s, transform .18s var(--ease);
}
.status-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.status-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.status-card .sc-top { display: flex; align-items: center; gap: 8px; }
.status-card .sc-count { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; }
.status-card .sc-label { font-size: 12px; color: var(--text-2); margin-top: 7px; }

/* ========================================================= badges ======== */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 100px; font-size: 11.5px; font-weight: 550;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.45;
}
.badge .bi { font-size: 10px; line-height: 1; }
.badge[data-tone=success]  { background: var(--success-dim);  color: var(--success);  border-color: rgba(63,185,132,.26); }
.badge[data-tone=warn]     { background: var(--warn-dim);     color: var(--warn);     border-color: rgba(224,160,46,.26); }
.badge[data-tone=danger]   { background: var(--danger-dim);   color: var(--danger);   border-color: rgba(229,84,77,.26); }
.badge[data-tone=info]     { background: var(--info-dim);     color: var(--info);     border-color: rgba(91,141,239,.26); }
.badge[data-tone=progress] { background: var(--progress-dim); color: var(--progress); border-color: rgba(155,123,224,.26); }
.badge[data-tone=active]   { background: var(--accent-dim);   color: var(--accent-2); border-color: rgba(201,169,97,.26); }
.badge[data-tone=muted]    { background: var(--surface-3);    color: var(--text-2);   border-color: var(--border); }
.badge[data-tone=neutral]  { background: var(--surface-3);    color: var(--text-2);   border-color: var(--border); }

/* Shape token — the non-colour channel required by §58 */
.badge .shape { width: 9px; height: 9px; flex: none; border-radius: 2px; border: 1.5px solid currentColor; }
.badge .shape[data-shape=solid]  { background: currentColor; border-radius: 50%; }
.badge .shape[data-shape=half]   { background: linear-gradient(90deg, currentColor 50%, transparent 50%); border-radius: 50%; }
.badge .shape[data-shape=ring]   { background: none; border-radius: 50%; border-width: 2px; }
.badge .shape[data-shape=dotted] { background: none; border-style: dotted; border-radius: 50%; }
.badge .shape[data-shape=dashed] { background: none; border-style: dashed; }
.badge .shape[data-shape=bars]   { background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 4px); border: none; }
.badge .shape[data-shape=cross]  { background: none; border: none; position: relative; }
.badge .shape[data-shape=cross]::before,
.badge .shape[data-shape=cross]::after {
  content: ""; position: absolute; inset: 0 3.5px; background: currentColor;
}
.badge .shape[data-shape=cross]::before { transform: rotate(45deg); }
.badge .shape[data-shape=cross]::after  { transform: rotate(-45deg); }
.badge .shape[data-shape=check]  { background: none; border: none; position: relative; }
.badge .shape[data-shape=check]::after {
  content: ""; position: absolute; left: 1px; top: 0px; width: 4px; height: 7px;
  border: solid currentColor; border-width: 0 1.8px 1.8px 0; transform: rotate(42deg);
}

/* ========================================================= tables ======== */

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 14px; white-space: nowrap;
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0; z-index: 2;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.tbl tbody tr { transition: background .13s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .mono { font-family: var(--mono); font-size: 12px; }
.cell-strong { font-weight: 550; }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty .e-ico { font-size: 26px; opacity: .35; margin-bottom: 10px; }
.empty .e-title { font-size: 14px; font-weight: 550; color: var(--text-2); margin-bottom: 5px; }
.empty .e-body { font-size: 12.5px; max-width: 380px; margin: 0 auto; }

.pager { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--border-soft); }
.pager .info { font-size: 12px; color: var(--muted); }
.pager .spacer { flex: 1; }

/* ======================================================== filters ======== */

.filters { display: flex; flex-wrap: wrap; gap: 9px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 145px; }
.filters .field .input, .filters .field .select { padding: 7.5px 11px; font-size: 12.5px; }
.filters .grow { flex: 1; min-width: 190px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 5px 11px; border-radius: 100px; font-size: 12px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  transition: all .15s;
}
.chip:hover { border-color: #2C3342; color: var(--text); }
.chip.active { background: var(--accent-dim); border-color: rgba(201,169,97,.4); color: var(--accent-2); font-weight: 550; }

/* ========================================================= modal ========= */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4,5,8,.72); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .18s var(--ease);
  overflow-y: auto;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: rise .24s var(--ease);
}
.modal.wide { max-width: 880px; }
.modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 17px 20px; border-bottom: 1px solid var(--border-soft); flex: none;
}
.modal-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.modal-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; gap: 9px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--border-soft); flex: none;
}
.modal-foot .spacer { flex: 1; }

/* ======================================================== toasts ========= */

.toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; pointer-events: none;
  max-width: min(400px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: toast-in .28s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast.leaving { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
.toast .t-ico { flex: none; font-size: 14px; line-height: 1.3; }
.toast[data-kind=success] { border-left: 3px solid var(--success); }
.toast[data-kind=success] .t-ico { color: var(--success); }
.toast[data-kind=error]   { border-left: 3px solid var(--danger); }
.toast[data-kind=error] .t-ico { color: var(--danger); }
.toast[data-kind=warn]    { border-left: 3px solid var(--warn); }
.toast[data-kind=warn] .t-ico { color: var(--warn); }
.toast[data-kind=info]    { border-left: 3px solid var(--info); }
.toast[data-kind=info] .t-ico { color: var(--info); }
.toast .t-title { font-size: 13px; font-weight: 550; }
.toast .t-body { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.toast .t-close { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 15px; line-height: 1; }

/* ================================================ employee (mobile) ====== */

.emp-shell { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }
.emp-top {
  flex: none; padding: 14px 14px; border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; gap: 8px;
}
.emp-top .mark { font-size: 11.5px; font-weight: 650; letter-spacing: .26em; padding-left: .26em; }
.emp-top .spacer { flex: 1; min-width: 0; }
/* The identity line must truncate rather than push the clock onto two lines. */
.emp-top > div:first-child { min-width: 0; }
.emp-top > div:first-child .xsmall {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.emp-top .clock { flex: none; }
.emp-top .clock .t { font-size: 13px; white-space: nowrap; }
.emp-top .clock .d { display: none; }
.emp-top .icon-btn { width: 30px; height: 30px; }
.emp-body { flex: 1; overflow-y: auto; padding: 18px; padding-bottom: 90px; }
.emp-inner { max-width: 560px; margin: 0 auto; }

.emp-tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.emp-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 4px 11px; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 10.5px; font-weight: 550;
}
.emp-tab.active { color: var(--accent-2); }
.emp-tab .ti { font-size: 16px; line-height: 1; }

.today-card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px 20px; text-align: center; margin-bottom: 16px;
}
.today-card .t-date { font-size: 13px; color: var(--text-2); }
.today-card .t-day { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.today-card .t-clock {
  font-size: 42px; font-weight: 300; letter-spacing: -.015em;
  font-variant-numeric: tabular-nums; margin: 14px 0 4px; line-height: 1;
}
.today-card .t-zone { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }

.status-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; margin-bottom: 16px;
}
.status-panel.checked-in { border-color: rgba(63,185,132,.35); background: linear-gradient(160deg, var(--success-dim), var(--surface)); }
.sp-row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; }
.sp-row + .sp-row { border-top: 1px solid var(--border-soft); }
.sp-row .l { font-size: 12px; color: var(--muted); }
.sp-row .v { font-size: 13.5px; font-weight: 550; text-align: right; }
.sp-row .v.big { font-size: 21px; font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: -.01em; }
.sp-row .v.site { color: var(--accent-2); }

.big-action {
  width: 100%; padding: 20px; border-radius: var(--radius-lg);
  font-size: 16px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  cursor: pointer; border: 1px solid transparent;
  transition: transform .14s var(--ease), filter .16s;
  min-height: 66px;
}
.big-action:active:not(:disabled) { transform: scale(.985); }
.big-action:disabled { opacity: .45; cursor: not-allowed; }
.big-action.in  { background: var(--success); color: #04150D; }
.big-action.out { background: var(--danger); color: #1B0605; }
.big-action.is-loading { position: relative; color: transparent !important; }
.big-action.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; margin: -11px 0 0 -11px;
  width: 22px; height: 22px; border: 2.5px solid rgba(0,0,0,.35);
  border-top-color: rgba(0,0,0,.85); border-radius: 50%; animation: spin .6s linear infinite;
}

.site-pick {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 15px 16px; margin-bottom: 9px; cursor: pointer; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .16s, background .16s;
}
.site-pick:hover { border-color: var(--accent); }
.site-pick.selected { border-color: var(--accent); background: var(--accent-dim); }
.site-pick .sp-mark {
  width: 10px; height: 10px; flex: none; border-radius: 50%;
  border: 2px solid var(--faint);
}
.site-pick.selected .sp-mark { border-color: var(--accent); background: var(--accent); }
.site-pick .sp-name { font-size: 14px; font-weight: 550; }
.site-pick .sp-loc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.site-pick .sp-pid { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-top: 3px; }

/* ==================================================== misc helpers ======= */

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.xsmall { font-size: 11px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }

.notice {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px;
  color: var(--text-2); line-height: 1.55;
}
.notice[data-kind=warn]   { background: var(--warn-dim);   border-color: rgba(224,160,46,.26); }
.notice[data-kind=danger] { background: var(--danger-dim); border-color: rgba(229,84,77,.26); }
.notice[data-kind=info]   { background: var(--info-dim);   border-color: rgba(91,141,239,.26); }
.notice .n-ico { flex: none; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 5px; bottom: 5px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--accent);
}
.tl-when { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-what { font-size: 13px; margin-top: 2px; }
.tl-who { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.notif-item {
  display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
}
.notif-item.unread { background: var(--surface-2); }
.notif-item .n-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 6px; }
.notif-item.read .n-dot { background: var(--faint); }
.notif-item .n-title { font-size: 13px; font-weight: 550; }
.notif-item .n-body { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }
.notif-item .n-when { font-size: 11px; color: var(--muted); margin-top: 4px; }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; }

.bar-track { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s var(--ease); }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow {
  text-align: center; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 6px 0;
}
.cal-day {
  aspect-ratio: 1 / .82; min-height: 62px; padding: 6px 7px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  display: flex; flex-direction: column; text-align: left; color: inherit;
  transition: border-color .15s, background .15s;
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.blank { background: transparent; border-color: transparent; cursor: default; }
.cal-day.blank:hover { border-color: transparent; }
.cal-day.today { border-color: var(--accent); }
.cal-day .cd-n { font-size: 12px; font-weight: 550; font-variant-numeric: tabular-nums; }
.cal-day.today .cd-n { color: var(--accent-2); }
.cal-day .cd-meta { margin-top: auto; font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.cal-day .cd-bar { height: 3px; border-radius: 2px; background: var(--accent); margin-top: 4px; opacity: .8; }

/* ==================================================== responsive ========= */

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 80;
    transform: translateX(-100%); transition: transform .26s var(--ease);
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 79; background: rgba(4,5,8,.6); }
  .menu-toggle { display: grid !important; }
  .searchbox { width: 170px; }
  .view { padding: 16px; }
}
@media (min-width: 1001px) { .menu-toggle { display: none !important; } }

@media (max-width: 640px) {
  .topbar { padding: 0 14px; gap: 9px; }
  .topbar h1 { font-size: 14.5px; }
  .searchbox { display: none; }
  .clock .d { display: none; }
  .grid-kpi { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .modal-foot .spacer { display: none; }
  .filters .field { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
