@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --canvas: #eaeef4;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --ink: #101722;
  --muted: #67748a;
  --line: #d9e0e9;
  --accent: #2b44e0;
  --accent-ink: #1b2ea8;
  --live: #0e9f6e;
  --warn: #b45309;
  --danger: #c0392b;

  --r: 12px;
  --shadow: 0 1px 2px rgba(16, 23, 34, .06), 0 8px 24px -12px rgba(16, 23, 34, .18);

  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; }

body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); letter-spacing: -.015em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- layout ---------- */

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.side {
  background: var(--ink);
  color: #cfd7e3;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  font-family: var(--display); font-weight: 700; font-size: 17px;
  color: #fff; letter-spacing: -.02em; padding: 4px 10px 20px;
  display: flex; align-items: center; gap: 9px;
}
.brand .mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-size: 12px;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-radius: 8px; color: #aab6c8; cursor: pointer;
  font-size: 14px; font-weight: 500; border: 0; background: none; width: 100%;
  text-align: left; font-family: var(--body);
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.on { background: var(--accent); color: #fff; }
.nav-badge {
  background: var(--warn); color: #fff; font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
}
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; }
.side-user { padding: 0 10px 10px; font-size: 13px; }
.side-user b { color: #fff; display: block; font-weight: 600; }
.side-user span { color: #8593a8; font-size: 12px; }

.main { padding: 34px 40px 72px; max-width: 1080px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 3px; }

/* ---------- kartu ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

/* kartu aplikasi: rel status di kiri = signature */
.app-card { display: grid; grid-template-columns: 3px 1fr; gap: 0; overflow: hidden; padding: 0; }
.rail { background: var(--live); }
.rail.off { background: var(--muted); }
.rail.expired { background: var(--danger); }
.app-body { padding: 18px 20px; }

.route {
  font-family: var(--mono); font-size: 13px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 12px 0;
}
.route .from { color: var(--muted); }
.route .arrow { color: var(--accent); font-weight: 500; }
.route .to { color: var(--ink); font-weight: 500; word-break: break-all; }

.meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.meta b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- kontrol ---------- */

.btn {
  font-family: var(--body); font-size: 14px; font-weight: 600;
  padding: 9px 15px; border-radius: 9px; border: 1px solid transparent;
  background: var(--accent); color: #fff; cursor: pointer; line-height: 1.3;
}
.btn:hover { background: var(--accent-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sec { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.sec:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: #fdf0ef; }
.btn.sm { padding: 6px 11px; font-size: 13px; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 5px; }

input[type=text], input[type=url], input[type=email], input[type=password],
input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; font-family: var(--body); font-size: 14px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  color: var(--ink);
}
input[type=color] { width: 46px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mono { font-family: var(--mono); }

/* ---------- lencana & status ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--line);
}
.pill.live { color: var(--live); border-color: #b7e6d3; background: #edfaf5; }
.pill.off { color: var(--muted); }
.pill.warn { color: var(--warn); border-color: #f0d9ae; background: #fdf6e9; }
.pill.danger { color: var(--danger); border-color: #f0c4c0; background: #fdefee; }
.pill.accent { color: var(--accent); border-color: #c3cbf7; background: #eef0fe; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- tabel ---------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600; padding: 0 12px 9px; border-bottom: 1px solid var(--line);
}
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- statistik ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .v { font-family: var(--display); font-size: 26px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ---------- meter kuota ---------- */

.meter { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter i.full { background: var(--danger); }

/* ---------- dialog ---------- */

dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px));
  box-shadow: 0 24px 64px -16px rgba(16,23,34,.35); color: var(--ink); background: var(--surface);
}
dialog::backdrop { background: rgba(16, 23, 34, .45); }
.dlg-head { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dlg-body { padding: 20px; max-height: 66vh; overflow: auto; }
.dlg-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 14px 14px; }

/* ---------- notifikasi toast ---------- */

#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(140%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; z-index: 99; transition: transform .22s ease; max-width: 90vw;
}
#toast.on { transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--danger); }

/* ---------- kosong ---------- */

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 5px; }
.empty p { font-size: 14px; margin-bottom: 16px; }

.banner {
  border-radius: var(--r); padding: 14px 18px; margin-bottom: 18px; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.banner.warn { background: #fdf6e9; border: 1px solid #f0d9ae; color: #7c4a02; }
.banner.danger { background: #fdefee; border: 1px solid #f0c4c0; color: #8f2820; }

.hidden { display: none !important; }

/* ---------- auth ---------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth { width: min(400px, 100%); }
.auth .card { padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.auth-brand .mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 14px; }
.auth .btn { width: 100%; padding: 11px; }
.swap { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.err { color: var(--danger); font-size: 13px; margin-bottom: 12px; font-weight: 500; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .side .brand { padding: 0 12px 0 4px; }
  .nav-item { width: auto; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .side-user { display: none; }
  .main { padding: 20px 16px 60px; }
  .grid2 { grid-template-columns: 1fr; }
}

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