/* GBot design system: paper, ink, one signal colour. No blur, no gradients, no radius. */

:root {
  --paper: #f2eee3;
  --paper-2: #e8e2d2;
  --white: #fffdf7;
  --ink: #111111;
  --ink-2: #3a3a3a;
  --muted: #6b675e;
  --signal: #ffcf1a;
  --red: #d7261e;
  --red-bg: #fbe1dd;
  --green: #17803d;
  --green-bg: #d9efd9;
  --line: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lg: 8px 8px 0 var(--ink);
  --display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --body: "Archivo", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --side: 232px;
  --top: 56px;
}

html, body { background: var(--paper); color: var(--ink); }
body { font-family: var(--body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
::selection { background: var(--signal); color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
a { color: inherit; }

/* ---------- type ---------- */
.display { font-family: var(--display); font-stretch: 112%; font-weight: 800; letter-spacing: -0.02em; line-height: 0.98; }
.h1 { font-family: var(--display); font-stretch: 108%; font-weight: 800; font-size: 28px; letter-spacing: -0.015em; line-height: 1.1; }
.h2 { font-family: var(--display); font-stretch: 105%; font-weight: 800; font-size: 19px; letter-spacing: -0.01em; line-height: 1.2; }
.label { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.mark { background: var(--signal); padding: 0 0.12em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; white-space: nowrap; cursor: pointer; text-decoration: none;
  font-family: var(--body); font-size: 14px; font-weight: 700;
  background: var(--white); color: var(--ink); border: var(--line); box-shadow: var(--shadow);
  transition: transform 80ms, box-shadow 80ms, background 80ms;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn-primary { background: var(--signal); }
.btn-primary:hover { background: #ffc300; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: #2a2a2a; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b81d16; }
.btn-flat { box-shadow: none; }
.btn-flat:active { transform: none; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; box-shadow: 3px 3px 0 var(--ink); }
.btn-lg { height: 54px; padding: 0 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { background: var(--paper-2); color: var(--muted); border-color: #b9b3a3; box-shadow: none; cursor: not-allowed; transform: none; }

/* text-style row actions */
.act { font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
  background: none; border: 0; padding: 4px 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.act:hover { background: var(--signal); }
.act-danger { color: var(--red); }
.act-danger:hover { background: var(--red); color: #fff; }
.act-ok { color: var(--green); }
.act-ok:hover { background: var(--green); color: #fff; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span.label { color: var(--ink); }
.input, .textarea, .select {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--white); border: var(--line); border-radius: 0; outline: none;
}
.input, .select { height: 44px; padding: 0 12px; }
.textarea { padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { box-shadow: 4px 4px 0 var(--signal); }
.input[readonly] { background: var(--paper-2); font-family: var(--mono); font-size: 13px; }
.select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 12px) 19px; background-size: 6px 6px; background-repeat: no-repeat; }
.hint { font-size: 12px; color: var(--muted); }
.req { color: var(--red); }

/* ---------- surfaces ---------- */
.box { background: var(--white); border: var(--line); box-shadow: var(--shadow); }
.box-pad { padding: 24px; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: var(--line); background: var(--paper-2); }
.box-ink { background: var(--ink); color: var(--paper); }
.box-signal { background: var(--signal); }
.rule { border: 0; border-top: var(--line); margin: 0; }

.note { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border: var(--line); background: var(--signal); font-size: 14px; }
.note b { font-weight: 700; }

.alert { padding: 12px 14px; border: var(--line); font-size: 14px; font-weight: 600; }
.alert-error { background: var(--red-bg); border-color: var(--red); color: #8f150f; }
.alert-success { background: var(--green-bg); border-color: var(--green); color: #0d5327; }

/* ---------- tags & status ---------- */
.tag { display: inline-block; font-family: var(--mono); font-size: 11px; line-height: 1; padding: 5px 7px; border: 1.5px solid var(--ink); background: var(--paper); white-space: nowrap; }
.tag-signal { background: var(--signal); }
.status { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.status::before { content: ""; width: 9px; height: 9px; border: 1.5px solid var(--ink); background: var(--paper); }
.status-ok::before { background: var(--green); }
.status-bad::before { background: var(--red); }
.status-wait::before { background: var(--signal); }

.count { display: inline-block; min-width: 20px; padding: 2px 6px; font-family: var(--mono); font-size: 11px; font-weight: 600; text-align: center; background: var(--signal); color: var(--ink); border: 1.5px solid var(--ink); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: var(--line); box-shadow: var(--shadow); background: var(--white); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--ink); color: var(--paper); padding: 10px 14px; white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid #d6d0c0; vertical-align: top; }
.table tbody tr:hover td { background: #fbf6e6; }
.table .num { font-family: var(--mono); font-size: 12px; color: var(--muted); width: 1%; white-space: nowrap; }
.table .strong { font-weight: 700; }
.table .right { text-align: right; }
.table .nowrap { white-space: nowrap; }
.table .clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .empty { padding: 48px 14px; text-align: center; color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.kw { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- toolbar / tabs / pager ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search { position: relative; }
.search .input { width: 260px; max-width: 100%; padding-right: 64px; }
.search button { position: absolute; right: 6px; top: 6px; bottom: 6px; padding: 0 10px; border: 0; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 11px; text-transform: uppercase; cursor: pointer; }
@media (max-width: 560px) { .search, .search .input { width: 100%; } }

.tabs { display: inline-flex; border: var(--line); background: var(--white); box-shadow: var(--shadow); }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; font-size: 14px; font-weight: 700; text-decoration: none;
  background: transparent; border: 0; border-right: var(--line); cursor: pointer; color: var(--ink); }
.tab:last-child { border-right: 0; }
.tab:hover { background: var(--paper-2); }
.tab.is-active { background: var(--ink); color: var(--paper); }
@media (max-width: 560px) { .tabs { display: flex; width: 100%; overflow-x: auto; } .tab { flex: 1 0 auto; } }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pager .label { color: var(--ink-2); }

/* ---------- app shell ---------- */
.app-top { position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; background: var(--paper); border-bottom: var(--line); }
.logo { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-stretch: 115%; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; text-decoration: none; }
.logo i { font-style: normal; display: inline-grid; place-items: center; width: 28px; height: 28px; background: var(--ink); color: var(--signal); font-size: 16px; }
.top-meta { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.top-meta .who { font-weight: 600; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-side { position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); z-index: 20; display: flex; flex-direction: column;
  background: var(--ink); color: var(--paper); border-right: var(--line); }
.side-id { padding: 18px 20px; border-bottom: 1px solid #333; }
.side-id .label { color: #9a958a; }
.side-id strong { display: block; margin-top: 4px; font-family: var(--display); font-stretch: 108%; font-weight: 800; font-size: 18px; line-height: 1.15; color: var(--signal); word-break: break-word; }
.side-nav { display: flex; flex-direction: column; padding: 10px 0; flex: 1; }
.side-nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 20px; font-size: 14px; font-weight: 600; color: #cfc9bb; text-decoration: none; border-left: 5px solid transparent; }
.side-nav a:hover { color: #fff; background: #1f1f1f; }
.side-nav a.is-active { color: var(--ink); background: var(--signal); border-left-color: var(--signal); font-weight: 800; }
.side-nav a .idx { font-family: var(--mono); font-size: 11px; color: #77726a; margin-right: 10px; }
.side-nav a.is-active .idx { color: var(--ink); }
.side-foot { padding: 14px 20px; border-top: 1px solid #333; font-family: var(--mono); font-size: 11px; color: #77726a; }

.app-main { margin-left: var(--side); padding-top: var(--top); min-height: 100vh; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 28px 32px 20px; border-bottom: var(--line); }
.page-head .crumb { margin-bottom: 6px; }
.page-body { padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 22px; }

@media (max-width: 900px) {
  .app-side { position: sticky; top: var(--top); bottom: auto; width: auto; flex-direction: row; align-items: stretch; border-right: 0; border-bottom: var(--line); overflow-x: auto; margin-top: var(--top); }
  .side-id, .side-foot { display: none; }
  .side-nav { flex-direction: row; padding: 0; }
  .side-nav a { border-left: 0; border-bottom: 5px solid transparent; white-space: nowrap; padding: 12px 16px; }
  .side-nav a .idx { display: none; }
  .app-main { margin-left: 0; padding-top: 0; }
  .page-head { padding: 20px 16px 16px; }
  .page-body { padding: 20px 16px 48px; }
  .top-meta .who { display: none; }
}

/* ---------- stats ledger ---------- */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border: var(--line); box-shadow: var(--shadow); background: var(--white); }
.ledger > div { padding: 18px 20px; border-right: var(--line); }
.ledger > div:last-child { border-right: 0; }
.ledger b { display: block; font-family: var(--display); font-stretch: 112%; font-weight: 800; font-size: 44px; line-height: 1; letter-spacing: -0.03em; margin-top: 8px; }
.ledger .hot { background: var(--signal); }
@media (max-width: 600px) { .ledger > div { border-right: 0; border-bottom: var(--line); } .ledger > div:last-child { border-bottom: 0; } }

/* ---------- modal & toast ---------- */
.modal { background: rgba(17, 17, 17, 0.55); padding: 16px; }
.modal-card { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--white); border: var(--line); box-shadow: var(--shadow-lg); }
.modal-card.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: var(--line); background: var(--signal); }
.modal-head.danger { background: var(--red); color: #fff; }
.modal-x { width: 32px; height: 32px; border: var(--line); background: var(--white); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }
.modal-x:hover { background: var(--ink); color: var(--paper); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: var(--line); background: var(--paper); }

.toast-box { padding: 12px 16px; border: var(--line); box-shadow: var(--shadow); font-weight: 700; font-size: 14px; max-width: calc(100vw - 32px); }
.toast-ok { background: var(--green-bg); }
.toast-bad { background: var(--red-bg); }

/* ---------- code ---------- */
.code { font-family: var(--mono); font-size: 13px; line-height: 1.7; background: var(--ink); color: var(--paper); padding: 16px 18px; overflow-x: auto; white-space: pre; border: var(--line); }
.code .c { color: #8d887c; }
.code .s { color: var(--signal); }

/* ---------- auth ---------- */
.auth { min-height: calc(100vh - var(--top)); margin-top: var(--top); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.auth-aside { padding: 56px 48px; border-right: var(--line); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-main { padding: 56px 48px; display: flex; align-items: center; justify-content: center; }
.auth-form { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { border-right: 0; border-bottom: var(--line); padding: 32px 16px; }
  .auth-main { padding: 32px 16px 56px; }
}
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* chat transcript (landing / auth illustration) */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 10px 14px; border: var(--line); font-size: 14px; line-height: 1.45; }
.bubble.user { align-self: flex-end; background: var(--white); }
.bubble.bot { align-self: flex-start; background: var(--signal); }
.bubble .label { display: block; margin-bottom: 4px; color: var(--ink-2); }
.src { align-self: flex-start; font-family: var(--mono); font-size: 11px; color: var(--muted); border-left: 3px solid var(--ink); padding: 2px 0 2px 8px; }

/* bilingual text: <span class="t-id">…</span><span class="t-en">…</span> */
html.en .t-id, html:not(.en) .t-en { display: none !important; }
.lang-switch { display: inline-flex; border: var(--line); font-family: var(--mono); font-size: 12px; }
.lang-switch button { padding: 5px 9px; background: var(--white); border: 0; cursor: pointer; }
.lang-switch button + button { border-left: var(--line); }
html:not(.en) .lang-switch [data-l="id"], html.en .lang-switch [data-l="en"] { background: var(--ink); color: var(--paper); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
