/* =====================================================================
   Rekkan.Ai — Control Panel
   Light, minimal, editorial. Inter 400/500. EcoBytes Group.
   Tokens mirror the netraruntime.com system: white canvas, #fafafa soft
   blocks, #e5e5e5 hairlines, #252525 primary actions, #737373 muted text.
   ===================================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-panel: #f5f5f5;
  --bg-hover: #f0f0f0;

  --line: #e5e5e5;
  --line-strong: #d4d4d4;

  --ink: #0a0a0a;
  --ink-head: #252525;
  --ink-dim: #525252;
  --ink-mute: #737373;
  /* The one accent in the system (same mint as the landing page). Used for the
     active-nav dot and nothing else: a fill here would fight the hairlines. */
  --accent: #0f7f5c;

  /* semantic tones — used only for the status dot, never for fills */
  --ok: #16a34a;
  --live: #2563eb;
  --warn: #d97706;
  --bad: #dc2626;
  --rose: #dc2626;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-card: 12px;
  --radius-lg: 20px;

  --shadow: 0 12px 32px -20px rgba(0, 0, 0, 0.28);
  --shadow-pop: 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 44px -26px rgba(0, 0, 0, 0.3);

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'DM Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 236px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  font-family: var(--font);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 { color: var(--ink-head); font-weight: 500; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: #e5e5e5; }

/* Scrollbars ------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: #d4d4d4 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #d4d4d4;
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #b3b3b3; background-clip: content-box; }

/* Boot ------------------------------------------------------------------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 22px;
  justify-items: center;
  position: relative;
  z-index: 1;
}
.boot__mark {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--ink-head);
}
.boot__mark span { color: var(--ink-mute); }
.boot__bar {
  width: 168px;
  height: 2px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.boot__bar span {
  display: block;
  height: 100%;
  width: 40%;
  background: #252525;
  animation: boot-slide 1.15s var(--ease) infinite;
}
@keyframes boot-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}

.noscript {
  padding: 40px;
  color: var(--ink-mute);
  font-family: var(--font);
  text-align: center;
}

/* Layout ----------------------------------------------------------------- */
.app { position: relative; z-index: 1; min-height: 100vh; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}
.brand__glyph {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 500;
  font-size: 14px;
  color: #ffffff;
  background: #252525;
  flex: none;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__name { font-size: 15px; font-weight: 500; letter-spacing: -0.02em; color: var(--ink-head); }
.brand__name b { color: var(--ink-mute); font-weight: 500; }
.brand__sub {
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 12px 10px 6px;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-dim);
  border: 1px solid transparent;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
  cursor: pointer;
}
.nav__item:hover { background: var(--bg-soft); color: var(--ink); }
.nav__item.is-active {
  background: var(--bg-panel);
  color: var(--ink);
  border-color: var(--line);
}
/* One accent, and only in the dot: enough to say "you are here" without
   painting a fill the rest of the shell does not use. */
.nav__item.is-active .nav__dot { background: var(--accent); width: 7px; height: 7px; }
.nav__dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--line-strong);
  flex: none;
  transition: background 0.16s var(--ease);
}
.nav__text { font-size: 13.5px; }

.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 16px; }
.sidebar__meta {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-mute);
}
.sidebar__meta b { color: var(--ink-dim); font-weight: 500; }

.main { min-width: 0; display: flex; flex-direction: column; }
.main__inner { padding: 34px 38px 72px; max-width: 1280px; width: 100%; }

/* Page head -------------------------------------------------------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}
.page-head__eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 10px;
}
.page-head__eyebrow a:hover { color: var(--ink); }
.page-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.028em;
  line-height: 1.15;
}
.page-head p { margin: 8px 0 0; color: var(--ink-mute); max-width: 62ch; font-size: 13.5px; }
.page-head__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease), opacity 0.16s var(--ease);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg-soft); border-color: var(--line-strong); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid #252525; outline-offset: 2px; }

.btn--primary {
  background: #252525;
  color: #ffffff;
  border-color: #252525;
}
.btn--primary:hover:not(:disabled) { background: #0a0a0a; border-color: #0a0a0a; }
.btn--danger { color: var(--bad); border-color: #e8c9c9; background: #ffffff; }
.btn--danger:hover:not(:disabled) { background: #fdf3f3; border-color: #dc2626; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-dim); }
.btn--ghost:hover:not(:disabled) { background: var(--bg-soft); border-color: var(--line); color: var(--ink); }

/* Toolbar-scale buttons (headers, cards) */
.btn--sm { padding: 6px 11px; font-size: 12px; border-radius: var(--radius-sm); }

/* The Library's in-row actions. `btn--xs` was referenced by the row buttons
 * without ever being defined, so "Unduh"/"Hapus" rendered at the full button
 * size and made every row 62px tall. */
.btn--xs { padding: 3px 8px; font-size: 12px; border-radius: var(--radius-sm); line-height: 1.4; }

/* Segmented control --------------------------------------------------------
   One control, three jobs: the ID|EN language switch, the agent-dashboard
   mode switch and its four tabs. Same vocabulary as .auth__switch. */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-panel);
  flex-wrap: wrap;
}
.seg button {
  border: none;
  background: transparent;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-mute);
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.seg button:focus-visible { outline: 2px solid #252525; outline-offset: 2px; }
/* The language switch is a header control, so it stays compact. */
.seg--sm button { padding: 4px 10px; font-size: 11px; letter-spacing: 0.06em; }
.sidebar__lang { padding: 0 10px 14px; }

/* Embedded frame (Advanced agent dashboard) ------------------------------ */
.frame {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #ffffff;
}
.frame iframe {
  display: block;
  width: 100%;
  height: min(72vh, 780px);
  border: 0;
  background: #ffffff;
}

/* Cards ------------------------------------------------------------------ */
.card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
}
.card--pad-lg { padding: 24px; }
.card__title {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 14px;
  font-weight: 500;
}
.card--soft { background: var(--bg-soft); border-color: var(--line); }

.grid { display: grid; gap: 16px; }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--side { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); align-items: start; }
@media (max-width: 980px) { .grid--side { grid-template-columns: 1fr; } }

/* Workload card ---------------------------------------------------------- */
.wl-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
  text-align: left;
  overflow: hidden;
}
.wl-card:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.wl-card.is-selected { border-color: #252525; box-shadow: inset 0 0 0 1px #252525; }
.wl-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.wl-card__name { font-size: 15.5px; font-weight: 500; letter-spacing: -0.015em; color: var(--ink-head); }
.wl-card__tag { font-size: 12.5px; color: var(--ink-dim); }
.wl-card__sum { font-size: 13px; color: var(--ink-mute); margin: 0; }
.wl-card__meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }

/* Chips / pills ---------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--ink-dim);
  white-space: nowrap;
}
.chip--mint { color: #15803d; background: #f0fdf4; border-color: #d7f0de; }
.chip--azure { color: #1d4ed8; background: #f2f6fe; border-color: #dbe6fb; }
.chip--amber { color: #b45309; background: #fefaf1; border-color: #f7e6c6; }
.chip--rose { color: #b91c1c; background: #fef5f5; border-color: #f6dcdc; }
.chip--violet { color: #6d28d9; background: #f8f5ff; border-color: #e7dffb; }
.chip--mute { color: var(--ink-mute); }

/* Status badge ----------------------------------------------------------- */
.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--ink-head);
  white-space: nowrap;
}
.state-badge__dot { width: 6px; height: 6px; border-radius: 99px; background: var(--ink-mute); flex: none; }
.state-badge[data-tone='live'] .state-badge__dot { background: var(--live); animation: pulse 1.6s infinite; }
.state-badge[data-tone='ok'] .state-badge__dot { background: var(--ok); }
.state-badge[data-tone='warn'] .state-badge__dot { background: var(--warn); }
.state-badge[data-tone='bad'] .state-badge__dot { background: var(--bad); }
.state-badge[data-tone='idle'] .state-badge__dot { background: #a3a3a3; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  70% { box-shadow: 0 0 0 5px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Table ------------------------------------------------------------------ */
/* overflow-x rather than hidden: a long instance name must not wrap the cell
   onto a second line and stagger the row heights — the table scrolls instead. */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius-card); overflow-x: auto; overflow-y: hidden; background: #ffffff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  white-space: nowrap;
}
.tbl td { padding: 15px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.14s var(--ease); }
.tbl tbody tr:hover { background: var(--bg-soft); }
.tbl tr.is-clickable { cursor: pointer; }
.tbl tr.is-clickable:focus-visible { outline: 2px solid #252525; outline-offset: -2px; }
.tbl .mono { font-family: var(--mono); font-size: 12px; color: var(--ink-mute); white-space: nowrap; }
.tbl__name { font-weight: 500; color: var(--ink-head); }
.tbl__name small { display: block; color: var(--ink-mute); font-size: 11.5px; font-weight: 400; font-family: var(--mono); }

/* Meta list -------------------------------------------------------------- */
.meta { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.meta__row {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 12px;
  padding: 10px 14px;
  background: #ffffff;
  font-size: 13px;
}
.meta__k { color: var(--ink-mute); }
.meta__v { color: var(--ink); word-break: break-word; font-family: var(--mono); font-size: 12.5px; }
.meta__v.is-plain { font-family: var(--font); font-size: 13px; }

/* Timeline --------------------------------------------------------------- */
.timeline { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
.tl-step { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 14px; padding-bottom: 18px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step__rail { position: relative; display: flex; justify-content: center; }
.tl-step__rail::before {
  content: '';
  position: absolute;
  top: 14px;
  bottom: -18px;
  width: 1px;
  background: var(--line);
}
.tl-step:last-child .tl-step__rail::before { display: none; }
.tl-step__dot {
  width: 11px;
  height: 11px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  margin-top: 3px;
  z-index: 1;
}
.tl-step__label { font-size: 13.5px; color: var(--ink-mute); }
.tl-step__note { font-size: 11.5px; color: #a3a3a3; font-family: var(--mono); }
.tl-step[data-s='done'] .tl-step__dot { background: var(--ok); border-color: var(--ok); }
.tl-step[data-s='done'] .tl-step__label { color: var(--ink-dim); }
.tl-step[data-s='done'] .tl-step__rail::before { background: #d7f0de; }
.tl-step[data-s='active'] .tl-step__dot {
  background: var(--live);
  border-color: var(--live);
  animation: pulse 1.6s infinite;
}
.tl-step[data-s='active'] .tl-step__label { color: var(--ink); font-weight: 500; }
.tl-step[data-s='failed'] .tl-step__dot { background: var(--bad); border-color: var(--bad); }
.tl-step[data-s='failed'] .tl-step__label { color: var(--bad); }

/* Event log -------------------------------------------------------------- */
.log {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--bg-soft);
  max-height: 420px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
}
.log__row { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 8px 13px; border-bottom: 1px solid var(--line); }
.log__row:last-child { border-bottom: none; }
.log__ts { color: var(--ink-mute); }
.log__msg { color: var(--ink-dim); word-break: break-word; }
.log__kind { color: #a3a3a3; }

/* Forms ------------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field__label { font-size: 12.5px; color: var(--ink-head); font-weight: 500; }
.field__hint { font-size: 11.5px; color: var(--ink-mute); }
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: #a3a3a3; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: #252525;
  box-shadow: 0 0 0 3px #f0f0f0;
}
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-mute) 50%), linear-gradient(135deg, var(--ink-mute) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; cursor: pointer; }
.select option { background: #ffffff; color: var(--ink); }
.textarea { font-family: var(--mono); font-size: 12.5px; min-height: 96px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
/* Deploy wizard, gateway credentials sub-step: one platform's fields at a time. */
.gw-cred { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 16px; }

/* Alerts ----------------------------------------------------------------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid #f6dcdc;
  background: #fef5f5;
  color: #b91c1c;
  margin-bottom: 16px;
}
.alert--ok { border-color: #d7f0de; background: #f0fdf4; color: #15803d; }
.alert--info { border-color: #dbe6fb; background: #f2f6fe; color: #1d4ed8; }
.alert--warn { border-color: #f7e6c6; background: #fefaf1; color: #b45309; }
.alert .btn { margin-left: auto; }
.alert[hidden] { display: none; }

/* Documentation view (#/docs) ------------------------------------------- *
 * The sidebar list plus the document body. The body is the bundle's own
 * `<article>` dropped in verbatim, so its typography is scoped here rather than
 * loading web/docs/docs.css — that stylesheet owns `body` and `a` for the public
 * site and must not reach into the panel.
 * ---------------------------------------------------------------------- */
.docs-layout {
  display: grid;
  grid-template-columns: minmax(220px, 268px) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.docs-side {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 12px;
  background: var(--bg-soft);
}

.docs-search { position: relative; margin-bottom: 10px; }
.docs-search__input {
  width: 100%;
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.docs-search__input:focus { outline: 2px solid var(--ink-head); outline-offset: -1px; }
.docs-search__results {
  margin-top: 6px;
  max-height: 40vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.docs-search__results[hidden] { display: none; }
.docs-search__hit {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-dim);
  cursor: pointer;
}
.docs-search__hit:hover { background: var(--bg-panel); color: var(--ink); }
.docs-search__hit-title { display: block; }
.docs-search__hit-doc { display: block; color: var(--ink-mute); font-size: 11px; }
.docs-search__results p { margin: 8px 9px; font-size: 12.5px; }

.docs-list__group { margin-top: 12px; }
.docs-list__label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin: 0 0 6px 2px;
}
.docs-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
}
.docs-list__item:hover { background: var(--bg-panel); color: var(--ink); }
.docs-list__item.is-active { background: var(--bg-panel); color: var(--ink); font-weight: 500; }

.docs-main { min-width: 0; }

#app-doc-body { max-width: 78ch; }
#app-doc-body h1, #app-doc-body h2, #app-doc-body h3,
#app-doc-body h4, #app-doc-body h5, #app-doc-body h6 {
  color: var(--ink-head);
  line-height: 1.25;
  margin: 1.7em 0 0.5em;
  scroll-margin-top: 18px;
}
#app-doc-body h1 { font-size: 26px; font-weight: 600; margin-top: 0; }
#app-doc-body h2 { font-size: 19px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
#app-doc-body h3 { font-size: 16px; font-weight: 600; }
#app-doc-body h4 { font-size: 14px; font-weight: 600; color: var(--ink-dim); }
#app-doc-body p, #app-doc-body li { color: var(--ink-dim); font-size: 13.5px; }
#app-doc-body ul, #app-doc-body ol { padding-left: 20px; }
#app-doc-body strong { color: var(--ink-head); }
#app-doc-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
}
#app-doc-body pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  overflow-x: auto;
}
#app-doc-body pre code { background: none; border: 0; padding: 0; font-size: 12.5px; color: var(--ink-head); }
#app-doc-body blockquote {
  margin: 1em 0;
  padding: 2px 12px;
  border-left: 2px solid var(--line-strong);
  color: var(--ink-mute);
}
#app-doc-body hr { border: 0; border-top: 1px solid var(--line); margin: 1.8em 0; }
#app-doc-body .doc-table { overflow-x: auto; margin: 1.1em 0; }
#app-doc-body table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
#app-doc-body th, #app-doc-body td {
  border: 1px solid var(--line);
  padding: 6px 9px;
  text-align: left;
  vertical-align: top;
}
#app-doc-body th { background: var(--bg-soft); color: var(--ink-head); font-weight: 600; }
#app-doc-body .doc-anchor { float: left; margin-left: -16px; color: var(--line-strong); text-decoration: none; }
#app-doc-body .doc-anchor:hover { color: var(--accent); }
#app-doc-body .doc-link-gone { color: var(--ink-mute); border-bottom: 1px dotted var(--line-strong); }

@media (max-width: 820px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-side { position: static; max-height: none; }
}

/* Modal / drawer --------------------------------------------------------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 10, 10, 0.4);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade 0.18s var(--ease);
}
.scrim--right { place-items: stretch end; padding: 0; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(620px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 26px;
  animation: rise 0.22s var(--ease);
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer {
  width: min(560px, 100%);
  height: 100vh;
  overflow: auto;
  background: #ffffff;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  padding: 28px;
  animation: slide-in 0.24s var(--ease);
}
@keyframes slide-in { from { transform: translateX(18px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal__head, .drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.modal__title, .drawer__title { font-size: 19px; font-weight: 500; letter-spacing: -0.02em; margin: 0; }
.modal__sub { color: var(--ink-mute); font-size: 13px; margin: 6px 0 0; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.x-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-mute);
  display: grid;
  place-items: center;
  flex: none;
  font-size: 13px;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.x-btn:hover { background: var(--bg-panel); color: var(--ink); border-color: var(--line-strong); }

/* Wizard ----------------------------------------------------------------- */
.steps { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; align-items: center; }
.steps__item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-mute);
}
.steps__num {
  width: 20px;
  height: 20px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-family: var(--mono);
  background: #ffffff;
}
.steps__item.is-done .steps__num { background: var(--bg-panel); border-color: var(--line-strong); color: var(--ink-dim); }
.steps__item.is-active { color: var(--ink); }
.steps__item.is-active .steps__num { background: #252525; border-color: #252525; color: #ffffff; }
.steps__sep { color: #d4d4d4; align-self: center; font-size: 12px; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 12px; max-height: 44vh; overflow: auto; padding: 2px; }

/* KV editor (secrets) ---------------------------------------------------- */
.kv { display: flex; flex-direction: column; gap: 9px; }
.kv__row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; }
.kv__row .input { padding: 8px 11px; font-size: 13px; }

/* Login ------------------------------------------------------------------ */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  background: #ffffff;
}
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth__aside { display: none; } }

.auth__aside {
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 54px 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 1;
}
.auth__aside > * { position: relative; z-index: 1; }
.auth__kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.auth__headline {
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 500;
  color: var(--ink-head);
  margin: 16px 0 0;
  max-width: 17ch;
}
.auth__headline em { font-style: normal; color: var(--ink-mute); }
.auth__lede { color: var(--ink-mute); max-width: 44ch; margin: 18px 0 0; font-size: 14px; }
.auth__stats { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 32px; }
.auth__stat b { display: block; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; color: var(--ink-head); font-family: var(--mono); }
.auth__stat span { font-size: 10.5px; color: var(--ink-mute); letter-spacing: 0.1em; text-transform: uppercase; }

.auth__panel {
  display: grid;
  place-items: center;
  padding: 46px 34px;
  background: #ffffff;
}
.auth__form { width: min(400px, 100%); }
.auth__switch {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-panel);
  margin-bottom: 26px;
}
.auth__switch button {
  border: none;
  background: transparent;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mute);
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.auth__switch button.is-active { background: #ffffff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.auth h2 { margin: 0 0 6px; font-size: 22px; font-weight: 500; letter-spacing: -0.025em; }
.auth__note { color: var(--ink-mute); font-size: 13px; margin: 0 0 24px; }

/* Empty / loading -------------------------------------------------------- */
.empty {
  text-align: center;
  padding: 58px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--bg-soft);
  color: var(--ink-mute);
}
.empty h3 { color: var(--ink-head); font-weight: 500; margin: 0 0 8px; font-size: 16px; letter-spacing: -0.015em; }
.empty p { margin: 0 auto 18px; max-width: 46ch; font-size: 13px; }

.skeleton {
  height: 96px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: linear-gradient(100deg, #fafafa 30%, #f0f0f0 50%, #fafafa 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s infinite linear;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }

.muted { color: var(--ink-mute); }
.dim { color: var(--ink-dim); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.list-clean { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list-clean li { display: flex; gap: 9px; font-size: 13px; color: var(--ink-dim); }
.list-clean li::before { content: '—'; color: #a3a3a3; flex: none; }

.spinner {
  width: 14px; height: 14px; border-radius: 99px;
  border: 2px solid var(--line);
  border-top-color: #252525;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-host {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: 380px;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  animation: rise 0.2s var(--ease);
}
.toast--ok { border-color: #d7f0de; color: #15803d; }
.toast--bad { border-color: #f6dcdc; color: #b91c1c; }

/* Progress bar (elapsed) ------------------------------------------------- */
.progress {
  height: 3px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  background: #252525;
  transition: width 0.6s var(--ease);
}

/* ----------------------------------------------------------------------
   Per-agent file manager (F5)
   Same system as the rest of the panel: white canvas, hairlines, one accent.
   ---------------------------------------------------------------------- */

/* Box page tabs (Overview | Files) — a link, not a control: it is a route. */
.tabs { display: flex; gap: 18px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 1px 10px;
  margin-bottom: -1px;
  font-size: 13px;
  color: var(--ink-mute);
  border-bottom: 1px solid transparent;
  text-decoration: none;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink-head); border-bottom-color: #252525; }
.tab:focus-visible { outline: 2px solid #252525; outline-offset: 2px; }

.files-drop { position: relative; }
/* The drag affordance: only a hairline and a tint — the panel stays quiet. */
.files-drop[data-dragover="1"] { outline: 2px dashed var(--line-strong); outline-offset: 6px; border-radius: var(--radius-card); }
.files-drop__hint {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-mute);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
.files-drop[data-dragover="1"] .files-drop__hint { display: flex; }
.files-drop__hint strong { color: var(--ink-head); font-weight: 500; }

.files-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 16px 0 14px;
  font-size: 13px;
}
.files-crumbs__link {
  border: none;
  background: none;
  padding: 2px 0;
  font: inherit;
  color: var(--ink-dim);
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.files-crumbs__link:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.files-crumbs__link:focus-visible { outline: 2px solid #252525; outline-offset: 2px; }
.files-crumbs__sep { color: var(--line-strong); }
.files-crumbs__here { color: var(--ink-head); font-weight: 500; }

/* A visible, keyboard-operable file input — never display:none. */
.files-picker { font-size: 12.5px; color: var(--ink-dim); max-width: 260px; }

.files-status { margin-bottom: 16px; }
.files-status:empty { display: none; }
.files-up { border-top: 1px solid var(--line); padding: 10px 0; }
.files-up:first-of-type { border-top: none; }
.files-up__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.files-up__name { color: var(--ink-head); font-weight: 500; max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-up__bytes { font-family: var(--mono); font-size: 11.5px; }
.files-up__actions { margin-left: auto; display: flex; gap: 4px; }
.files-list { min-height: 60px; }
.files-row__actions { white-space: nowrap; text-align: right; }
.files-name-error { margin: 0; color: var(--bad); font-size: 12.5px; }
.files-name-error[hidden] { display: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: column; border-right: none; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav__label { display: none; }
  .sidebar__foot { margin-top: 0; }
  .main__inner { padding: 24px 18px 60px; }
  .meta__row { grid-template-columns: 1fr; gap: 3px; }
  .page-head { padding-bottom: 18px; margin-bottom: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  #hero-canvas { display: none; }
}

/* ----------------------------------------------------------------------
   Library — shared file storage (c1/c2/c3/system)
   ---------------------------------------------------------------------- */

.library-container {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* Sidebar */
.library-sidebar {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px;
  background: var(--bg-soft);
  height: fit-content;
  position: sticky;
  top: 18px;
}

.library-sidebar__title {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 12px;
  font-weight: 500;
}

.level-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  min-width: 0;
}

/* One authority class per row: the label on its own line, what that class can
 * read underneath it in smaller type.
 *
 * The description used to sit *beside* the label with `white-space: nowrap`, so
 * "Melihat seluruh Library (c1, c2, c3)" ran straight out of the 240px sidebar
 * and past the tab's own border. Stacked and wrapping, it stays inside the box.
 * The class colour is the tab's left border rather than a coloured dot: the same
 * signal without a decorative element. */
.level-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--ink-dim);
  text-align: left;
  cursor: pointer;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.level-tab:hover { background: var(--bg); color: var(--ink); }
.level-tab.is-active { background: var(--bg); color: var(--ink); border-color: var(--line); }

.level-tab__label { font-weight: 500; }

.level-tab__desc {
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-mute);
  white-space: normal;
  overflow-wrap: anywhere;
}

.dept-list { border-top: 1px solid var(--line); padding-top: 12px; }
.dept-list__title {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 8px;
}

.dept-item {
  padding: 5px 10px;
  font-size: 13px;
  color: var(--ink-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s var(--ease);
}

.dept-item:hover { background: var(--bg); color: var(--ink); }
.dept-item.is-active { background: var(--bg); color: var(--ink); font-weight: 500; }
.dept-empty { font-size: 12.5px; color: var(--ink-mute); padding: 4px 0; }

/* A department name and a path segment are operator data: wrap them rather than
 * let a long one widen the sidebar or the table. */
.dept-item span { overflow-wrap: anywhere; }

/* Main content */
.library-main { min-width: 0; }

.library-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.library-tab {
  padding: 8px 16px;
  font-size: 13.5px;
  color: var(--ink-mute);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  transition: color 0.14s var(--ease), border-color 0.14s var(--ease);
}

.library-tab:hover { color: var(--ink); }
.library-tab.is-active { color: var(--ink-head); border-bottom-color: #252525; }

/* File list */
.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.library-header__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 500;
}

.level-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.04em;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  font-size: 13px;
}

.breadcrumb__item {
  color: var(--ink-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  max-width: 100%;
  overflow-wrap: anywhere;
  transition: background 0.12s;
}

.breadcrumb__item:hover { background: var(--bg-soft); color: var(--ink); }
.breadcrumb__item.is-active { color: var(--ink-head); font-weight: 500; }
.breadcrumb__sep { color: var(--line-strong); user-select: none; }

.library-table {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.library-table__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 88px auto;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

.library-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 88px auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  align-items: center;
  transition: background 0.12s var(--ease);
}

.library-row:last-child { border-bottom: none; }
.library-row:hover { background: var(--bg-soft); }
.library-row.is-folder { cursor: pointer; }

/* `min-width: 0` on every cell, and the name wraps: a grid item's default
 * `min-width: auto` is what lets a long name push its column wide and spill past
 * the card's edge instead of wrapping inside it. */
.library-table__col { display: flex; align-items: center; gap: 8px; min-width: 0; }
.library-table__col-name { color: var(--ink-head); font-weight: 500; }
/* Size is a number: right-aligned so the units line up down the column instead
 * of every row starting at a different place. */
.library-table__col-size { font-family: var(--mono); font-size: 12px; color: var(--ink-mute); justify-content: flex-end; text-align: right; padding-right: 18px; }
.library-table__col-actions { justify-content: flex-end; gap: 6px; flex-wrap: wrap; }

/* The permissions table reuses the file table's grid; its third column is a
 * department name, not a byte count, so it must not inherit the right-align. */
.library-table__col-department { color: var(--ink-mute); overflow-wrap: anywhere; }

.library-entry-name { overflow-wrap: anywhere; }

.library-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 16px;
  color: var(--ink-mute);
  font-size: 13.5px;
}

/* Permissions panel */
.perm-form {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px;
  margin-bottom: 20px;
}

.perm-form h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 500;
}

.perm-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

@media (max-width: 800px) {
  /* The library itself stacks at 1080px (see the end of this file); this block
   * only has to undo the four-column permission form. */
  .perm-form__row { grid-template-columns: 1fr 1fr; }
}

.perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.perm-row:last-child { border-bottom: none; }
.perm-row > span:first-child { color: var(--ink-head); font-weight: 500; }

/* Responsive */
@media (max-width: 1080px) {
  /* Stacked before the table is crushed, not after: with the 240px sidebar
   * beside it, a 900px window left the name column 0px wide and the file names
   * spilled out of the card. */
  .library-container { grid-template-columns: 1fr; }
  .library-sidebar { position: static; }
  .library-table__header,
  .library-row { grid-template-columns: minmax(0, 1fr) 72px 80px auto; }
}