:root {
  --sidebar-bg: #12172b;
  --sidebar-bg-2: #1b2138;
  --sidebar-text: #9aa4bf;
  --sidebar-active: #2563eb;
  --brand: #2563eb;
  --brand-2: #0ea5e9;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

[data-theme="dark"] {
  --ink: #e5e7eb;
  --muted: #9ca3af;
  --line: #2b3245;
  --bg: #0e1220;
  --card: #161c2e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; }

/* ----------------------------------------------------------------- layout */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #2c3550; border-radius: 3px; }

.brand {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: #fff;
  display: grid; place-items: center;
  color: #111;
  font-weight: 800;
  font-size: 15px;
  flex: 0 0 auto;
}
.brand-name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 10px; color: #6d7899; letter-spacing: .08em; text-transform: uppercase; }

.nav { padding: 14px 12px 20px; flex: 1; }
.nav-group { margin-bottom: 18px; }
.nav-group-label {
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6d7899;
  padding: 0 10px;
  margin-bottom: 6px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}
.nav-item:hover { background: var(--sidebar-bg-2); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item .chev { margin-left: auto; font-size: 11px; transition: transform .15s; }
.nav-item.open .chev { transform: rotate(90deg); }
.nav-children { display: none; padding: 4px 0 4px 34px; }
.nav-item.open + .nav-children { display: block; }
.nav-children a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: #8a94b3;
  font-size: 13px;
  border-left: 2px solid transparent;
}
.nav-children a:hover { color: #fff; background: var(--sidebar-bg-2); text-decoration: none; }
.nav-children a.active { color: #fff; font-weight: 600; background: rgba(37, 99, 235, .16); border-left-color: var(--sidebar-active); }

.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--sidebar-bg);
}
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #2fb3e6;
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  flex: 0 0 auto;
  letter-spacing: .5px;
}
.sidebar-foot .who { line-height: 1.15; min-width: 0; }
.sidebar-foot .who b { color: #fff; font-size: 13px; display: block; }
.sidebar-foot .who span { font-size: 11px; color: #6d7899; }

/* ------------------------------------------------------------------ main */

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

.topbar {
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .clock { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.topbar .spacer { flex: 1; }

/* Bare icon controls: no button chrome, matching the reference topbar. */
.icon-bare {
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1;
  padding: 7px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
}
.icon-bare:hover { background: var(--bg); }

.bell-wrap { position: relative; display: inline-flex; }
.bell-dot {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f59e0b;
  border: 1.5px solid var(--card);
  pointer-events: none;
}

/* Notifications dropdown */
.notif-panel {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: -60px;
  width: 330px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .18);
  z-index: 120;
  overflow: hidden;
}
.notif-panel.open { display: block; }
.notif-head {
  padding: 13px 15px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.notif-empty {
  padding: 26px 15px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.notif-empty i { font-size: 22px; opacity: .4; display: block; margin-bottom: 8px; }
.notif-empty b { display: block; color: var(--ink); font-size: 13.5px; }
.notif-list { max-height: 190px; overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 9px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.notif-item b { display: block; font-size: 13px; }
.notif-item span { color: var(--muted); }
.notif-all {
  display: block;
  padding: 11px 15px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border-top: 1px solid var(--line);
}
.notif-foot {
  padding: 10px 15px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Two-option theme pill: white circular thumb travels between sun and moon. */
.theme-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 88px;
  height: 38px;
  border-radius: 19px;
  background: #c9cedb;
  margin: 0 8px;
  flex: 0 0 auto;
}
.theme-pill .opt {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  color: #8b90a0;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.theme-pill .thumb {
  position: absolute;
  z-index: 1;
  top: 3px;
  left: 3px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: left .18s ease;
}
.theme-pill[data-active="dark"] .thumb { left: calc(100% - 35px); }
.theme-pill[data-active="light"] .opt[data-theme-set="light"],
.theme-pill[data-active="dark"] .opt[data-theme-set="dark"] { color: #f5a623; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border-radius: 10px;
  color: inherit;
}
.topbar-user:hover { background: var(--bg); text-decoration: none; }
.topbar-user .tu-text { line-height: 1.25; }
.topbar-user .tu-name { font-size: 14.5px; font-weight: 700; }
.topbar-user .tu-role { font-size: 12.5px; color: var(--muted); }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { background: var(--bg); }

.tabs {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  flex-wrap: wrap;
  position: sticky; top: 60px; z-index: 25;
}
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}
.tab:hover { background: var(--bg); text-decoration: none; }
.tab.active { color: var(--brand); }

.content { padding: 22px 24px 40px; flex: 1; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 6px; }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.page-head .ico {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: #eff6ff;
  color: var(--brand);
  display: grid; place-items: center;
  font-size: 20px;
  flex: 0 0 auto;
}
.page-head h1 { font-size: 21px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card > h2, .card > h3 { font-size: 16px; margin-bottom: 4px; }
.card > p.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.kpi-green {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ok);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.kpi-green .label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.kpi-green .value {
  font-size: 30px;
  font-weight: 700;
  color: var(--ok);
}
.kpi-green .glyph {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 26px;
  color: var(--ok);
  opacity: .9;
}

/* ------------------------------------------------- account dropdown menu */

.user-menu-wrap { position: relative; display: inline-flex; }

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border-radius: 10px;
  color: inherit;
  cursor: pointer;
}
.user-menu-trigger:hover,
.user-menu-trigger.active { background: var(--bg); text-decoration: none; }
.user-menu-trigger .tu-text { line-height: 1.25; text-align: left; }
.user-menu-trigger .tu-name { font-size: 14.5px; font-weight: 700; }
.user-menu-trigger .tu-role { font-size: 12.5px; color: var(--muted); }

.user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 268px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
  z-index: 130;
  overflow: hidden;
}
.user-menu.open { display: block; }

.user-menu-head {
  padding: 14px 16px;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
}
[data-theme="dark"] .user-menu-head { background: #17233c; border-bottom-color: #1e2c49; }
.user-menu-head .um-name { font-size: 16px; font-weight: 700; }
.user-menu-head .um-role { font-size: 13px; color: var(--muted); margin-top: 1px; }

.user-menu form { margin: 0; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.user-menu-item i { font-size: 16px; color: var(--muted); }
.user-menu-item:hover { background: var(--bg); text-decoration: none; }
.user-menu-item:hover i { color: var(--brand); }
.user-menu-item.danger { color: var(--bad); }
.user-menu-item.danger i { color: var(--bad); }
.user-menu-item.danger:hover { background: #fef2f2; }
.user-menu-item.danger:hover i { color: var(--bad); }
[data-theme="dark"] .user-menu-item.danger:hover { background: #2a1414; }

.user-menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

.sidebar-foot .user-menu-wrap { width: 100%; }
.sidebar-foot .user-menu-trigger { width: 100%; gap: 10px; }
.sidebar-foot .user-menu-trigger:hover,
.sidebar-foot .user-menu-trigger.active { background: var(--sidebar-bg-2); }
.sidebar-foot .tu-name { color: #fff; }
.sidebar-foot .tu-role { color: #6d7899; }
.sidebar-foot .avatar { background: #2fb3e6; }
.sidebar-foot .user-menu { right: auto; left: 0; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-2-1, .grid-3, .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .grid-4 { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* -------------------------------------------------------------- stat card */

.stat {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--tint, #eff6ff);
  opacity: .55;
}
.stat > * { position: relative; }
.stat .label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 32px; font-weight: 700; margin: 6px 0 2px; }
.stat .foot { font-size: 12.5px; color: var(--muted); }
.stat .chip {
  position: absolute; top: 16px; right: 16px;
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-size: 19px;
  z-index: 1;
}
.t-blue  { --tint: #eff6ff; } .t-red   { --tint: #fef2f2; }
.t-green { --tint: #ecfdf5; } .t-amber { --tint: #fffbeb; }
.c-blue  { background: #3b82f6; } .c-red  { background: #f43f5e; }
.c-green { background: #22c55e; } .c-amber{ background: #f59e0b; }

/* ----------------------------------------------------------------- table */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left;
  padding: 11px 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tbody tr:hover { background: var(--bg); }
table.data .empty { text-align: center; padding: 42px 12px; color: var(--muted); }
.code {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-family: Consolas, monospace;
  font-size: 12.5px;
}
.code-link { color: var(--brand); background: #eff6ff; border-color: #dbeafe; }
[data-theme="dark"] .code-link { background: #1e293b; border-color: #334155; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.bad { background: #fee2e2; color: #b91c1c; }
.badge.info { background: #dbeafe; color: #1d4ed8; }
.badge.mute { background: var(--line); color: var(--muted); }
.badge.warn { background: #fef3c7; color: #b45309; }
[data-theme="dark"] .badge.ok { background: #14532d; color: #86efac; }
[data-theme="dark"] .badge.bad { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge.info { background: #1e3a8a; color: #bfdbfe; }
[data-theme="dark"] .badge.warn { background: #78350f; color: #fde68a; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-mute { background: #64748b; border-color: #64748b; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row.right { justify-content: flex-end; }

.icon-act {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  display: inline-grid; place-items: center;
  color: #fff; cursor: pointer; font-size: 14px;
}
.icon-act.blue { background: var(--brand); }
.icon-act.red { background: var(--bad); }
.icon-act.grey { background: #94a3b8; }
.icon-act.green { background: var(--ok); }

/* ----------------------------------------------------------------- forms */

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid.one { grid-template-columns: 1fr; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.field .req { color: var(--bad); }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; outline-offset: -1px; border-color: var(--brand); }
textarea { min-height: 84px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; margin-right: 18px; }
.check input { width: 15px; height: 15px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.filters .field label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------------------------------------------------------------- modals */

.modal-back {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--card);
  border-radius: 14px;
  width: min(880px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.modal-head { padding: 18px 20px 0; display: flex; align-items: flex-start; gap: 10px; }
.modal-head h2 { font-size: 18px; }
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 16px 20px; }
.modal-foot { padding: 0 20px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------------------------------------------------------- toasts */

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; max-width: 380px; }
.toast {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ok);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
}
.toast.error { border-left-color: var(--bad); }
.toast b { display: block; font-size: 13.5px; }
.toast span { font-size: 13px; color: var(--muted); }

/* -------------------------------------------------------------- misc bits */

.badge-pill { display: inline-flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px 0; font-size: 13px; color: var(--muted); flex-wrap: wrap; gap: 10px; }
.pager .pages { display: flex; gap: 6px; align-items: center; }
.pager .pg { padding: 6px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--card); }
.pager .pg.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .pg.disabled { opacity: .45; pointer-events: none; }

.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-state .big { font-size: 38px; opacity: .35; margin-bottom: 10px; }
.empty-state b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

pre.code-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  font-family: Consolas, "Courier New", monospace;
}
.note { border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.note.ok { background: #dcfce7; color: #14532d; }
.note.info { background: #dbeafe; color: #1e3a8a; }
.note.warn { background: #fef3c7; color: #78350f; }
[data-theme="dark"] .note.ok { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .note.info { background: #1e3a8a; color: #dbeafe; }
[data-theme="dark"] .note.warn { background: #78350f; color: #fde68a; }

.chat-launcher {
  position: fixed; right: 24px; bottom: 24px;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--brand-2); color: #fff;
  border: none; font-size: 22px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(14, 165, 233, .45);
  z-index: 90;
}

.footer { padding: 16px 24px 26px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; flex-wrap: wrap; gap: 10px; }
.footer .links a { color: var(--muted); margin-left: 18px; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.steps { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 170px; }
.step .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); font-weight: 700; font-size: 13px; }
.step.on .n { background: var(--brand); color: #fff; }
.step.done .n { background: var(--ok); color: #fff; }
.step .lbl { font-size: 12.5px; color: var(--muted); }
.step.on .lbl { color: var(--ink); font-weight: 600; }
.step .bar { flex: 1; height: 2px; background: var(--line); min-width: 12px; }

.switch { position: relative; width: 42px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 22px; cursor: pointer; transition: .2s; }
.switch .track::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::before { transform: translateX(20px); }

.chart-box { height: 280px; }

/* --------------------------------------------------------------- login */

.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }
.auth-side {
  background: linear-gradient(150deg, #1e3a8a 0%, #2563eb 45%, #0ea5e9 100%);
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center;
}
.auth-side h1 { font-size: 30px; margin-bottom: 10px; }
.auth-side p { opacity: .88; max-width: 460px; line-height: 1.6; }
.auth-side .feats { margin-top: 26px; display: grid; gap: 12px; }
.auth-side .feat { display: flex; gap: 11px; align-items: center; font-size: 14px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: min(430px, 100%); }
.auth-card .card { padding: 30px; }
.auth-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.auth-err { background: #fee2e2; color: #b91c1c; padding: 11px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.auth-news { margin-top: 22px; display: grid; gap: 10px; }
.auth-news .n { font-size: 12.5px; color: var(--muted); border-left: 3px solid var(--brand); padding-left: 11px; }
.auth-news .n b { display: block; color: var(--ink); font-size: 13px; }

/* --------------------------------------------------------------- print */

@media print {
  .sidebar, .topbar, .tabs, .footer, .btn, .chat-launcher, .no-print { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
  body { background: #fff; }
}

/* ============================================================ additions
 * Classes the static Pages build uses that the stylesheet above does not
 * define. Appended last so they win on equal specificity.
 * ====================================================================== */

/* --- form controls --------------------------------------------------- */

.field {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}

.field:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

textarea.field { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }

select.field {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236b7280'%3E%3Cpath d='M4.5 6.5 8 10l3.5-3.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
}

.field-wrap { display: grid; gap: 6px; }

/* .switch is a 42x22 track; the label text sits beside it. */
label.switch,
.field-wrap .switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink);
}

label.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.req { color: var(--bad); font-style: normal; }

/* --- toggled surfaces ------------------------------------------------- */

/* .modal-back, .user-menu and .notif-panel all hide by default and are
   revealed with .open, so the open state has to be declared here. */
.modal-back.open { display: grid; }
.user-menu.open,
.notif-panel.open { display: block; }

.user-menu-head,
.notif-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }

.user-menu-item { display: flex; align-items: center; gap: 10px; }

.tu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal { padding: 0; }
.modal .btn { width: auto; }
.modal-back .field { width: 100%; }

.notif-empty { padding: 18px 16px; text-align: center; color: var(--muted); }
.notif-list { max-height: 260px; overflow-y: auto; }
.notif-foot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.notif-row { padding: 10px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.notif-all { display: block; padding: 10px 16px; text-align: center; font-size: 13px; border-top: 1px solid var(--line); }

/* --- misc ------------------------------------------------------------ */

.code-block {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  overflow-x: auto;
}

.code-block .code { background: none; border: 0; padding: 0; }

.feats { list-style: none; padding: 0; }

table { width: 100%; border-collapse: collapse; }
table th,
table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
table th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
table tbody tr:hover { background: var(--bg); }

.btn { display: inline-flex; align-items: center; gap: 6px; }
.spacer { flex: 1; }

.empty-state i { font-size: 26px; display: block; margin-bottom: 8px; }
.empty-state b { display: block; }
.empty-state span { display: block; margin-top: 4px; font-size: 13px; }

/* --- login ------------------------------------------------------------ */

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}

.auth-card h2 { margin: 0 0 4px; font-size: 20px; }
.auth-card form { display: grid; gap: 14px; margin-top: 18px; }

/* The status line is empty until the first submit, so stay hidden until used. */
.auth-err { display: none; }
.auth-err:empty { display: none; }
.auth-err:not(:empty) { display: block; }