/* ==========================================================================
   NO9 STUDIO Admin — design system
   Dark, technical, editorial. IBM Plex Sans (UI) + IBM Plex Mono (data).
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --bg-1: #111111;
  --bg-2: #161616;
  --surface: #1a1a1a;
  --surface-2: #1f1f1f;
  --surface-3: #262626;
  --line: #262626;
  --line-2: #303030;
  --text: #f3f3f1;
  --text-2: #a3a3a0;
  --text-3: #6f6f6c;
  --white: #ffffff;
  --black: #000000;

  --ok: #6fcf97;
  --ok-bg: rgba(111, 207, 151, .10);
  --warn: #f2c66d;
  --warn-bg: rgba(242, 198, 109, .10);
  --danger: #ff5c5c;
  --danger-bg: rgba(255, 92, 92, .12);
  --danger-glow: 0 0 0 1px rgba(255, 92, 92, .35), 0 0 24px rgba(255, 92, 92, .18);
  --info: #8ab4f8;
  --info-bg: rgba(138, 180, 248, .10);

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 40px rgba(0,0,0,.45);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--white); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, .mono { font-family: var(--mono); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.upper { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.gap-2 { gap: 16px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 28px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .danger { color: var(--danger); } .info { color: var(--info); }

::selection { background: #fff; color: #000; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

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

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--white); color: var(--black);
  display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 12px; letter-spacing: -.02em;
}
.brand-name { font-family: var(--mono); font-size: 13px; letter-spacing: .06em; }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: .1em; text-transform: uppercase; }

.nav-group { margin-top: 14px; }
.nav-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-3); padding: 0 10px 8px;
}
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--text-2); font-size: 13.5px;
  transition: background .12s ease, color .12s ease;
}
.nav a i { font-size: 18px; width: 20px; text-align: center; color: var(--text-3); }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); }
.nav a.active i { color: var(--text); }
.nav a .pill { margin-left: auto; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.user-chip:hover { background: var(--surface); }
.avatar {
  width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); color: var(--text);
  display: grid; place-items: center; font-family: var(--mono); font-size: 11px; flex-shrink: 0;
}
.avatar.lg { width: 44px; height: 44px; font-size: 14px; border-radius: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 16px;
  padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.crumbs i { font-size: 14px; color: var(--text-3); }
.crumbs .current { color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.content { padding: 26px 28px 60px; max-width: 1400px; width: 100%; }
.content.wide { max-width: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; line-height: 1.2;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn i { font-size: 16px; }
.btn:hover { background: var(--surface-2); border-color: #3a3a3a; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--white); color: var(--black); border-color: var(--white); }
.btn-primary:hover { background: #e9e9e6; border-color: #e9e9e6; color: var(--black); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger { color: var(--danger); border-color: rgba(255,92,92,.3); background: rgba(255,92,92,.06); }
.btn-danger:hover { background: rgba(255,92,92,.12); border-color: rgba(255,92,92,.5); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-sm i { font-size: 14px; }
.btn-icon { padding: 7px; }
.btn-icon.btn-sm { padding: 5px; }
.btn-pill { border-radius: 999px; padding-left: 18px; padding-right: 18px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }

/* --------------------------------------------------------------------------
   Cards / panels
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 14px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }

.stat { padding: 18px 20px; }
.stat .label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.stat .value { font-family: var(--mono); font-size: 26px; margin-top: 8px; letter-spacing: -.02em; }
.stat .sub { color: var(--text-2); font-size: 12px; margin-top: 4px; }
.stat.stat-alert { box-shadow: var(--danger-glow); border-color: rgba(255,92,92,.4); }
.stat.stat-alert .value { color: var(--danger); }

/* Settings-style rows (icon tile + title + description) */
.rows { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line);
  transition: background .12s ease;
}
.row-item:last-child { border-bottom: 0; }
a.row-item:hover, .row-item.hoverable:hover { background: var(--surface-2); }
.tile {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: var(--surface-3); border: 1px solid var(--line-2);
  display: grid; place-items: center; color: var(--text-2); font-size: 20px;
}
.tile.danger { color: var(--danger); background: var(--danger-bg); border-color: rgba(255,92,92,.35); box-shadow: 0 0 18px rgba(255,92,92,.15); }
.tile.ok { color: var(--ok); background: var(--ok-bg); border-color: rgba(111,207,151,.3); }
.tile.warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(242,198,109,.3); }
.tile.info { color: var(--info); background: var(--info-bg); border-color: rgba(138,180,248,.3); }
.tile.sm { width: 34px; height: 34px; border-radius: 9px; font-size: 16px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; color: var(--text); }
.row-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.row-end { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* --------------------------------------------------------------------------
   Badges & pills
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-ok { color: var(--ok); background: var(--ok-bg); border-color: rgba(111,207,151,.3); }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(242,198,109,.3); }
.badge-danger { color: var(--danger); background: var(--danger-bg); border-color: rgba(255,92,92,.35); }
.badge-info { color: var(--info); background: var(--info-bg); border-color: rgba(138,180,248,.3); }
.badge-muted { color: var(--text-2); }
.pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 7px;
  border-radius: 999px; background: var(--surface-3); font-family: var(--mono); font-size: 11px; color: var(--text-2);
}
.pill.danger { background: var(--danger); color: #fff; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-size: 12.5px; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: #3a3a3a; }
.chip.active { background: var(--white); color: var(--black); border-color: var(--white); }
.chip .pill { background: rgba(0,0,0,.1); }
.chip.active .pill { background: rgba(0,0,0,.12); color: var(--black); }
.chip:not(.active) .pill { background: var(--surface-3); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3); font-weight: 500; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s ease; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .num { font-family: var(--mono); text-align: right; white-space: nowrap; }
.table .mono { font-family: var(--mono); }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn { opacity: .55; }
.table tr:hover td.actions .btn { opacity: 1; }
.cell-title { color: var(--text); }
.cell-sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }

.empty {
  padding: 48px 20px; text-align: center; color: var(--text-3);
}
.empty i { font-size: 34px; display: block; margin-bottom: 10px; color: var(--text-3); }
.empty strong { display: block; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label {
  display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px;
}
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.field .error { font-size: 12px; color: var(--danger); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text);
  outline: none; transition: border-color .12s ease, box-shadow .12s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: #4a4a4a; box-shadow: 0 0 0 3px rgba(255,255,255,.05); }
.input.mono { font-family: var(--mono); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: rgba(255,92,92,.6); }
.textarea { min-height: 96px; resize: vertical; }
.select {
  appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a0' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
.select option { background: var(--surface); }
.input-group { display: flex; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .addon {
  display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-left: 0;
  border-radius: 0 10px 10px 0; background: var(--surface-2); color: var(--text-2); font-family: var(--mono); font-size: 12px;
}
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: #fff; }
input[type="date"] { color-scheme: dark; }
input[type="file"] { color: var(--text-2); font-size: 12.5px; }
input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }

/* Search */
.search { position: relative; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 16px; }
.search .input { padding-left: 36px; }
.search.compact .input { padding-top: 8px; padding-bottom: 8px; width: 260px; }

/* Type-select cards (modal / forms) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.choice label {
  display: block; padding: 14px 14px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2);
  cursor: pointer; transition: border-color .12s ease, background .12s ease; margin: 0;
}
.choice label i.bx-check-circle { position: absolute; top: 12px; right: 12px; font-size: 18px; color: var(--text-3); }
.choice label .t { color: var(--text); font-size: 13.5px; }
.choice label .d { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.choice label:hover { border-color: #3a3a3a; }
.choice input:checked + label { border-color: var(--white); background: var(--surface-2); }
.choice input:checked + label i.bx-check-circle { color: var(--white); }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; width: min(560px, calc(100% - 32px)); margin: 8vh auto 0;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow);
  overflow: hidden; animation: pop .16s ease-out;
}
.modal-panel.lg { width: min(760px, calc(100% - 32px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 0 22px 22px; }
.modal-foot { display: flex; justify-content: space-between; gap: 8px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--bg-2); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985);} to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Flash / alerts
   -------------------------------------------------------------------------- */
.flashes { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-width: 260px; max-width: 420px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); font-size: 13px;
  animation: pop .18s ease-out;
}
.flash i { font-size: 18px; }
.flash-success i { color: var(--ok); }
.flash-error { border-color: rgba(255,92,92,.45); }
.flash-error i { color: var(--danger); }
.flash-info i { color: var(--info); }
.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); font-size: 13px;
}
.alert i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-danger { border-color: rgba(255,92,92,.4); background: var(--danger-bg); color: var(--text); }
.alert-danger i { color: var(--danger); }
.alert-warn { border-color: rgba(242,198,109,.35); background: var(--warn-bg); color: var(--text); }
.alert-warn i { color: var(--warn); }

/* --------------------------------------------------------------------------
   Tabs / key-value / timeline
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13.5px; }
.tabs a.active { color: var(--text); border-color: var(--white); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); }
.kv dd.mono { font-family: var(--mono); }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); margin-top: 7px; flex-shrink: 0; }
.tl-item .dot.ok { background: var(--ok); }
.tl-item .dot.danger { background: var(--danger); }

/* Status stepper */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; }
.step {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); font-family: var(--mono); font-size: 11px;
  color: var(--text-3); background: var(--bg-2);
}
.step.done { color: var(--text-2); border-color: var(--line-2); }
.step.current { color: var(--black); background: var(--white); border-color: var(--white); }

/* Amount display */
.amount { font-family: var(--mono); letter-spacing: -.01em; }
.amount.lg { font-size: 22px; }
.amount.xl { font-size: 30px; }
.total-block { background: var(--white); color: var(--black); border-radius: 12px; padding: 14px 18px; }
.total-block .label { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; opacity: .6; }
.total-block .value { font-family: var(--mono); font-size: 24px; margin-top: 4px; }

/* --------------------------------------------------------------------------
   Auth (split screen)
   -------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--black); }
.auth-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px;
  border-right: 1px solid #1c1c1c;
}
.auth-brand .grid-lines { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(#141414 1px, transparent 1px), linear-gradient(90deg, #141414 1px, transparent 1px);
  background-size: 50% 100%, 100% 50%; background-position: center; }
.auth-brand .glyph { position: absolute; left: 50%; top: 50%; width: 140px; height: 140px; transform: translate(-50%, -50%); }
.auth-brand .glyph span { position: absolute; left: 50%; top: 50%; width: 3px; height: 140px; background: var(--white); transform-origin: center; }
.auth-brand .glyph span:nth-child(1) { transform: translate(-50%,-50%) rotate(0deg); }
.auth-brand .glyph span:nth-child(2) { transform: translate(-50%,-50%) rotate(45deg); }
.auth-brand .glyph span:nth-child(3) { transform: translate(-50%,-50%) rotate(90deg); }
.auth-brand .glyph span:nth-child(4) { transform: translate(-50%,-50%) rotate(135deg); }
.auth-brand .glyph::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--black); border: 3px solid var(--white); transform: translate(-50%,-50%); }
.auth-brand .top { position: relative; font-family: var(--mono); letter-spacing: .08em; font-size: 14px; }
.auth-brand .top sup { font-size: 9px; margin-left: 2px; }
.auth-brand .bottom { position: relative; color: var(--text-3); font-size: 11.5px; }
.auth-panel {
  margin: 20px; border-radius: 26px; background: var(--bg-1); border: 1px solid #1c1c1c;
  display: flex; flex-direction: column; padding: 32px 56px; position: relative;
}
.auth-panel .corner { align-self: flex-end; font-size: 12px; color: var(--text-3); }
.auth-form { margin: auto 0; max-width: 460px; }
.auth-form h1 { font-size: 40px; font-weight: 400; letter-spacing: -.02em; margin-bottom: 44px; }
.ul-field label { display: block; font-size: 11px; letter-spacing: .06em; color: var(--text-3); margin-bottom: 6px; }
.ul-field input {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid #333; padding: 8px 0; color: var(--text); outline: none; font-size: 14px;
}
.ul-field input:focus { border-color: var(--white); }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.auth-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; font-size: 12px; color: var(--text-3); }
.auth-submit { display: flex; justify-content: flex-end; margin-top: 70px; }
.btn-circle {
  width: 84px; height: 84px; border-radius: 50%; background: var(--white); color: var(--black); border: 0; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; display: grid; place-items: center;
  transition: transform .12s ease, background .12s ease;
}
.btn-circle:hover { transform: scale(1.04); background: #e9e9e6; }
.auth-error { margin-bottom: 24px; }

/* --------------------------------------------------------------------------
   Invoice editor + preview
   -------------------------------------------------------------------------- */
.inv-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 46%); gap: 20px; align-items: start; }
.inv-layout.preview-hidden { grid-template-columns: 1fr; }
.inv-layout.preview-hidden .inv-preview-col { display: none; }
.items-table { width: 100%; border-collapse: collapse; }
.items-table th { text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding: 0 6px 8px; font-weight: 500; }
.items-table td { padding: 4px 6px; vertical-align: top; }
.items-table .input { padding: 8px 10px; }
.items-table .drag { color: var(--text-3); cursor: grab; padding-top: 12px; }
.items-table .line-total { font-family: var(--mono); padding-top: 12px; text-align: right; white-space: nowrap; color: var(--text-2); }
.inv-totals { margin-top: 12px; display: grid; grid-template-columns: 1fr 200px; gap: 8px 16px; align-items: center; }
.inv-totals .label { text-align: right; color: var(--text-2); font-size: 13px; margin: 0; }
.inv-totals .val { font-family: var(--mono); text-align: right; }
.inv-totals .grand { font-size: 18px; color: var(--text); }

.inv-preview {
  position: sticky; top: calc(var(--topbar-h) + 20px);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xl); padding: 28px; box-shadow: var(--shadow);
}
.inv-preview::after { content: ""; position: absolute; right: 0; top: 0; width: 26px; height: 26px; background: linear-gradient(225deg, var(--bg) 50%, var(--surface-3) 50%); border-radius: 0 var(--r-xl) 0 0; }
.inv-preview .pv-head { display: flex; justify-content: space-between; align-items: flex-start; }
.inv-preview .pv-title { font-size: 26px; font-weight: 500; letter-spacing: -.02em; }
.inv-preview .pv-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--white); color: var(--black); display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 13px; }
.inv-preview .pv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; margin-top: 22px; font-size: 12.5px; }
.inv-preview .pv-meta .k { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.inv-preview .pv-meta .v { color: var(--text); white-space: pre-line; }
.inv-preview .pv-meta .v.dim { color: var(--text-2); }
.inv-preview table { width: 100%; border-collapse: collapse; margin-top: 22px; font-size: 12.5px; }
.inv-preview th { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-weight: 500; }
.inv-preview td { padding: 10px 0; border-bottom: 1px solid var(--line); }
.inv-preview .r { text-align: right; font-family: var(--mono); }
.inv-preview .pv-sum { margin-top: 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; font-size: 12.5px; justify-content: end; }
.inv-preview .pv-sum .k { color: var(--text-2); text-align: right; }
.inv-preview .pv-sum .v { font-family: var(--mono); text-align: right; min-width: 120px; }
.inv-preview .pv-total { margin-top: 12px; display: flex; justify-content: flex-end; }
.inv-preview .pv-total .total-block { min-width: 220px; }
.inv-preview .pv-note { margin-top: 22px; color: var(--text-3); font-size: 12px; white-space: pre-line; }
.inv-preview .pv-bank { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); font-family: var(--mono); white-space: pre-line; }

/* --------------------------------------------------------------------------
   Email
   -------------------------------------------------------------------------- */
.mail-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); min-height: 60vh; }
.mail-list { border-right: 1px solid var(--line); max-height: 75vh; overflow: auto; }
.mail-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mail-item:hover { background: var(--surface-2); }
.mail-item.active { background: var(--surface-2); }
.mail-item.unread .m-subject { color: var(--text); font-weight: 500; }
.mail-item.unread .avatar { background: var(--white); color: var(--black); }
.m-from { font-size: 13px; color: var(--text); display: flex; justify-content: space-between; gap: 8px; }
.m-from time { font-family: var(--mono); font-size: 11px; color: var(--text-3); white-space: nowrap; }
.m-subject { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.m-preview { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.mail-read { padding: 24px 28px; }
.mail-body { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); line-height: 1.65; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.mail-body-html { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 20px; }
.mail-body-html iframe { width: 100%; min-height: 480px; border: 0; background: #fff; border-radius: 10px; }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--white); border-radius: 999px; }
.progress.ok > span { background: var(--ok); }
.progress.warn > span { background: var(--warn); }
.divider-v { width: 1px; height: 22px; background: var(--line-2); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.list-links a { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text-2); }
.list-links a:last-child { border-bottom: 0; }
.list-links a:hover { color: var(--text); }
.file-tile { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-2); }
.file-tile .tile { font-size: 22px; }
.mobile-toggle { display: none; }

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .inv-layout { grid-template-columns: 1fr; }
  .inv-preview { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mail-layout { grid-template-columns: 1fr; }
  .mail-list { border-right: 0; max-height: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar.open { transform: none; }
  .mobile-toggle { display: inline-flex; }
  .content { padding: 20px 16px 60px; }
  .topbar { padding: 0 16px; }
  .form-grid, .grid-3, .grid-2, .split-even { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { margin: 12px; padding: 28px 24px; }
  .auth-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
}
