/* wea dashboard — mengikuti Design Tokens v2 dash-admin (gradien biru, input pill, Rubik).
 * Satu elemen yang menonjol: penanda waktu tunggu (SLA) di daftar chat. Sisanya tenang dan rapi. */
:root {
  --brand: #1a73e8;
  --brand-deep: #0d47a1;
  --brand-tint: #e8f0fe;
  --grad: linear-gradient(135deg, #1a73e8, #0d47a1);
  --rail: #0c3270;
  --rail-ink: rgba(255, 255, 255, .74);
  --canvas: #eef3fa;
  --surface: #ffffff;
  --ink: #14213d;
  --muted: #5f6b7d;
  --faint: #8a94a6;
  --line: #dbe3ef;
  --line-soft: #eef2f8;
  --bubble-in: #ffffff;
  --bubble-out: #dce9fd;
  --chat-bg: #e9eff7;
  --warn: #a35a00;
  --warn-bg: #fff4e0;
  --danger: #c5221f;
  --danger-bg: #fdecea;
  --ok: #137333;
  --ok-bg: #e6f4ea;
  --note-bg: #fff7e0;
  --note-line: #f2d48a;
  --radius-pill: 30px;
  --radius-card: 14px;
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --rail-w: 84px;
  --appbar-h: 58px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--brand-deep); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: #f1f4f9; padding: 1px 5px; border-radius: 5px; }
.ico { flex: none; }

/* ---------- Login & halaman tamu ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--grad); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 32px 28px 28px; box-shadow: 0 24px 60px rgba(13, 71, 161, .35); }
.login-card .wordmark { font-size: 40px; font-weight: 700; letter-spacing: -1.5px; color: var(--brand-deep); margin: 0; }
.login-card p.lead { margin: 4px 0 24px; color: var(--muted); }
.login-card.wide { max-width: 440px; }
.login-card .aside { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.login-card .aside.center { text-align: center; margin: 8px 0 18px; }
.login-card .secret { display: inline-block; margin-top: 6px; padding: 6px 10px; background: #f3f6fb; border-radius: 8px; letter-spacing: .5px; overflow-wrap: anywhere; }
.steps { margin: 0 0 12px; padding-left: 20px; }
.steps li { margin: 4px 0; }
.qr { display: grid; place-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.qr svg { width: 200px; height: 200px; display: block; }
.input.otp { font-size: 20px; letter-spacing: 6px; text-align: center; }
.codes { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes li { background: #f3f6fb; border-radius: 10px; padding: 8px; text-align: center; }
.below { margin-top: 16px; text-align: center; }
.link-btn { background: none; border: 0; color: #fff; text-decoration: underline; opacity: .9; }

/* ---------- Form & tombol ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 500; margin-bottom: 6px; }
.field.sm { margin-bottom: 10px; }
.field.sm > span { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f8fafd;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.input:focus { border-color: var(--brand); background: #fff; }
.input:disabled { opacity: .7; }
.input.sm { padding: 6px 14px; font-size: 13px; width: auto; }
select.input.sm { padding-right: 30px; background-position: right 11px center; }
.input.area { border-radius: 16px; resize: vertical; line-height: 1.45; }
.input.file { padding: 7px 10px; }
select.input { appearance: none; padding-right: 34px; background: #f8fafd url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235f6b7d'/%3E%3C/svg%3E") no-repeat right 14px center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; border-radius: var(--radius-pill);
  padding: 10px 20px; font-weight: 500; white-space: nowrap; text-decoration: none;
}
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-primary { background: var(--grad); color: #fff; }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn-link { background: none; border: 0; color: var(--brand-deep); padding-left: 6px; padding-right: 6px; }
.btn-link:hover { text-decoration: underline; }
.danger, .btn.danger { color: var(--danger); }
.btn-ghost.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-error { background: var(--danger-bg); color: var(--danger); border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; }
.flash { background: var(--ok-bg); color: var(--ok); border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; }
.help { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.field .help { display: block; margin: 6px 4px 0; font-size: 12px; font-weight: 400; }
.lead-help { margin: 0 0 16px; max-width: 72ch; }
.note-warn { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.link { color: var(--brand-deep); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
.sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Chip, label, status ---------- */
.chip { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 500; line-height: 1.6; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.c-blue { background: #e8f0fe; color: #174ea6; }
.c-green { background: #e6f4ea; color: #137333; }
.c-amber { background: #fef3e0; color: #8a4b00; }
.c-red { background: #fdecea; color: #b3261e; }
.c-purple { background: #f3e8fd; color: #6a1b9a; }
.c-teal { background: #e0f5f3; color: #00695c; }
.c-gray { background: #eef0f4; color: #4a5568; }
.role-tag { display: inline-block; font-size: 11px; color: var(--muted); background: #f1f4f9; border-radius: 6px; padding: 0 6px; margin-left: 4px; font-weight: 400; }
.presence-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.presence-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #b8c0cc; flex: none; }
.presence-dot.online::before { background: #1e9e55; box-shadow: 0 0 0 3px rgba(30, 158, 85, .15); }
.presence-dot.away::before { background: #f2a600; }
.quality { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.quality::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #b8c0cc; }
.quality.q-green::before { background: #1e9e55; }
.quality.q-yellow::before { background: #f2a600; }
.quality.q-red::before { background: var(--danger); }

/* ---------- Kerangka aplikasi: rail + konten ---------- */
body.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.rail { background: var(--rail); color: #fff; display: flex; flex-direction: column; align-items: stretch; padding: 12px 8px; min-height: 0; overflow-y: auto; }
.rail-logo { display: block; text-align: center; font-weight: 700; font-size: 25px; letter-spacing: -1px; color: #fff; text-decoration: none; padding: 4px 0 14px; }
.rail-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail-nav a, .rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 4px 8px; border-radius: 14px; color: var(--rail-ink); text-decoration: none;
  font-size: 11px; font-weight: 500; text-align: center; background: none; border: 0; width: 100%;
}
.rail-nav a:hover, .rail-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.rail-nav a[aria-current="page"] { color: var(--rail); background: #fff; }
.rail-foot { margin-top: auto; display: grid; gap: 6px; padding-top: 12px; }
.agent-status { display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(255, 255, 255, .08); border: 0; border-radius: 14px; color: #fff; font-size: 11px; padding: 8px 4px; }
.agent-status .dot { width: 10px; height: 10px; border-radius: 50%; background: #5fd38d; box-shadow: 0 0 0 3px rgba(95, 211, 141, .25); }
.agent-status.away .dot { background: #ffc94d; box-shadow: 0 0 0 3px rgba(255, 201, 77, .25); }

.main { display: grid; grid-template-rows: var(--appbar-h) minmax(0, 1fr); min-width: 0; min-height: 0; }
.appbar { display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); min-width: 0; }
.appbar-title { font-size: 18px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .spacer { flex: 1; }
.appbar form { margin: 0; }
.ws-switch select {
  appearance: none; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 6px 32px 6px 14px; max-width: 220px;
  background: var(--brand-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%230d47a1'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--brand-deep); font-weight: 500; border-color: transparent;
}
.me { display: flex; align-items: center; gap: 8px; min-width: 0; }
.me-name { display: grid; font-size: 13px; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.me-name small { color: var(--faint); font-weight: 400; font-size: 11px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: #d6e4fb; color: var(--brand-deep); font-weight: 600; font-size: 15px;
}
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; margin-bottom: 10px; }
.live { font-size: 12px; padding: 4px 10px 4px 22px; border-radius: var(--radius-pill); background: #f1f4f9; color: var(--muted); position: relative; white-space: nowrap; }
.live::before { content: ""; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #f2a600; }
.live.on::before { background: #1e9e55; }
.live:empty { display: none; }

/* ---------- Halaman (server-rendered) ---------- */
.page-body { overflow-y: auto; padding: 22px 24px 48px; min-height: 0; }
.page-body > * { max-width: 1180px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px 20px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.narrow { max-width: 760px; }
.panel-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.panel-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.panel-head .link, .panel-head form, .panel-head > .btn { margin-left: auto; }
.panel-head .sub { display: inline; }
.sub-head { margin-top: 18px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.grid-2 > .panel { margin-bottom: 18px; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state h2 { font-size: 17px; margin: 0 0 6px; }
.empty-state p { color: var(--muted); margin: 0; }
.stack { display: grid; gap: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-inline { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0 12px; align-items: end; }
.form-inline .btn { margin-bottom: 14px; }
.label-edit .chip { min-width: 112px; justify-content: center; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.add-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.add-row .input:not(.area) { max-width: 260px; }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.subnav a { padding: 6px 14px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 13px; }
.subnav a:hover { border-color: var(--brand); color: var(--brand); }
.toolbar { margin: 0 0 14px; }
.toolbar-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1 1 260px; max-width: 380px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: #e3eaf4; border-radius: var(--radius-pill); padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: var(--radius-pill); padding: 5px 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand-deep); font-weight: 500; box-shadow: 0 1px 2px rgba(20, 33, 61, .12); }
.pager { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.pager-info { color: var(--muted); font-size: 13px; }
.copy-box { display: flex; align-items: center; gap: 10px; background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; }
.copy-box code { overflow-wrap: anywhere; background: transparent; flex: 1; }
.import-errors { color: var(--danger); font-size: 13px; margin: 0 0 12px; padding-left: 18px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfd; }
.panel:not(.flush) .table th { background: transparent; padding-left: 4px; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.panel:not(.flush) .table td { padding-left: 4px; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.muted td { color: var(--faint); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.row-link { color: var(--ink); text-decoration: none; }
.row-link:hover strong { color: var(--brand); text-decoration: underline; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

details.more { position: relative; display: inline-block; }
details.more > summary { list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 12px 32px rgba(20, 33, 61, .16); text-align: left; }
.more-menu form { display: block !important; margin: 0; }
.more-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 9px 12px; }
.more-menu button:hover { background: var(--brand-tint); }
.inv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.inv-row:last-child { border-bottom: 0; }

/* Ringkasan */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); margin-bottom: 18px; overflow: hidden; }
.kpi { padding: 16px 18px; border-left: 1px solid var(--line-soft); display: grid; gap: 2px; }
.kpi:first-child { border-left: 0; }
.kpi-n { font-size: 28px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi-l { color: var(--muted); font-size: 13px; }
.kpi.is-late { background: var(--danger-bg); }
.kpi.is-late .kpi-n { color: var(--danger); }
.legend { margin-left: auto; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.legend .key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.key.in { background: #9dbcf2; }
.key.out { background: var(--brand); }
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; height: 170px; align-items: end; padding: 6px 0 0; }
.bar-day { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100%; gap: 6px; }
.bar-pair { display: flex; align-items: flex-end; justify-content: center; gap: 3px; min-height: 0; border-bottom: 1px solid var(--line); }
.bar { width: min(18px, 40%); min-height: 2px; border-radius: 5px 5px 0 0; position: relative; }
.bar.in { background: #9dbcf2; }
.bar.out { background: var(--brand); }
.bar em { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.bar-label { text-align: center; font-size: 12px; font-weight: 500; display: grid; line-height: 1.2; }
.bar-label small { color: var(--faint); font-weight: 400; font-size: 10.5px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wait-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); border-left: 4px solid #8fd1a8; margin-bottom: 6px; background: #fafbfd; }
.wait-row.warn { border-left-color: #f2a600; }
.wait-row.late { border-left-color: var(--danger); background: #fff7f6; }
.wait-row:hover { background: var(--brand-tint); }
.wait-who { display: grid; min-width: 0; }
.wait-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.wait-who small { color: var(--muted); font-size: 12px; }
.wait-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.wait-row.late .wait-time { color: var(--danger); }

/* Template */
.tpl-list { display: grid; gap: 8px; }
.tpl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.tpl > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 13px 18px; cursor: pointer; }
.tpl > summary::-webkit-details-marker { display: none; }
.tpl > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); margin-left: 6px; transition: transform .15s; }
.tpl[open] > summary::after { transform: rotate(-135deg); }
.tpl-name { flex: 1; display: grid; min-width: 0; }
.tpl-name strong { font-weight: 500; overflow-wrap: anywhere; }
.tpl-name small { color: var(--muted); font-size: 12px; }
.tpl-body { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; padding: 0 18px 18px; }
.wa-preview { background: var(--chat-bg); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; }
.tpl-bubble { white-space: pre-wrap; max-width: 100%; }
.tpl-btn { display: block; text-align: center; color: var(--brand); border-top: 1px solid rgba(20, 33, 61, .08); margin: 8px -12px -2px; padding: 7px 8px 2px; font-weight: 500; font-size: 13px; }
.tpl-btns .tpl-btn:first-child { margin-top: 8px; }
.vars { margin: 0; padding-left: 18px; font-size: 13px; }
.vars li { margin: 3px 0; }
.vars .sub { display: inline; }

/* Sistem */
.sys { max-width: 860px; }
.overall { font-weight: 600; font-size: 16px; padding: 14px 18px; border-radius: var(--radius-card); margin: 0 0 14px; }
.overall.ok { background: var(--ok-bg); color: var(--ok); }
.overall.warn { background: var(--warn-bg); color: var(--warn); }
.overall.fail { background: var(--danger-bg); color: var(--danger); }
.checks { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.check { display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 12px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.check:last-child { border-bottom: 0; }
.check .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.check.warn .dot { background: #f2a600; }
.check.fail .dot { background: var(--danger); }
.check .label { font-weight: 500; }
.check .state { font-size: 12px; color: var(--muted); }
.check.fail .state { color: var(--danger); font-weight: 500; }
.check.warn .state { color: var(--warn); font-weight: 500; }
.check .check-detail { grid-column: 2 / -1; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

/* ---------- Inbox ---------- */
.panes { display: grid; grid-template-columns: 350px minmax(0, 1fr) 310px; min-height: 0; }
.list { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); border-right: 1px solid var(--line); }
.list-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.list-title { display: flex; align-items: center; justify-content: space-between; }
.list-title h2 { margin: 0; font-size: 16px; font-weight: 600; }
.search { position: relative; }
.search .input { padding-left: 40px; }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.tabs { display: flex; gap: 6px; }
.tab { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: var(--radius-pill); padding: 5px 12px; font-size: 13px; }
.tab[aria-pressed="true"] { background: var(--brand-tint); border-color: transparent; color: var(--brand-deep); font-weight: 500; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: #f1f4f9; border-radius: var(--radius-pill); padding: 3px; }
.segmented button { border: 0; background: transparent; border-radius: var(--radius-pill); padding: 5px 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--brand-deep); font-weight: 500; box-shadow: 0 1px 2px rgba(20, 33, 61, .12); }
.filters { display: flex; gap: 6px; }
.filters .input { flex: 1 1 0; min-width: 0; }
.notif-hint { display: flex; align-items: center; gap: 6px; justify-content: center; border: 1px dashed var(--line); background: #fafbfd; color: var(--brand-deep); border-radius: 12px; padding: 6px 10px; font-size: 12.5px; }
.items { flex: 1; overflow-y: auto; }
.item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line-soft);
  padding: 11px 14px 11px 12px; border-left: 4px solid transparent; position: relative;
}
.item:hover { background: #f6f9fe; }
.item[aria-current="true"] { background: var(--brand-tint); }
/* Penanda waktu tunggu: garis kiri + label. Elemen utama daftar chat. */
.item.wait-ok { border-left-color: #8fd1a8; }
.item.wait-warn { border-left-color: #f2a600; }
.item.wait-late { border-left-color: var(--danger); background: #fff8f7; }
.item.wait-late[aria-current="true"] { background: #fdeeee; }
.wait { font-size: 11px; font-weight: 600; white-space: nowrap; border-radius: 6px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
.wait.ok { color: var(--ok); background: var(--ok-bg); }
.wait.warn { color: var(--warn); background: var(--warn-bg); }
.wait.late { color: #fff; background: var(--danger); }
.item .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .preview { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.item .preview > span { overflow: hidden; text-overflow: ellipsis; }
.item .preview .tick { flex: none; }
.item .mid { min-width: 0; display: grid; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; min-width: 0; }
.owner { flex: none; font-size: 11px; padding: 1px 8px; border-radius: var(--radius-pill); background: #eef1f6; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.6; }
.owner.me { background: var(--brand-tint); color: var(--brand-deep); }
.owner.none { background: var(--warn-bg); color: var(--warn); }
.item .meta { text-align: right; font-size: 12px; color: var(--faint); display: grid; gap: 4px; justify-items: end; align-self: start; padding-top: 2px; }
.item.unread .name { font-weight: 600; }
.item.unread .meta time { color: var(--brand); font-weight: 500; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 500; display: inline-grid; place-items: center; }
.list-empty, .list-error { padding: 32px 22px; color: var(--muted); text-align: center; }
.list-error button { margin-top: 10px; }
.skeleton { padding: 14px; display: grid; gap: 12px; }
.skeleton div { height: 48px; border-radius: 12px; background: linear-gradient(90deg, #eef2f8, #f7f9fc, #eef2f8); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--chat-bg); position: relative; }
.chat-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line-soft); min-height: 64px; }
.chat-head .who { min-width: 120px; flex: 1; }
.chat-head .who strong { display: block; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .who span { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-strip { display: flex; align-items: center; gap: 10px; padding: 6px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.head-labels { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; min-width: 0; }
.no-labels { color: var(--faint); font-size: 12px; }
.assign { position: relative; flex: none; }
.assign-btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-pill); padding: 6px 14px; font-size: 13px; white-space: nowrap; }
.assign-btn::after { content: ""; display: inline-block; margin-left: 8px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.assign-btn.mine { background: var(--brand-tint); border-color: transparent; color: var(--brand-deep); font-weight: 500; }
.assign-btn.free { background: var(--warn-bg); border-color: transparent; color: var(--warn); font-weight: 500; }
.resolve-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: var(--radius-pill); padding: 7px 14px; background: var(--ok-bg); color: var(--ok); font-weight: 500; font-size: 13px; flex: none; }
.resolve-btn:hover { background: #d3ecdb; }
.resolve-btn.reopen { background: #eef0f4; color: var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px; max-height: 340px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 12px 32px rgba(20, 33, 61, .16); }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 9px 12px; }
.menu button:hover, .menu button:focus-visible { background: var(--brand-tint); outline: none; }
.menu button.danger { color: var(--danger); }
.menu-sub { margin-left: auto; color: var(--faint); font-size: 11.5px; }
.menu-label { margin: 6px 12px 4px; font-size: 12px; color: var(--faint); }
.menu-check { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; cursor: pointer; }
.menu-check:hover { background: #f6f9fe; }
.menu-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.presence { padding: 8px 16px; background: #eef3fe; color: var(--brand-deep); font-size: 13px; border-bottom: 1px solid var(--line); }
.presence.hot { background: var(--warn-bg); color: var(--warn); font-weight: 500; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; color: var(--muted); flex: none; padding: 0; }
.icon-btn:hover:not(:disabled) { color: var(--brand); border-color: var(--brand); }
.icon-btn:disabled { opacity: .4; }
.icon-btn.sm { width: 26px; height: 26px; }
.back-btn, .info-btn { display: none; }

/* Meteran jendela layanan 24 jam */
.window {
  --fill: 100%;
  position: relative; overflow: hidden; flex: none;
  border-radius: var(--radius-pill);
  padding: 4px 14px 6px;
  background: var(--ok-bg); color: var(--ok);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  min-width: 160px; text-align: center;
}
.window::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--fill); background: currentColor; opacity: .55; transition: width .6s ease; }
.window.low { background: var(--warn-bg); color: var(--warn); }
.window.closed { background: #eef0f4; color: var(--faint); }
.window.closed::after { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 18px 6% 10px; display: flex; flex-direction: column; gap: 4px; }
.load-more { align-self: center; margin-bottom: 10px; padding: 6px 16px; font-size: 13px; }
.day { align-self: center; background: rgba(255, 255, 255, .85); color: var(--muted); font-size: 12px; border-radius: var(--radius-pill); padding: 3px 12px; margin: 10px 0 6px; }
.bubble {
  max-width: min(70%, 560px);
  padding: 7px 11px 5px; border-radius: 14px;
  background: var(--bubble-in);
  box-shadow: 0 1px 0 rgba(20, 33, 61, .06);
  overflow-wrap: anywhere;
  align-self: flex-start; position: relative;
}
.bubble .text { white-space: pre-wrap; }
.bubble .text a { color: var(--brand-deep); }
.bubble .text code.mono { display: block; white-space: pre-wrap; margin: 4px 0; }
.bubble.out { align-self: flex-end; background: var(--bubble-out); }
.bubble.in + .bubble.in { border-top-left-radius: 6px; }
.bubble.out + .bubble.out { border-top-right-radius: 6px; }
.bubble.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(26, 115, 232, .45); } 100% { box-shadow: 0 1px 0 rgba(20, 33, 61, .06); } }
.bubble .kind { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.bubble .foot { display: flex; justify-content: flex-end; align-items: center; gap: 5px; margin-top: 2px; font-size: 11px; color: var(--faint); }
.bubble .author { margin-right: auto; padding-right: 10px; color: var(--muted); font-weight: 500; }
.bubble.failed { background: var(--danger-bg); }
.bubble .err { display: block; color: var(--danger); font-size: 12px; margin-top: 4px; }
.bubble.system { align-self: center; background: transparent; box-shadow: none; color: var(--muted); font-size: 12px; text-align: center; }
.bubble.unsupported { border: 1px dashed var(--faint); box-shadow: none; max-width: 420px; }
.bubble.unsupported .kind { color: var(--text, inherit); font-weight: 600; }
.bubble.unsupported .text { color: var(--muted); font-size: 13px; font-style: italic; }
.bubble.tpl { border: 1px solid #c3d6f7; }
.bubble-act { position: absolute; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; padding: 0; opacity: 0; transition: opacity .12s; }
.bubble.in .bubble-act { right: -34px; }
.bubble.out .bubble-act { left: -34px; }
.bubble:hover .bubble-act, .bubble-act:focus-visible { opacity: 1; }
.bubble-act:hover { color: var(--brand); border-color: var(--brand); }
.quoted { display: grid; text-align: left; width: 100%; border: 0; border-left: 3px solid #1e9e55; background: rgba(20, 33, 61, .05); border-radius: 8px; padding: 5px 9px; margin: 2px 0 5px; font-size: 12.5px; color: var(--muted); }
.quoted.out { border-left-color: var(--brand); }
.quoted strong { color: var(--ink); font-weight: 500; font-size: 12px; }
.quoted span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-link { display: block; margin: 2px -5px 4px; }
.bubble img.photo { display: block; max-width: 100%; width: 320px; max-height: 360px; object-fit: cover; border-radius: 10px; background: #dfe7f2; }
.bubble img.sticker { width: 150px; height: 150px; object-fit: contain; }
.bubble video { display: block; max-width: 100%; width: 320px; border-radius: 10px; margin: 2px 0 4px; background: #000; }
.bubble audio { display: block; width: 260px; max-width: 100%; margin: 2px 0 4px; }
.file-card { display: grid; grid-template-columns: 36px minmax(0, 1fr) 24px; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); background: rgba(20, 33, 61, .05); border-radius: 10px; padding: 8px 10px; margin: 2px 0 4px; min-width: 220px; }
.file-card:hover { background: rgba(26, 115, 232, .1); }
.file-ico { width: 36px; height: 36px; border-radius: 8px; background: #fff; display: grid; place-items: center; color: var(--brand-deep); }
.file-meta { display: grid; min-width: 0; }
.file-meta strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta small { color: var(--muted); font-size: 11.5px; }
.file-dl { color: var(--muted); }
.media-missing { display: block; color: var(--faint); font-style: italic; font-size: 12.5px; padding: 6px 0; }
.loc-link { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-deep); font-weight: 500; text-decoration: none; padding: 4px 0; }
.internal { align-self: stretch; margin: 6px 8%; background: var(--note-bg); border: 1px dashed var(--note-line); border-radius: 12px; padding: 8px 12px 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.internal .kind { display: block; font-size: 12px; font-weight: 500; color: var(--warn); margin-bottom: 2px; }
.internal .foot { display: flex; justify-content: flex-end; font-size: 11px; color: var(--faint); }
.event { align-self: center; font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, .75); border-radius: var(--radius-pill); padding: 3px 12px; margin: 4px 0; text-align: center; max-width: 90%; }
.tick { width: 18px; height: 12px; flex: none; color: #8696a0; }
.tick.read { color: #2b9fe0; }
.tick.clock { width: 13px; height: 13px; }
.tick.failed { color: var(--danger); width: 14px; height: 14px; }

.composer { padding: 6px 16px 12px; background: var(--chat-bg); position: relative; }
.mode { display: flex; gap: 4px; margin-bottom: 8px; }
.mode button { border: 0; background: transparent; color: var(--muted); font-size: 13px; padding: 5px 12px; border-radius: var(--radius-pill); }
.mode button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(20, 33, 61, .1); }
.composer.noting textarea { background: var(--note-bg); border-color: var(--note-line); }
.composer.noting .send-btn { background: var(--warn); }
.composer form { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea {
  flex: 1; resize: none; max-height: 160px; min-height: 44px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 22px; padding: 11px 18px; outline: none; line-height: 1.4;
}
.composer textarea:focus { border-color: var(--brand); }
.composer textarea:disabled { background: #f1f3f6; }
.composer .tool { width: 44px; height: 44px; }
.send-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.send-btn:disabled { opacity: .45; }
.composer .note { margin: 0 0 8px; padding: 9px 14px; border-radius: 12px; background: #fff; color: var(--muted); font-size: 13px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.composer .note.error { background: var(--danger-bg); color: var(--danger); }
.composer .note.locked-note { border: 1px solid var(--line); }
.composer .hint { margin: 6px 4px 0; font-size: 12px; color: var(--faint); }
.quote-bar, .attach-bar { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 12px; padding: 7px 8px 7px 12px; margin-bottom: 8px; border-left: 3px solid var(--brand); }
.attach-bar { border-left-color: #1e9e55; }
.quote-text { display: grid; flex: 1; min-width: 0; font-size: 13px; }
.quote-text strong { font-weight: 500; font-size: 12px; color: var(--brand-deep); }
.quote-text span, .attach-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-name { flex: 1; font-size: 13px; }
.attach-ico { color: #1e9e55; display: grid; }
.qr-pop { position: absolute; left: 16px; right: 16px; bottom: calc(100% - 4px); z-index: 25; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -8px 30px rgba(20, 33, 61, .14); padding: 6px; max-height: 300px; overflow-y: auto; }
.qr-item { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 8px 10px; }
.qr-item[aria-selected="true"], .qr-item:hover { background: var(--brand-tint); }
.qr-item code { grid-row: span 2; align-self: start; }
.qr-title { font-weight: 500; font-size: 13px; }
.qr-body { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-hint { position: absolute; inset: 12px; border: 2px dashed var(--brand); border-radius: 18px; background: rgba(232, 240, 254, .92); display: grid; place-items: center; font-weight: 600; color: var(--brand-deep); z-index: 40; pointer-events: none; }

.chat-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.chat-empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

.detail { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 20px; }
.detail h2 { font-size: 17px; margin: 0 0 2px; overflow-wrap: anywhere; }
.detail .sub { margin: 0 0 12px; font-size: 13px; }
.detail-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.detail dl { margin: 0 0 16px; }
.detail dt { font-size: 12px; color: var(--faint); }
.detail dd { margin: 1px 0 12px; overflow-wrap: anywhere; }
.detail-form { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-bottom: 12px; }
.detail-form .input.sm { width: 100%; }
.detail-link { display: block; margin: 0 0 14px; font-size: 13px; }
.detail .close-btn { width: 100%; }
.detail-empty { color: var(--faint); text-align: center; margin-top: 40px; }

.modal { border: 0; border-radius: 18px; padding: 24px; width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 24px 60px rgba(20, 33, 61, .3); }
.modal.wide { width: min(820px, calc(100% - 32px)); }
.modal::backdrop { background: rgba(20, 33, 61, .38); }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.tpl-start { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.tpl-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; min-height: 300px; }
.tpl-pick { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.tpl-pick .input.sm { width: 100%; }
.tpl-options { border: 1px solid var(--line); border-radius: 14px; padding: 4px; overflow-y: auto; max-height: 340px; flex: 1; }
.tpl-option { display: grid; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 8px 10px; }
.tpl-option strong { font-weight: 500; overflow-wrap: anywhere; }
.tpl-option small { color: var(--muted); font-size: 11.5px; }
.tpl-option:hover { background: #f6f9fe; }
.tpl-option[aria-selected="true"] { background: var(--brand-tint); }
.tpl-option.disabled { opacity: .5; }
.tpl-config .input.sm { width: 100%; }
.tpl-preview-label { font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
#tplPreview { white-space: pre-wrap; }

/* Pop-up foto */
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(9, 15, 30, .94); color: #fff; }
.lightbox::backdrop { background: rgba(9, 15, 30, .6); }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.lb-title { flex: 1; min-width: 0; font-size: 13px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-btn { display: inline-flex; align-items: center; gap: 6px; color: #fff; background: rgba(255, 255, 255, .12); border: 0; border-radius: var(--radius-pill); padding: 7px 14px; font-size: 13px; text-decoration: none; }
.lb-btn:hover { background: rgba(255, 255, 255, .22); }
.lb-stage { display: grid; place-items: center; overflow: auto; padding: 8px 16px 20px; min-height: 0; }
.lb-stage img { max-width: 100%; max-height: calc(100dvh - 90px); object-fit: contain; border-radius: 6px; cursor: zoom-in; background: #1b2235; }
.lb-stage img.zoom { max-width: none; max-height: none; cursor: zoom-out; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: var(--radius-pill); padding: 10px 18px; font-size: 13px; z-index: 60; max-width: calc(100% - 32px); }

/* ---------- Responsif ---------- */
@media (max-width: 1279px) {
  .panes { grid-template-columns: 330px minmax(0, 1fr); }
  .detail { position: fixed; top: var(--appbar-h); right: 0; bottom: 0; width: min(330px, 100%); transform: translateX(105%); visibility: hidden; transition: transform .2s ease, visibility .2s; z-index: 20; }
  body.show-detail .detail { transform: none; visibility: visible; box-shadow: -12px 0 30px rgba(20, 33, 61, .15); }
  .info-btn { display: inline-grid; }
  .window { min-width: 0; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 1023px) {
  .grid-2, .grid-2.wide-left { grid-template-columns: 1fr; }
  .tpl-body { grid-template-columns: 1fr; }
  .me-name { display: none; }
  .resolve-btn span { display: none; }
}
@media (max-width: 859px) {
  :root { --appbar-h: 54px; }
  body.app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 62px; }
  .main { grid-row: 1; }
  .rail { grid-row: 2; flex-direction: row; padding: 4px 6px; overflow-x: auto; overflow-y: hidden; }
  .rail-logo { display: none; }
  .rail-nav { display: flex; gap: 2px; }
  .rail-nav a, .rail-btn { padding: 6px 8px; min-width: 64px; font-size: 10.5px; }
  .rail-foot { margin: 0 0 0 auto; display: flex; padding: 0; gap: 2px; }
  .agent-status { min-width: 64px; padding: 6px 8px; }
  .appbar { padding: 0 12px; gap: 8px; }
  .appbar-title { font-size: 16px; }
  .ws-switch select { max-width: 140px; }
  .detail { top: 0; bottom: 62px; }
  .page-body { padding: 16px 14px 32px; }
  .panel { padding: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 0; border-top: 1px solid var(--line-soft); }
  .kpi:nth-child(odd) { border-right: 1px solid var(--line-soft); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi-n { font-size: 24px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-inline, .tpl-start { grid-template-columns: 1fr; }
  .form-inline .btn { margin-bottom: 0; }
  .tpl-grid { grid-template-columns: 1fr; }
  .tpl-options { max-height: 180px; }
  .panes { grid-template-columns: 1fr; }
  .chat { display: none; }
  body.show-chat .list { display: none; }
  body.show-chat .chat { display: flex; }
  .back-btn { display: inline-grid; }
  .chat-head { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .chat-head .avatar { display: none; }
  .chat-head .who { flex: 1 1 calc(100% - 110px); }
  .head-strip { padding: 6px 12px; }
  .live { display: none; }
  .inbox-page .appbar-title { display: none; }
  .ws-switch select { max-width: 200px; }
  .messages { padding: 14px 12px 8px; }
  .bubble { max-width: 86%; }
  .bubble-act { opacity: 1; }
  .bubble.in .bubble-act { right: -30px; }
  .bubble.out .bubble-act { left: -30px; }
  .composer { padding: 6px 10px 10px; }
  .composer form { gap: 6px; }
  .composer .tool { width: 38px; height: 38px; }
  .composer .hint { display: none; }
  .add-row .input:not(.area) { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- Tagihan, pendaftaran, admin (Paket C) */
.main.has-banner { grid-template-rows: var(--appbar-h) auto minmax(0, 1fr); }
.billing-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 20px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.billing-banner.warn { background: var(--warn-bg); color: var(--warn); }
.billing-banner.danger { background: var(--danger-bg); color: var(--danger); }
.billing-banner > span { flex: 1; min-width: 200px; }
.billing-banner small { opacity: .85; }
.pad { padding: 14px 18px 0; }
.subnav a[aria-current="page"] { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-deep); font-weight: 500; }
.usage-kv { margin-bottom: 4px; }
.usage-kv dd small { color: var(--muted); }
.feat-box .menu-check { align-items: flex-start; flex-wrap: wrap; row-gap: 4px; }
.feat-box .menu-check input { margin-top: 2px; }
.feat-box .chip { flex: none; }
.billing-actions { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.panel.flush .pagination, .panel.flush .pager { padding: 12px 18px; }
.crumb { color: var(--muted); font-size: 13px; margin: -4px 0 14px; }
.crumb a { color: var(--brand-deep); }
.top-gap { margin-top: 14px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plain-list .sub, .kv-line .sub { font-size: 12.5px; }
.kv-line { margin: 4px 0; }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.more-menu.wide { min-width: 280px; }
.more-menu .field { padding: 6px 8px 0; margin-bottom: 4px; }
.more-menu .input.sm { width: 100%; }
.feat-box { border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin: 4px 0 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feat-box legend { font-weight: 500; padding: 0 6px; }

.sub-plan { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 14px; }
.sub-plan-name { font-size: 26px; font-weight: 600; letter-spacing: -.5px; color: var(--brand-deep); }
.meter-row { margin-bottom: 14px; }
.meter-row:last-child { margin-bottom: 0; }
.meter-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 6px; }
.meter-top span { color: var(--muted); }
.meter-top strong { font-variant-numeric: tabular-nums; }
.meter-top small { color: var(--muted); font-weight: 400; }
.meter { height: 8px; border-radius: var(--radius-pill); background: var(--line-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); min-width: 2px; }
.meter.is-high > span { background: #f2a600; }
.meter.is-full > span { background: var(--danger); }

.due-panel { border-color: #f2d48a; }
.due-row { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.due-row:last-of-type { border-bottom: 0; }
.due-act { text-align: right; display: grid; gap: 8px; justify-items: end; align-content: start; }
.due-total { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.inv-items { list-style: none; margin: 6px 0; padding: 0; font-size: 13px; color: var(--muted); max-width: 420px; }
.inv-items li { display: flex; justify-content: space-between; gap: 16px; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius-card); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.plan-card.hot { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.plan-card.current { background: var(--brand-tint); }
.plan-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-card h3 { margin: 0; font-size: 16px; }
.plan-price { font-size: 22px; font-weight: 600; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.plan-price small { font-size: 13px; color: var(--muted); font-weight: 400; }
.plan-limits, .plan-feats { list-style: none; margin: 0; padding: 0; font-size: 13px; display: grid; gap: 4px; }
.plan-limits li { display: flex; justify-content: space-between; gap: 8px; }
.plan-limits span { color: var(--muted); }
.plan-feats li::before { content: "✓ "; color: var(--ok); font-weight: 600; }
.plan-feats li.soon { color: var(--muted); }
.plan-feats li.soon::before { color: var(--faint); }
.plan-card footer { margin-top: auto; }

.login-card.signup-card { max-width: 640px; }
.plan-pick { border: 0; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.plan-pick legend { font-weight: 500; margin-bottom: 8px; }
.plan-opt { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; }
.plan-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.plan-opt input { margin-top: 4px; accent-color: var(--brand); }
.plan-body { display: grid; gap: 2px; flex: 1; }
.plan-name { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-opt .plan-price { font-size: 18px; }
.plan-lim { color: var(--muted); font-size: 12.5px; }
.terms { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 4px 0 16px; }
.terms input { margin-top: 3px; accent-color: var(--brand); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 859px) {
  .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sub-plan { grid-template-columns: 1fr; gap: 10px; }
  .feat-box { grid-template-columns: 1fr; }
  .due-act { text-align: left; justify-items: start; }
  .login-card.signup-card .form-grid { grid-template-columns: 1fr; }
}
@media (min-width: 860px) and (max-width: 1279px) {
  .kpis.kpis-4 .kpi:nth-child(4) { border-left: 1px solid var(--line-soft); border-top: 0; }
}

/* Admin → Situs: logo klien */
.logo-thumb { display: block; height: 32px; width: auto; max-width: 120px; object-fit: contain; }
.input.input-num { width: 80px; }

/* ---------- Tombol tutup panel info ---------- */
.detail-close { display: none; }
@media (max-width: 1279px) {
  .detail-close { display: inline-grid; place-items: center; position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 1px solid var(--line-soft); border-radius: 50%; background: #fff; color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; z-index: 2; }
  .detail-close:hover { background: var(--line-soft); }
}
