:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --soft: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --surface-2: #f1f5f9;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: #dbeafe;
  --accent-50: #eff6ff;
  --ok: #059669;
  --danger: #dc2626;
  --sidebar: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 18px 44px -24px rgba(15, 23, 42, .18);
  --font: "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --sidebar-w: 264px;
  --rail-w: clamp(360px, 34vw, 560px);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --panel: #111827;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --soft: #64748b;
  --line: #1e293b;
  --line-strong: #334155;
  --surface-2: #1e293b;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-soft: #1e3a8a;
  --accent-50: #0f172a;
  --ok: #34d399;
  --danger: #f87171;
  --sidebar: #0f172a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 44px -24px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: .92em; background: #f1f5f9; padding: .1em .38em; border-radius: .35em; }
html[data-theme="dark"] code { background: #1e293b; }

/* ---------- theme toggle ---------- */
.theme-toggle { color: var(--muted); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-ico-sun { display: none; }
html[data-theme="dark"] .theme-ico-sun { display: block; }
html[data-theme="dark"] .theme-ico-moon { display: none; }


/* ---------- brand ---------- */
.brand-row { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(140deg, #3b82f6, #2563eb 55%, #1d4ed8);
  color: #fff; box-shadow: 0 8px 22px -8px rgba(37, 99, 235, .65);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-mark img { width: 100%; height: 100%; display: block; border-radius: inherit; }
.brand-name { font-weight: 700; font-size: 16.5px; letter-spacing: -.02em; }
.brand-row.small .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.brand-row.small .brand-mark svg { width: 18px; height: 18px; }
.brand-row.small .brand-name { font-size: 15px; }
.pill {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  padding: 3px 8px; border-radius: 999px; color: var(--accent-2);
  background: var(--accent-soft); border: 1px solid #bfdbfe;
}

/* ---------- auth ---------- */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  background: var(--bg);
}
.auth-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column;
  padding: clamp(26px, 4vw, 52px) clamp(26px, 5.2vw, 84px) 30px;
  background: #0f172a; color: #f1f5f9;
}
.auth-hero::before {
  content: ""; position: absolute; inset: -30% -20% auto auto; width: 760px; height: 760px; z-index: -1;
  background: radial-gradient(circle at center, rgba(37, 99, 235, .42), transparent 62%);
}
.auth-hero::after {
  content: ""; position: absolute; left: -22%; bottom: -46%; width: 720px; height: 720px; z-index: -1;
  background: radial-gradient(circle at center, rgba(13, 148, 136, .28), transparent 60%);
}
.hero-copy { margin-top: clamp(34px, 8vh, 92px); max-width: 560px; }
.eyebrow {
  margin: 0 0 14px; color: var(--accent); font-size: 11.5px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
}
.hero-copy h1 {
  margin: 0; font-size: clamp(44px, 5.6vw, 76px); line-height: .98;
  letter-spacing: -.045em; font-weight: 800;
}
.hero-sub { margin: 22px 0 0; max-width: 470px; color: #94a3b8; font-size: clamp(14.5px, 1.2vw, 17px); line-height: 1.65; }
.hero-points { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 11px; color: #cbd5e1; font-size: 14px; }
.hero-points li { display: flex; align-items: center; gap: 10px; }
.tick {
  width: 19px; height: 19px; border-radius: 999px; flex: 0 0 auto; position: relative;
  background: rgba(20, 184, 166, .16); border: 1px solid rgba(20, 184, 166, .4);
}
.tick::after {
  content: ""; position: absolute; left: 6px; top: 4px; width: 5px; height: 8px;
  border: solid #2dd4bf; border-width: 0 1.6px 1.6px 0; transform: rotate(42deg);
}
.hero-window {
  margin-top: auto; width: min(470px, 100%); padding: 16px;
  border-radius: 16px; background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8); transform: rotate(-1deg);
}
.window-dots { display: flex; gap: 5px; margin-bottom: 13px; }
.window-dots i { width: 7px; height: 7px; border-radius: 999px; background: rgba(255, 255, 255, .22); }
.mini-bubble {
  margin-left: auto; width: fit-content; max-width: 86%;
  background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff;
  padding: 10px 13px; border-radius: 13px 13px 4px 13px; font-size: 12.5px; line-height: 1.5;
}
.mini-steps { margin: 13px 0; display: grid; gap: 7px; }
.mini-step { display: flex; align-items: center; gap: 8px; color: #94a3b8; font-size: 12px; }
.mini-ok {
  width: 17px; height: 17px; border-radius: 999px; display: grid; place-items: center;
  font-size: 10px; color: #2dd4bf; background: rgba(20, 184, 166, .14);
}
.mini-site {
  display: flex; align-items: center; gap: 7px; padding: 9px 11px; border-radius: 10px;
  background: rgba(0, 0, 0, .3); color: #99f6e4; font-size: 11.5px;
  font-family: "Cascadia Code", Consolas, monospace;
}
.live-dot { width: 6px; height: 6px; border-radius: 999px; background: #2dd4bf; box-shadow: 0 0 0 4px rgba(20, 184, 166, .14); }
.auth-foot { margin: 22px 0 0; color: #64748b; font-size: 11.5px; }

.auth-panel {
  display: grid; place-items: center; padding: 40px clamp(22px, 4vw, 60px);
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(37, 99, 235, .08) 0%, transparent 60%),
    var(--bg);
}
.auth-card {
  width: min(404px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
}
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: 10px; margin-bottom: 22px;
}
.tab {
  border: 0; background: transparent; padding: 9px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--muted); transition: .18s;
}
.tab.active { background: var(--panel); color: var(--ink); box-shadow: 0 2px 8px rgba(15, 23, 42, .08); }
.auth-card h2 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.auth-sub { margin: 7px 0 22px; color: var(--muted); font-size: 14px; }
.auth-swipe {
  --swipe-x: 0px;
  --swipe-progress: 0;
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 100%; height: 54px; margin-top: 4px; padding: 0 54px;
  border: 1px solid #bfdbfe; border-radius: 999px;
  background: linear-gradient(90deg, #eff6ff, #f8fbff);
  color: var(--accent-2); font: inherit; font-weight: 650; font-size: 13.5px;
  overflow: hidden; touch-action: none; cursor: grab;
  -webkit-user-select: none; user-select: none;
}
.auth-swipe:hover { border-color: #93c5fd; }
.auth-swipe:focus-visible { outline: 3px solid rgba(37, 99, 235, .25); outline-offset: 2px; }
.auth-swipe.dragging { cursor: grabbing; }
.auth-swipe-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--swipe-x) + 54px);
  background: rgba(37, 99, 235, .16); pointer-events: none;
}
.auth-swipe-text {
  position: relative; z-index: 1; white-space: nowrap; pointer-events: none;
  opacity: calc(1 - var(--swipe-progress));
  transition: opacity .15s;
}
.auth-swipe-thumb {
  position: absolute; left: 4px; top: 4px; z-index: 2;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(37, 99, 235, .3);
  transform: translateX(var(--swipe-x));
  transition: transform .22s cubic-bezier(.22, .9, .3, 1), background .16s;
  pointer-events: none;
}
.auth-swipe-thumb svg { width: 20px; height: 20px; }
.auth-swipe.dragging .auth-swipe-thumb { transition: none; }
.auth-swipe.done { border-color: var(--accent); }
.auth-swipe.done .auth-swipe-fill { background: var(--accent); }
.auth-swipe.done .auth-swipe-thumb { background: var(--accent-2); }
.auth-swipe:disabled { cursor: default; opacity: .72; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input {
  width: 100%; height: 46px; padding: 0 13px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--panel); outline: none; transition: .16s;
  font-size: 15px;
}
.field input::placeholder { color: var(--soft); }
.field input:focus {
  border-color: var(--accent); background: var(--panel);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.form-error { min-height: 18px; margin: 11px 0 0; color: var(--danger); font-size: 13px; line-height: 1.45; }
.auth-note { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--soft); font-size: 12px; text-align: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 15px;
  font-size: 13.5px; font-weight: 600; transition: transform .15s, box-shadow .15s, background .15s;
  background: var(--surface-2); color: var(--ink);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 10px 24px -12px rgba(37, 99, 235, .7);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-2); box-shadow: 0 14px 30px -12px rgba(37, 99, 235, .8); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--panel); border-color: var(--line); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); border-color: var(--line-strong); }
.btn-new {
  width: 100%; background: var(--accent); color: #fff;
  border: 1px solid var(--accent); justify-content: flex-start;
  box-shadow: 0 10px 20px -12px rgba(37, 99, 235, .65);
}
.btn-new:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-new svg { color: #fff; }
.btn-publish-mobile { display: none; padding: 8px 14px; border-radius: 9px; background: var(--accent); color: #fff; border: 0; font-size: 12.5px; }
.btn-preview-mobile {
  display: none; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 12.5px;
}
.btn-preview-mobile svg { width: 16px; height: 16px; color: var(--accent); }
.rail-mobile-head { display: none; }

/* ---------- app shell ---------- */
.app-shell { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 64px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(14px, 2.4vw, 26px); background: rgba(255, 255, 255, .84);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); z-index: 10;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.mode-banner {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  padding: 9px clamp(14px, 2.4vw, 26px); font-size: 12.5px; line-height: 1.45;
  background: #fffbeb; border-bottom: 1px solid #fde68a; color: #92400e;
}
.mode-banner strong { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.mode-banner code { background: rgba(146, 64, 14, .09); color: inherit; }
#unpublish-btn { color: var(--danger); }
.balance-chip {
  display: flex; align-items: baseline; gap: 8px; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  font-family: inherit; color: inherit; cursor: pointer;
}
.balance-chip:hover { background: var(--bg); }
.balance-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); font-weight: 700; }
.balance-chip strong { font-size: 13px; letter-spacing: -.01em; }
.storage-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.storage-chip svg { width: 15px; height: 15px; color: var(--accent); }
.storage-chip strong { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.storage-chip:hover { background: var(--bg); }
.storage-chip.warn { border-color: #fecaca; background: #fff6f5; color: #b42318; }
.storage-chip.warn svg { color: #dc2626; }
html[data-theme="dark"] .storage-chip.warn { background: #2a1215; border-color: #7f1d1d; color: #fca5a5; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 7px 4px 4px;
  border: 1px solid transparent; border-radius: 999px; background: transparent;
  font-size: 13px; font-weight: 600; color: inherit;
}
.user-chip:hover { background: var(--bg); border-color: var(--line); }
.user-chevron { width: 15px; height: 15px; color: var(--soft); }
.avatar {
  width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2);
  font-size: 12.5px; font-weight: 700;
}
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
}
.icon-btn:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn svg { width: 18px; height: 18px; }

.app-body {
  position: relative;
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
}
.app-shell.admin-mode .app-body { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.app-shell.admin-mode .rail, .app-shell.admin-mode .rail-resizer { display: none; }
.sidebar {
  position: relative;
  display: flex; flex-direction: column; min-height: 0; padding: 18px 14px;
  background: var(--sidebar); color: var(--ink);
  border-right: 1px solid var(--line);
}
.sidebar-resizer {
  position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; z-index: 12;
  cursor: col-resize; touch-action: none;
}
.sidebar-resizer::after {
  content: ""; position: absolute; top: 50%; left: 3px; width: 2px; height: 46px;
  margin-top: -23px; border-radius: 999px; background: var(--line-strong);
  transition: background .15s, height .15s, margin .15s;
}
.sidebar-resizer:hover::after { background: var(--accent); height: 76px; margin-top: -38px; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing * { cursor: col-resize !important; }
.sidebar-top { display: grid; gap: 11px; padding: 0 2px; }
.sidebar-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--soft); font-weight: 700; padding-left: 4px;
}
.project-list { flex: 1; min-height: 0; overflow-y: auto; margin-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.project-item {
  width: 100%; text-align: left; border: 1px solid transparent; border-radius: 9px;
  padding: 10px 11px; background: transparent; color: var(--muted); display: grid; gap: 3px;
  transition: .15s;
}
.project-item:hover { background: var(--bg); }
.project-item.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.project-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-date { font-size: 10.5px; color: var(--soft); }
.project-empty { color: var(--soft); font-size: 12px; padding: 10px 6px; line-height: 1.55; }
.sidebar-foot { padding: 16px 6px 2px; border-top: 1px solid var(--line); }
.sidebar-foot p { margin: 0; color: var(--soft); font-size: 11px; line-height: 1.55; }
.sidebar-foot .card-label { color: var(--soft); }
.sidebar-foot .mini-list { margin-top: 10px; gap: 9px; }
.sidebar-foot .mini-list li::before { background: var(--accent-soft); color: var(--accent-2); }
.sidebar-foot .mini-list b { color: var(--ink); font-size: 12px; }
.sidebar-foot .mini-list span { color: var(--muted); font-size: 11px; }
.sidebar-helpdesk {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.sidebar-chat-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0;
  background: transparent; color: var(--accent); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.sidebar-chat-link svg { width: 14px; height: 14px; }
.sidebar-chat-link:hover { color: var(--accent-2); }
.sidebar-copy { color: var(--soft); font-size: 10px; }
.sidebar-admin { margin-top: 2px; }
.admin-menu-btn {
  position: relative; width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 9px; border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2); font-size: 12.5px; font-weight: 600; text-align: left;
}
.admin-menu-btn:hover { background: var(--accent-soft); border-color: var(--accent-2); }
.admin-menu-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.admin-menu-btn svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--accent); }
.admin-menu-btn.active svg { color: #fff; }
.admin-menu-btn span { flex: 1; }
.admin-menu-btn .admin-badge { border-color: var(--sidebar); }

.main { min-width: 0; min-height: 0; display: flex; padding: 0 6px; }
.empty-state { width: 100%; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 30px 0; }
.empty-inner { width: min(760px, 100%); padding: 18px 4px 40px; }
.empty-inner h2 { margin: 0; font-size: clamp(28px, 3.4vw, 42px); letter-spacing: -.04em; line-height: 1.1; }
.empty-sub { margin: 12px 0 26px; color: var(--muted); font-size: 15px; max-width: 480px; line-height: 1.6; }
.ideas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.idea {
  text-align: left; display: grid; gap: 5px; padding: 17px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); transition: .17s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px -12px rgba(15, 23, 42, .14);
}
.idea:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 18px 34px -22px rgba(37, 99, 235, .4); }
.idea-icon {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 5px;
}
.idea-icon svg { width: 19px; height: 19px; }
.idea-title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.idea-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.chat-view { width: 100%; display: flex; flex-direction: column; min-height: 0; position: relative; }
.chat-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 4px 12px; }
.chat-title-wrap h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.chat-title-wrap p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.chat-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.chat-settings { background: var(--panel); border-color: var(--line); }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 4px 14px; display: flex; flex-direction: column; gap: 13px; }
.site-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 9px;
  margin: 0 4px 10px; padding: 8px 10px 8px 12px;
  background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px; min-width: 0;
}
.site-bar-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #0f766e; flex: 0 0 auto; }
.site-bar a { font-size: 12px; color: #0f766e; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.site-bar .btn { padding: 6px 10px; font-size: 11px; flex: 0 0 auto; }
@media (min-width: 1181px) { .site-bar { display: none !important; } }
.msg {
  max-width: min(710px, 88%); padding: 12px 15px; border-radius: 14px;
  font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap;
  animation: rise .22s ease both;
}
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; box-shadow: 0 10px 22px -16px rgba(37, 99, 235, .7); }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.msg.error { align-self: flex-start; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-bottom-left-radius: 4px; }
html[data-theme="dark"] .msg.assistant { box-shadow: none; }
html[data-theme="dark"] .msg.error { background: #2a1215; border-color: #7f1d1d; color: #fca5a5; }
.msg.assistant a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.msg-meta { margin-top: 7px; color: var(--soft); font-size: 11px; display: flex; gap: 8px; flex-wrap: wrap; }
.plan-actions {
  flex: 0 0 auto; margin: 0 96px 10px 4px; padding: 10px 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 1px dashed #bfdbfe; border-radius: var(--radius); background: var(--accent-50, #eff6ff);
}
html[data-theme="dark"] .plan-actions { background: #0f172a; border-color: #1e40af; }
.plan-actions[hidden] { display: none; }
.plan-actions .btn { flex: 0 0 auto; }
.plan-actions span { flex: 1 1 180px; color: var(--soft); font-size: 12px; line-height: 1.45; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.activity {
  flex: 0 0 auto; margin: 0 4px 10px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 30px -24px rgba(15, 23, 42, .4); animation: rise .2s ease both;
}
.activity-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.spinner {
  width: 13px; height: 13px; border-radius: 999px; flex: 0 0 auto;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.step-label { margin-left: auto; color: var(--soft); font-size: 10.5px; }
.activity-list {
  margin-top: 9px; display: grid; gap: 5px; max-height: 62px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 12px);
}
.activity-list::-webkit-scrollbar { width: 6px; }
.activity-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.activity-list::-webkit-scrollbar-track { background: transparent; }
.activity-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.activity-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); flex: 0 0 auto; }
.activity-row.done .activity-dot { background: var(--ok); }
.activity-row.fail .activity-dot { background: var(--danger); }
.activity-row span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity.done .spinner { border-color: #bbf7d0; border-top-color: var(--ok); animation: none; }

.composer {
  flex: 0 0 auto; margin: 0 4px 16px; padding: 11px 13px 9px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 16px 40px -30px rgba(15, 23, 42, .35);
  transition: border-color .16s, box-shadow .16s;
}
.composer:focus-within { border-color: #bfdbfe; box-shadow: 0 0 0 4px rgba(37, 99, 235, .1), 0 16px 40px -30px rgba(15, 23, 42, .35); }
html[data-theme="dark"] .composer:focus-within { border-color: #1e40af; }
.composer textarea {
  width: 100%; border: 0; outline: 0; resize: none; background: transparent;
  font-size: 15px; line-height: 1.55; max-height: 158px; padding: 2px 2px 6px;
}
.composer textarea::placeholder { color: #94a3b8; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-hint { color: var(--soft); font-size: 10.5px; padding-left: 3px; }
.send-btn {
  width: 37px; height: 37px; border-radius: 10px; border: 0; display: grid; place-items: center;
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .8); transition: .15s;
}
.send-btn:hover:not(:disabled) { background: var(--accent-2); transform: translateY(-1px); }
.send-btn:disabled { opacity: .45; cursor: not-allowed; }
.send-btn svg { width: 19px; height: 19px; }

.rail {
  position: relative; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
  padding: 14px; gap: 14px; background: var(--bg); border-left: 1px solid var(--line);
}
.rail-resizer {
  position: absolute; top: 0; right: var(--rail-w); bottom: 0; width: 10px;
  transform: translateX(5px); z-index: 12; cursor: col-resize; touch-action: none;
}
.rail-resizer::after {
  content: ""; position: absolute; top: 50%; left: 4px; width: 2px; height: 46px;
  margin-top: -23px; border-radius: 999px; background: var(--line-strong);
  transition: background .15s, height .15s, margin .15s;
}
.rail-resizer:hover::after { background: var(--accent); height: 76px; margin-top: -38px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.rail .card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px -12px rgba(15, 23, 42, .14); }
html[data-theme="dark"] .rail .card { box-shadow: none; }
.card-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--soft); font-weight: 700; }
.card-hint { margin: 10px 0 0; color: var(--soft); font-size: 11px; line-height: 1.5; }
.balance-big { margin-top: 7px; font-size: 25px; font-weight: 700; letter-spacing: -.035em; }
.balance-card .btn { margin-top: 12px; }
.balance-card { background: var(--panel); }
.publish-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.publish-live {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px;
  border-radius: 999px; background: #f0fdfa; color: #0f766e;
  font-size: 10.5px; font-weight: 700;
}
html[data-theme="dark"] .publish-live { background: #042f2e; color: #5eead4; }
.publish-live i { width: 6px; height: 6px; border-radius: 50%; background: #14b8a6; box-shadow: 0 0 0 3px rgba(20, 184, 166, .14); }
.publish-state { margin: 8px 0 10px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.publish-result { display: flex; align-items: stretch; gap: 6px; margin: 0 0 9px; }
.publish-result a {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center;
  font-size: 11.5px; color: var(--accent-2); text-decoration: none;
  background: var(--accent-soft); padding: 9px 11px; border-radius: 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.publish-copy {
  flex: 0 0 auto; width: 38px; height: auto; border: 1px solid var(--line);
  border-radius: 9px; background: var(--panel); color: var(--accent);
}
.publish-copy:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-2); }
.site-address { margin: -4px 0 10px; font-family: "Cascadia Code", Consolas, monospace; font-size: 10.5px; color: var(--muted); word-break: break-all; line-height: 1.45; }
.publish-card { flex: 0 0 auto; padding: 15px 14px 20px; }
.publish-main { padding: 11px 15px; }
.publish-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 7px; }
.publish-grid .btn { padding: 9px 8px; font-size: 12.5px; }
.publish-danger-link {
  display: block; width: 100%; margin-top: 6px; padding: 7px; border: 0;
  border-radius: 8px; background: none; color: var(--danger);
  font-size: 11.5px; font-weight: 600;
}
.publish-danger-link:hover:not(:disabled) { background: rgba(220, 38, 38, .07); }
.publish-danger-link:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 380px) { .publish-grid { grid-template-columns: 1fr; } }
.preview-card { flex: 1 1 auto; min-height: 340px; padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-left: 2px; }
.preview-tools { display: flex; align-items: center; gap: 2px; }
.preview-tool { width: 26px; height: 26px; border-radius: 7px; background: var(--bg); color: var(--muted); }
.preview-tool:hover:not(:disabled) { background: var(--line); color: var(--ink); }
.preview-tool:disabled { opacity: .35; cursor: not-allowed; }
.preview-tool svg { width: 14px; height: 14px; }
.preview-modes { display: flex; align-items: center; gap: 2px; }
.preview-tool[aria-pressed="true"] { background: var(--accent); color: #fff; }
.preview-tool[aria-pressed="true"]:hover { background: var(--accent); color: #fff; }
.preview-tool-sep { width: 1px; height: 16px; background: var(--line); margin: 0 3px; }
.preview-zoom-label { min-width: 38px; text-align: center; font-size: 10.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.preview-frame {
  flex: 1 1 auto; min-height: 260px; position: relative; overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.preview-frame iframe {
  width: var(--preview-w, 1280px); height: var(--preview-h, 900px); border: 0; display: block; background: #fff;
  zoom: var(--preview-zoom, .3);
}
.field-optional { font-style: normal; color: var(--soft); font-weight: 500; }
.storage-block { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.storage-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
.storage-line b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.storage-bar { margin-top: 7px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.storage-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #14b8a6); transition: width .3s; }
.storage-bar i.warn { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.storage-note { margin: 8px 0 0; color: var(--soft); font-size: 10.5px; line-height: 1.5; }
.storage-inline { margin: -8px 0 16px; font-size: 11.5px; color: var(--muted); }
.storage-card { width: min(456px, 100%); }
.storage-summary { display: flex; align-items: baseline; gap: 8px; margin-top: 16px; }
.storage-summary strong { font-size: 31px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.storage-summary span { color: var(--muted); font-size: 13px; }
.storage-meter { margin-top: 11px; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.storage-meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #14b8a6); transition: width .3s; }
.storage-meter i.warn { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.storage-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.storage-apps-title { margin: 18px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.storage-apps { display: grid; gap: 6px; max-height: 224px; overflow-y: auto; }
.storage-app-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg);
}
.storage-app-name { min-width: 0; font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-app-row b { flex: 0 0 auto; font-size: 12.5px; }
.storage-apps-empty { margin: 0; padding: 12px; border: 1px dashed var(--line); border-radius: 9px; color: var(--muted); font-size: 12px; text-align: center; }
.storage-plan { margin: 14px 0 0; font-size: 12px; color: var(--muted); }
.mini-list { margin: 11px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: step; }
.mini-list li { position: relative; padding-left: 28px; }
.mini-list li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 1px; width: 19px; height: 19px; border-radius: 999px;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft);
}
.mini-list b { display: block; font-size: 12.5px; }
.mini-list span { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.5; margin-top: 1px; }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(11, 13, 18, .52); backdrop-filter: blur(5px); }
.modal-card {
  width: min(432px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px;
  position: relative; box-shadow: var(--shadow); animation: rise .2s ease both;
}
.modal-card h3 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.modal-sub { margin: 8px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-close { position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.modal-close:hover { background: var(--line); color: var(--ink); }
.modal-close svg { width: 16px; height: 16px; }
.topup-email {
  margin: 0 0 14px; padding: 12px; border-radius: 12px; background: var(--accent-50);
  border: 1px dashed var(--accent); text-align: center; font-weight: 700; font-size: 14px; color: var(--accent-2);
  word-break: break-all;
}
.site-field { display: flex; align-items: stretch; min-width: 0; }
.site-field input { flex: 1 1 auto; min-width: 0; border-radius: 12px 0 0 12px; }
.site-suffix {
  display: inline-flex; align-items: center; padding: 0 10px; flex: 0 0 auto;
  border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 12px 12px 0;
  background: var(--surface-2); color: var(--muted); font-size: 11px; white-space: nowrap;
}
.site-status { min-height: 18px; margin: -2px 0 10px; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.site-status.ok { color: var(--ok); }
.site-status.bad { color: var(--danger); }
.site-status.pending { color: var(--soft); }
.settings-warning {
  margin: 0 0 13px; padding: 10px 12px; border-radius: 10px;
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 11.5px; line-height: 1.5;
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b42318; }
.btn-danger-ghost { background: var(--panel); border-color: #fecaca; color: var(--danger); white-space: nowrap; }
.btn-danger-ghost:hover:not(:disabled) { background: #fef3f2; }
html[data-theme="dark"] .btn-danger-ghost { border-color: #7f1d1d; }
html[data-theme="dark"] .btn-danger-ghost:hover:not(:disabled) { background: #2a1215; }
.danger-zone {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--line);
}
.danger-zone-text b { display: block; font-size: 13px; color: var(--ink); }
.danger-zone-text p { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.delete-warning {
  display: flex; gap: 11px; margin: 0 0 18px; padding: 13px 14px; border-radius: 13px;
  background: #fef3f2; border: 1px solid #fecdca; color: #912018;
}
.delete-warning svg { flex: 0 0 auto; width: 21px; height: 21px; margin-top: 1px; }
.delete-warning b { display: block; font-size: 13px; }
.delete-warning p { margin: 4px 0 0; font-size: 12px; line-height: 1.55; color: #b42318; }
.delete-actions { display: grid; gap: 8px; }
.delete-actions .form-error { margin: 4px 0 0; text-align: center; }
@media (max-width: 420px) {
  .danger-zone { align-items: flex-start; flex-direction: column; }
  .danger-zone .btn { width: 100%; }
}
.dns-help { margin: -2px 0 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); }
.dns-help summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--ink);
  list-style: none;
}
.dns-help summary::-webkit-details-marker { display: none; }
.dns-help summary svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--soft); transition: transform .2s; }
.dns-help[open] summary svg { transform: rotate(180deg); }
.dns-body { padding: 0 11px 11px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.dns-body p { margin: 0 0 8px; }
.dns-table {
  display: grid; grid-template-columns: auto auto 1fr; gap: 6px 9px; align-items: center;
  padding: 9px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); font-size: 11px;
}
.dns-head { font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--soft); font-weight: 600; }
.dns-table code { font-family: "Cascadia Code", Consolas, monospace; font-size: 10.5px; color: var(--ink); word-break: break-all; }
.dns-note { margin: 8px 0 0; font-size: 10.5px; color: var(--soft); line-height: 1.5; }
#settings-modal .modal-card { max-height: calc(100dvh - 40px); overflow-y: auto; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #0f172a; color: #f8fafc; padding: 10px 16px; border-radius: 999px;
  font-size: 12.5px; z-index: 80; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .55);
  max-width: min(92vw, 560px); text-align: center; animation: rise .2s ease both;
}
html[data-theme="dark"] .toast { background: #1e293b; border: 1px solid #334155; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .app-body { grid-template-columns: min(var(--sidebar-w), 260px) minmax(0, 1fr); }
  .app-shell.admin-mode .app-body { grid-template-columns: min(var(--sidebar-w), 260px) minmax(0, 1fr); }
  .rail { display: none; }
  .rail-resizer { display: none; }
  .btn-publish-mobile { display: inline-flex; }
  .btn-preview-mobile { display: inline-flex; }
  .rail-locked { overflow: hidden; }
  .app-shell.rail-open .rail {
    display: flex; position: fixed; inset: 0; z-index: 55;
    background: var(--bg); border-left: 0; overflow-y: auto;
  }
  .app-shell.rail-open .rail-mobile-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px 10px 14px; position: sticky; top: 0; z-index: 3;
    background: var(--panel); border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }
  .rail-mobile-head strong { font-size: 13.5px; letter-spacing: -.01em; }
  .app-shell.rail-open .preview-card { flex: 0 0 auto; min-height: 0; height: min(58vh, 520px); }
}
@media (max-width: 480px) {
  .preview-btn-text { display: none; }
  .btn-preview-mobile { padding: 8px 9px; }
}
@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { padding: 22px 20px 34px; }
  .hero-window, .auth-foot { display: none; }
  .hero-copy { margin-top: 26px; }
  .hero-copy h1 { font-size: clamp(38px, 11vw, 52px); }
  .hero-sub { margin-top: 16px; font-size: 14px; }
  .hero-points { margin-top: 18px; }
  .auth-panel { padding: 0 16px 42px; }
  .auth-card { margin-top: -18px; padding: 24px; border-radius: 22px; position: relative; z-index: 2; }
  .topbar { height: 58px; }
  .topbar-right { gap: 7px; }
  .balance-label, #user-name { display: none; }
  .user-chevron { display: none; }
  .storage-chip { padding: 6px 9px; gap: 5px; }
  .storage-chip svg { width: 15px; height: 15px; }
  .storage-chip strong { font-size: 11px; }
  .user-chip { padding: 3px; gap: 0; border-color: transparent; }
  .sidebar-resizer { display: none; }
  .app-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .app-shell.admin-mode .app-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { flex-direction: row; align-items: center; gap: 9px; padding: 9px 12px; overflow-x: auto; }
  .sidebar-top { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
  .sidebar-label, .sidebar-foot { display: none; }
  .sidebar-top .btn-new { width: auto; white-space: nowrap; padding: 8px 11px; font-size: 12px; }
  .sidebar-admin { margin-top: 0; flex: 0 0 auto; }
  .admin-menu-btn { width: auto; white-space: nowrap; padding: 8px 11px; font-size: 12px; }
  .admin-menu-btn svg { display: none; }
  .admin-menu-btn .admin-badge { top: -5px; right: -5px; border-color: var(--sidebar); }
  .project-list { flex-direction: row; margin: 0; padding: 0; gap: 6px; overflow-x: auto; overflow-y: hidden; flex: 0 1 auto; }
  .project-item { min-width: max-content; padding: 7px 10px; display: block; }
  .project-date { display: none; }
  .main { padding: 0 6px; }
  .chat-head { padding: 13px 3px 9px; }
  .chat-title-wrap h2 { font-size: 16px; }
  .chat-title-wrap p { display: none; }
  .messages { padding: 6px 2px 10px; gap: 9px; }
  .msg { max-width: 93%; font-size: 13.5px; }
  .activity { margin: 0 2px 8px; }
  .composer { margin: 0 2px 9px; }
  .composer-hint { display: none; }
  .empty-state { align-items: flex-start; }
  .empty-inner { padding-top: 26px; }
  .ideas { grid-template-columns: 1fr; }
  .idea { padding: 14px; }
  .toast { bottom: 14px; }
}
@media (max-width: 560px) {
  .brand-row.small .brand-name { display: none; }
  .topbar { padding: 0 12px; }
  .balance-chip { padding: 6px 10px; }
}

/* ---------- riwayat saldo ---------- */
.ledger { margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ledger-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.ledger-head h4 { margin: 0; font-size: 12.5px; letter-spacing: .01em; }
.ledger-head span { font-size: 10.5px; color: var(--soft); }
.ledger-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.ledger-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.ledger-item:last-child { border-bottom: 0; }
.ledger-what { min-width: 0; }
.ledger-what b { display: block; font-size: 12px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-what small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-amount { flex: 0 0 auto; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ledger-amount.minus { color: var(--danger); }
.ledger-amount.plus { color: var(--ok); }
.ledger-empty { padding: 14px 12px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- metode pembayaran QRIS / VA ---------- */
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pay-method {
  display: grid; gap: 2px; padding: 10px 11px; border: 1px solid var(--line);
  border-radius: 11px; background: var(--bg); cursor: pointer;
}
.pay-method input { margin: 0 0 3px; accent-color: var(--accent); }
.pay-method b { font-size: 12px; }
.pay-method small { font-size: 10px; line-height: 1.4; color: var(--muted); }
.pay-method:has(input:checked) { border-color: var(--accent); background: var(--accent-50); box-shadow: 0 0 0 2px rgba(37, 99, 235, .08); }
.qr-box { margin: 12px auto; padding: 12px; width: fit-content; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.qr-box svg { display: block; width: min(232px, 72vw); height: auto; }
.va-box {
  display: grid; gap: 4px; margin: 12px 0; padding: 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
}
.va-box span { font-size: 10.5px; color: var(--muted); }
.va-box b { font-size: 18px; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.va-box .btn { justify-self: start; margin-top: 4px; }
@media (max-width: 420px) {
  .pay-methods { grid-template-columns: 1fr; }
}

/* ---------- helpdesk mengambang ---------- */
.hd-fab {
  position: fixed; right: 18px; bottom: 106px; z-index: 75;
  width: 68px; height: 68px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: var(--accent); color: #fff;
  font: inherit; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 16px 34px -12px rgba(37, 99, 235, .65);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.hd-fab svg { width: 33px; height: 33px; color: #fff; }
.hd-fab:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -12px rgba(37, 99, 235, .75); }
.hd-fab:hover svg { color: #fff; }
.hd-fab.dragging, .hd-fab.dragging:hover { cursor: grabbing; transform: scale(1.06); box-shadow: 0 24px 48px -14px rgba(37, 99, 235, .85); }
.hd-fab[aria-expanded="true"] { opacity: 0; transform: scale(.86); pointer-events: none; }
@media (min-width: 1181px) {
  .app-shell:not([hidden]) ~ .hd-panel {
    right: calc(var(--rail-w) + 18px); bottom: 158px;
    height: min(64dvh, 566px);
  }
}

.hd-panel {
  position: fixed; right: 22px; bottom: 84px; z-index: 76;
  width: min(382px, calc(100vw - 24px)); height: min(566px, calc(100dvh - 116px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 34px 90px -34px rgba(15, 23, 42, .5);
  animation: rise .18s ease both;
}
.hd-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 12px 12px 14px; background: #0f172a; color: #f8fafc;
}
.hd-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hd-avatar {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #3b82f6, #2563eb); font-size: 10.5px; font-weight: 800;
  letter-spacing: .04em; flex: 0 0 auto;
}
.hd-title b { display: block; font-size: 13px; }
.hd-title span { display: block; font-size: 10.5px; color: #94a3b8; margin-top: 1px; }
.hd-close {
  width: 30px; height: 30px; border-radius: 9px; border: 0; flex: 0 0 auto;
  background: rgba(255, 255, 255, .1); color: #f8fafc; display: grid; place-items: center; cursor: pointer;
}
.hd-close:hover { background: rgba(255, 255, 255, .18); }
.hd-close svg { width: 15px; height: 15px; }
.hd-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 9px; background: var(--bg);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.hd-msg {
  max-width: 88%; padding: 10px 12px; border-radius: 14px;
  font-size: 12.8px; line-height: 1.58; white-space: pre-wrap; overflow-wrap: anywhere;
  animation: rise .16s ease both;
}
.hd-msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.hd-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.hd-msg.typing { color: var(--soft); font-style: italic; }
.hd-msg a { color: var(--accent); }
.hd-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 9px; background: var(--bg); }
.hd-suggest:empty { display: none; }
.hd-suggest button {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--ink); font: inherit; font-size: 10.8px; cursor: pointer;
}
.hd-suggest button:hover { border-color: var(--accent); background: var(--accent-50); }
.hd-form {
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel);
}
.hd-form textarea {
  flex: 1 1 auto; min-width: 0; max-height: 92px; resize: none; outline: 0;
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px;
  font: inherit; font-size: 12.8px; line-height: 1.5; background: var(--panel);
}
.hd-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.hd-send {
  width: 36px; height: 36px; flex: 0 0 auto; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.hd-send svg { width: 17px; height: 17px; }
.hd-send:disabled { opacity: .5; cursor: default; }
.hd-foot { flex: 0 0 auto; padding: 8px 12px 11px; background: var(--panel); border-top: 1px dashed var(--line); }
.hd-email-row { display: flex; gap: 6px; }
.hd-email-row input {
  flex: 1 1 auto; min-width: 0; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 9px; font: inherit; font-size: 11.5px; outline: 0;
}
.hd-email-row input:focus { border-color: var(--accent); }
.hd-email-row button {
  flex: 0 0 auto; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--ink); font: inherit; font-size: 11px; cursor: pointer;
}
.hd-email-row button:hover:not(:disabled) { background: var(--bg); }
.hd-email-row button:disabled { opacity: .55; cursor: default; }
.hd-note { margin: 6px 0 0; color: var(--soft); font-size: 10px; line-height: 1.45; }
.hd-note.ok { color: var(--ok); }
.hd-note.bad { color: var(--danger); }
@media (max-width: 1180px) {
  body.rail-open .hd-fab { display: none; }
}
@media (max-width: 560px) {
  .hd-fab { width: 60px; height: 60px; right: 12px; bottom: 102px; }
  .plan-actions { margin-right: 82px; }
  .hd-fab svg { width: 29px; height: 29px; }
  .hd-panel {
    right: 8px; left: 8px; bottom: 8px; width: auto;
    height: min(84dvh, 640px); border-radius: 18px;
  }
}

/* ---------- dark mode: penyesuaian komponen ---------- */
html[data-theme="dark"] .topbar { background: rgba(17, 24, 39, .86); }
html[data-theme="dark"] .mode-banner {
  background: #2a2008; border-bottom-color: #78350f; color: #fcd34d;
}
html[data-theme="dark"] .mode-banner code { background: rgba(252, 211, 77, .12); }
html[data-theme="dark"] .site-bar { background: #042f2e; border-color: #115e59; }
html[data-theme="dark"] .site-bar-label, html[data-theme="dark"] .site-bar a { color: #5eead4; }
html[data-theme="dark"] .auth-swipe {
  border-color: #1e40af;
  background: linear-gradient(90deg, #172554, #0f172a);
  color: #bfdbfe;
}
html[data-theme="dark"] .auth-swipe:hover { border-color: #3b82f6; }
html[data-theme="dark"] .project-item.active,
html[data-theme="dark"] .publish-result a,
html[data-theme="dark"] .avatar,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .admin-menu-btn { color: #bfdbfe; }
html[data-theme="dark"] .admin-menu-btn svg { color: #60a5fa; }
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-new,
html[data-theme="dark"] .send-btn,
html[data-theme="dark"] .hd-send,
html[data-theme="dark"] .hd-fab,
html[data-theme="dark"] .preview-tool[aria-pressed="true"],
html[data-theme="dark"] .msg.user,
html[data-theme="dark"] .hd-msg.user,
html[data-theme="dark"] .auth-swipe-thumb { background: #2563eb; color: #fff; }
html[data-theme="dark"] .btn-primary:hover:not(:disabled),
html[data-theme="dark"] .btn-new:hover,
html[data-theme="dark"] .send-btn:hover:not(:disabled),
html[data-theme="dark"] .preview-tool[aria-pressed="true"]:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
html[data-theme="dark"] .settings-warning {
  background: #2a2008; border-color: #78350f; color: #fcd34d;
}
html[data-theme="dark"] .delete-warning { background: #2a1215; border-color: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .delete-warning p { color: #fca5a5; }
html[data-theme="dark"] .activity.done .spinner { border-color: #064e3b; border-top-color: var(--ok); }

/* admin panel */
html[data-theme="dark"] .admin-chip,
html[data-theme="dark"] .admin-tabs,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .admin-section,
html[data-theme="dark"] .admin-topup,
html[data-theme="dark"] .admin-alert,
html[data-theme="dark"] .payment-card,
html[data-theme="dark"] .topup-box,
html[data-theme="dark"] .hd-admin-chat { background: var(--panel); border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .admin-tab { color: var(--muted); }
html[data-theme="dark"] .admin-tab:hover,
html[data-theme="dark"] .admin-empty,
html[data-theme="dark"] .admin-user,
html[data-theme="dark"] .account-stat,
html[data-theme="dark"] .margin-stat,
html[data-theme="dark"] .token-stat,
html[data-theme="dark"] .topup-history-item,
html[data-theme="dark"] .hd-admin-item,
html[data-theme="dark"] .hd-admin-line,
html[data-theme="dark"] .amount-chips button { background: var(--bg); border-color: var(--line); }
html[data-theme="dark"] .admin-tab.active { background: #2563eb; color: #fff; }
html[data-theme="dark"] .kpi-card.good { background: linear-gradient(160deg, #052e24, var(--panel)); border-color: #065f46; }
html[data-theme="dark"] .kpi-card.warn { background: linear-gradient(160deg, #2a2008, var(--panel)); border-color: #78350f; }
html[data-theme="dark"] .admin-alert.unread { background: #172554; border-color: #1e40af; }
html[data-theme="dark"] .admin-user.minus { background: #2a1215; box-shadow: inset 3px 0 0 #f87171; }
html[data-theme="dark"] .account-stat.bad { background: #2a1215; }
html[data-theme="dark"] .margin-main { background: #172554; border-color: #1e40af; }
html[data-theme="dark"] .margin-meta { color: #bfdbfe; }
html[data-theme="dark"] .margin-mult { color: #93c5fd; }
html[data-theme="dark"] .topup-pending { background: #172554; border-color: #1e40af; color: #bfdbfe; }
html[data-theme="dark"] .topup-code,
html[data-theme="dark"] .topup-detail { color: #bfdbfe; }
html[data-theme="dark"] .payment-webhook { background: var(--bg); color: var(--muted); }
html[data-theme="dark"] .payment-webhook code { color: #93c5fd; }
html[data-theme="dark"] .admin-form input,
html[data-theme="dark"] .admin-user-search,
html[data-theme="dark"] .hd-admin-form input,
html[data-theme="dark"] .hd-admin-form textarea,
html[data-theme="dark"] .payment-active-form select {
  background: var(--panel); border-color: var(--line-strong); color: var(--ink);
}
html[data-theme="dark"] .admin-form input:focus,
html[data-theme="dark"] .admin-user-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, .18); }
html[data-theme="dark"] .provider-note.warn { background: #2a2008; border-color: #78350f; color: #fcd34d; }
html[data-theme="dark"] .provider-note.bad { background: #2a1215; border-color: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .provider-status.ok { background: #052e24; color: #6ee7b7; }
html[data-theme="dark"] .provider-status.warn { background: #2a2008; color: #fcd34d; }
html[data-theme="dark"] .provider-status.bad { background: #2a1215; color: #fca5a5; }
html[data-theme="dark"] .status-pill.pending { background: #2a2008; color: #fcd34d; }
html[data-theme="dark"] .status-pill.paid { background: #052e24; color: #6ee7b7; }
html[data-theme="dark"] .status-pill.rejected,
html[data-theme="dark"] .status-pill.expired { background: #2a1215; color: #fca5a5; }
html[data-theme="dark"] .token-bar { background: var(--surface-2); }
html[data-theme="dark"] .token-bar .token-out { background: #818cf8; }
html[data-theme="dark"] .admin-user .role-tag { background: var(--accent-soft); color: #bfdbfe; }
html[data-theme="dark"] .admin-user .minus-tag { background: #7f1d1d; color: #fecaca; }
html[data-theme="dark"] .hd-admin-chat .hd-admin-line.user { background: var(--accent-soft); }
html[data-theme="dark"] .hd-admin-chat .hd-admin-badge { background: var(--bg); color: var(--muted); }


/* ---------- pembelian token & storage ---------- */
.buy-tabs {
  display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 12px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2);
}
.buy-tab {
  border: 0; border-radius: 8px; padding: 7px 15px; background: transparent;
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s;
}
.buy-tab:hover { color: var(--ink); }
.buy-tab.active { background: var(--panel); color: var(--accent); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.storage-pick-label {
  margin: 2px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
}
.storage-packages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.storage-package {
  display: grid; gap: 2px; padding: 11px 12px; text-align: left; font: inherit;
  border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--ink);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.storage-package:hover { border-color: var(--accent); }
.storage-package.active {
  border-color: var(--accent); background: var(--accent-50);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .08);
}
.storage-package-mb { font-size: 13px; font-weight: 700; }
.storage-package-price { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.storage-package.active .storage-package-price { color: var(--accent); font-weight: 700; }
.storage-package-deal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.storage-package-deal s { color: var(--soft); }
.storage-package-deal em {
  font-style: normal; font-weight: 700; color: var(--ok);
  background: rgba(5, 150, 105, .1); padding: 1px 6px; border-radius: 999px;
}
.storage-shop { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.storage-shop-head { display: grid; gap: 3px; margin-bottom: 10px; }
.storage-shop-head b { font-size: 13px; }
.storage-shop-head span { font-size: 11.5px; line-height: 1.5; color: var(--muted); }
html[data-theme="dark"] .buy-tab.active { background: var(--accent-soft); color: #bfdbfe; }
html[data-theme="dark"] .storage-package-deal em { background: rgba(52, 211, 153, .14); color: #6ee7b7; }
