/* Tools SagalaIT: gaya bersama untuk portal dan semua app */

:root {
  color-scheme: light;
  --bg: #F1F3EF;
  --panel: #FFFFFF;
  --well: #F7F9F6;
  --ink: #0E2740;
  --body: #2F4256;
  --muted: #5B6B7A;
  --line: #D9DED6;
  --line-strong: #BFC7BC;
  --accent: #2447D6;
  --accent-t: #E4EAFB;
  --mark: #FFE066;
  --mark-title: #FFE066;
  --hl: #FFE066;
  --err: #C8372D;
  --err-t: #FBE3E0;
  --ok: #1F7A4D;
  --ok-t: #DDF0E5;
  --ok-mark: #BFE6CF;
  --warn: #B45309;
  --warn-t: #FEF3C7;
  --star: #C99A00;
  --link: #2447D6;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 96px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1724;
  --panel: #112235;
  --well: #0E1E2F;
  --ink: #EAF0F6;
  --body: #C3CFDB;
  --muted: #8FA1B3;
  --line: #243649;
  --line-strong: #35506A;
  --accent: #4A6CF0;
  --accent-t: rgba(91, 124, 250, .18);
  --mark-title: rgba(255, 224, 102, .34);
  --hl: rgba(255, 224, 102, .30);
  --err: #FF8A80;
  --err-t: rgba(255, 138, 128, .14);
  --ok: #6FD3A0;
  --ok-t: rgba(111, 211, 160, .14);
  --ok-mark: rgba(111, 211, 160, .32);
  --warn: #FBBF24;
  --warn-t: rgba(251, 191, 36, .14);
  --star: #FFD34D;
  --link: #8FA6FF;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--link); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap {
  width: 100%;
  max-width: calc(1248px + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- bilah atas ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 28px; }
.logo {
  position: relative; display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-weight: 800; font-size: 20px; line-height: 1; text-decoration: none;
}
.logo::after {
  content: ""; position: absolute; left: 7px; right: 7px; bottom: 6px;
  height: 4px; border-radius: 2px; background: #FFE066;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--ink); }
.back { font-size: 14px; font-weight: 500; text-decoration: none; }
.back:hover { text-decoration: underline; }

/* ---------- tombol ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 15px;
  height: 44px; padding: 0 20px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
label.btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- halaman app ---------- */
.app-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin: 28px 0 24px;
}
.app-head h1 { font-size: clamp(26px, 4vw, 32px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.app-head .lead { color: var(--muted); font-size: 14.5px; margin-top: 6px; max-width: 62ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; padding-bottom: 72px; }
@media (max-width: 900px) { .app-grid { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 16px; }
.stack > [hidden]:first-child + * { margin-top: 0; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px 24px;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.field {
  width: 100%; display: block;
  font: 13px/1.55 var(--mono);
  background: var(--well); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  resize: vertical; min-height: 120px;
}
.field:focus { outline: 3px solid var(--accent-t); border-color: var(--accent); }
.field[readonly] { color: var(--body); }
select.field-sm, .field-sm {
  font: inherit; font-size: 14px; height: 36px; border-radius: 10px; padding: 0 10px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
}
.empty { text-align: center; color: var(--muted); padding: 40px 24px; }
.empty .btn { margin-top: 16px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 12px; font-weight: 600; flex-wrap: wrap; }
.banner .aside { margin-left: auto; font-weight: 400; font-size: 13.5px; }
.banner.ok { background: var(--ok-t); color: var(--ok); }
.banner.bad { background: var(--err-t); color: var(--err); }
.dot { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.banner.ok .dot { background: var(--ok); }
.banner.bad .dot { background: var(--err); }
:root[data-theme="dark"] .dot { color: #0B1724; }

.issue {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--err);
  border-radius: 16px; padding: 16px 20px;
}
.issue.warning { border-left-color: var(--warn); }
.issue.info { border-left-color: var(--accent); }
.issue-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 13px; color: var(--muted); }
.tag { font-weight: 600; font-size: 12.5px; padding: 2px 10px; border-radius: 7px; background: var(--err-t); color: var(--err); }
.issue.warning .tag { background: var(--warn-t); color: var(--warn); }
.issue.info .tag { background: var(--accent-t); color: var(--accent); }
.issue-head .where { margin-left: auto; }
dl.kv { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px 14px; margin: 12px 0 0; font-size: 14.5px; }
dl.kv dt { color: var(--muted); font-size: 13.5px; padding-top: 2px; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; color: var(--body); }
.code { font: 13.5px var(--mono); color: var(--ink); }
.pill { display: inline-block; font: 14px var(--mono); padding: 3px 10px; border-radius: 8px; }
.pill.from { background: var(--err-t); color: var(--err); }
.pill.to { background: var(--ok-t); color: var(--ok); }
.arrow { margin: 0 8px; color: var(--ink); }

pre.src {
  margin: 0; background: var(--well); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  font: 13px/1.75 var(--mono); color: var(--ink);
  white-space: pre-wrap; word-break: break-all; max-height: 340px; overflow: auto;
}
mark.hl { background: var(--hl); color: inherit; border-radius: 3px; box-shadow: 0 2px 0 var(--err); }
mark.hl.warning { box-shadow: 0 2px 0 var(--warn); }
mark.hl.flash { animation: flash 1s ease-out 1; }
@keyframes flash { 0% { outline: 4px solid var(--accent); } 100% { outline: 4px solid transparent; } }
@media (prefers-reduced-motion: reduce) { mark.hl.flash { animation: none; } }
a.jump { cursor: pointer; font-size: 13px; }

.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.stat-row:last-child { border-bottom: 0; }
.stat-row .k { color: var(--muted); }
.stat-row .v { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.stat-row .v.mono { font-family: var(--mono); font-weight: 400; }
.big { font-size: clamp(36px, 6vw, 52px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
