:root {
  --brand-950: #2c0910;
  --brand-900: #3f0e18;
  --brand-800: #571422;
  --brand-700: #7a1e2c;
  --brand-600: #922a3c;
  --brand-500: #a83a4d;
  --brand-200: #ecc9cf;
  --brand-100: #f6e6e9;
  --brand-50: #fcf5f6;
  --green-800: #1d5640;
  --green-700: #23684c;
  --green-600: #2f7d5b;
  --green-500: #3fae7f;
  --green-100: #e2f2ea;
  --green-50: #f1f9f5;
  --amber-700: #8a5a12;
  --amber-600: #b7791f;
  --amber-100: #fbf0dc;
  --red-700: #b42318;
  --red-600: #d23b2f;
  --red-100: #fde8e6;
  --slate-700: #36506f;
  --slate-100: #e7eef6;
  --ink: #1e1a1c;
  --ink-2: #4f484c;
  --muted: #847b80;
  --line: #ebe5e7;
  --line-2: #f3eff0;
  --bg: #f6f3f4;
  --surface: #ffffff;
  --surface-2: #fbf9fa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(40, 10, 18, .05);
  --shadow: 0 1px 3px rgba(40, 10, 18, .06), 0 8px 24px rgba(40, 10, 18, .05);
  --shadow-lg: 0 24px 60px rgba(40, 10, 18, .18);
  --sidebar-w: 264px;
  --topbar-h: 68px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { width: 56px; height: 56px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-name { font-size: 21px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.brand-name span { font-weight: 500; opacity: .78; }
.brand-tag { font-size: 11.5px; opacity: .7; margin-top: 4px; letter-spacing: .01em; }

.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column;
  background: linear-gradient(185deg, var(--brand-800) 0%, var(--brand-900) 55%, var(--brand-950) 100%);
  color: rgba(255, 255, 255, .86);
  transition: transform .25s ease;
}
.sidebar-head { padding: 22px 22px 18px; color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 14px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-section { margin-top: 14px; }
.nav-section:first-child { margin-top: 0; }
.nav-section-title {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; padding: 8px 10px 6px; color: rgba(255,255,255,.5);
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.nav-section-title i { font-size: 12px; transition: transform .2s; }
.nav-section.collapsed .nav-section-title i { transform: rotate(-90deg); }
.nav-section.collapsed .nav-links { display: none; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0;
  border-radius: 10px; color: rgba(255,255,255,.82); font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-link i { font-size: 19px; opacity: .9; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--green-500); }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--green-500); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.sidebar-foot { padding: 14px; }
.side-card { border-radius: 14px; padding: 16px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.1); color: #fff; }
.side-card strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.35; }
.side-card p { font-size: 12.5px; opacity: .75; margin-top: 4px; }
.side-card .btn { margin-top: 12px; width: 100%; justify-content: space-between; background: #fff; color: var(--brand-800); border-color: #fff; }

.main { margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.icon-btn.menu-toggle { display: none; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; width: min(420px, 100%); height: 42px; padding: 0 12px 0 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); text-align: left;
}
.search-trigger i { font-size: 18px; color: var(--ink-2); }
.search-trigger span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger:hover { border-color: var(--brand-200); }
kbd { font-family: inherit; font-size: 11.5px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink-2); white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-date { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.topbar-date i { font-size: 20px; color: var(--brand-700); }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink);
}
.icon-btn i { font-size: 21px; }
.icon-btn:hover { background: var(--line-2); }
.icon-btn .count {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--brand-700); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
  border: 2px solid #fff; box-sizing: content-box;
}
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border: 0; background: none; border-radius: 12px; text-align: left; }
.user-chip:hover { background: var(--line-2); }
.user-meta { line-height: 1.25; }
.user-meta strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; }
.user-meta small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand-100); color: var(--brand-800); font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

.popover {
  position: absolute; z-index: 60; min-width: 220px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: fade-in .15s ease;
}
.popover a, .popover button.item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px;
  color: var(--ink); background: none; border: 0; font-size: 14px; text-align: left;
}
.popover a:hover, .popover button.item:hover { background: var(--line-2); text-decoration: none; }
.popover i { font-size: 18px; color: var(--ink-2); }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.notif-panel { width: min(380px, calc(100vw - 24px)); padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 420px; overflow: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item .ic { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; }
.notif-item strong { display: block; font-size: 13.5px; font-weight: 600; }
.notif-item small { color: var(--muted); font-size: 12.5px; }

.content { padding: 28px 32px 48px; max-width: 1480px; margin: 0 auto; animation: fade-in .25s ease; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 27px; font-weight: 700; }
.page-head p { color: var(--ink-2); font-size: 15px; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs i { font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.card-head h2 i, .card-head h3 i { font-size: 20px; color: var(--brand-700); }
.card-head small { color: var(--muted); font-weight: 400; font-size: 13px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); }

.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); align-items: start; }
.tree-card { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 40px); overflow: auto; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mt { margin-top: 20px; }
.mt-sm { margin-top: 10px; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--green-700); }
.neg { color: var(--red-700); }

.kpi { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.kpi-top { display: flex; align-items: flex-start; gap: 14px; }
.kpi-icon { flex: none; width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center; font-size: 23px; }
.kpi-label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.delta i { font-size: 15px; }
.delta span { color: var(--muted); font-weight: 400; }
.tone-brand { background: var(--brand-100); color: var(--brand-700); }
.tone-green { background: var(--green-100); color: var(--green-700); }
.tone-amber { background: var(--amber-100); color: var(--amber-700); }
.tone-red { background: var(--red-100); color: var(--red-700); }
.tone-slate { background: var(--slate-100); color: var(--slate-700); }
.spark { width: 96px; height: 34px; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; text-decoration: none !important;
}
.btn i { font-size: 18px; }
.btn-primary { background: var(--brand-700); color: #fff; box-shadow: 0 1px 2px rgba(122,30,44,.25); }
.btn-primary:hover { background: var(--brand-800); }
.btn-green { background: var(--green-600); color: #fff; }
.btn-green:hover { background: var(--green-700); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand-200); background: var(--brand-50); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-danger { background: #fff; border-color: #f3c9c4; color: var(--red-700); }
.btn-danger:hover { background: var(--red-100); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-sm i { font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 8px; background: transparent; border: 0; color: var(--ink-2); display: inline-grid; place-items: center; }
.btn-icon:hover { background: var(--line-2); color: var(--ink); }
.btn-icon i { font-size: 20px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 6px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
  background: var(--line-2); color: var(--ink-2);
}
.badge i { font-size: 13px; }
.badge-success { background: var(--green-100); color: var(--green-800); }
.badge-info { background: var(--slate-100); color: var(--slate-700); }
.badge-warning { background: var(--amber-100); color: var(--amber-700); }
.badge-danger { background: var(--red-100); color: var(--red-700); }
.badge-brand { background: var(--brand-100); color: var(--brand-700); }
.badge-neutral { background: #efeced; color: var(--ink-2); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); background: #fff; white-space: nowrap; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--red-700); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23847b80' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(168,58,77,.14); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--red-600); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 17px; pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.input-icon .toggle-pw { position: absolute; right: 4px; top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand-700); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 6px; border-top: 1px solid var(--line-2); }
.form-section:first-child { border-top: 0; padding-top: 0; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar .input-icon { flex: 1 1 240px; max-width: 360px; }
.toolbar .select { width: auto; min-width: 150px; flex: 0 1 auto; }
.toolbar-spacer { flex: 1; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  position: sticky; top: 0; background: #faf6f7; text-align: left; font-size: 12.5px; font-weight: 650; color: var(--ink-2);
  padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
}
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--ink); }
.table th .sort-ic { font-size: 12px; margin-left: 4px; opacity: .55; vertical-align: -1px; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.actions { width: 1%; white-space: nowrap; text-align: right; }
.table .ref { color: var(--brand-700); font-weight: 600; white-space: nowrap; }
.sub { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.cell-loc { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cell-loc i { color: var(--brand-700); font-size: 15px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px; }
.pages { display: flex; gap: 4px; align-items: center; }
.pages button { min-width: 34px; height: 34px; border-radius: 8px; border: 0; background: none; font-weight: 600; color: var(--ink-2); display: inline-grid; place-items: center; }
.pages button:hover { background: var(--line-2); }
.pages button.on { background: var(--brand-700); color: #fff; }
.pages button[disabled] { opacity: .35; pointer-events: none; }
.pages .gap { padding: 0 4px; color: var(--muted); }
.per-page { display: flex; align-items: center; gap: 10px; }
.per-page .select { width: 76px; height: 34px; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty i { font-size: 38px; color: var(--brand-200); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-top: 10px; }
.empty p { margin-top: 4px; font-size: 13.5px; }
.skeleton { background: linear-gradient(90deg, var(--line-2) 25%, #f9f6f7 50%, var(--line-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 6px; }
.skel-line { height: 14px; margin: 6px 0; }
.loader { display: grid; place-items: center; padding: 48px; color: var(--muted); }
.loader::before { content: ""; width: 26px; height: 26px; border: 3px solid var(--brand-100); border-top-color: var(--brand-700); border-radius: 50%; animation: spin .8s linear infinite; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs button { position: relative; padding: 14px 12px; border: 0; background: none; font-weight: 600; color: var(--muted); white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand-700); }
.tabs button.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand-700); }
.tabs .count { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); }
.segmented { display: inline-flex; padding: 3px; background: var(--line-2); border-radius: 10px; gap: 2px; }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.segmented button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(30, 10, 16, .45); animation: fade-in .15s ease; }
.modal { width: min(680px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(960px, 100%); }
.modal.narrow { width: min(460px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 18px; font-weight: 700; }
.modal-head p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 40px); }
.toast { display: flex; align-items: flex-start; gap: 10px; min-width: 280px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); animation: fade-in .2s ease; font-size: 13.5px; }
.toast i { font-size: 19px; flex: none; margin-top: 1px; }
.toast.success i { color: var(--green-500); }
.toast.error { background: var(--red-700); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .2s; }

.palette { position: fixed; inset: 0; z-index: 120; background: rgba(30,10,16,.4); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette-box { width: min(620px, 100%); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: fade-in .15s ease; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-input i { font-size: 20px; color: var(--muted); }
.palette-input input { flex: 1; height: 56px; border: 0; outline: none; font-size: 16px; background: none; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette-group { padding: 10px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink); }
.palette-item i { font-size: 19px; color: var(--brand-700); }
.palette-item small { color: var(--muted); margin-left: auto; font-size: 12.5px; }
.palette-item.on, .palette-item:hover { background: var(--brand-50); text-decoration: none; }

.chart { position: relative; width: 100%; }
.chart svg { overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11.5px; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 140px; padding: 10px 12px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12.5px; transform: translate(-50%, -100%); white-space: nowrap;
}
.chart-tip strong { display: block; font-size: 13px; margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.chart-tip .tip-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.progress { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-700); }
.progress.green > span { background: var(--green-600); }
.progress.amber > span { background: var(--amber-600); }
.progress.red > span { background: var(--red-600); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .grow small { color: var(--muted); font-size: 12.5px; }

.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 10px 16px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid; font-size: 13.5px; }
.alert i { font-size: 20px; flex: none; }
.alert strong { display: block; }
.alert-warning { background: var(--amber-100); border-color: #f2dcae; color: var(--amber-700); }
.alert-info { background: var(--slate-100); border-color: #d2deec; color: var(--slate-700); }
.alert-danger { background: var(--red-100); border-color: #f6c8c2; color: var(--red-700); }
.alert-success { background: var(--green-100); border-color: #c6e5d5; color: var(--green-800); }

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.auth-side {
  position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(120% 90% at 0% 0%, var(--brand-600) 0%, var(--brand-800) 45%, var(--brand-950) 100%);
}
.auth-side::after {
  content: ""; position: absolute; right: -160px; bottom: -160px; width: 480px; height: 480px; border-radius: 50%;
  border: 70px solid rgba(255,255,255,.05); pointer-events: none;
}
.auth-side .brand-name { font-size: 26px; }
.auth-pitch h2 { font-size: 34px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; max-width: 520px; }
.auth-pitch p { font-size: 16px; opacity: .78; margin-top: 14px; max-width: 480px; }
.auth-points { display: grid; gap: 14px; margin-top: 32px; max-width: 480px; }
.auth-point { display: flex; gap: 14px; align-items: flex-start; }
.auth-point i { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; background: rgba(255,255,255,.1); color: #b8ebd3; }
.auth-point strong { display: block; font-weight: 600; }
.auth-point span { font-size: 13.5px; opacity: .72; }
.auth-side footer { font-size: 12.5px; opacity: .6; position: relative; z-index: 1; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface-2); }
.auth-card { width: min(460px, 100%); }
.auth-card h1 { font-size: 26px; font-weight: 700; }
.auth-card > p { color: var(--ink-2); margin-top: 6px; }
.auth-form { display: grid; gap: 16px; margin-top: 26px; }
.auth-alt { margin-top: 20px; text-align: center; color: var(--ink-2); }
.demo { margin-top: 26px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.demo-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.demo-head strong { font-size: 13.5px; }
.demo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 10px; }
.demo-btn { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; background: none; text-align: left; min-width: 0; }
.demo-btn:hover { background: var(--brand-50); border-color: var(--brand-100); }
.demo-btn strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-btn small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-btn > div { min-width: 0; }
.mobile-brand { display: none; margin-bottom: 26px; }

.state-page { min-height: calc(100vh - var(--topbar-h) - 80px); display: grid; place-items: center; text-align: center; padding: 20px; }
.state-page .ic { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; font-size: 34px; margin: 0 auto 18px; }
.state-page h1 { font-size: 22px; }
.state-page p { color: var(--ink-2); margin: 8px auto 0; max-width: 460px; }
.state-page .row { justify-content: center; margin-top: 22px; }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; min-height: 200px; }
.kanban-col header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-weight: 650; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.kanban-col .items { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow-sm); cursor: pointer; }
.kanban-card:hover { border-color: var(--brand-200); }
.kanban-card strong { display: block; font-size: 13.5px; }
.kanban-card small { color: var(--muted); font-size: 12px; }

.planning { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.planning th, .planning td { border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); padding: 6px; text-align: center; }
.planning th { background: #faf6f7; font-weight: 650; color: var(--ink-2); position: sticky; top: 0; white-space: nowrap; }
.planning th.today { background: var(--brand-100); color: var(--brand-800); }
.planning td.emp { text-align: left; min-width: 190px; position: sticky; left: 0; background: #fff; z-index: 1; padding: 8px 12px; }
.planning th:first-child { position: sticky; left: 0; z-index: 2; text-align: left; padding-left: 12px; }
.slot { display: block; padding: 5px 4px; border-radius: 7px; font-weight: 600; font-size: 11.5px; white-space: nowrap; border: 0; width: 100%; min-width: 64px; }
.slot.matin { background: #fdf3df; color: var(--amber-700); }
.slot.apres_midi { background: var(--slate-100); color: var(--slate-700); }
.slot.nuit { background: #ece6f3; color: #4f3a6b; }
.slot.journee { background: var(--brand-100); color: var(--brand-700); }
.slot.repos { background: transparent; color: var(--muted); font-weight: 500; }
.slot.absent { box-shadow: inset 0 0 0 2px var(--red-600); }
.slot.retard { box-shadow: inset 0 0 0 2px var(--amber-600); }
.slot.conge { background: var(--green-100); color: var(--green-800); }
.slot-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.slot-legend .slot { display: inline-block; width: auto; min-width: 0; padding: 3px 8px; }

.slot.permanence { background: #fdf3df; color: var(--amber-700); }
.slot.teletravail { background: var(--slate-100); color: var(--slate-700); }
.slot.mission { background: #ece6f3; color: #4f3a6b; }

.tree { display: flex; flex-direction: column; padding: 8px; }
.tree-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 9px; text-align: left; color: var(--ink); cursor: pointer; font: inherit; }
.tree-item:hover { background: var(--surface-2); }
.tree-item.on { background: var(--brand-50); color: var(--brand-800); box-shadow: inset 3px 0 0 var(--brand-700); }
.tree-item .ph { font-size: 18px; color: var(--muted); flex: none; }
.tree-item.on .ph { color: var(--brand-700); }
.tree-item .grow { flex: 1; min-width: 0; }
.tree-item .grow strong { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-item .grow small { color: var(--muted); font-size: 12px; }
.tree-item.inactive { opacity: .55; }

.timeline { display: flex; flex-direction: column; padding: 4px 0; }
.tl-item { position: relative; display: flex; gap: 14px; padding: 0 20px 18px; }
.tl-item:last-child { padding-bottom: 6px; }
.tl-item::before { content: ""; position: absolute; left: 35px; top: 34px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 16px; position: relative; z-index: 1; }
.tl-icon.tone-brand { background: var(--brand-100); border-color: var(--brand-200); color: var(--brand-700); }
.tl-icon.tone-green { background: var(--green-100); border-color: #c6e5d5; color: var(--green-700); }
.tl-icon.tone-amber { background: var(--amber-100); border-color: #f2dcae; color: var(--amber-700); }
.tl-icon.tone-red { background: var(--red-100); border-color: #f6c6c1; color: var(--red-700); }
.tl-icon.tone-slate { background: var(--slate-100); border-color: #d2deec; color: var(--slate-700); }
.tl-body { flex: 1; min-width: 0; padding-top: 4px; }
.tl-body strong { font-weight: 600; }
.tl-body .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tl-body .note { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; white-space: pre-wrap; }

.steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 12px; overflow-x: auto; padding: 16px 20px; }
.step { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.step .step-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.step .step-n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; background: var(--surface-2); color: var(--ink-2); }
.step strong { font-size: 13.5px; }
.step small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.current { border-color: var(--amber-600); box-shadow: 0 0 0 3px var(--amber-100); }
.step.done .step-n { background: var(--green-100); color: var(--green-800); }
.step.current .step-n { background: var(--amber-100); color: var(--amber-700); }
.step.ko .step-n { background: var(--red-100); color: var(--red-700); }

.scan { background: #e9e4e6; border-radius: 12px; padding: 14px; overflow: auto; max-height: 72vh; text-align: center; }
.scan img { max-width: 100%; height: auto; box-shadow: var(--shadow); border-radius: 4px; background: #fff; }
.scan.zoom img { max-width: none; width: 160%; }
.ocr { white-space: pre-wrap; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; max-height: 420px; overflow: auto; margin: 0; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.file-row + .file-row { margin-top: 8px; }
.file-row .grow { flex: 1; min-width: 0; }
.file-row .grow strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .grow small { color: var(--muted); font-size: 12px; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--ink-2); cursor: pointer; background: var(--surface-2); }
.dropzone:hover, .dropzone.over { border-color: var(--brand-500); background: var(--brand-50); }
.dropzone .ph { font-size: 28px; color: var(--brand-700); display: block; margin: 0 auto 6px; }

mark, .hl { background: #fbe7a6; color: inherit; border-radius: 3px; padding: 0 2px; }
.hit { display: block; padding: 14px 20px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none; }
.hit:hover { background: var(--surface-2); }
.hit:last-child { border-bottom: 0; }
.hit .hit-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hit .hit-title { font-weight: 600; font-size: 14.5px; }
.hit .hit-snip { color: var(--ink-2); font-size: 13px; margin-top: 4px; line-height: 1.55; }
.hit .hit-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; }
.visa { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 12px; border: 1px solid #c6e5d5; background: var(--green-50); }
.visa .ph { font-size: 28px; color: var(--green-700); flex: none; }
.visa code { font-size: 11.5px; word-break: break-all; color: var(--ink-2); }
.doc-body { white-space: pre-wrap; line-height: 1.65; font-size: 14px; color: var(--ink); }

.matrix-wrap { overflow: auto; max-height: calc(100vh - 260px); }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.matrix th, .matrix td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: center; }
.matrix thead th { position: sticky; top: 0; z-index: 2; background: #faf6f7; font-weight: 650; color: var(--ink-2); vertical-align: bottom; min-width: 112px; font-size: 12px; line-height: 1.3; }
.matrix th.mod, .matrix td.mod { position: sticky; left: 0; z-index: 1; text-align: left; background: #fff; min-width: 220px; font-weight: 500; }
.matrix thead th.mod { z-index: 3; background: #faf6f7; }
.matrix tr.section td { background: var(--surface-2); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); text-align: left; }
.matrix tr.section td.mod { background: var(--surface-2); }
.lvl { appearance: none; border: 1px solid var(--line); border-radius: 8px; height: 30px; padding: 0 26px 0 10px; font-size: 12.5px; font-weight: 600; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23847b80' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 6px center; background-size: 14px; }
.lvl.l0 { color: var(--muted); }
.lvl.l1 { color: var(--slate-700); background-color: var(--slate-100); border-color: #d2deec; }
.lvl.l2 { color: var(--amber-700); background-color: var(--amber-100); border-color: #f2dcae; }
.lvl.l3 { color: var(--green-800); background-color: var(--green-100); border-color: #c6e5d5; }
.lvl:disabled { opacity: .75; cursor: not-allowed; }
.lvl-pill { display: inline-block; min-width: 86px; padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; }

.scorebar { display: flex; gap: 3px; }
.scorebar span { width: 14px; height: 6px; border-radius: 3px; background: var(--line); }
.scorebar span.on { background: var(--green-600); }

.checklist { display: flex; flex-direction: column; gap: 4px; }
.checklist label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.checklist label:hover { background: var(--surface-2); }
.checklist input { width: 17px; height: 17px; accent-color: var(--green-600); }
.checklist .done span { text-decoration: line-through; color: var(--muted); }

.overlay { position: fixed; inset: 0; z-index: 35; background: rgba(30,10,16,.45); animation: fade-in .15s; }

@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-main, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .tree-card { position: static; max-height: 340px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .icon-btn.menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-date { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .mobile-brand { display: flex; }
}
@media (max-width: 760px) {
  .content { padding: 20px 16px 40px; }
  .page-head h1 { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .user-meta { display: none; }
  .search-trigger { width: auto; flex: 1; }
  .search-trigger kbd { display: none; }
  .modal-root { padding: 0; place-items: end stretch; }
  .modal, .modal.wide, .modal.narrow { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal-foot { border-radius: 0; }
  .toolbar { padding: 12px 16px; }
  .toolbar .input-icon { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1 1 140px; }
  .card-head, .card-body, .pager { padding-left: 16px; padding-right: 16px; }
  .table th, .table td { padding: 11px 12px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .demo-list { grid-template-columns: minmax(0, 1fr); }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; max-width: none; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 23px; }
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1 1 auto; }
}
@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .pager { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; }
}
.table td > .strong, .table td > a.strong { white-space: nowrap; }
.search-trigger { min-width: 0; }
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
@media (max-width: 760px) {
  .topbar .user-chip > .ph { display: none; }
  .search-trigger span { font-size: 13px; }
  .page-actions .segmented { width: 100%; }
  .page-actions .segmented button { flex: 1; }
}
@media (max-width: 420px) {
  .search-trigger span { display: none; }
  .search-trigger { flex: 0 0 auto; width: 42px; padding: 0; justify-content: center; }
}
@media (max-width: 1024px), (max-height: 760px) {
  .sidebar-foot { display: none; }
}

.table .wrap { display: block; white-space: normal; min-width: 220px; max-width: 420px; }
.table .sub.wrap { min-width: 0; max-width: 300px; }
@media (max-width: 760px) {
  .table .wrap { min-width: 180px; }
}
.toolbar .filters { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.toolbar .select { min-width: 0; max-width: 100%; }
.table .row .strong { white-space: nowrap; }
@media (max-width: 760px) {
  .toolbar .filters { width: 100%; }
  .toolbar .filters .select { flex: 1 1 calc(50% - 8px); width: auto; }
}
@media (max-width: 420px) {
  .toolbar .filters .select { flex-basis: 100%; }
}
