/* DRW Ops — token warna di :root; mode gelap mengikuti sistem (bisa dipaksa via data-theme). */
:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --border: #dfe4ea;
  --text: #0f1720;
  --text-2: #475467;
  --muted: #6b7684;
  --accent: #0b7285;
  --accent-ink: #ffffff;
  --accent-soft: #e0f4f7;
  --good: #12a150; --good-soft: #e2f5ea;
  --bad: #d23c3c; --bad-soft: #fbe5e5;
  --warn: #c98a0c; --warn-soft: #fbf0d9;
  --star: #e3a008;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 14px rgba(16,24,40,.05);
  --shadow-hi: 0 2px 4px rgba(16,24,40,.06), 0 10px 28px rgba(16,24,40,.10);
  --radius: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1216; --surface: #171b21; --surface-2: #1f252d; --border: #2b323c;
    --text: #f2f5f8; --text-2: #c2cad4; --muted: #8d97a3;
    --accent: #3bc9db; --accent-ink: #04252b; --accent-soft: #0f2e33;
    --good: #34d07a; --good-soft: #10291b; --bad: #f06a6a; --bad-soft: #351717; --warn: #e9b23f; --warn-soft: #33270d;
    --star: #f5c542;
    --shadow: 0 1px 2px rgba(0,0,0,.45); --shadow-hi: 0 6px 22px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1216; --surface: #171b21; --surface-2: #1f252d; --border: #2b323c;
  --text: #f2f5f8; --text-2: #c2cad4; --muted: #8d97a3;
  --accent: #3bc9db; --accent-ink: #04252b; --accent-soft: #0f2e33;
  --good: #34d07a; --good-soft: #10291b; --bad: #f06a6a; --bad-soft: #351717; --warn: #e9b23f; --warn-soft: #33270d;
  --star: #f5c542;
  --shadow: 0 1px 2px rgba(0,0,0,.45); --shadow-hi: 0 6px 22px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 680; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 640; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: none; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* Tombol */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 560; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon-only { padding: 0; width: 36px; justify-content: center; }
.btn.icon-only.sm { width: 30px; }
.btn.danger { color: var(--bad); }
.btn.block { display: flex; justify-content: center; width: 100%; height: 44px; font-size: 15px; }
.btn.spin .icon { animation: putar 1s linear infinite; }
@keyframes putar { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.brand b { display: block; font-size: 15px; line-height: 1.1; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); }
.logo .icon { width: 18px; height: 18px; }
.search { flex: 1; max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); background: var(--surface); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.top-act { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.who { display: inline-flex; align-items: center; gap: 8px; padding: 0 8px; color: var(--text-2); font-size: 13px; max-width: 220px; }
.who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who img, .ava { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.ava { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 22px 24px 40px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 28px; }

/* Ringkasan */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.stat .lbl { display: block; color: var(--muted); font-size: 12px; font-weight: 560; text-transform: uppercase; letter-spacing: .04em; }
.stat b { display: block; font-size: 28px; font-weight: 720; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .unit { font-size: 14px; font-weight: 560; color: var(--muted); }
.stat small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat.good b { color: var(--good); }
.stat.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); background: var(--bad-soft); }
.stat.bad b { color: var(--bad); }

/* Filter */
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 13px; font-weight: 540; cursor: pointer; white-space: nowrap; }
.chip em { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 2px; }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.on em { color: inherit; opacity: .8; }

/* Seksi & grid kartu */
.sec { margin-top: 22px; }
.sec h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--text-2); }
.sec h2 em, .tbl-h em { font-style: normal; font-weight: 560; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 1px 8px; border-radius: 999px; }
#list > .grid { margin-top: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

.app { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 12px; transition: box-shadow .15s, border-color .15s, transform .15s; }
.app:hover { box-shadow: var(--shadow-hi); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); transform: translateY(-1px); }
.app.offline { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.app.nonaktif { opacity: .6; }
.app-head { display: flex; align-items: flex-start; gap: 10px; }
.app-ico { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 11px; background: var(--surface-2); font-size: 22px; line-height: 1; }
.app-tt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.app-tt h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-tt h3 a { color: var(--text); }
.app-tt h3 a:hover { text-decoration: none; }
/* seluruh kartu bisa diklik (membuka URL utama); tautan & tombol lain di atasnya */
.stretch::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.fav, .app .dom, .pill { position: relative; z-index: 2; }
.fav { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.fav:hover { background: var(--surface-2); color: var(--star); }
.fav.on { color: var(--star); }
.fav.on .icon { fill: currentColor; }
.fav .icon { width: 18px; height: 18px; }
.app-desc { margin: 0; color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.app-note { margin: 0; font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 6px 8px; }
.app-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding-top: 6px; border-top: 1px dashed var(--border); }
.links { display: flex; flex-direction: column; min-width: 0; }
.dom { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dom .icon { width: 13px; height: 13px; }
.dom.alt { font-size: 12px; font-weight: 450; color: var(--muted); }
.dom.alt:hover { color: var(--accent); }
.meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.ver { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--text-2); background: var(--surface-2); padding: 1px 7px; border-radius: 6px; }
.tag { display: inline-block; font-size: 11px; color: var(--muted); border: 1px solid var(--border); padding: 0 6px; border-radius: 6px; }

/* Status */
.pill { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12px; font-weight: 600; padding: 1px 9px 1px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; cursor: default; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.online { background: var(--good-soft); color: var(--good); }
.pill.online .dot { box-shadow: 0 0 0 0 currentColor; animation: denyut 2.4s ease-out infinite; }
.pill.offline { background: var(--bad-soft); color: var(--bad); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
@keyframes denyut { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .pill.online .dot { animation: none; } .app { transition: none; } }
.spark { display: inline-flex; gap: 1px; align-items: flex-end; height: 12px; }
.spark i { display: block; width: 3px; height: 12px; border-radius: 1px; background: var(--good); opacity: .75; }
.spark i.no { background: var(--bad); opacity: 1; }

.empty { text-align: center; padding: 50px 16px; color: var(--muted); }
.empty .icon { width: 28px; height: 28px; }

/* Admin */
.admin-head { margin-bottom: 14px; }
.admin-head p { margin: 4px 0 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 9px 14px; color: var(--text-2); font-weight: 560; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.tbl-card { margin-bottom: 14px; overflow: hidden; }
.tbl-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px 4px; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl th.right, .tbl th.num { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.dim td { opacity: .55; }
.tbl td.ord { width: 66px; white-space: nowrap; }
.tbl td.ord .btn { width: 26px; height: 26px; }
.tbl select { font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); max-width: 260px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(8,12,18,.5); display: grid; place-items: center; padding: 16px; }
.modal { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-hi); border: 1px solid var(--border); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; padding: 16px 18px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld.full, .full { grid-column: 1 / -1; }
.fld > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.fld small { color: var(--muted); font-size: 11.5px; }
.fld input, .fld select, .fld textarea { font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 100%; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fld.chk { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 8px; }
.fld.chk input { width: 18px; height: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }

/* Toast */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-hi); font-size: 13.5px; }
.toast.err { background: var(--bad); color: #fff; }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login-card { width: min(440px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 21px; }
.login-card p { margin: 0; }
.brand.big .logo { width: 42px; height: 42px; border-radius: 11px; }
.brand.big b { font-size: 18px; }
.alert { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; background: var(--bad-soft); color: var(--bad); font-size: 13px; }
.points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); font-size: 13px; }
.points li { display: flex; gap: 8px; align-items: flex-start; }
.points .icon { color: var(--accent); margin-top: 2px; }
.row-btn { display: flex; gap: 8px; }
.login-foot { color: var(--muted); font-size: 12px; margin-top: 14px; }

/* Responsif */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .hide-sm { display: none; }
  .wrap { padding: 16px 16px 32px; }
  .stat { padding: 12px; }
  .stat b { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
  .filters .chips:first-child { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; scrollbar-width: none; }
  .form-grid { grid-template-columns: 1fr; }
  .who { padding: 0 4px; }
}
