@font-face {
  font-family: "Estedad";
  src: url("fonts/estedad-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Estedad", "Segoe UI", Tahoma, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --bg: #f2f5fb;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --surface-3: #edf2fa;

  --ink: #111c33;
  --ink-2: #344054;
  --muted: #68758c;
  --line: #e2e8f2;
  --line-strong: #d3ddec;

  --brand: #2458e6;
  --brand-strong: #1740b8;
  --brand-soft: #eaf0ff;
  --teal: #0f9d8a;
  --teal-soft: #e5f7f3;

  --ok: #0b7a5d;
  --ok-soft: #e7f8f1;
  --warn: #a45c00;
  --warn-soft: #fff5e5;
  --danger: #d92d20;
  --danger-soft: #fdecea;

  --nav: #09142c;
  --nav-2: #102348;
  --nav-ink: #c6d4ee;
  --nav-muted: #8094b8;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 8px 24px rgba(16, 24, 40, 0.055);
  --shadow: 0 24px 60px rgba(11, 23, 48, 0.1);

  --nav-w: 264px;
  --appbar-h: 62px;
  --bottom-h: 68px;

  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html.sheet-open { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { line-height: 1.45; font-weight: 800; }
h1 { font-size: 24px; letter-spacing: -0.01em; }
h2 { font-size: 15.5px; font-weight: 700; }
h3 { font-size: 13.5px; font-weight: 700; }

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

button, input, select, textarea { font: inherit; }

img, svg { vertical-align: middle; }

::selection { background: rgba(36, 88, 230, 0.16); }

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

.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-16 { margin-bottom: 16px; }
.pos { color: var(--ok); font-weight: 700; }
.neg { color: var(--danger); font-weight: 700; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--mono); }
code, .code-pill { font-family: var(--mono); font-size: 0.88em; }

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ico {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: fixed;
  inset-inline-start: 16px;
  top: -80px;
  z-index: 300;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
  transition: top 0.2s ease;
}
.skip-link:focus { top: 16px; }

/* ---------- shell ---------- */

.shell {
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 100% -12%, rgba(36, 88, 230, 0.07), transparent 62%),
    radial-gradient(900px 520px at 0% 105%, rgba(15, 157, 138, 0.05), transparent 60%),
    var(--bg);
}

.main {
  margin-inline-start: var(--nav-w);
  min-height: 100vh;
  padding: 30px 34px 64px;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  animation: page-in 0.34s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-head h1 { font-size: 25px; }
.page-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.page-date .ico { width: 15px; height: 15px; }

/* ---------- sidebar ---------- */

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: var(--nav-w);
  padding: 22px 16px 16px;
  color: var(--nav-ink);
  background:
    radial-gradient(420px 300px at 100% 0%, rgba(64, 116, 244, 0.28), transparent 65%),
    radial-gradient(360px 280px at 0% 100%, rgba(15, 157, 138, 0.16), transparent 60%),
    linear-gradient(170deg, var(--nav), var(--nav-2));
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset-inline-end: -70px;
  top: 36%;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 13px;
  background: linear-gradient(135deg, #6b9bff, #23c9b1);
  color: #04122b;
  font-size: 21px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(36, 88, 230, 0.4);
}

.brand-mark.sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 16px;
  box-shadow: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
}
.brand-text small {
  color: #93a8cc;
  font-size: 10.5px;
  font-weight: 400;
  margin-top: 1px;
}

.nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-label {
  padding: 10px 12px 5px;
  color: var(--nav-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-label:first-child { padding-top: 0; }

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--nav-ink);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease;
}
.nav a .ico { width: 19px; height: 19px; opacity: 0.85; }
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.nav a.on {
  color: #ffffff;
  font-weight: 700;
  background: linear-gradient(90deg, rgba(78, 132, 255, 0.3), rgba(35, 201, 177, 0.12));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.nav a.on::before {
  content: "";
  position: absolute;
  inset-inline-start: -16px;
  top: 50%;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: #6b9bff;
  transform: translateY(-50%);
}
.nav a.on .ico { opacity: 1; }

.side-foot {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.side-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.5;
}
.side-user-text strong {
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user-text small { color: var(--nav-muted); font-size: 10.5px; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 14px;
  font-weight: 800;
}
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 17px; font-size: 21px; }
.avatar.on-dark {
  background: rgba(255, 255, 255, 0.1);
  color: #dce8ff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.side-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: transparent;
  color: #c6d4ee;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.side-logout:hover { background: rgba(255, 255, 255, 0.07); color: #ffffff; }
.side-logout .ico { width: 17px; height: 17px; }

/* ---------- mobile app bar ---------- */

.appbar { display: none; }

.appbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}
.appbar-name {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  font-size: 14px;
  font-weight: 800;
}
.appbar-name small { color: var(--muted); font-size: 9.5px; font-weight: 400; }

.appbar-actions { display: flex; align-items: center; gap: 8px; }
.appbar-logout { display: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s ease, border 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .ico { width: 18px; height: 18px; }
.icon-btn.danger { color: var(--danger); border-color: #f0d1cd; }
.icon-btn.danger:hover { background: var(--danger-soft); }

.appbar-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.appbar-user .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }

/* ---------- mobile bottom nav ---------- */

.bottom-nav { display: none; }

.bottom-nav .bnav-item {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 3px 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav .bico {
  display: grid;
  place-items: center;
  width: 32px;
  height: 27px;
  border-radius: 9px;
  transition: background 0.16s ease, color 0.16s ease;
}
.bottom-nav .bico .ico { width: 20px; height: 20px; }
.bottom-nav .on { color: var(--brand-strong); }
.bottom-nav .on .bico { background: var(--brand-soft); color: var(--brand); }

/* ---------- more sheet ---------- */

.sheet,
.sheet-backdrop { display: none; }

.sheet-grip {
  width: 38px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 99px;
  background: var(--line-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.sheet-head-text { display: flex; flex-direction: column; line-height: 1.5; }
.sheet-head-text strong { font-size: 13px; }
.sheet-head-text small { color: var(--muted); font-size: 10.5px; }

.sheet-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }

.sheet-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}
.sheet-link .ico { width: 19px; height: 19px; color: var(--brand); }
.sheet-link.on { border-color: #bdd0fb; background: var(--brand-soft); color: var(--brand-strong); }

.sheet-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  border: 1px solid #f0d1cd;
  border-radius: 12px;
  background: var(--surface);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.sheet-logout .ico { width: 17px; height: 17px; }

/* ---------- alerts ---------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.8;
  animation: alert-in 0.25s ease both;
}
@keyframes alert-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.alert .ico { width: 18px; height: 18px; margin-top: 2px; }
.alert-text { flex: 1; min-width: 0; }
.alert-close {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: -1px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: currentColor;
  font-size: 17px;
  line-height: 1;
  opacity: 0.7;
  cursor: pointer;
}
.alert-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.05); }
.alert.ok { background: var(--ok-soft); border-color: #c5ebdd; color: #08604a; }
.alert.err { background: var(--danger-soft); border-color: #f6d2ce; color: #a91f15; }
.alert.warn { background: var(--warn-soft); border-color: #f1dcb2; color: #8a4e00; }
.alert.small { padding: 9px 12px; font-size: 11.8px; border-radius: 11px; }
.alert.dismissing { opacity: 0; transform: translateY(-4px); transition: opacity 0.2s ease, transform 0.2s ease; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border 0.15s ease, filter 0.15s ease, transform 0.06s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-2); border-color: #c3cfdf; }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 17px; height: 17px; }

.btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg, #3168f0, var(--brand));
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(36, 88, 230, 0.22);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.soft {
  border-color: transparent;
  background: var(--brand-soft);
  color: var(--brand-strong);
}
.btn.soft:hover { background: #dfe8ff; }
.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  padding-inline: 9px;
}
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger {
  border-color: #f0cfcb;
  background: var(--surface);
  color: var(--danger);
}
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { height: 32px; padding: 0 11px; border-radius: 9px; font-size: 11.5px; gap: 5px; }
.btn.small .ico { width: 15px; height: 15px; }
.btn.lg { height: 46px; border-radius: 12px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }

form.htmx-request button[type="submit"] { pointer-events: none; opacity: 0.8; }
form.htmx-request button[type="submit"]::after {
  content: "";
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.copy-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.copy-btn:hover { color: var(--brand); border-color: #c5d5fa; background: var(--brand-soft); }
.copy-btn .ico { width: 14px; height: 14px; }

.copy-helper {
  position: fixed;
  inset-inline-start: -9999px;
  top: 0;
  opacity: 0;
  pointer-events: none;
}

/* ---------- flags ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.9;
  white-space: nowrap;
  vertical-align: middle;
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}
.badge.plain::before { display: none; }

.st-active, .st-approved, .st-paid { background: var(--ok-soft); color: var(--ok); }
.st-pending, .st-queued, .st-processing, .st-ready { background: var(--warn-soft); color: var(--warn); }
.st-blocked, .st-failed, .st-rejected { background: var(--danger-soft); color: var(--danger); }
.st-viewed { background: var(--surface-3); color: var(--muted); }
.st-unknown { background: #ffeadd; color: #a64b00; }

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.status-dot.ok { background: #16b98a; box-shadow: 0 0 0 4px rgba(22, 185, 138, 0.14); }
.status-dot.off { background: #e05252; box-shadow: 0 0 0 4px rgba(224, 82, 82, 0.12); }
.status-dot.wait { background: #e0a23c; box-shadow: 0 0 0 4px rgba(224, 162, 60, 0.14); }

/* ---------- cards ---------- */

.card {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card:last-child { margin-bottom: 0; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.card-title { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.card-title > .ico {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  color: var(--brand);
}
.card-title h2 { font-size: 15px; }
.card-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.8px;
  font-weight: 400;
  line-height: 1.8;
}
.card-head-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); align-items: start; }
.grid.split { grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); align-items: start; }
.grid.two > .card, .grid.split > .card { margin-bottom: 0; }
.stack-cards { display: flex; flex-direction: column; gap: 18px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset-inline-end: -32px;
  bottom: -42px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36, 88, 230, 0.06), transparent 68%);
  pointer-events: none;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.stat-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
}
.stat-icon .ico { width: 19px; height: 19px; }
.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.stat-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.stat-sub a { font-weight: 600; }
.stat.accent { border-color: #f0ddb7; background: linear-gradient(180deg, #fffdf7, #ffffff); }
.stat.accent .stat-icon { background: var(--warn-soft); color: var(--warn); }
.stat.teal .stat-icon { background: var(--teal-soft); color: var(--teal); }
.stat.danger .stat-icon { background: var(--danger-soft); color: var(--danger); }

.meter {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 9px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  appearance: none;
}
.meter::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
.meter::-webkit-progress-value { background: linear-gradient(90deg, #3168f0, #23c9b1); border-radius: 999px; }
.meter::-moz-progress-bar { background: linear-gradient(90deg, #3168f0, #23c9b1); border-radius: 999px; }

/* ---------- toolbar / lead / empty ---------- */

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.page-lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 12.3px;
  line-height: 1.9;
}
.toolbar .btn { flex: none; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 38px 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--surface-2);
  text-align: center;
  color: var(--muted);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: #8d9ab0;
}
.empty-icon .ico { width: 23px; height: 23px; }
.empty strong { color: var(--ink); font-size: 13.5px; }
.empty p { max-width: 420px; font-size: 11.8px; line-height: 1.9; }
.empty .btn { margin-top: 8px; }

/* ---------- tables ---------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow-x: auto;
  background: var(--surface);
}
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.8px;
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
}
.table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s ease; }
.table tbody tr:hover { background: #fafcff; }
.table td.actions { white-space: nowrap; text-align: end; }
.table td.actions form { display: inline-flex; margin-inline-start: 4px; vertical-align: middle; }
.table .row-error { margin-top: 3px; color: var(--danger); font-size: 10.5px; line-height: 1.7; }

.cell-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cell-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.55; }
.cell-name { color: var(--ink); font-size: 12.5px; font-weight: 700; }
a.cell-name:hover { color: var(--brand); }
.cell-meta { color: var(--muted); font-size: 10.5px; }
.cell-sub { color: var(--muted); font-size: 10.5px; margin-top: 2px; }

.kv {
  display: grid;
  grid-template-columns: minmax(108px, auto) minmax(0, 1fr);
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  font-size: 12.3px;
}
.kv dt,
.kv dd { margin: 0; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.kv dt { background: var(--surface-2); color: var(--muted); font-weight: 500; }
.kv dd { background: var(--surface); word-break: break-word; }
.kv > :nth-last-child(-n + 2) { border-bottom: 0; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.pager-info { color: var(--muted); font-size: 11.5px; }
.pager-actions { display: flex; align-items: center; gap: 7px; }
.page-num {
  min-width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 0 8px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

label > small,
.field-hint {
  color: var(--muted);
  font-size: 10.8px;
  font-weight: 400;
  line-height: 1.8;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.8px;
  font-weight: 400;
  line-height: 1.7;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}
textarea { min-height: 76px; resize: vertical; line-height: 1.8; }
input::placeholder, textarea::placeholder { color: #9aa7bb; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(36, 88, 230, 0.13);
}

input[type="checkbox"], input[type="radio"] {
  width: 17px;
  height: 17px;
  min-height: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

select {
  appearance: none;
  padding-inline-end: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2368758c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 11px center;
  background-size: 15px;
  cursor: pointer;
}
select:disabled { opacity: 0.65; cursor: not-allowed; }

input[dir="ltr"], textarea[dir="ltr"], .mono { text-align: left; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 16px;
}
.form-grid .span2 { grid-column: span 2; }

.form-section {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}
.form-section + .form-section { padding-top: 22px; border-top: 1px solid var(--line); }
.form-section legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 0;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
}
.form-section legend .ico { width: 17px; height: 17px; color: var(--brand); }

.form-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.form-footer .spacer { flex: 1; }

.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.quick-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick-status form { display: inline-flex; }

label.check {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  cursor: pointer;
}
label.check input { flex: none; }

.switch {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 40px;
  height: 23px;
  flex: none;
  border-radius: 99px;
  background: #c9d3e2;
  transition: background 0.18s ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.2);
  transition: transform 0.18s ease;
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(-17px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-text { display: flex; flex-direction: column; gap: 1px; font-size: 12px; font-weight: 600; }
.switch-text small { color: var(--muted); font-size: 10.8px; font-weight: 400; line-height: 1.7; }

.control { position: relative; display: block; }
.control > .ico {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  width: 17px;
  height: 17px;
  color: #8b98ad;
  transform: translateY(-50%);
  pointer-events: none;
}
.control > input { padding-inline-start: 38px; }

.pw-toggle {
  position: absolute;
  inset-inline-end: 5px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8b98ad;
  cursor: pointer;
  transform: translateY(-50%);
}
.pw-toggle:hover { background: var(--surface-3); color: var(--ink-2); }
.pw-toggle .ico { width: 17px; height: 17px; }
.pw-toggle .eye-off { display: none; }
.pw-toggle.is-visible .eye { display: none; }
.pw-toggle.is-visible .eye-off { display: block; }
.has-toggle > input { padding-inline-end: 42px; }

.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.filters .search { position: relative; flex: 1 1 250px; min-width: 200px; }
.filters .search > .ico {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  width: 17px;
  height: 17px;
  color: #8b98ad;
  transform: translateY(-50%);
  pointer-events: none;
}
.filters .search input { padding-inline-start: 38px; background: var(--surface); }
.filters select { flex: 0 1 156px; width: auto; min-height: 40px; padding-block: 7px; background-color: var(--surface); }
.filters .btn { flex: none; }

.field-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.counter { color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; direction: ltr; }

/* ---------- group cards ---------- */

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.group-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border 0.16s ease, box-shadow 0.16s ease;
}
.group-card:hover { border-color: #ccd9ee; box-shadow: var(--shadow-sm); }

.group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.group-identity { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.group-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}
.group-icon .ico { width: 19px; height: 19px; }
.group-name {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.group-name:hover { color: var(--brand); }
.group-desc {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.8px;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.group-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.meta-label { color: var(--muted); font-size: 10px; }
.meta-value { font-size: 11.8px; font-weight: 600; overflow-wrap: anywhere; }
.meta-value .badge { font-size: 9.8px; padding: 0 7px; }

.group-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10.5px;
}
.group-note .ico { width: 14px; height: 14px; }

.group-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.group-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.group-actions form { display: inline-flex; }

/* ---------- profile ---------- */

.profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.profile-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.profile-text { min-width: 0; }
.profile-name { font-size: 18px; font-weight: 800; line-height: 1.5; overflow-wrap: anywhere; }
.profile-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
}
.profile-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }

/* ---------- bank / chips / tools ---------- */

.chips { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip:hover { border-color: #b9c9e6; background: var(--surface-2); }
.chip.on { border-color: transparent; background: var(--brand); color: #ffffff; box-shadow: 0 5px 12px rgba(36, 88, 230, 0.2); }

.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.tool {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  transition: border 0.15s ease, background 0.15s ease;
}
.tool:hover { border-color: #bfd0f7; background: #f8faff; }
.tool-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
}
.tool-icon .ico { width: 18px; height: 18px; }
.tool-text { display: flex; flex-direction: column; line-height: 1.6; min-width: 0; }
.tool-text strong { font-size: 12px; }
.tool-text small { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }

.steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  font-size: 11.8px;
  color: var(--ink-2);
}
.steps li { display: flex; align-items: flex-start; gap: 9px; counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  flex: none;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
}

.secure-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #f1dcb2;
  border-radius: 11px;
  background: var(--warn-soft);
  color: #7c4700;
  font-size: 10.8px;
  line-height: 1.8;
}
.secure-note .ico { width: 16px; height: 16px; margin-top: 2px; }

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

.rule-list { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }
.rule-list li { display: flex; align-items: flex-start; gap: 9px; color: var(--ink-2); font-size: 11.8px; line-height: 1.9; }
.rule-list .ico { width: 17px; height: 17px; margin-top: 3px; color: var(--teal); }

/* ---------- two-factor auth ---------- */

.totp-steps {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding-inline-start: 18px;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.9;
}
.totp-steps li::marker { color: var(--brand); font-weight: 700; }
.totp-qr { display: flex; justify-content: center; margin: 14px 0 4px; }
.totp-qr img {
  width: 200px;
  height: 200px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}
.secret-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.secret-label { color: var(--muted); font-size: 10.5px; }
.secret-code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}
.secret-box .btn { flex: none; }

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 11.8px;
}
.info-row:last-child { border-bottom: 0; padding-bottom: 0; }
.info-row .label { color: var(--muted); }
.info-row .value { font-weight: 600; text-align: end; overflow-wrap: anywhere; }

.code-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--ink-2);
  direction: ltr;
  unicode-bidi: isolate;
  font-size: 10.5px;
}

.section-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #cdddfb;
  border-radius: 12px;
  background: linear-gradient(180deg, #f7faff, #f2f7ff);
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.9;
}
.section-note .ico { width: 18px; height: 18px; margin-top: 2px; color: var(--brand); }

/* ---------- auth ---------- */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  min-height: 100vh;
  background: var(--bg);
}

.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
  padding: 42px 48px;
  overflow: hidden;
  color: #eaf1ff;
  background:
    radial-gradient(700px 500px at 90% -8%, rgba(76, 132, 255, 0.36), transparent 60%),
    radial-gradient(520px 420px at 4% 106%, rgba(28, 200, 179, 0.2), transparent 62%),
    linear-gradient(155deg, #071126 4%, #0e2450 56%, #0b3a53 100%);
}
.auth-aside::before {
  content: "";
  position: absolute;
  inset-inline-end: -150px;
  top: 14%;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  pointer-events: none;
}
.auth-aside::after {
  content: "";
  position: absolute;
  inset-inline-end: -84px;
  top: 24%;
  width: 290px;
  height: 290px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  color: #ffffff;
}

.auth-hero { position: relative; z-index: 1; max-width: 430px; }
.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
  padding: 4px 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #b8d1ff;
  font-size: 10.5px;
  font-weight: 600;
}
.auth-eyebrow .ico { width: 14px; height: 14px; }
.auth-hero h2 {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.55;
  letter-spacing: -0.01em;
}
.auth-hero > p {
  margin-top: 12px;
  color: #a9bcdf;
  font-size: 12.5px;
  line-height: 2;
}

.auth-points { display: grid; gap: 15px; margin-top: 28px; }
.auth-point { display: flex; align-items: flex-start; gap: 11px; }
.auth-point-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.07);
  color: #79e4d2;
}
.auth-point-icon .ico { width: 18px; height: 18px; }
.auth-point-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.7; }
.auth-point-text strong { color: #f2f7ff; font-size: 12px; font-weight: 700; }
.auth-point-text span { color: #93a9cf; font-size: 10.8px; }

.auth-legal {
  position: relative;
  z-index: 1;
  max-width: 380px;
  color: #7d93ba;
  font-size: 10px;
  line-height: 1.9;
}

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 28px;
  background:
    radial-gradient(620px 420px at 100% 100%, rgba(36, 88, 230, 0.05), transparent 65%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: 0 30px 70px rgba(11, 23, 48, 0.1);
}
.auth-card.wide { max-width: 500px; }

.auth-mobile-brand { display: none; }

.auth-head { margin-bottom: 20px; }
.auth-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), #23c9b1);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(36, 88, 230, 0.24);
}
.auth-icon .ico { width: 22px; height: 22px; }
.auth-head h1 { font-size: 20px; }
.auth-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11.8px;
  line-height: 1.9;
}

.auth-card .alert { margin-bottom: 16px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn { margin-top: 4px; }

.auth-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.9;
}

.auth-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 10.2px;
}
.auth-meta span { display: inline-flex; align-items: center; gap: 5px; }
.auth-meta .ico { width: 13px; height: 13px; color: var(--teal); }
.auth-inline-link { display: inline-block; margin-top: 6px; color: var(--brand); font-weight: 600; }
.auth-inline-link:hover { text-decoration: underline; }

input.otp-input {
  padding-inline: 12px;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
}

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}
.auth-foot .ico { width: 13px; height: 13px; }

.setup-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #cdddfb;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 10.8px;
  line-height: 1.8;
}
.setup-note .ico { width: 16px; height: 16px; margin-top: 2px; }

/* ---------- feedback ---------- */

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: 24px;
  z-index: 90;
  width: max-content;
  max-width: calc(100vw - 32px);
  margin-inline: auto;
  padding: 10px 16px;
  border-radius: 12px;
  background: #10203c;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 500;
  box-shadow: 0 16px 36px rgba(11, 23, 48, 0.28);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: none; }

.top-progress {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 200;
  height: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.top-progress::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 42%;
  background: linear-gradient(90deg, transparent, #5b8cff, #23c9b1, transparent);
  transform: translateX(-110%);
}
html.is-loading .top-progress { opacity: 1; }
html.is-loading .top-progress::before { animation: progress 1.05s linear infinite; }
@keyframes progress { to { transform: translateX(340%); } }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1024px) {
  .sidebar { display: none; }

  .appbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: calc(var(--appbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 16px 0;
    border-bottom: 1px solid rgba(226, 232, 242, 0.9);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .appbar-logout { display: inline-flex; }

  .main {
    margin-inline-start: 0;
    min-height: calc(100vh - var(--appbar-h));
    padding: 20px 16px calc(var(--bottom-h) + 28px + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 45;
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
    padding: 6px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 -10px 28px rgba(16, 24, 40, 0.06);
  }

  .sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: block;
    background: rgba(7, 16, 34, 0.46);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }
  .sheet {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 61;
    display: block;
    padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    background: var(--surface);
    box-shadow: 0 -24px 60px rgba(11, 23, 48, 0.2);
    transform: translateY(110%);
    visibility: hidden;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.28s;
  }
  html.sheet-open .sheet { transform: none; visibility: visible; }
  html.sheet-open .sheet-backdrop { opacity: 1; visibility: visible; }

  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 22px; }

  .toast { bottom: calc(var(--bottom-h) + 16px + env(safe-area-inset-bottom)); }

  .grid.two { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .table-wrap { border: 0; border-radius: 0; overflow: visible; background: transparent; }
  .table { display: block; }
  .table thead { display: none; }
  .table tbody { display: grid; gap: 9px; }
  .table tr {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
  }
  .table tr:hover { background: var(--surface); }
  .table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border: 0;
    text-align: end;
    font-size: 12px;
  }
  .table td::before {
    content: attr(data-label);
    flex: none;
    padding-top: 1px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
  }
  .table td:empty { display: none; }
  .table td.actions {
    justify-content: flex-end;
    gap: 6px;
    margin-top: 7px;
    padding-top: 9px;
    border-top: 1px dashed var(--line);
    text-align: end;
  }
  .table td.actions::before { display: none; }
  .table .cell-user { justify-content: flex-end; text-align: start; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span2 { grid-column: span 1; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .btn { width: 100%; }

  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 20px; }
  .page-date { font-size: 10.8px; }

  .card { padding: 18px; border-radius: 17px; }
  .card-head { flex-wrap: wrap; }
  .card-head-actions { width: 100%; justify-content: flex-end; }

  .stats { gap: 10px; }
  .stat { padding: 14px; border-radius: 16px; }
  .stat strong { font-size: 22px; }
  .stat-label { font-size: 10.5px; }
  .stat-sub { font-size: 9.8px; }
  .stat-icon { width: 32px; height: 32px; border-radius: 10px; }
  .stat-icon .ico { width: 17px; height: 17px; }

  .group-grid { grid-template-columns: minmax(0, 1fr); }

  .kv { grid-template-columns: 100px minmax(0, 1fr); font-size: 11.5px; }
  .kv dt, .kv dd { padding: 9px 11px; }

  .table-wrap + .pager { margin-top: 14px; }
  .pager { align-items: flex-start; }

  .profile { align-items: flex-start; }
  .profile-actions { width: 100%; }
  .profile-actions .btn { flex: 1 1 auto; }

  .auth-main { padding: calc(26px + env(safe-area-inset-top)) 16px calc(26px + env(safe-area-inset-bottom)); }
  .auth-card { padding: 26px 22px; border-radius: 22px; }
  .auth-card.wide { max-width: 100%; }
}

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
  }
  .auth-mobile-brand .brand-text { color: var(--ink); }
  .auth-mobile-brand .brand-text small { color: var(--muted); }
}

@media (max-width: 560px) {
  .appbar { padding: 0 13px; }
  .main { padding-inline: 13px; }
  .filters { padding: 9px; }
  .filters select { flex: 1 1 100%; }
  .filters .search { flex-basis: 100%; }
  .filters .btn { flex: 1 1 auto; }
  .stat strong { font-size: 20px; }
  .auth-card { padding: 24px 18px; }
  .auth-meta { gap: 5px 12px; }
  .sheet-links { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
