/* ==========================================================================
   Suvi AI Workspace — sistem tampilan "Benang Emas"
   Gagasan: tenun songket — dasar gelap nila seperti kain tenun malam, aksen benang emas
   (warna merek dari Panel Admin), motif belah ketupat sebagai tekstur yang sangat halus.
   Satu elemen yang diingat: benang emas yang "menenun" saat AI bekerja.
   ========================================================================== */

/* ---------- Token ---------- */
:root {
  --accent: var(--brand-accent, #d4af6a);
  --accent-2: var(--brand-accent-2, #8b7bff);
  --bg: #13111f;
  --bg-deep: #0d0b17;
  --surface: #1a1729;
  --surface-2: #221e35;
  --surface-3: #2b2643;
  --line: #2f2a48;
  --line-soft: #241f38;
  --ink: #f1ebdd;
  --ink-2: #c3bdd0;
  --ink-3: #8f88a3;
  --ink-on-accent: #1d1508;
  --ok: #5fbf8e;
  --warn: #e3b341;
  --danger: #ea7a72;
  --info: #8fb0ff;
  --accent-ink: color-mix(in oklab, var(--accent) 78%, #fff);
  --accent-soft: color-mix(in oklab, var(--accent) 14%, transparent);
  --accent-line: color-mix(in oklab, var(--accent) 40%, transparent);
  --accent-2-soft: color-mix(in oklab, var(--accent-2) 16%, transparent);
  --scrim: rgba(6, 4, 14, .62);
  --shadow-pop: 0 24px 60px -18px rgba(4, 2, 12, .8), 0 0 0 1px var(--line);
  --shadow-soft: 0 10px 30px -14px rgba(4, 2, 12, .7);
  --r-xs: 6px; --r-sm: 9px; --r-md: 13px; --r-lg: 18px; --r-xl: 26px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, "DejaVu Sans Mono", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.45, .64, 1);
  --t-fast: 140ms; --t: 240ms; --t-slow: 420ms;
  --sidebar-w: 284px;
  --topbar-h: 56px;
  --fs-xs: .78rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem; --fs-3xl: 2.35rem;
  --motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M14 1 27 14 14 27 1 14Z M14 8 20 14 14 20 8 14Z' fill='none' stroke='%23d4af6a' stroke-opacity='.09' stroke-width='1'/%3E%3C/svg%3E");
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f4fb; --bg-deep: #eeeaf6; --surface: #ffffff; --surface-2: #f3f0f9; --surface-3: #e9e4f3;
  --line: #ddd6eb; --line-soft: #ebe6f4;
  --ink: #1c1830; --ink-2: #4e4866; --ink-3: #7a7391;
  --accent-ink: color-mix(in oklab, var(--accent) 62%, #3a2a00);
  --accent-soft: color-mix(in oklab, var(--accent) 16%, transparent);
  --scrim: rgba(28, 24, 48, .38);
  --shadow-pop: 0 24px 60px -20px rgba(40, 30, 80, .35), 0 0 0 1px var(--line);
  --shadow-soft: 0 10px 30px -16px rgba(40, 30, 80, .3);
  --danger: #c4463d; --ok: #2f8f5f; --warn: #a8770a; --info: #3b62c4;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg: #f6f4fb; --bg-deep: #eeeaf6; --surface: #ffffff; --surface-2: #f3f0f9; --surface-3: #e9e4f3;
    --line: #ddd6eb; --line-soft: #ebe6f4;
    --ink: #1c1830; --ink-2: #4e4866; --ink-3: #7a7391;
    --accent-ink: color-mix(in oklab, var(--accent) 62%, #3a2a00);
    --scrim: rgba(28, 24, 48, .38);
    --shadow-pop: 0 24px 60px -20px rgba(40, 30, 80, .35), 0 0 0 1px var(--line);
    --shadow-soft: 0 10px 30px -16px rgba(40, 30, 80, .3);
    --danger: #c4463d; --ok: #2f8f5f; --warn: #a8770a; --info: #3b62c4;
    color-scheme: light;
  }
}

/* ---------- Dasar ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; height: 100%; }
html[data-font="sm"] { font-size: 15px; } html[data-font="lg"] { font-size: 17.5px; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font: 400 var(--fs-md)/1.6 var(--font); letter-spacing: -.003em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: clip;
}
img, svg, video { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.wrap-any { overflow-wrap: anywhere; word-break: break-word; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.scroll-y { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--line); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Ikon ---------- */
.ic { width: 1.15em; height: 1.15em; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.ic.fill { fill: currentColor; stroke: none; }
.ic-lg { width: 1.45em; height: 1.45em; }

/* ---------- Tombol ---------- */
.btn {
  --b-bg: var(--surface-2); --b-ink: var(--ink); --b-line: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 40px; padding: .5rem 1rem;
  border-radius: var(--r-sm); border: 1px solid var(--b-line); background: var(--b-bg); color: var(--b-ink);
  font-weight: 600; font-size: var(--fs-sm); line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), background var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), color var(--t);
  user-select: none; -webkit-tap-highlight-color: transparent; position: relative;
}
.btn:hover { --b-bg: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary {
  --b-bg: var(--accent); --b-ink: var(--ink-on-accent); --b-line: transparent;
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 88%, #fff) 0%, var(--accent) 55%, color-mix(in oklab, var(--accent) 82%, #5a3a00) 100%);
  box-shadow: 0 8px 22px -10px color-mix(in oklab, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 12px 28px -10px color-mix(in oklab, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255,255,255,.4); }
.btn.ghost { --b-bg: transparent; --b-line: transparent; color: var(--ink-2); }
.btn.ghost:hover { --b-bg: var(--surface-2); color: var(--ink); }
.btn.outline { --b-bg: transparent; }
.btn.outline:hover { --b-bg: var(--surface-2); }
.btn.danger { --b-bg: color-mix(in oklab, var(--danger) 18%, transparent); --b-ink: var(--danger); --b-line: color-mix(in oklab, var(--danger) 35%, transparent); }
.btn.danger:hover { --b-bg: color-mix(in oklab, var(--danger) 26%, transparent); }
.btn.sm { min-height: 32px; padding: .3rem .7rem; font-size: var(--fs-xs); border-radius: var(--r-xs); }
.btn.lg { min-height: 48px; padding: .7rem 1.4rem; font-size: var(--fs-md); border-radius: var(--r-md); }
.btn.icon { width: 40px; min-width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; min-width: 32px; }
.btn.block { width: 100%; }
.btn .badge-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.btn.is-busy { color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--b-ink) transparent var(--b-ink) transparent; animation: spin .8s linear infinite; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------- Formulir ---------- */
.field { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.field > label, .field-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.field .help { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5; }
.field .err { font-size: var(--fs-xs); color: var(--danger); }
.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: .62rem .85rem; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg-deep); color: var(--ink); outline: none; transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t);
}
:root[data-theme="light"] .input, :root[data-theme="light"] .textarea, :root[data-theme="light"] .select { background: var(--surface); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.invalid, .textarea.invalid { border-color: color-mix(in oklab, var(--danger) 60%, transparent); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.select { appearance: none; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%238f88a3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .85rem center; }
.input-group { display: flex; align-items: stretch; gap: 0; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .btn { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 0; }
.check { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-size: var(--fs-sm); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.switch { position: relative; display: inline-flex; align-items: center; gap: .7rem; cursor: pointer; font-size: var(--fs-sm); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 44px; height: 26px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line); position: relative; transition: background var(--t) var(--ease), border-color var(--t); flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-2); transition: transform var(--t) var(--spring), background var(--t); }
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--ink-on-accent); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 3px; border-radius: var(--r-sm); background: var(--bg-deep); border: 1px solid var(--line); max-width: 100%; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: .42rem .8rem; border-radius: 7px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); white-space: nowrap; display: inline-flex; gap: .4rem; align-items: center; transition: background var(--t) var(--ease), color var(--t); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 4px 12px -6px rgba(0,0,0,.4); }

/* ---------- Lencana, chip, meter ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 99px; font-size: .72rem; font-weight: 600; line-height: 1.5; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge.gold { background: var(--accent-soft); color: var(--accent-ink); }
.badge.ok { background: color-mix(in oklab, var(--ok) 18%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in oklab, var(--warn) 18%, transparent); color: var(--warn); }
.badge.danger { background: color-mix(in oklab, var(--danger) 18%, transparent); color: var(--danger); }
.badge.violet { background: var(--accent-2-soft); color: color-mix(in oklab, var(--accent-2) 70%, #fff); }
.chip { display: inline-flex; align-items: center; gap: .45rem; padding: .38rem .7rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: var(--fs-sm); max-width: 100%; transition: border-color var(--t), background var(--t), color var(--t), transform var(--t-fast); }
.chip:hover { border-color: var(--accent-line); color: var(--ink); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 70%, #fff)); transition: width var(--t-slow) var(--ease-out); }
.meter.warn > i { background: var(--warn); } .meter.danger > i { background: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-3); flex: 0 0 auto; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ok) 20%, transparent); }
.dot.warn { background: var(--warn); } .dot.danger { background: var(--danger); }
.kbd { font-family: var(--mono); font-size: .74rem; padding: .05rem .38rem; border-radius: 5px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); }

/* ---------- Animasi ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes slide-left { from { transform: translateX(100%); } to { transform: none; } }
@keyframes slide-right { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes weave { 0% { stroke-dashoffset: var(--len, 120); } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: calc(var(--len, 120) * -1); } }
@keyframes glint { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes caret { 0%, 100% { opacity: 1; } 50% { opacity: .15; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .55; } 50% { transform: scale(1.06); opacity: .9; } }
.anim-rise { animation: rise var(--t-slow) var(--ease-out) both; }
.anim-pop { animation: pop var(--t) var(--ease-out) both; }
.anim-fade { animation: fade var(--t) var(--ease) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }

/* Benang emas (indikator kerja AI) */
.weave { width: 44px; height: 26px; flex: 0 0 auto; }
.weave path { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: var(--len, 120); animation: weave 2.4s var(--ease) infinite; }
.weave path:nth-child(2) { stroke: var(--accent-2); opacity: .8; animation-delay: -.8s; }
.weave path:nth-child(3) { opacity: .5; animation-delay: -1.6s; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: 0 0 auto; }
.skeleton { border-radius: var(--r-xs); background: linear-gradient(90deg, var(--surface-2) 0, var(--surface-3) 40%, var(--surface-2) 80%) 0 0 / 800px 100%; animation: shimmer 1.4s linear infinite; }

/* ---------- Lapisan (modal, sheet, menu, toast) ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 80; animation: fade var(--t) var(--ease) both; }
.modal { position: fixed; z-index: 90; inset: 0; margin: auto; height: fit-content; width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop var(--t) var(--ease-out) both; }
.modal.wide { width: min(860px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem .6rem; }
.modal-head h2 { margin: 0; font-size: var(--fs-lg); font-weight: 700; flex: 1; min-width: 0; }
.modal-body { padding: .4rem 1.25rem 1.1rem; overflow-y: auto; }
.modal-foot { display: flex; gap: .6rem; justify-content: flex-end; padding: .8rem 1.25rem 1.15rem; flex-wrap: wrap; }
.drawer { position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: slide-left var(--t-slow) var(--ease-out) both; }
.drawer.wide { width: min(820px, 100vw); }
.menu { position: fixed; z-index: 100; min-width: 200px; max-width: min(320px, calc(100vw - 24px)); padding: .35rem; border-radius: var(--r-md); background: var(--surface-2); box-shadow: var(--shadow-pop); animation: pop var(--t-fast) var(--ease-out) both; max-height: min(70dvh, 520px); overflow-y: auto; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: .65rem; padding: .55rem .7rem; border: 0; border-radius: var(--r-xs); background: none; text-align: left; color: var(--ink); text-decoration: none; font-size: var(--fs-sm); }
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: var(--surface-3); outline: none; }
.menu button.danger { color: var(--danger); }
.menu .menu-sep { height: 1px; background: var(--line); margin: .3rem .2rem; }
.menu .menu-note { padding: .35rem .7rem .5rem; font-size: var(--fs-xs); color: var(--ink-3); }
.toasts { position: fixed; z-index: 120; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r-md); background: var(--surface-3); color: var(--ink); box-shadow: var(--shadow-pop); font-size: var(--fs-sm); animation: toast-in var(--t) var(--spring) both; }
.toast.error { border-left: 3px solid var(--danger); } .toast.ok { border-left: 3px solid var(--ok); }
.tooltip { position: fixed; z-index: 130; pointer-events: none; padding: .4rem .6rem; border-radius: var(--r-xs); background: var(--surface-3); color: var(--ink); font-size: var(--fs-xs); box-shadow: var(--shadow-soft); max-width: 260px; animation: fade var(--t-fast) both; }

@media (max-width: 640px) {
  .modal { inset: auto 0 0 0; margin: 0; width: 100vw; max-height: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sheet-up var(--t-slow) var(--ease-out) both; padding-bottom: env(safe-area-inset-bottom); }
  .modal::before { content: ""; display: block; width: 42px; height: 4px; border-radius: 4px; background: var(--line); margin: .55rem auto 0; }
  .modal-foot .btn { flex: 1 1 auto; }
  .drawer { width: 100vw; }
}

/* ---------- Kerangka aplikasi ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.app.sidebar-hidden { grid-template-columns: 0 minmax(0, 1fr); }
.app.with-panel { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--panel-w, minmax(380px, 46%)); }
.app.sidebar-hidden.with-panel { grid-template-columns: 0 minmax(0, 1fr) var(--panel-w, minmax(380px, 50%)); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--bg-deep); border-right: 1px solid var(--line-soft); overflow: hidden; position: relative; }
.sidebar::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 180px; background-image: var(--motif); mask-image: linear-gradient(#000, transparent); -webkit-mask-image: linear-gradient(#000, transparent); pointer-events: none; }
.sb-head { display: flex; align-items: center; gap: .6rem; padding: 1rem 1rem .6rem; position: relative; }
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; text-decoration: none; color: var(--ink); }
.brand img { height: 28px; width: auto; max-width: 140px; object-fit: contain; }
.brand-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -.02em; }
.sb-new { margin: .2rem 1rem .6rem; }
.sb-search { margin: 0 1rem .5rem; position: relative; }
.sb-search .ic { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.sb-search .input { padding-left: 2.3rem; min-height: 40px; background: var(--surface); }
.sb-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .6rem .4rem; }
.sb-link { display: flex; align-items: center; gap: .7rem; padding: .5rem .65rem; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; border: 0; background: none; width: 100%; text-align: left; }
.sb-link:hover { background: var(--surface); color: var(--ink); }
.sb-link[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
.sb-section { padding: .9rem 1.25rem .35rem; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); display: flex; align-items: center; justify-content: space-between; }
.sb-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 .6rem .8rem; }
.conv-item { display: flex; align-items: center; gap: .4rem; border-radius: var(--r-sm); position: relative; }
.conv-item > a { flex: 1; min-width: 0; display: flex; align-items: center; gap: .55rem; padding: .5rem .65rem; color: var(--ink-2); text-decoration: none; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.conv-item:hover > a, .conv-item > a:focus-visible { background: var(--surface); color: var(--ink); }
.conv-item[aria-current="page"] > a { background: var(--surface-2); color: var(--ink); }
.conv-item[aria-current="page"] > a::before { content: ""; position: absolute; left: 0; top: 22%; bottom: 22%; width: 2px; border-radius: 2px; background: var(--accent); }
.conv-item .more { opacity: 0; transition: opacity var(--t-fast); position: absolute; right: 4px; }
.conv-item:hover .more, .conv-item:focus-within .more, .conv-item .more[aria-expanded="true"] { opacity: 1; }
.conv-item .gen-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: glint 1.2s ease-in-out infinite; flex: 0 0 auto; }
.sb-foot { border-top: 1px solid var(--line-soft); padding: .6rem; }
.user-chip { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .55rem .6rem; border-radius: var(--r-md); border: 0; background: none; text-align: left; }
.user-chip:hover { background: var(--surface); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9rem; color: var(--ink-on-accent); background: radial-gradient(circle at 30% 25%, color-mix(in oklab, var(--accent) 70%, #fff), var(--accent) 60%, color-mix(in oklab, var(--accent) 60%, #000)); flex: 0 0 auto; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.credit-line { font-size: var(--fs-xs); color: var(--ink-3); }

/* Topbar (HP & panel) */
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: .4rem; padding: 0 .6rem; border-bottom: 1px solid transparent; flex: 0 0 auto; position: relative; z-index: 5; }
.topbar.bordered { border-bottom-color: var(--line-soft); }
.topbar-title { flex: 1; min-width: 0; font-weight: 600; font-size: var(--fs-sm); text-align: center; }
.topbar-title button { background: none; border: 0; max-width: 100%; padding: .3rem .6rem; border-radius: var(--r-xs); font-weight: 600; }
.topbar-title button:hover { background: var(--surface); }
.desktop-only { } .mobile-only { display: none !important; }

@media (max-width: 900px) {
  .app, .app.with-panel, .app.sidebar-hidden, .app.sidebar-hidden.with-panel { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(86vw, 320px); transform: translateX(-102%); transition: transform var(--t-slow) var(--ease-out); box-shadow: var(--shadow-pop); padding-top: env(safe-area-inset-top); }
  .app.sidebar-open .sidebar { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 65; background: var(--scrim); animation: fade var(--t) both; }
  .desktop-only { display: none !important; } .mobile-only { display: inline-flex !important; }
  .conv-item .more { opacity: 1; }
}

/* ---------- Chat ---------- */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.thread { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.thread-inner { width: 100%; max-width: 780px; margin: 0 auto; padding: 1.2rem 1.25rem 2rem; display: flex; flex-direction: column; gap: 1.6rem; }
.msg { display: flex; flex-direction: column; gap: .5rem; min-width: 0; animation: rise var(--t-slow) var(--ease-out) both; }
.msg.user { align-items: flex-end; }
.msg.user .bubble { max-width: min(88%, 620px); padding: .75rem 1rem; border-radius: var(--r-lg) var(--r-lg) var(--r-xs) var(--r-lg); background: var(--surface-2); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; line-height: 1.6; }
.msg.user .attachments { justify-content: flex-end; }
.msg.ai .ai-head { display: flex; align-items: center; gap: .55rem; font-size: var(--fs-xs); color: var(--ink-3); min-height: 22px; }
.ai-mark { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft)); color: var(--accent-ink); flex: 0 0 auto; }
.ai-mark .ic { width: 14px; height: 14px; }
.msg-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; opacity: .0; transition: opacity var(--t); min-height: 32px; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions, .msg.last .msg-actions { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: 1; } }
.msg-actions .btn { color: var(--ink-3); }
.msg-actions .btn:hover { color: var(--ink); }
.msg-actions .btn[aria-pressed="true"] { color: var(--accent-ink); }
.branch-nav { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.msg-meta { font-size: var(--fs-xs); color: var(--ink-3); }
.status-line { display: flex; align-items: center; gap: .7rem; color: var(--ink-2); font-size: var(--fs-sm); padding: .2rem 0; }
.status-line .phase { animation: fade var(--t) both; }
.msg-error { border-left: 2px solid var(--danger); padding: .6rem .9rem; border-radius: 0 var(--r-sm) var(--r-sm) 0; background: color-mix(in oklab, var(--danger) 8%, transparent); font-size: var(--fs-sm); display: flex; flex-direction: column; gap: .55rem; }
.msg-warn { border-left: 2px solid var(--warn); padding: .45rem .8rem; border-radius: 0 var(--r-sm) var(--r-sm) 0; background: color-mix(in oklab, var(--warn) 8%, transparent); font-size: var(--fs-xs); color: var(--ink-2); }
.streaming-caret::after { content: ""; display: inline-block; width: .5em; height: 1em; margin-left: 2px; vertical-align: -.15em; border-radius: 2px; background: var(--accent); animation: caret 1s ease-in-out infinite; box-shadow: 0 0 12px var(--accent); }

/* Lampiran */
.attachments { display: flex; gap: .5rem; flex-wrap: wrap; max-width: 100%; }
.att { display: inline-flex; align-items: center; gap: .55rem; max-width: min(100%, 280px); padding: .42rem .65rem .42rem .45rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); font-size: var(--fs-sm); position: relative; animation: pop var(--t) var(--ease-out) both; }
.att .att-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-ink); flex: 0 0 auto; overflow: hidden; }
.att .att-ic img { width: 100%; height: 100%; object-fit: cover; }
.att .att-name { font-weight: 600; font-size: var(--fs-sm); }
.att .att-sub { font-size: .72rem; color: var(--ink-3); }
.att.failed { border-color: color-mix(in oklab, var(--danger) 45%, transparent); }
.att.failed .att-sub { color: var(--danger); }
.att .att-x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--ink-2); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.att .att-progress { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.att .att-progress > i { display: block; height: 100%; background: var(--accent); transition: width var(--t) var(--ease); }
.msg-image { display: block; border-radius: var(--r-md); overflow: hidden; max-width: min(100%, 520px); border: 1px solid var(--line); background: var(--surface); cursor: zoom-in; animation: pop var(--t-slow) var(--ease-out) both; }
.msg-image img { display: block; width: 100%; height: auto; }
.image-grid { display: flex; flex-wrap: wrap; gap: .6rem; }

/* Kartu artefak di dalam pesan */
.art-card { display: flex; align-items: center; gap: .85rem; width: 100%; max-width: 560px; padding: .8rem .9rem; margin: .4rem 0; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); text-align: left; color: var(--ink); position: relative; overflow: hidden; transition: border-color var(--t), transform var(--t-fast), background var(--t); }
.art-card:hover { border-color: var(--accent-line); background: var(--surface-2); }
.art-card:active { transform: scale(.99); }
.art-card .art-ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: 0 0 auto; }
.art-card .art-title { font-weight: 700; font-size: var(--fs-sm); }
.art-card .art-sub { font-size: var(--fs-xs); color: var(--ink-3); }
.art-card.streaming::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: shimmer-bar 1.6s var(--ease) infinite; }
@keyframes shimmer-bar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* Sambutan (percakapan kosong) */
.welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem 1.25rem 1rem; gap: 1.1rem; min-height: 0; }
.welcome-motif { width: 92px; height: 92px; }
.welcome-motif path { fill: none; stroke: var(--accent); stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw 1.6s var(--ease-out) forwards; }
.welcome-motif path:nth-child(2) { stroke: var(--accent-2); animation-delay: .25s; }
.welcome-motif path:nth-child(3) { animation-delay: .5s; opacity: .6; }
.welcome-motif circle { fill: var(--accent); animation: breathe 3.2s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.welcome h1 { margin: 0; font-size: clamp(1.6rem, 4.2vw, var(--fs-3xl)); line-height: 1.15; font-weight: 800; letter-spacing: -.028em; max-width: 20ch; text-wrap: balance; animation: rise .7s var(--ease-out) .35s both; }
.welcome p { margin: 0; max-width: 46ch; color: var(--ink-2); text-wrap: pretty; animation: rise .7s var(--ease-out) .45s both; }
.starters { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; max-width: 720px; animation: rise .7s var(--ease-out) .55s both; }
.starters .chip { padding: .5rem .85rem; }

/* Komposer */
.composer-wrap { flex: 0 0 auto; padding: .4rem 1.25rem calc(.9rem + env(safe-area-inset-bottom)); position: relative; }
.composer-wrap::before { content: ""; position: absolute; left: 0; right: 0; top: -28px; height: 28px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.composer { max-width: 780px; margin: 0 auto; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-soft); transition: border-color var(--t), box-shadow var(--t); }
.composer:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-soft); }
.composer.dragging { border-color: var(--accent); border-style: dashed; }
.composer .attachments { padding: .75rem .85rem 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.composer .attachments::-webkit-scrollbar { display: none; }
.composer textarea { display: block; width: 100%; border: 0; outline: none; background: transparent; resize: none; padding: .9rem 1.1rem .4rem; min-height: 52px; max-height: 40dvh; line-height: 1.55; color: var(--ink); }
.composer textarea::placeholder { color: var(--ink-3); }
.composer-bar { display: flex; align-items: center; gap: .35rem; padding: .35rem .5rem .5rem; flex-wrap: nowrap; min-width: 0; }
.composer-bar .tools { display: flex; align-items: center; gap: .25rem; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.composer-bar .tools::-webkit-scrollbar { display: none; }
.pill-btn { display: inline-flex; align-items: center; gap: .4rem; height: 34px; padding: 0 .7rem; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; transition: border-color var(--t), color var(--t), background var(--t); }
.pill-btn:hover { color: var(--ink); background: var(--surface-2); }
.pill-btn[aria-pressed="true"] { border-color: var(--accent-line); color: var(--accent-ink); background: var(--accent-soft); }
.send-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: var(--ink-on-accent); flex: 0 0 auto; transition: transform var(--t-fast) var(--spring), opacity var(--t), background var(--t); box-shadow: 0 8px 20px -8px color-mix(in oklab, var(--accent) 80%, transparent); }
.send-btn:hover { transform: scale(1.05); }
.send-btn:active { transform: scale(.94); }
.send-btn[disabled] { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }
.send-btn.stop { background: var(--ink); color: var(--bg); }
.composer-hint { max-width: 780px; margin: .45rem auto 0; display: flex; gap: .6rem; justify-content: space-between; font-size: .72rem; color: var(--ink-3); flex-wrap: wrap; }
.drop-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: color-mix(in oklab, var(--bg) 70%, transparent); backdrop-filter: blur(4px); animation: fade var(--t) both; pointer-events: none; }
.drop-overlay > div { padding: 2rem 2.5rem; border-radius: var(--r-xl); border: 2px dashed var(--accent); color: var(--accent-ink); font-weight: 700; background: var(--surface); }
.jump-down { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% + 8px); z-index: 4; border-radius: 99px; box-shadow: var(--shadow-soft); animation: pop var(--t) var(--ease-out) both; }

@media (max-width: 900px) {
  .thread-inner { padding: .8rem 1rem 1.5rem; gap: 1.3rem; }
  .composer-wrap { padding: .3rem .6rem calc(.55rem + env(safe-area-inset-bottom)); }
  .composer { border-radius: var(--r-lg); }
  .composer-hint { display: none; }
  .msg.user .bubble { max-width: 92%; }
}

/* ---------- Isi Markdown ---------- */
.prose { font-size: 1rem; line-height: 1.72; color: var(--ink); overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.prose > :first-child { margin-top: 0; } .prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 .85em; }
.prose h1, .prose h2, .prose h3, .prose h4 { line-height: 1.3; letter-spacing: -.015em; margin: 1.4em 0 .5em; font-weight: 700; }
.prose h1 { font-size: 1.55rem; } .prose h2 { font-size: 1.28rem; } .prose h3 { font-size: 1.1rem; } .prose h4 { font-size: 1rem; }
.prose ul, .prose ol { margin: 0 0 .9em; padding-left: 1.4em; }
.prose li { margin: .25em 0; } .prose li::marker { color: var(--accent-ink); }
.prose li > input[type="checkbox"] { accent-color: var(--accent); margin-right: .4em; }
.prose blockquote { margin: 1em 0; padding: .1em 1em; border-left: 2px solid var(--accent); color: var(--ink-2); }
.prose a { color: var(--accent-ink); }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 1.6em 0; }
.prose img { border-radius: var(--r-sm); }
.prose code { font-family: var(--mono); font-size: .86em; padding: .12em .36em; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.prose .table-wrap { overflow-x: auto; margin: 1em 0; border-radius: var(--r-sm); border: 1px solid var(--line); max-width: 100%; }
.prose table { border-collapse: collapse; width: 100%; font-size: .92em; }
.prose th, .prose td { padding: .55em .8em; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; min-width: 7ch; }
.prose th { background: var(--surface-2); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }
.code-block { margin: 1em 0; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--bg-deep); overflow: hidden; max-width: 100%; }
:root[data-theme="light"] .code-block { background: #faf9fd; }
.code-head { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem .35rem .85rem; font-size: .74rem; color: var(--ink-3); border-bottom: 1px solid var(--line-soft); }
.code-head .lang { flex: 1; font-family: var(--mono); }
.code-head button { border: 0; background: none; color: var(--ink-3); display: inline-flex; gap: .35rem; align-items: center; padding: .25rem .5rem; border-radius: 6px; font-size: .74rem; }
.code-head button:hover { background: var(--surface-2); color: var(--ink); }
.code-block pre { margin: 0; padding: .85rem 1rem; overflow-x: auto; font-family: var(--mono); font-size: .84rem; line-height: 1.6; tab-size: 2; }
.code-block pre code { background: none; border: 0; padding: 0; font-size: inherit; white-space: pre; word-break: normal; overflow-wrap: normal; }
/* highlight.js — palet benang emas */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name { color: #c9a0ff; }
.hljs-string, .hljs-attr, .hljs-template-tag, .hljs-addition { color: #9fd8a8; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #f2b36d; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #e8cb8a; }
.hljs-comment, .hljs-quote, .hljs-meta { color: #7f789a; font-style: italic; }
.hljs-type, .hljs-class .hljs-title, .hljs-params { color: #8fc0ff; }
.hljs-variable, .hljs-property, .hljs-attribute, .hljs-tag { color: #f0a3a3; }
.hljs-deletion { color: #ea7a72; } .hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }
:root[data-theme="light"] .hljs-keyword, :root[data-theme="light"] .hljs-built_in, :root[data-theme="light"] .hljs-name { color: #7a3fc4; }
:root[data-theme="light"] .hljs-string, :root[data-theme="light"] .hljs-attr { color: #2a7a3b; }
:root[data-theme="light"] .hljs-number, :root[data-theme="light"] .hljs-literal { color: #b35a00; }
:root[data-theme="light"] .hljs-title, :root[data-theme="light"] .hljs-section { color: #8a5d00; }
:root[data-theme="light"] .hljs-comment { color: #8a84a0; }
:root[data-theme="light"] .hljs-type, :root[data-theme="light"] .hljs-params { color: #2f5fb5; }
:root[data-theme="light"] .hljs-variable, :root[data-theme="light"] .hljs-property, :root[data-theme="light"] .hljs-tag { color: #b3343a; }

/* ---------- Panel artefak ---------- */
.panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); border-left: 1px solid var(--line-soft); position: relative; animation: slide-left var(--t-slow) var(--ease-out) both; }
.panel-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 3; }
.panel-resize:hover::after, .panel-resize.active::after { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; background: var(--accent-line); }
.panel-head { display: flex; align-items: center; gap: .5rem; padding: .6rem .6rem .6rem 1rem; border-bottom: 1px solid var(--line-soft); min-height: 58px; }
.panel-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.panel-title input { border: 0; background: none; font-weight: 700; font-size: var(--fs-md); padding: .1rem .3rem; margin-left: -.3rem; border-radius: 6px; width: 100%; min-width: 0; text-overflow: ellipsis; }
.panel-title input:hover { background: var(--surface-2); }
.panel-title input:focus { outline: none; background: var(--surface-2); }
.panel-sub { font-size: var(--fs-xs); color: var(--ink-3); padding-left: .05rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.panel-tabs { display: flex; gap: .25rem; padding: .5rem .8rem; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; }
.panel-tabs::-webkit-scrollbar { display: none; }
.panel-body { flex: 1; min-height: 0; overflow: auto; position: relative; }
.panel-body .doc { max-width: 760px; margin: 0 auto; padding: 1.5rem 1.6rem 3rem; }
.panel-foot { display: flex; gap: .5rem; align-items: center; padding: .6rem .8rem; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.editor { width: 100%; height: 100%; min-height: 60dvh; border: 0; outline: none; resize: none; padding: 1.2rem 1.4rem; background: var(--bg-deep); color: var(--ink); font-family: var(--mono); font-size: .88rem; line-height: 1.65; tab-size: 2; }
.code-view { display: grid; grid-template-columns: auto minmax(0, 1fr); font-family: var(--mono); font-size: .84rem; line-height: 1.62; }
.code-view .ln { padding: 1rem .6rem 1rem 1rem; text-align: right; color: var(--ink-3); user-select: none; border-right: 1px solid var(--line-soft); white-space: pre; opacity: .7; }
.code-view pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; }
.code-view pre code { white-space: pre; }
.preview-frame { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.slides { padding: 1.2rem; display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.slide { width: 100%; max-width: 860px; aspect-ratio: 16 / 9; border-radius: var(--r-md); background: #111116; color: #f3f1ea; padding: 5% 6%; position: relative; overflow: hidden; box-shadow: var(--shadow-soft); display: flex; flex-direction: column; container-type: inline-size; animation: pop var(--t-slow) var(--ease-out) both; }
.slide::before { content: ""; width: 44px; height: 3px; border-radius: 3px; background: var(--accent); margin-bottom: 4cqi; flex: 0 0 auto; }
.slide h2 { margin: 0 0 3cqi; font-size: 4.2cqi; line-height: 1.2; font-weight: 700; color: #f3f1ea; }
.slide .slide-body { font-size: 2.3cqi; color: #c9c6bb; overflow: hidden; }
.slide .slide-body li::marker { color: var(--accent); }
.slide .slide-body code { background: #1f1f27; border-color: #2c2c34; color: #e7e4da; }
.slide .slide-body .code-block { background: #1a1a21; border-color: #2c2c34; }
.slide.title-slide { justify-content: center; }
.slide.title-slide h2 { font-size: 6.4cqi; }
.slide .slide-num { position: absolute; right: 3.5%; bottom: 4%; font-size: 1.5cqi; color: #8d8a80; }
.slide-notes { width: 100%; max-width: 860px; font-size: var(--fs-sm); color: var(--ink-2); padding: .6rem .9rem; border-left: 2px solid var(--accent-line); }
.diagram-view { padding: 1.5rem; display: flex; justify-content: center; }
.diagram-view svg { max-width: 100%; height: auto; }
.data-view { padding: 1rem 1.1rem 2rem; display: flex; flex-direction: column; gap: 1.2rem; }
.chart-fig { margin: 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line-soft); position: relative; }
.chart-fig svg { display: block; width: 100%; height: auto; }
.chart-fig [data-tip] { cursor: crosshair; }
.chart-fig [data-tip]:hover { filter: brightness(1.15); }
.grid-table { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); max-height: 60dvh; }
.grid-table table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .86rem; }
.grid-table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; z-index: 1; }
.grid-table th, .grid-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
.grid-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.version-list { display: flex; flex-direction: column; }
.version-item { display: flex; gap: .75rem; align-items: center; padding: .65rem .9rem; border-bottom: 1px solid var(--line-soft); }
.version-item[aria-current="true"] { background: var(--accent-soft); }
@media (max-width: 900px) {
  .panel { position: fixed; z-index: 75; inset: 0; border: 0; animation: sheet-up var(--t-slow) var(--ease-out) both; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .panel-resize { display: none; }
  .panel-body .doc { padding: 1.1rem 1.1rem 2.5rem; }
}

/* ---------- Halaman umum (pustaka, akun, proyek) ---------- */
.page { flex: 1; min-height: 0; overflow-y: auto; }
.page-inner { max-width: 980px; margin: 0 auto; padding: 1.6rem 1.5rem 4rem; display: flex; flex-direction: column; gap: 1.4rem; }
.page-inner.narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.page-head p { margin: .3rem 0 0; color: var(--ink-2); max-width: 60ch; }
.section { display: flex; flex-direction: column; gap: .9rem; }
.section > h2 { margin: 0; font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.section > p { margin: -.4rem 0 0; color: var(--ink-3); font-size: var(--fs-sm); }
.panel-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 1.15rem 1.2rem; display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
.list { display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.list-row { display: flex; align-items: center; gap: .85rem; padding: .8rem .3rem; border-bottom: 1px solid var(--line-soft); min-width: 0; color: inherit; text-decoration: none; transition: background var(--t-fast); }
a.list-row:hover, button.list-row:hover { background: var(--surface); }
button.list-row { width: 100%; border-left: 0; border-right: 0; border-top: 0; background: none; text-align: left; }
.list-row .lr-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent-ink); flex: 0 0 auto; overflow: hidden; }
.list-row .lr-ic img { width: 100%; height: 100%; object-fit: cover; }
.list-row .lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.list-row .lr-title { font-weight: 600; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.list-row .lr-sub { font-size: var(--fs-xs); color: var(--ink-3); overflow-wrap: anywhere; }
.list-row .lr-side { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .75rem; padding: 2.6rem 1rem; color: var(--ink-2); }
.empty .ic { width: 34px; height: 34px; color: var(--accent-ink); }
.empty h3 { margin: 0; color: var(--ink); font-size: var(--fs-lg); }
.empty p { margin: 0; max-width: 44ch; font-size: var(--fs-sm); color: var(--ink-3); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a { border: 0; background: none; padding: .7rem .9rem; font-weight: 600; font-size: var(--fs-sm); color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; transition: color var(--t), border-color var(--t); }
.tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.stat-row { display: flex; flex-wrap: wrap; gap: 1.6rem 2.4rem; }
.stat { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.stat .v { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em; }
.stat .l { font-size: var(--fs-xs); color: var(--ink-3); }
.kv { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: .45rem 1rem; font-size: var(--fs-sm); }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.notice { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--r-md); background: var(--accent-soft); color: var(--ink); font-size: var(--fs-sm); }
.notice .ic { color: var(--accent-ink); margin-top: .15rem; }
.notice.warn { background: color-mix(in oklab, var(--warn) 12%, transparent); } .notice.warn .ic { color: var(--warn); }
.notice.danger { background: color-mix(in oklab, var(--danger) 12%, transparent); } .notice.danger .ic { color: var(--danger); }
.notice.ok { background: color-mix(in oklab, var(--ok) 12%, transparent); } .notice.ok .ic { color: var(--ok); }
@media (max-width: 720px) {
  .page-inner { padding: 1rem 1rem 3rem; gap: 1.1rem; }
  .page-head h1 { font-size: var(--fs-xl); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .panel-card { border-radius: 0; border-left: 0; border-right: 0; margin: 0 -1rem; padding: 1rem; background: transparent; border-color: var(--line-soft); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: .1rem; } .kv dd { margin-bottom: .5rem; }
}

/* ---------- Tabel responsif (admin) ---------- */
.dtable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.dtable th { text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); padding: .55rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dtable td { padding: .7rem .7rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; overflow-wrap: anywhere; }
.dtable tr.clickable { cursor: pointer; } .dtable tr.clickable:hover td { background: var(--surface); }
.dtable td.num, .dtable th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dtable-wrap { overflow-x: auto; }
@media (max-width: 760px) {
  .dtable thead { display: none; }
  .dtable, .dtable tbody, .dtable tr, .dtable td { display: block; width: 100%; }
  .dtable tr { padding: .7rem 0; border-bottom: 1px solid var(--line-soft); }
  .dtable td { border: 0; padding: .18rem 0; display: flex; gap: .75rem; justify-content: space-between; align-items: baseline; text-align: right; }
  .dtable td::before { content: attr(data-label); color: var(--ink-3); font-size: var(--fs-xs); text-align: left; flex: 0 0 auto; max-width: 45%; }
  .dtable td.primary { font-weight: 600; font-size: var(--fs-md); text-align: left; justify-content: flex-start; }
  .dtable td.primary::before { display: none; }
  .dtable td.num { text-align: right; }
}

/* ---------- Admin ---------- */
.admin { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.admin-nav { background: var(--bg-deep); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; position: relative; }
.admin-nav::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 140px; background-image: var(--motif); mask-image: linear-gradient(#000, transparent); -webkit-mask-image: linear-gradient(#000, transparent); pointer-events: none; }
.admin-nav nav { flex: 1; overflow-y: auto; padding: .3rem .6rem 1rem; display: flex; flex-direction: column; gap: 2px; position: relative; }
.admin-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.admin-main .page-inner { max-width: 1120px; }
.setup-steps { display: flex; flex-direction: column; }
.setup-step { display: flex; gap: .9rem; padding: .85rem 0; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.setup-step .st-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-3); color: var(--ink-3); }
.setup-step.ok .st-ic { background: color-mix(in oklab, var(--ok) 20%, transparent); color: var(--ok); }
.setup-step.todo .st-ic { background: var(--accent-soft); color: var(--accent-ink); box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 8%, transparent); }
.setup-step.warn .st-ic { background: color-mix(in oklab, var(--warn) 18%, transparent); color: var(--warn); }
.setup-step h4 { margin: 0 0 .15rem; font-size: var(--fs-sm); }
.setup-step p { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.source-tag { font-size: .7rem; padding: .05rem .45rem; border-radius: 99px; border: 1px solid var(--line); color: var(--ink-3); white-space: nowrap; }
.source-tag.panel { border-color: var(--accent-line); color: var(--accent-ink); }
.source-tag.env { border-color: color-mix(in oklab, var(--info) 50%, transparent); color: var(--info); }
.provider-row { display: flex; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.provider-row .pv-main { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: .25rem; }
.provider-row .pv-name { font-weight: 700; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.pv-account { margin-top:.8rem; padding:1rem; border:1px solid var(--line-soft); border-radius:12px; background:var(--bg-soft,transparent); min-width:0; }
.pv-account-head { gap:.35rem; margin-bottom:.7rem; }
.pv-account-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr)); gap:.7rem; }
.pv-metric { display:flex; flex-direction:column; gap:.25rem; min-width:0; }
.pv-metric span,.pv-metric small,.pv-account-note { font-size:.78rem; color:var(--muted); line-height:1.5; }
.pv-metric strong { font-size:1.3rem; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.pv-account-note { margin:.5rem 0; }
.pv-manual { margin:.8rem 0; padding:.8rem; border:1px dashed var(--line-soft); border-radius:8px; }
.pv-manual>.row { margin-bottom:.6rem; font-size:.8rem; gap:.5rem; }
.pv-account-local { display:flex; flex-wrap:wrap; justify-content:space-between; gap:.5rem; font-size:.8rem; margin:.8rem 0; color:var(--muted); }
.pv-account-rates { border-top:1px solid var(--line-soft); padding-top:.6rem; margin-bottom:.7rem; }
.pv-account-rates summary { cursor:pointer; font-size:.8rem; }
.pv-rate { display:flex; flex-direction:column; gap:.3rem; padding:.5rem 0; font-size:.8rem; }
.pv-rate .badge { white-space:normal; overflow-wrap:anywhere; }
.preset-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.preset-grid button { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; padding: .75rem .9rem; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); min-width: 170px; flex: 1 1 170px; text-align: left; transition: border-color var(--t), background var(--t), transform var(--t-fast); }
.preset-grid button:hover { border-color: var(--accent-line); }
.preset-grid button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.preset-grid button:active { transform: scale(.98); }
.preset-grid .pg-name { font-weight: 700; font-size: var(--fs-sm); }
.preset-grid .pg-sub { font-size: var(--fs-xs); color: var(--ink-3); }
.mini-chart { width: 100%; height: 140px; }
.log-line { font-family: var(--mono); font-size: .76rem; padding: .35rem 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; color: var(--ink-2); }
@media (max-width: 900px) {
  .admin { grid-template-columns: minmax(0, 1fr); }
  .admin-nav { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(86vw, 300px); transform: translateX(-102%); transition: transform var(--t-slow) var(--ease-out); box-shadow: var(--shadow-pop); }
  .admin.nav-open .admin-nav { transform: none; }
}

/* ---------- Halaman masuk ---------- */
.auth-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 20% 10%, color-mix(in oklab, var(--accent-2) 22%, var(--bg-deep)) 0%, var(--bg-deep) 55%); display: flex; flex-direction: column; justify-content: space-between; padding: 2.4rem; }
.auth-art::before { content: ""; position: absolute; inset: 0; background-image: var(--motif); background-size: 34px 34px; opacity: .9; mask-image: radial-gradient(70% 70% at 40% 45%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(70% 70% at 40% 45%, #000 20%, transparent 75%); }
.auth-art > * { position: relative; }
.auth-art .art-quote { max-width: 30ch; font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; text-wrap: balance; animation: rise .8s var(--ease-out) .2s both; }
.auth-art .art-motif { width: min(340px, 70%); aspect-ratio: 1; margin: 1rem 0; }
.auth-art .art-motif path { fill: none; stroke: var(--accent); stroke-width: .8; stroke-dasharray: 900; stroke-dashoffset: 900; animation: draw 2.6s var(--ease-out) forwards; }
.auth-art .art-motif path:nth-child(even) { stroke: var(--accent-2); opacity: .6; animation-delay: .4s; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 1.1rem; animation: rise .6s var(--ease-out) both; }
.auth-card h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.025em; }
.auth-card .sub { margin: -.5rem 0 .3rem; color: var(--ink-2); }
.or-line { display: flex; align-items: center; gap: .8rem; color: var(--ink-3); font-size: var(--fs-xs); }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 860px) {
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: auto; padding: 1.4rem 1.25rem 1.6rem; }
  .auth-art .art-motif { display: none; }
  .auth-art .art-quote { font-size: 1.5rem; margin-top: 1.6rem; }
  .auth-form { align-items: flex-start; padding: 1.6rem 1.25rem 2.5rem; }
}

/* ---------- Boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 200; transition: opacity var(--t-slow) var(--ease); }
.boot.done { opacity: 0; pointer-events: none; }
.boot svg { width: 64px; height: 64px; }
.boot path { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw 1.2s var(--ease-out) forwards; }
.boot path + path { stroke: var(--accent-2); animation-delay: .2s; }

/* ==========================================================================
   Tambahan: halaman umum, panel admin, berbagi
   ========================================================================== */
.page-topbar { position: sticky; top: 0; background: color-mix(in oklab, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
@media (min-width: 901px) { .page-topbar { display: none; } }
.page-inner.wide { max-width: 1280px; }
details.adv { border-top: 1px solid var(--line-soft); padding-top: .7rem; margin-top: .4rem; }
details.adv > summary, details > summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); list-style: none; display: inline-flex; align-items: center; gap: .4rem; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform var(--t) var(--ease); margin-right: .2rem; }
details[open] > summary::before { transform: rotate(45deg); }
.chart-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.chart-table { border-top: 1px solid var(--line-soft); padding: .5rem .8rem; }
.chart-table > summary { font-size: var(--fs-xs); }
.chart-table[open] { padding-bottom: 0; }
.chart-table .grid-table { margin: .5rem -.8rem 0; }
@media (max-width: 1100px) { .chart-pair { grid-template-columns: minmax(0, 1fr); } }

/* Paket (akun) */
.plan-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.plan-item { border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .55rem; min-width: 0; background: var(--surface); }
.plan-item.current { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.plan-item h3 { margin: 0; font-size: var(--fs-lg); }
.plan-item p { margin: 0; font-size: var(--fs-sm); }
.plan-price { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; }
.plan-price .muted { font-size: var(--fs-sm); font-weight: 500; letter-spacing: 0; }
.plan-feats { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; font-size: var(--fs-sm); color: var(--ink-2); }
.plan-feats li { display: flex; gap: .55rem; align-items: flex-start; overflow-wrap: anywhere; }
.plan-feats .ic { color: var(--accent-ink); margin-top: .15rem; }
@media (max-width: 720px) {
  .plan-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .plan-item { border-radius: 0; border-width: 0 0 1px; background: transparent; padding: 1rem 0; box-shadow: none; }
  .plan-item.current { box-shadow: none; border-color: var(--line-soft); }
  .plan-item.current h3::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: .5rem; vertical-align: middle; }
}

/* Halaman tautan berbagi */
.share-page { min-height: 100dvh; display: flex; flex-direction: column; }
.share-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .8rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--line-soft); background: color-mix(in oklab, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.share-head h1 { margin: 0 0 .3rem; font-size: clamp(1.4rem, 3.4vw, 2rem); font-weight: 800; letter-spacing: -.025em; line-height: 1.2; }
.share-head p { margin: 0; font-size: var(--fs-sm); }

/* Provider & key */
.key-list { display: flex; flex-direction: column; gap: .35rem; margin-top: .35rem; }
.key-item { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; font-size: var(--fs-sm); padding: .35rem .55rem; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line-soft); min-width: 0; }
.key-item .ic { color: var(--accent-ink); }
@media (max-width: 720px) { .key-item { background: transparent; border-width: 0 0 1px; border-radius: 0; padding: .45rem 0; } }

/* Routing */
.route-task { display: flex; flex-direction: column; gap: .7rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line-soft); }
.route-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; counter-reset: none; }
.route-list li { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: .55rem .7rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); animation: pop var(--t) var(--ease-out) both; }
.route-list li.off { opacity: .55; }
.route-pos { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.route-cond { flex-basis: 100%; padding: .6rem 0 .2rem; border-top: 1px dashed var(--line); margin-top: .2rem; }
@media (max-width: 720px) { .route-list li { background: transparent; border-width: 0 0 1px; border-radius: 0; padding: .6rem 0; } }

/* Pengaturan */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.settings-nav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 2px; }
.settings-nav .sb-link .badge { flex: 0 0 auto; }
.settings-body { min-width: 0; display: flex; flex-direction: column; gap: .4rem; padding-bottom: 5rem; }
.setting-row { display: flex; gap: .6rem; align-items: flex-start; padding: 1rem 0; border-bottom: 1px solid var(--line-soft); transition: background var(--t); position: relative; }
.setting-row.dirty::before { content: ""; position: absolute; left: -.9rem; top: 1rem; bottom: 1rem; width: 2px; border-radius: 2px; background: var(--accent); }
.setting-row .field > label { gap: .45rem; }
.secret-mask { display: inline-flex; align-items: center; width: auto; min-width: 150px; color: var(--ink-2); letter-spacing: .04em; }
.color-swatch { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: none; cursor: pointer; flex: 0 0 auto; }
.color-swatch::-webkit-color-swatch-wrapper { padding: 4px; } .color-swatch::-webkit-color-swatch { border: 0; border-radius: 6px; }
.brand-preview { width: 64px; height: 64px; border-radius: var(--r-md); border: 1px dashed var(--line); display: grid; place-items: center; background: var(--bg-deep); overflow: hidden; color: var(--ink-3); flex: 0 0 auto; }
.brand-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.save-bar { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 6; display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem .7rem 1.1rem; border-radius: var(--r-lg); background: var(--surface-3); box-shadow: var(--shadow-pop); font-weight: 600; font-size: var(--fs-sm); flex-wrap: wrap; }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
  .settings-nav { position: sticky; top: var(--topbar-h); z-index: 4; flex-direction: row; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: .4rem 1rem; background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-soft); }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav .sb-link { width: auto; flex: 0 0 auto; white-space: nowrap; padding: .45rem .7rem; }
  .settings-nav .sb-link .grow { overflow: visible; }
  .setting-row.dirty::before { left: -.55rem; }
  .save-bar { margin: 0 -.25rem; }
}

/* Sentuhan kecil */
.list-row[aria-pressed="true"] { background: var(--accent-soft); }
.admin-main .page { position: relative; }
.admin-main .page::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 220px; pointer-events: none; background: radial-gradient(60% 100% at 85% 0%, var(--accent-2-soft), transparent 70%); opacity: .7; }
.admin-main .page-inner { position: relative; }
.stat .v { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Judul panel artefak: input di layar lebar, teks yang bisa turun baris di layar sempit */
.panel-title .title-text { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-title .title-text.when-narrow { display: none; }
.panel-actions { display: flex; align-items: center; gap: .15rem; flex: 0 0 auto; }
@media (max-width: 900px) {
  .panel-head { flex-wrap: wrap; row-gap: .2rem; padding: .55rem .5rem .45rem .9rem; }
  .panel-title { flex: 1 1 calc(100% - 90px); }
  .panel-title .title-input { display: none; }
  .panel-title .title-text, .panel-title .title-text.when-narrow { display: block; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
  .panel-actions { order: 3; flex-basis: 100%; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line-soft); padding-top: .3rem; margin-top: .1rem; }
}
/* Item percakapan: sisakan ruang untuk tombol opsi supaya judul tidak tertutup */
.conv-item:hover > a, .conv-item:focus-within > a { padding-right: 2.4rem; }
@media (max-width: 900px) { .conv-item > a { padding-right: 2.4rem; } }
/* Tab & tabel di HP: tidak ada teks yang terpotong */
@media (max-width: 720px) {
  .tabs { flex-wrap: wrap; border-bottom: 0; gap: .35rem; overflow: visible; }
  .tabs button, .tabs a { border: 1px solid var(--line); border-radius: 99px; padding: .42rem .85rem; margin: 0; }
  .tabs [aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }
  .dtable td.primary { flex-direction: column; align-items: flex-start; gap: .1rem; }
}
.settings-select { display: none; }
@media (max-width: 900px) {
  .settings-nav { display: none; }
  .settings-select { display: flex; position: sticky; top: var(--topbar-h); z-index: 4; margin: 0 -1rem; padding: .5rem 1rem; background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 900px) {
  .conv-item > a .ellipsis { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
  .topbar-title button.ellipsis { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .82rem; line-height: 1.3; text-align: center; }
}
/* Isi modal/drawer: kepala & kaki tetap terlihat, hanya bagian tengah yang bergulir */
.modal > div, .modal > form, .drawer > div, .drawer > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.modal .modal-body, .drawer .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.modal-head, .modal-foot { flex: 0 0 auto; }
.drawer .modal-foot { border-top: 1px solid var(--line-soft); padding-bottom: calc(1.15rem + env(safe-area-inset-bottom)); }
/* Desain dari Editor Diagram (SVG draw.io) tampil di atas kertas terang agar warna aslinya terbaca di tema gelap. */
.diagram-view.drawio-view { margin: 1rem; padding: 1.25rem; background: #fff; border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 0 0 1px var(--line); }
.diagram-view.drawio-view img { display: block; max-width: 100%; height: auto; }
/* Diagram chat: toolbar gaya/tata letak dan kanvas per gaya (ala draw.io). Gaya selain Modern selalu "kertas". */
.dg-wrap { display: flex; flex-direction: column; }
.dg-toolbar { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding: .85rem 1rem 0; }
.diagram-view.dg-canvas { margin: .85rem 1rem 1rem; padding: 2rem 1.5rem; border-radius: 14px; overflow: auto; justify-content: safe center; box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(15, 23, 42, .06);
  --dg-bg: #fbfcfe; --dg-grid: #edf0f6; --dg-grid-major: #dde3ee; background-color: var(--dg-bg); background-position: -1px -1px; }
.diagram-view.dg-canvas svg { flex: 0 0 auto; }
.dg-grid, .dg-paper, .dg-blueprint {
  background-image: linear-gradient(var(--dg-grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--dg-grid-major) 1px, transparent 1px),
    linear-gradient(var(--dg-grid) 1px, transparent 1px), linear-gradient(90deg, var(--dg-grid) 1px, transparent 1px);
  background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px; }
.dg-grid.dg-dark { --dg-bg: #171c27; --dg-grid: rgba(255, 255, 255, .045); --dg-grid-major: rgba(255, 255, 255, .085); }
.dg-paper { --dg-bg: #fffdf8; --dg-grid: #f4eee2; --dg-grid-major: #ebe1cf; }
.dg-blueprint { --dg-bg: #123a6b; --dg-grid: rgba(255, 255, 255, .07); --dg-grid-major: rgba(255, 255, 255, .16); }
.dg-plain { --dg-bg: #ffffff; }
.dg-dots { --dg-bg: #fffef7; background-image: radial-gradient(#d9d3bd 1.2px, transparent 1.3px); background-size: 18px 18px; }
@media (max-width: 700px) { .dg-toolbar { padding: .75rem .75rem 0; } .diagram-view.dg-canvas { margin: .75rem; padding: 1.25rem .75rem; } }
/* Diagram lebar: kanvas digeser (bukan dipotong), latar kisi ikut bergeser; zoom dan layar penuh. */
.diagram-view.dg-canvas { display: block; background-attachment: local; }
.diagram-view.dg-canvas svg { display: block; margin: 0 auto; }
.dg-wrap.is-full { background: var(--bg); overflow: auto; height: 100vh; box-sizing: border-box; padding-bottom: .5rem; }
.dg-wrap.is-full .dg-canvas { flex: 1; min-height: 0; margin: .75rem 1rem 0; }
/* Toolbar diagram ringkas satu baris: menu Tata letak & Gaya, zoom tersegmen, tombol layar penuh. */
.dg-toolbar { align-items: center; gap: .5rem; }
.dg-select { display: inline-flex; align-items: center; gap: .35rem; height: 32px; padding: 0 .2rem 0 .65rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: .8rem; cursor: pointer; }
.dg-select > span { color: var(--ink-3); font-weight: 600; font-size: .74rem; white-space: nowrap; }
.dg-select select { border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 600; height: 30px; padding: 0 .25rem; cursor: pointer; outline: none; }
.dg-select:focus-within { border-color: var(--accent-line, var(--accent)); }
.dg-select select option { color: #111; }
.dg-seg { display: inline-flex; height: 32px; margin-left: auto; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.dg-seg button { border: 0; background: transparent; color: var(--ink); min-width: 32px; padding: 0 .5rem; font: inherit; font-size: .85rem; cursor: pointer; }
.dg-seg button + button { border-left: 1px solid var(--line); }
.dg-seg .dg-pct { min-width: 54px; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.dg-seg button:hover, .dg-icon:hover { background: var(--surface-2); }
.dg-icon { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); cursor: pointer; }
@media (max-width: 520px) { .dg-seg { margin-left: 0; } }

/* Header chat tetap satu baris saat panel artefak membuat kolom chat sempit. */
.app .chat .topbar { container-type: inline-size; }
.app .chat .topbar .btn.sm { white-space: nowrap; flex-shrink: 0; }
@container (max-width: 760px) { .app .chat .topbar a.btn[href="/connections"] { display: none; } }
@container (max-width: 600px) { .app .chat .topbar .tb-label { display: none; } }
/* Banner "Versi baru tersedia" (js/lib/update-check.js): di atas toast, tidak menutupi area ketik. */
.update-banner { position: fixed; z-index: 121; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: .75rem; width: max-content; max-width: calc(100vw - 24px);
  padding: .6rem .6rem .6rem 1rem; border-radius: var(--r-md); background: var(--surface-3); color: var(--ink); box-shadow: var(--shadow-pop); border: 1px solid var(--accent-line, var(--line)); font-size: var(--fs-sm); animation: update-in .25s var(--ease-out, ease) both; }
.update-banner b { font-weight: 650; }
.update-reload { border: 0; border-radius: var(--r-sm); padding: .45rem .85rem; background: var(--accent); color: var(--ink-on-accent); font: inherit; font-weight: 650; cursor: pointer; white-space: nowrap; }
.update-close { border: 0; background: transparent; color: var(--ink-2); font-size: 1.15rem; line-height: 1; width: 28px; height: 28px; border-radius: var(--r-xs); cursor: pointer; }
.update-close:hover { background: var(--surface-2); }
@keyframes update-in { from { opacity: 0; transform: translate(-50%, -8px); } }
@media (max-width: 560px) { .update-banner { width: calc(100vw - 24px); } .update-banner span { flex: 1; } }
/* Komentar revisi artefak (views/artifact-comments.js): tombol "Komentari" saat teks ditandai, laci komentar di panel. */
.cm-btn { position: relative; }
.cm-btn.is-on { background: var(--accent-soft); color: var(--accent-ink); }
.cm-badge { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--ink-on-accent); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.cm-pick { position: fixed; z-index: 60; transform: translateX(-50%); display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .75rem; border: 1px solid var(--accent-line, var(--line)); border-radius: 999px; background: var(--surface-3); color: var(--ink); font: inherit; font-size: .8rem; font-weight: 600; box-shadow: var(--shadow-pop); cursor: pointer; animation: update-in .15s ease-out both; }
.cm-pick:hover { background: var(--accent-soft); }
.cm-drawer { position: absolute; z-index: 20; top: 0; right: 0; bottom: 0; width: min(340px, 100%); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(0, 0, 0, .12); }
.cm-head { display: flex; align-items: center; gap: .5rem; padding: .85rem .75rem .75rem 1rem; border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
.cm-head .muted { font-size: .78rem; }
.cm-scroll { flex: 1; min-height: 0; overflow: auto; padding: .75rem 1rem 1rem; }
.cm-hint { font-size: .8rem; line-height: 1.55; color: var(--ink-2); margin: .25rem 0 .75rem; }
.cm-form { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.cm-form textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 72px; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); font: inherit; font-size: .85rem; line-height: 1.5; }
.cm-form textarea:focus { outline: none; border-color: var(--accent-line, var(--accent)); }
.cm-form-actions { display: flex; justify-content: flex-end; gap: .4rem; }
.cm-list { list-style: none; margin: 0 0 .75rem; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.cm-item { padding: .7rem .75rem; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--bg); }
.cm-item.is-done { opacity: .62; }
.cm-quote { margin: 0 0 .45rem; padding: .3rem .55rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 6px 6px 0; font-size: .78rem; line-height: 1.45; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cm-general { display: inline-block; margin-bottom: .35rem; font-size: .7rem; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; color: var(--ink-3); }
.cm-body { margin: 0; font-size: .85rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-meta { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .5rem; font-size: .72rem; color: var(--ink-3); }
.cm-actions { display: inline-flex; gap: .7rem; }
.cm-actions .link-btn { font-size: .74rem; }
.link-btn.danger { color: var(--danger); }
.cm-toggle { font-size: .78rem; margin: .25rem 0 .6rem; }
.cm-foot { padding: .75rem 1rem; border-top: 1px solid var(--line-soft); }
.cm-foot .btn { width: 100%; justify-content: center; }
/* Workspace tim (views/team.js) dan dialog bagikan proyek (views/pages.js). */
.team-kicker { font-size: .74rem; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }
.team-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: .9rem; }
.team-avatar.big { width: 56px; height: 56px; font-size: 1.4rem; margin-bottom: .75rem; }
.team-role { width: auto; min-width: 128px; height: 34px; padding: 0 .6rem; font-size: .82rem; flex: 0 0 auto; }
.team-member .chip { flex: 0 0 auto; }
.team-create { display: flex; align-items: flex-end; gap: .6rem; flex-wrap: wrap; }
.team-create .field, .team-create > :first-child { flex: 1 1 260px; margin: 0; }
.team-empty .btn { margin-top: .25rem; }
.team-note { margin-top: 1rem; font-size: .85rem; }
.team-invite { display: flex; flex-direction: column; gap: .75rem; }
.team-invite-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.team-invite-form input { flex: 1 1 240px; }
.team-invite-form select { flex: 0 0 auto; width: auto; min-width: 120px; }
.team-link { align-items: flex-start; gap: .75rem; }
.team-link p { margin: .25rem 0 .5rem; font-size: .82rem; }
.team-url { display: block; padding: .45rem .6rem; border-radius: var(--r-xs); background: var(--surface-2); font-family: var(--mono); font-size: .76rem; overflow-wrap: anywhere; user-select: all; }
.team-sub { font-size: .9rem; margin: 1.25rem 0 .5rem; }
.team-how ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .45rem; line-height: 1.55; font-size: .9rem; color: var(--ink-2); }
.team-danger { border-top: 1px solid var(--line-soft); padding-top: 1.25rem; }
.btn.outline.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.team-join { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .5rem; padding-top: 2rem; }
.team-join p { max-width: 520px; }
.project-shared-chip { font-size: .68rem; padding: .1rem .45rem; margin-left: .35rem; vertical-align: middle; }
@media (max-width: 560px) { .team-role { min-width: 108px; } }
