/* ============================
   DESIGN TOKENS
   ============================ */
:root {
  --c-primary: #1f5f9f;
  --c-on-primary: #ffffff;
  --c-primary-ct: #d7e7ff;
  --c-on-primary-ct: #12385f;
  --c-secondary-ct: #e7ebf0;
  --c-on-secondary-ct: #26313d;
  --c-surface: #f6f8fb;
  --c-surface-1: #ffffff;
  --c-surface-2: #f0f3f7;
  --c-surface-3: #e6ebf1;
  --c-surface-4: #dbe2ea;
  --c-on-surface: #1e242c;
  --c-on-surface-v: #4d5b69;
  --c-outline: #667586;
  --c-outline-v: #d6dde6;
  --c-error: #b3261e;
  --c-error-ct: #fce8e6;
  --c-warn: #9a4f00;
  --c-warn-ct: #fff0d9;
  --c-ok: #137333;
  --c-ok-ct: #dff4e7;
  --c-tertiary: #6d4c7d;
  --c-tertiary-ct: #f0e4f5;
  --c-on-tertiary-ct: #3d2148;
  --r-xs: 6px; --r-sm: 8px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  --h-btn: 40px; --h-field: 44px;
  --ease: cubic-bezier(.4,0,.2,1);
  --sidebar-w: 240px;
  --glass: rgba(255,255,255,.82);
  --glass-b: rgba(102,117,134,.18);
}

[data-theme="dark"] {
  --c-primary: #a8c7fa;
  --c-on-primary: #0d2b4e;
  --c-primary-ct: #325e9f;
  --c-on-primary-ct: #d6e3ff;
  --c-secondary-ct: #3d4148;
  --c-on-secondary-ct: #e3e3eb;
  --c-surface: #0f1116;
  --c-surface-1: #15171d;
  --c-surface-2: #1c1e26;
  --c-surface-3: #252730;
  --c-surface-4: #30323b;
  --c-on-surface: #e3e2e6;
  --c-on-surface-v: #a5a6b0;
  --c-outline: #787a84;
  --c-outline-v: #3c3e47;
  --c-error: #f4b6b9;
  --c-error-ct: #6c0010;
  --c-warn: #ffb687;
  --c-warn-ct: #693300;
  --c-ok: #80d79f;
  --c-ok-ct: #004619;
  --c-tertiary: #e0c0e8;
  --c-tertiary-ct: #5d4163;
  --c-on-tertiary-ct: #f5dcff;
  --glass: rgba(18,20,26,.72);
  --glass-b: rgba(176,177,188,.08);
}

/* ============================
   RESET & BASE
   ============================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 13px; scroll-behavior: smooth; }
body {
  font-family: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--c-surface);
  color: var(--c-on-surface);
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }

/* Ambient BG */
.bg-fx {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0) 260px),
    var(--c-surface);
}
[data-theme="dark"] .bg-fx {
  background:
    linear-gradient(180deg, rgba(36,39,48,.42), rgba(15,17,22,0) 260px),
    var(--c-surface);
}

/* Material Icons */
.icon {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  line-height: 1;
  vertical-align: middle; display: inline-flex; align-items: center; justify-content: center;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-outline-v); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-outline); }

/* Selection */
::selection { background: rgba(168,199,250,.25); }

/* Focus */
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }

/* ============================
   TYPOGRAPHY
   ============================ */
.h1 { font-size: 22px; font-weight: 400; letter-spacing: -.01em; }
.h2 { font-size: 16px; font-weight: 500; }
.h3 { font-size: 14px; font-weight: 500; }
.body { font-size: 13px; }
.sm { font-size: 12px; }
.xs { font-size: 11px; }
.mono { font-family: 'Roboto Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace; }
.muted { color: var(--c-outline); }
.addr-inline, .addr-cell { overflow-wrap: anywhere; word-break: break-word; }
.addr-cell { min-width: 220px; max-width: 460px; white-space: normal; }
.fw5 { font-weight: 500; }
.primary { color: var(--c-primary); }
.ok { color: var(--c-ok); }
.err { color: var(--c-error); }
.warn { color: var(--c-warn); }
.text-center { text-align: center; }

/* ============================
   LAYOUT
   ============================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }

.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }

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

/* ============================
   GRIDS
   ============================ */
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2,1fr); }
.g3 { grid-template-columns: repeat(3,1fr); }
.g4 { grid-template-columns: repeat(4,1fr); }
.g5 { grid-template-columns: repeat(5,1fr); }
@media (max-width:1300px) { .g5 { grid-template-columns: repeat(3,1fr); } }
@media (max-width:1100px) { .g4, .g5 { grid-template-columns: repeat(2,1fr); } }
@media (max-width:700px) { .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; } }

/* ============================
   FORM FIELDS
   ============================ */
.field { position: relative; margin-bottom: 14px; }
.field.select-field::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' width='20' height='20' fill='none' stroke='%23787a84' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  pointer-events: none;
}
.field input,
.field textarea,
.field select {
  width: 100%; height: var(--h-field);
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-outline-v);
  border-radius: var(--r-xs);
  padding: 0 14px;
  color: var(--c-on-surface);
  font-size: 13px; font-family: inherit;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .15s;
  outline: none;
}
.field textarea { height: auto; min-height: 80px; padding: 12px 14px; resize: vertical; }
.field select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  line-height: 1.2;
  background-color: var(--c-surface-2);
  padding-right: 40px;
}
.field select::-ms-expand { display: none; }
.field select:-moz-focusring { color: transparent; text-shadow: 0 0 0 var(--c-on-surface); }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(168,199,250,.12);
  background: var(--c-surface-3);
}
.field input:hover:not(:focus), .field select:hover:not(:focus) { border-color: var(--c-outline); }
.field label {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--c-outline); font-size: 13px;
  pointer-events: none;
  transition: all .2s var(--ease);
  background: var(--c-surface-2);
  padding: 0 4px; border-radius: 3px;
  z-index: 1;
}
.field textarea ~ label { top: 14px; transform: none; }
.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label,
.field textarea:focus ~ label,
.field textarea:not(:placeholder-shown) ~ label,
.field select ~ label {
  top: 0; transform: translateY(-50%) scale(.78);
  color: var(--c-primary); font-weight: 500;
}
.field.err input, .field.err textarea { border-color: var(--c-error); box-shadow: 0 0 0 2px rgba(244,182,185,.1); }
.field-msg { display: none; font-size: 11px; color: var(--c-error); padding-left: 14px; margin-top: -8px; margin-bottom: 8px; }
.field.err + .field-msg { display: block; }

/* ============================
   BUTTONS
   ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h-btn); padding: 0 24px;
  border-radius: var(--r-md);
  font-family: inherit; font-size: 13px; font-weight: 500; letter-spacing: .02em;
  cursor: pointer; border: none; position: relative; overflow: hidden;
  transition: all .2s var(--ease); white-space: nowrap; user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .38; cursor: not-allowed; pointer-events: none; transform: none; }
.btn.primary { background: var(--c-primary); color: var(--c-on-primary); }
.btn.primary:hover { filter: brightness(.95); box-shadow: 0 2px 10px rgba(31,95,159,.16); }
.btn.tonal { background: var(--c-secondary-ct); color: var(--c-on-secondary-ct); }
.btn.tonal:hover { background: var(--c-surface-4); }
.btn.text { background: transparent; color: var(--c-primary); padding: 0 12px; }
.btn.text:hover { background: rgba(168,199,250,.08); box-shadow: none; }
.btn.err { background: var(--c-error-ct); color: var(--c-error); }
.btn.err:hover { filter: brightness(.96); }
.btn.warn { background: var(--c-warn-ct); color: var(--c-warn); }
.btn.warn:hover { filter: brightness(.96); }
.btn.ok { background: var(--c-ok-ct); color: var(--c-ok); }
.btn.ok:hover { filter: brightness(.96); }
.btn.full { width: 100%; }
.btn.sm { height: 34px; padding: 0 16px; font-size: 12px; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 11px; border-radius: var(--r-xs); }

/* Ripple */
.btn .ripple {
  position: absolute; border-radius: 50%;
  background: currentColor; opacity: .12;
  transform: scale(0); animation: rip .5s ease-out; pointer-events: none;
}
@keyframes rip { to { transform: scale(3); opacity: 0; } }

/* ============================
   CHIPS
   ============================ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px; border-radius: 8px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.chip.out { border: 1px solid var(--c-outline-v); color: var(--c-on-surface-v); }
.chip.pri { background: var(--c-primary-ct); color: var(--c-on-primary-ct); }
.chip.ok { background: var(--c-ok-ct); color: var(--c-ok); }
.chip.err { background: var(--c-error-ct); color: var(--c-error); }
.chip.warn { background: var(--c-warn-ct); color: var(--c-warn); }
.chip.ter { background: var(--c-tertiary-ct); color: var(--c-on-tertiary-ct); }
.chip.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================
   CARDS
   ============================ */
.card {
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--c-outline-v);
  padding: 16px; position: relative; overflow: hidden;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.card:hover { border-color: var(--c-outline); box-shadow: 0 1px 4px rgba(30,36,44,.10); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* Stat Card */
.stat {
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
  padding: 16px;
  border: 1px solid var(--c-outline-v);
  transition: all .25s var(--ease);
  position: relative; overflow: hidden;
}
.stat:hover { border-color: var(--c-outline); box-shadow: 0 2px 8px rgba(30,36,44,.10); transform: translateY(-2px); }
.stat .label { font-size: 11px; color: var(--c-outline); text-transform: uppercase; letter-spacing: .5px; font-weight: 500; }
.stat .value { font-size: 24px; font-weight: 500; margin-top: 6px; letter-spacing: -.02em; }
.stat .sub { font-size: 11px; color: var(--c-outline); margin-top: 2px; }
.stat .delta { font-size: 11px; margin-top: 4px; font-weight: 500; }

/* ============================
   TABLE
   ============================ */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead th {
  text-align: left; padding: 8px 12px;
  color: var(--c-outline); font-weight: 500; font-size: 11px;
  border-bottom: 1px solid var(--c-outline-v);
  white-space: nowrap; text-transform: uppercase; letter-spacing: .3px;
  position: sticky; top: 0; background: var(--c-surface-2);
}
tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--c-outline-v);
  color: var(--c-on-surface-v); vertical-align: middle;
  transition: background .15s;
}
tbody tr:hover td { background: rgba(176,177,188,.04); }
tbody tr:last-child td { border-bottom: none; }
.t-hint { display: none; text-align: center; padding: 4px; font-size: 11px; color: var(--c-outline); }
@media (max-width:900px) { .t-hint { display: block; } }

/* ============================
   TABS (Section)
   ============================ */
.tabs {
  display: flex; gap: 2px; margin-bottom: 16px;
  border-bottom: 1px solid var(--c-outline-v);
  overflow-x: auto;
}
.tabs::-webkit-scrollbar { height: 0; }
.tab-item {
  height: 38px; padding: 0 16px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--c-on-surface-v); font-size: 13px; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .2s var(--ease); white-space: nowrap;
  border-radius: var(--r-xs) var(--r-xs) 0 0; user-select: none;
  text-decoration: none;
}
.tab-item:hover { color: var(--c-on-surface); background: rgba(176,177,188,.06); }
.tab-item.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab-item .tb {
  background: var(--c-primary-ct); color: var(--c-on-primary-ct);
  font-size: 10px; font-weight: 600; min-width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; padding: 0 5px;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .3s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ============================
   NOTICES
   ============================ */
.notice {
  padding: 12px 14px; border-radius: var(--r-sm);
  margin-bottom: 12px; font-size: 12px; line-height: 1.5;
  display: flex; align-items: flex-start; gap: 10px;
}
.notice .ni { flex-shrink: 0; font-size: 18px; }
.notice.info { background: var(--c-primary-ct); color: var(--c-on-primary-ct); border: 1px solid var(--c-primary-ct); }
.notice.ok { background: var(--c-ok-ct); color: var(--c-ok); border: 1px solid var(--c-ok-ct); }
.notice.warn { background: var(--c-warn-ct); color: var(--c-warn); border: 1px solid var(--c-warn-ct); }
.notice.err { background: var(--c-error-ct); color: var(--c-error); border: 1px solid var(--c-error-ct); }

/* QR slot */
.qr-slot {
  background:
    linear-gradient(135deg, rgba(168,199,250,.12), transparent 60%),
    linear-gradient(315deg, rgba(224,192,232,.12), transparent 60%),
    #fff;
  box-shadow: inset 0 0 0 1px rgba(17,17,17,.06);
}

/* ============================
   CODE BLOCK
   ============================ */
.code {
  background: var(--c-surface-1); border: 1px solid var(--c-outline-v);
  border-radius: var(--r-sm); padding: 12px 14px;
  font-family: 'Roboto Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 12px;
  overflow-x: auto; position: relative; margin: 8px 0; line-height: 1.6;
}
.code code { color: var(--c-tertiary); display: block; white-space: pre-wrap; tab-size: 4; }
.copy-btn {
  position: absolute; top: 6px; right: 6px;
  background: var(--c-surface-3); border: 1px solid var(--c-outline-v);
  border-radius: var(--r-xs); padding: 4px 8px;
  color: var(--c-outline); cursor: pointer; font-size: 11px; font-family: inherit;
  transition: all .2s; z-index: 1;
}
.copy-btn:hover { color: var(--c-primary); border-color: var(--c-primary); }

/* ============================
   CHECKBOX
   ============================ */
.chk { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; cursor: pointer; user-select: none; position: relative; width: 100%; }
.chk input {
  position: absolute;
  top: 2px;
  left: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.chk > :last-child { min-width: 0; flex: 1 1 auto; }
.chk .box {
  width: 20px; height: 20px; border: 1.5px solid var(--c-outline);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  transition: all .2s var(--ease); flex-shrink: 0;
  margin-top: 2px;
  background: var(--c-surface-1);
}
.chk .box::after {
  content: ''; width: 5px; height: 10px;
  border: solid var(--c-on-primary); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s var(--ease);
}
.chk:hover .box { border-color: var(--c-primary); }
.chk input:checked ~ .box { background: var(--c-primary); border-color: var(--c-primary); }
.chk input:checked ~ .box::after { transform: rotate(45deg) scale(1); }
.check-card {
  border: 1px solid var(--c-outline-v);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  background: rgba(21,23,29,.6);
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.check-card:hover {
  border-color: var(--c-outline);
  background: rgba(28,30,38,.85);
}
.check-card input:checked ~ .box { box-shadow: 0 0 0 3px rgba(168,199,250,.12); }
.check-card-body { display: grid; gap: 4px; }
.check-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.check-card-title { font-weight: 500; color: var(--c-on-surface); }
.check-card-sub { font-size: 12px; color: var(--c-on-surface-v); line-height: 1.45; }
.check-card-note { font-size: 11px; color: var(--c-outline); line-height: 1.45; }
.method-client-note {
  display: block;
  margin-top: 6px;
  padding: 7px 9px;
  border: 1px solid rgba(251,188,4,.24);
  border-radius: var(--r-xs);
  background: rgba(251,188,4,.08);
  color: var(--c-on-surface);
  font-size: 12px;
  line-height: 1.45;
}

/* ============================
   DIVIDER
   ============================ */
.divider { height: 1px; background: var(--c-outline-v); margin: 16px 0; }

/* ============================
   TIMELINE
   ============================ */
.tl-item { display: flex; gap: 12px; padding: 8px 0; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--c-outline-v); flex-shrink: 0; }
.tl-dot.on { background: var(--c-primary); box-shadow: 0 0 6px rgba(168,199,250,.4); }
.tl-body { flex: 1; }
.tl-time { font-size: 11px; color: var(--c-outline); }

/* ============================
   PROGRESS
   ============================ */
.progress { height: 4px; background: var(--c-outline-v); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 2px; transition: width .6s var(--ease); }
.progress-bar.ok { background: var(--c-ok); }
.progress-bar.warn { background: var(--c-warn); }
.progress-bar.pri { background: var(--c-primary); }

/* ============================
   AVATAR
   ============================ */
.av {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
  color: var(--c-on-primary-ct);
}

/* ============================
   MERCHANT MINI
   ============================ */
.m-merchant {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--c-outline-v);
  transition: all .2s; cursor: pointer; margin-bottom: 6px;
  text-decoration: none; color: inherit;
}
.m-merchant:hover { background: rgba(176,177,188,.05); border-color: var(--c-outline); }
.m-merchant-ico {
  width: 36px; height: 36px; border-radius: var(--r-xs);
  background: var(--c-primary-ct); color: var(--c-on-primary-ct);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.m-merchant-info { flex: 1; min-width: 0; }
.m-merchant-name { font-size: 13px; font-weight: 500; }
.m-merchant-sub { font-size: 11px; color: var(--c-outline); }
.m-merchant-val { font-size: 13px; font-weight: 500; text-align: right; }

/* ============================
   COOLDOWN
   ============================ */
.cooldown {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--c-warn);
  padding: 6px 10px; background: rgba(105,51,0,.2);
  border-radius: var(--r-xs);
}

/* ============================
   STATUS DOT
   ============================ */
.sdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sdot.on { background: var(--c-ok); box-shadow: 0 0 4px rgba(128,215,159,.5); }
.sdot.off { background: var(--c-outline-v); }

/* ============================
   SPINNER
   ============================ */
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--c-outline-v);
  border-top-color: var(--c-primary); border-radius: 50%;
  animation: spin .6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================
   RECOVERY KEY DISPLAY
   ============================ */
.rkey {
  background: var(--c-surface-1); border: 1.5px dashed var(--c-warn);
  border-radius: var(--r-sm); padding: 16px; text-align: center; margin: 12px 0;
}
.rkey .val { font-size: 20px; font-weight: 700; letter-spacing: 4px; color: var(--c-warn); font-family: 'Roboto Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace; margin: 8px 0; }
.rkey .lbl { font-size: 11px; color: var(--c-outline); text-transform: uppercase; letter-spacing: .5px; }

/* ============================
   QR PLACEHOLDER
   ============================ */
.qr {
  width: 150px; height: 150px; background: white;
  border-radius: var(--r-sm); display: flex;
  align-items: center; justify-content: center;
  margin: 12px auto;
}
.qr img { max-width: 100%; max-height: 100%; border-radius: var(--r-sm); }

/* ============================
   BAR CHART (simple CSS)
   ============================ */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-fill { width: 100%; border-radius: 4px 4px 0 0; transition: height .6s var(--ease); }

/* ============================
   TOAST SYSTEM
   ============================ */
#toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--c-surface-4); border: 1px solid var(--c-outline-v);
  border-radius: var(--r-sm); padding: 12px 16px;
  min-width: 300px; max-width: 440px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  font-size: 13px; color: var(--c-on-surface);
  animation: toastIn .35s var(--ease);
  pointer-events: all; position: relative; overflow: hidden;
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.95); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px) scale(.95); } }
.toast .tp {
  position: absolute; bottom: 0; left: 0; height: 3px;
  background: var(--c-primary); border-radius: 0 0 var(--r-sm) var(--r-sm);
  animation: toastProg 5s linear forwards;
}
@keyframes toastProg { from { width: 100%; } to { width: 0%; } }
.toast .ti { flex-shrink: 0; font-size: 18px; }
.toast .ti.ok { color: var(--c-ok); }
.toast .ti.err { color: var(--c-error); }
.toast .ti.warn { color: var(--c-warn); }
.toast .ti.info { color: var(--c-primary); }
.toast .tc {
  margin-left: auto; background: none; border: none;
  color: var(--c-outline); cursor: pointer; padding: 4px;
  border-radius: 50%; transition: all .15s; display: flex;
  align-items: center; justify-content: center;
}
.toast .tc:hover { background: rgba(176,177,188,.1); color: var(--c-on-surface); }

/* ============================
   DIALOG
   ============================ */
.dlg-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 3000; padding: 20px;
}
.dlg-overlay.open { display: flex; }
.dlg-overlay.open .dlg { animation: dlgIn .3s var(--ease); }
@keyframes dlgIn { from { opacity: 0; transform: scale(.93) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.dlg {
  background: var(--c-surface-3);
  border: 1px solid var(--c-outline-v);
  border-radius: var(--r-xl); padding: 24px;
  max-width: 500px; width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  max-height: 90vh; overflow-y: auto;
}
.dlg.wide { max-width: 900px; }
.dlg-title { font-size: 18px; font-weight: 400; margin-bottom: 16px; }
.dlg-body { font-size: 13px; color: var(--c-on-surface-v); margin-bottom: 24px; line-height: 1.6; }
.dlg-acts { display: flex; gap: 8px; justify-content: flex-end; }

/* ============================
   FILTER BAR
   ============================ */
.fbar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.fbar .field { margin-bottom: 0; }
.fbar .field input, .fbar .field select { height: 36px; font-size: 12px; padding: 0 10px; width: 160px; }
.fbar .field.select-field select { padding-right: 30px; }
.fbar .field.select-field::after { right: 8px; width: 16px; height: 16px; background-size: 16px 16px; }

/* ============================
   PAGE SHELL (auth)
   ============================ */
.auth-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-xl); padding: 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  position: relative; overflow: hidden;
}
.auth-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.04), transparent);
}
.auth-logo { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; gap: 12px; }
.auth-logo .icon { font-size: 36px; color: var(--c-primary); filter: drop-shadow(0 0 12px rgba(168,199,250,.3)); }
.auth-logo span { font-size: 22px; font-weight: 500; }

/* ============================
   APP SHELL (sidebar + content)
   ============================ */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); background: var(--c-surface-1);
  padding: 10px 8px; display: flex; flex-direction: column;
  border-right: 1px solid var(--c-outline-v);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  z-index: 10; flex-shrink: 0;
  transition: transform .3s var(--ease);
}
.sb-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px 8px; }
.sb-head .icon { font-size: 30px; }
.sb-head span { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.sb-section { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--c-outline); padding: 14px 14px 6px; font-weight: 500; }
.sb-pill {
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px; height: 38px;
  border-radius: var(--r-sm);
  color: var(--c-on-surface-v);
  cursor: pointer; transition: all .2s var(--ease);
  font-size: 13px; font-weight: 400;
  margin-bottom: 2px; position: relative; user-select: none;
  text-decoration: none;
}
.sb-pill:hover { background: rgba(176,177,188,.08); color: var(--c-on-surface); }
.sb-pill:active { transform: scale(.98); }
.sb-pill.active { background: var(--c-secondary-ct); color: var(--c-on-secondary-ct); font-weight: 500; }
.sb-pill.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--c-primary); border-radius: 0 3px 3px 0;
}
.sb-pill .icon { font-size: 20px; flex-shrink: 0; }
.sb-logout-form { margin: 0; }
.sb-logout-form .sb-pill {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  text-align: left;
}
.theme-toggle {
  width: 100%;
  border: 1px solid var(--c-outline-v);
  background: var(--c-surface-2);
  font: inherit;
  text-align: left;
  margin-bottom: 8px;
}
.theme-toggle:hover { background: var(--c-surface-3); }
.sb-badge {
  margin-left: auto; background: var(--c-primary-ct); color: var(--c-on-primary-ct);
  font-size: 10px; font-weight: 600; min-width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center; border-radius: 10px; padding: 0 6px;
}
.sb-footer { margin-top: auto; padding: 8px; border-top: 1px solid var(--c-outline-v); }
.sb-divider { height: 1px; background: var(--c-outline-v); margin: 10px 8px; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: 12px; font-weight: 500; }
.sb-user-role { font-size: 10px; color: var(--c-outline); }

/* Main content */
.main { flex: 1; padding: 20px 24px; overflow-x: hidden; min-width: 0; }

/* Page header */
.pg-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.pg-title { font-size: 20px; font-weight: 400; letter-spacing: -.01em; }
.pg-sub { font-size: 12px; color: var(--c-outline); margin-top: 3px; }

/* ============================
   STAGGER ANIMATIONS
   ============================ */
.si { animation: slideUp .4s var(--ease) both; }
.si:nth-child(1) { animation-delay: .04s; }
.si:nth-child(2) { animation-delay: .08s; }
.si:nth-child(3) { animation-delay: .12s; }
.si:nth-child(4) { animation-delay: .16s; }
.si:nth-child(5) { animation-delay: .2s; }
.si:nth-child(6) { animation-delay: .24s; }
.si:nth-child(7) { animation-delay: .28s; }
.si:nth-child(8) { animation-delay: .32s; }
.si:nth-child(9) { animation-delay: .36s; }
.si:nth-child(10) { animation-delay: .4s; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ============================
   MOBILE NAV
   ============================ */
.burger {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 200;
  background: var(--c-surface-3); border: 1px solid var(--c-outline-v);
  border-radius: var(--r-xs); width: 40px; height: 40px;
  align-items: center; justify-content: center; cursor: pointer;
  color: var(--c-on-surface); transition: all .2s;
}
.burger:hover { background: var(--c-surface-4); }
.sb-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 15; display: none;
}
@media (max-width: 900px) {
  .burger { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%); z-index: 20;
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sb-overlay.open { display: block; }
  .main { padding: 16px; padding-top: 60px; }
}

/* ============================
   EMPTY STATE
   ============================ */
.empty { text-align: center; padding: 48px 20px; color: var(--c-outline); }
.empty .icon { font-size: 56px; margin-bottom: 12px; opacity: .4; }
.empty p { font-size: 14px; margin-bottom: 16px; color: var(--c-on-surface-v); }

/* ============================
   BADGE
   ============================ */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; border-radius: 10px;
  font-size: 10px; font-weight: 600; padding: 0 6px;
  background: var(--c-primary-ct); color: var(--c-on-primary-ct);
}

/* ============================
   LINK
   ============================ */
.link { color: var(--c-primary); text-decoration: none; cursor: pointer; transition: opacity .2s; }
.link:hover { opacity: .8; text-decoration: underline; }

/* ============================
   TOOLTIP
   ============================ */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%) scale(.9);
  background: var(--c-surface-4); color: var(--c-on-surface);
  padding: 6px 10px; border-radius: var(--r-xs);
  font-size: 11px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: all .15s var(--ease);
  border: 1px solid var(--c-outline-v);
  box-shadow: 0 2px 8px rgba(0,0,0,.2); z-index: 50;
}
[data-tip]:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }

/* Print */
@media print {
  .sidebar, .burger, #toasts, .dlg-overlay, .sb-overlay { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; color: #000; }
}

/* ============================
   RESPONSIVE TWEAKS
   ============================ */
@media (max-width: 600px) {
  .auth-card { padding: 24px 20px; }
  .dlg { padding: 20px 16px; }
  .toast { min-width: auto; max-width: calc(100vw - 40px); }
  .pg-head { flex-direction: column; }
  .fbar .field input, .fbar .field select { width: 100%; }
}
