/* ===========================================================
   Roserin ERP — design tokens & base styles
   Dense, utilitarian, accountant-friendly. Teal accent.
   IBM Plex Sans (+Thai) for UI, IBM Plex Mono for figures.
   (Ported verbatim from the Claude Design prototype styles.css)
   =========================================================== */

:root {
  /* Accent */
  --accent:        #2f7d6b;
  --accent-700:    #266658;
  --accent-800:    #1e5246;
  --accent-soft:   #e7f1ee;
  --accent-soft-2: #d3e6e1;

  /* Neutrals (cool) */
  --bg:        #f4f6f6;
  --surface:   #ffffff;
  --surface-2: #fafbfb;
  --line:      #e3e7e8;
  --line-2:    #eef1f1;
  --line-strong: #d3d9da;

  /* Text */
  --ink:       #1d2a28;
  --ink-2:     #46514f;
  --muted:     #6b7674;
  --faint:     #9aa3a1;

  /* Status */
  --green:     #2f7d6b;
  --green-bg:  #e4f1ec;
  --amber:     #9a6b16;
  --amber-bg:  #f7eed8;
  --red:       #b23a36;
  --red-bg:    #f7e3e2;
  --blue:      #3b6fb0;
  --blue-bg:   #e6eef7;
  --slate:     #5b6664;
  --slate-bg:  #eceeee;
  --violet:    #6b5bb0;
  --violet-bg: #ece8f7;

  /* Sidebar (dark) */
  --side-bg:   #15211f;
  --side-bg-2: #1d2d2a;
  --side-ink:  #cdd6d4;
  --side-muted:#7f908c;
  --side-line: #2a3a37;
  --side-active: #2f7d6b;

  --radius: 7px;
  --radius-sm: 5px;
  --shadow-1: 0 1px 2px rgba(20,33,31,.06), 0 1px 1px rgba(20,33,31,.04);
  --shadow-2: 0 4px 16px rgba(20,33,31,.10), 0 1px 3px rgba(20,33,31,.07);
  --shadow-pop: 0 12px 38px rgba(20,33,31,.18);

  --ui: "IBM Plex Sans", "IBM Plex Sans Thai", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  /* density */
  --row-h: 34px;
  --row-pad-y: 7px;
  --cell-pad-x: 12px;
  --font-base: 13.5px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ui);
  font-size: var(--font-base);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
}

.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.num { font-variant-numeric: tabular-nums; }

h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
button { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #c7cfce; border-radius: 6px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b1bbb9; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ LAYOUT ============================ */
.app { display: grid; grid-template-columns: var(--side-w, 232px) 1fr; height: 100%; }
.app.side-collapsed { --side-w: 60px; }

/* Sidebar */
.side {
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex; flex-direction: column;
  border-right: 1px solid #0d1716;
  overflow: hidden;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 16px 14px;
  border-bottom: 1px solid var(--side-line);
  min-height: 56px;
}
.side-logo {
  width: 28px; height: 28px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(150deg, #3f9582, #2f7d6b 60%, #245f53);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.side-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.side-brand-text b { font-size: 14.5px; color: #f1f5f4; letter-spacing: -0.01em; }
.side-brand-text span { font-size: 10.5px; color: var(--side-muted); letter-spacing: .04em; text-transform: uppercase; }

.side-nav { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.side-nav::-webkit-scrollbar-thumb { background: #2e3f3c; border-color: var(--side-bg); }
.nav-group-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--side-muted); padding: 14px 10px 5px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  color: var(--side-ink); font-size: 13px; font-weight: 450;
  position: relative; user-select: none; margin-bottom: 1px;
  text-decoration: none;
}
.nav-item:hover { background: var(--side-bg-2); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--side-active); color: #fff; font-weight: 500; }
.nav-item.active .nav-ico { opacity: 1; }
.nav-ico { width: 17px; height: 17px; flex: 0 0 auto; opacity: .8; }
.nav-item.active .nav-badge, .nav-item .nav-badge {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px;
  background: rgba(255,255,255,.13); color: #e7efed; padding: 1px 6px; border-radius: 20px; min-width: 18px; text-align: center;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.22); }
.side-foot { padding: 10px; border-top: 1px solid var(--side-line); }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }
.topbar {
  height: 56px; flex: 0 0 auto; background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.topbar .crumb { font-size: 13px; color: var(--muted); }
.topbar .crumb b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar-search {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; width: 280px;
  color: var(--muted);
}
.topbar-search input { border: none; background: none; outline: none; font-family: var(--ui); font-size: 13px; width: 100%; color: var(--ink); }
.topbar-user { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 6px; border-radius: 8px; position: relative; }
.topbar-user:hover { background: var(--surface-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent-soft); color: var(--accent-800);
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }

.content { flex: 1; overflow-y: auto; }
.page { padding: 22px 26px 60px; max-width: 1320px; margin: 0 auto; }
.page-wide { max-width: 1480px; }

/* Page header */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.page-head .ph-titles { flex: 1; min-width: 0; }
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.page-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.page-th { font-size: 12px; color: var(--faint); font-weight: 500; }

/* ============================ BUTTONS ============================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font-family: var(--ui); font-size: 13px; font-weight: 500; line-height: 1;
  padding: 8px 13px; border-radius: 7px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: background .12s, border-color .12s, box-shadow .12s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: #c2cac9; text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-700); border-color: var(--accent-700); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--red); border-color: #e6c9c8; background: #fff; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: 5px 9px; font-size: 12px; border-radius: 6px; }
.btn.sm svg { width: 13px; height: 13px; }
.btn.lg { padding: 11px 18px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================ CARDS ============================ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 13.5px; font-weight: 600; }
.card-head .spacer { flex: 1; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow-1); position: relative; overflow: hidden; }
.stat .stat-label { font-size: 11.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .stat-val { font-family: var(--mono); font-size: 25px; font-weight: 600; letter-spacing: -0.02em; margin-top: 7px; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .stat-val .cur { font-size: 15px; color: var(--muted); font-weight: 500; margin-right: 2px; }
.stat .stat-foot { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.stat .stat-foot.up { color: var(--green); }
.stat .stat-foot.down { color: var(--red); }
.stat-accent { width: 3px; position: absolute; left: 0; top: 0; bottom: 0; }

/* ============================ TABLES ============================ */
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.tbl-toolbar { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.tbl-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--font-base); }
table.tbl thead th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding: 9px var(--cell-pad-x); border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.tbl tbody td { padding: var(--row-pad-y) var(--cell-pad-x); border-bottom: 1px solid var(--line-2); color: var(--ink-2); height: var(--row-h); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .08s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr.clickable { cursor: pointer; }
.td-num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-code { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.td-strong { color: var(--ink); font-weight: 500; }
.td-actions { text-align: right; white-space: nowrap; }
.row-act {
  display: inline-flex; width: 27px; height: 27px; border-radius: 6px; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; border: 1px solid transparent; background: none;
}
.row-act:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.row-act.danger:hover { color: var(--red); background: var(--red-bg); border-color: #eccfce; }
.row-act svg { width: 15px; height: 15px; }
.tbl-foot { padding: 9px 14px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }

.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state svg { width: 34px; height: 34px; color: var(--faint); margin-bottom: 10px; }
.empty-state h4 { font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }

/* ============================ BADGES ============================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500;
  padding: 2px 9px; border-radius: 20px; white-space: nowrap; line-height: 1.5;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green  { color: var(--green);  background: var(--green-bg); }
.badge.amber  { color: var(--amber);  background: var(--amber-bg); }
.badge.red    { color: var(--red);    background: var(--red-bg); }
.badge.blue   { color: var(--blue);   background: var(--blue-bg); }
.badge.slate  { color: var(--slate);  background: var(--slate-bg); }
.badge.violet { color: var(--violet); background: var(--violet-bg); }

/* chips / filters */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12px; padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
  text-decoration: none;
}
.chip:hover { background: var(--surface-2); text-decoration: none; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .chip-n { font-family: var(--mono); opacity: .7; font-size: 11px; }
.chip.active .chip-n { opacity: .85; }

/* ============================ FORMS ============================ */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.field label .th { color: var(--faint); font-weight: 400; }
.field .req { color: var(--red); }
.field .hint { font-size: 11px; color: var(--faint); }
.input, .select, textarea.input, select.input {
  font-family: var(--ui); font-size: 13px; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 7px; padding: 8px 11px; background: var(--surface);
  outline: none; width: 100%; transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, textarea.input:focus, select.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.num { font-family: var(--mono); text-align: right; }
.input::placeholder { color: var(--faint); }
textarea.input { resize: vertical; min-height: 64px; line-height: 1.5; }
.select, select.input { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7674' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .col-span-2 { grid-column: 1 / -1; }
.field-row { display: flex; gap: 8px; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.toggle .track { width: 38px; height: 22px; border-radius: 20px; background: #cfd6d5; position: relative; transition: background .15s; flex: 0 0 auto; }
.toggle .track::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle.on .track { background: var(--accent); }
.toggle.on .track::after { left: 18px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; background: var(--surface); }
.seg button, .seg label { border: none; background: none; padding: 7px 13px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child, .seg label:last-child { border-right: none; }
.seg button.active, .seg label.active { background: var(--accent); color: #fff; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

/* ============================ MODAL / DRAWER ============================ */
.overlay { position: fixed; inset: 0; background: rgba(18,28,26,.42); z-index: 60; display: flex; backdrop-filter: blur(1px); }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-pop); margin: auto; width: 480px; max-width: calc(100vw - 40px); max-height: calc(100vh - 60px); display: flex; flex-direction: column; overflow: hidden; }
.drawer { background: var(--surface); box-shadow: var(--shadow-pop); margin-left: auto; height: 100%; width: 860px; max-width: 96vw; display: flex; flex-direction: column; }
.drawer.narrow { width: 560px; }
.modal-head, .drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.modal-head h3, .drawer-head h3 { font-size: 16px; font-weight: 600; }
.drawer-head .doc-no { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-body, .drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot, .drawer-foot { display: flex; align-items: center; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); flex: 0 0 auto; }
.modal-foot .spacer, .drawer-foot .spacer { flex: 1; }
.x-close { margin-left: auto; }

/* line item editor */
table.lines { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lines th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.lines td { padding: 5px 6px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.lines .input { padding: 6px 8px; font-size: 12.5px; }
table.lines td.l-total { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.line-del { color: var(--faint); cursor: pointer; width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; background: none; border: none; }
.line-del:hover { color: var(--red); background: var(--red-bg); }

.totals { margin-left: auto; width: 300px; }
.totals-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; color: var(--ink-2); }
.totals-row .v { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.totals-row.grand { border-top: 1.5px solid var(--line-strong); margin-top: 4px; padding-top: 10px; font-size: 16px; font-weight: 600; color: var(--ink); }
.totals-row.grand .v { font-size: 18px; }

/* doc meta header inside drawer */
.doc-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 14px 16px; margin-bottom: 18px; }
.doc-meta .dm { display: flex; flex-direction: column; gap: 2px; }
.doc-meta .dm-l { font-size: 11px; color: var(--muted); }
.doc-meta .dm-v { font-size: 13.5px; color: var(--ink); font-weight: 500; }
.doc-meta .dm-v.mono { font-family: var(--mono); }

.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin: 18px 0 9px; }

/* toast / messages */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13px;
  box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: 10px; min-width: 240px;
  animation: toastIn .2s ease; max-width: 460px;
}
.toast .t-ico { width: 18px; height: 18px; color: #6fd6bf; flex: 0 0 auto; }
.toast b { font-weight: 600; }
.toast.error .t-ico { color: #ff9b95; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* misc */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pill-link { color: var(--accent); cursor: pointer; font-weight: 500; }
.pill-link:hover { text-decoration: underline; }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }
.kbd { font-family: var(--mono); font-size: 11px; background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--muted); }
.dim-when-void { opacity: .55; }

/* bar chart */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding: 0 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-pair { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bar { width: 18px; border-radius: 4px 4px 0 0; transition: height .4s cubic-bezier(.2,.7,.3,1); position: relative; }
.bar.rev { background: var(--accent); }
.bar.exp { background: #d8a657; }
.bar-col .bx { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.legend .lg { display: flex; align-items: center; gap: 6px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; }

/* login */
.login-wrap { height: 100%; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-art { background: linear-gradient(155deg, #1d2d2a, #15211f 60%, #0f1817); color: #fff; padding: 54px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.login-art .la-logo { display: flex; align-items: center; gap: 11px; }
.login-art .la-logo b { font-size: 18px; }
.login-art .la-mid { margin-top: auto; }
.login-art h2 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; max-width: 440px; }
.login-art p { color: #9fb3ae; margin-top: 14px; font-size: 14px; max-width: 400px; line-height: 1.6; }
.login-art .la-foot { margin-top: 28px; display: flex; gap: 22px; }
.login-art .la-stat .v { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.login-art .la-stat .l { font-size: 11.5px; color: #8aa39e; }
.login-art .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35; }
.login-form-side { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.login-card { width: 340px; max-width: 100%; }
.login-card h1 { font-size: 23px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }
.login-hint { font-size: 11.5px; color: var(--faint); margin-top: 18px; text-align: center; }
.form-error { color: var(--red); background: var(--red-bg); border: 1px solid #eccfce; border-radius: 7px; padding: 8px 11px; font-size: 12.5px; margin-bottom: 14px; }

@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ============================ helpers added for the Django port ============= */
#root { height: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 360px; gap: 14px; align-items: start; }
.grid-acc { display: grid; grid-template-columns: 1fr 340px; gap: 14px; align-items: start; }
.flex-col-gap { display: flex; flex-direction: column; gap: 14px; }
.stack-card { padding: 10px 0; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; cursor: pointer; text-decoration: none; color: inherit; }
.stack-card:last-child { border-bottom: none; }
.glance-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); }
.feed-ico { width: 28px; height: 28px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-800); display: grid; place-items: center; }
.amt-block { text-align: center; padding: 30px 0; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--line-2); }
.amt-block .v { font-family: var(--mono); font-size: 34px; font-weight: 600; color: var(--accent-800); margin-top: 4px; }
.callout { padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 9px; display: flex; align-items: center; gap: 12px; }
.menu { position: absolute; right: 0; top: 36px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-pop); padding: 5px; min-width: 200px; z-index: 50; }
.menu a, .menu button { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 6px; font-size: 13px; color: var(--ink-2); width: 100%; text-align: left; background: none; border: none; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu .danger { color: var(--red); }
.menu .danger:hover { background: var(--red-bg); }
[hidden] { display: none !important; }
.lang-seg { height: 34px; }
.lang-seg button { background: none; padding: 0 11px; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--ink-2); }
.lang-seg button.active { background: var(--accent); color: #fff; }
details.rowmenu { position: relative; display: inline-block; }
details.rowmenu > summary { list-style: none; }
details.rowmenu > summary::-webkit-details-marker { display: none; }
details.rowmenu[open] > .menu { display: block; }
