/* ════════════════════════════════════════════════════════════════════════
   KomiteApp Web — token visual diselaraskan dengan QML Theme.qml
   ════════════════════════════════════════════════════════════════════════ */

@font-face { font-family: "Lato"; src: url("../fonts/Lato-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lato"; src: url("../fonts/Lato-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Lato"; src: url("../fonts/Lato-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lato"; src: url("../fonts/Lato-Black.ttf") format("truetype"); font-weight: 900; font-style: normal; font-display: swap; }

:root {
  --primary: #5271ff;
  --primary-strong: #3f5cf0;
  --primary-soft: #eef1ff;
  --primary-ink: #ffffff;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f7f2fa;
  --surface-3: #eef1f7;
  --text: #0f172a;
  --muted: #475569;
  --hint: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --green: #15803d;
  --green-soft: #dcfce7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --orange: #c2410c;
  --blue: #1d4ed8;
  --shadow: 0 12px 32px rgba(15, 23, 42, .07);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, .05);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --topbar-h: 64px;
  --sidebar-w: 252px;
  --font: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --primary: #7c8cff;
  --primary-strong: #6a7cff;
  --primary-soft: rgba(124, 140, 255, .16);
  --primary-ink: #0b0f19;
  --bg: #0b0f19;
  --surface: #111827;
  --surface-2: #161e2e;
  --surface-3: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --hint: #64748b;
  --border: #263445;
  --border-strong: #334155;
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, .14);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, .14);
  --orange: #fb923c;
  --blue: #93c5fd;
  --shadow: 0 16px 40px rgba(0, 0, 0, .34);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .26);
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.7rem; font-weight: 900; letter-spacing: -.02em; }
h2 { font-size: 1.02rem; font-weight: 700; }
.muted { color: var(--muted); }
.block { display: block; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }

/* ── Tombol ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 16px; font-weight: 700; font-size: .93rem;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .06s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn-secondary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn-secondary:hover:not(:disabled) { filter: brightness(.97); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .85rem; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid transparent; background: transparent; color: var(--muted);
}
.icon-button:hover { background: var(--surface-3); color: var(--text); }

/* ── Login ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100dvh; display: grid; place-items: center; position: relative;
  overflow: hidden; padding: 32px 18px;
  background:
    radial-gradient(900px 600px at 12% 8%, rgba(82, 113, 255, .16), transparent 60%),
    radial-gradient(700px 500px at 88% 92%, rgba(82, 113, 255, .12), transparent 55%),
    var(--bg);
}
.login-orbit { position: absolute; border-radius: 50%; border: 1px solid rgba(82, 113, 255, .18); pointer-events: none; }
.login-orbit::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.login-orbit-a { width: 620px; height: 620px; }
.login-orbit-a::after { top: 46px; right: 108px; }
.login-orbit-b { width: 430px; height: 430px; border-color: rgba(82, 113, 255, .12); }
.login-orbit-b::after { bottom: 58px; left: 30px; width: 6px; height: 6px; opacity: .7; }

.login-card {
  position: relative; z-index: 1; width: min(430px, 100%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 38px 36px 26px;
  box-shadow: var(--shadow);
  animation: rise .4s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-brand { text-align: center; }
.login-logo { margin: 0 auto 14px; filter: drop-shadow(0 10px 20px rgba(82, 113, 255, .22)); }
.login-brand h1 { font-size: 1.5rem; letter-spacing: .22em; font-weight: 900; }
.login-brand p { margin-top: 6px; color: var(--muted); font-size: .92rem; }
.brand-rule { display: block; width: 44px; height: 3px; border-radius: 3px; margin: 16px auto 24px; background: var(--primary); }
.login-form { display: grid; gap: 16px; }

.field label { display: block; font-size: .82rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--hint); }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field input:disabled { background: var(--surface-2); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; }
.form-error {
  margin: 0; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--red-soft); color: var(--red); font-size: .86rem; font-weight: 700;
}
.login-meta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 22px; color: var(--muted); font-size: .78rem;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hint); }
.status-dot.is-online { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status-dot.is-offline { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.dot-sep { color: var(--border-strong); }

.theme-fab {
  position: fixed; top: 18px; right: 18px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.theme-fab:hover { color: var(--primary); border-color: var(--primary); }
.theme-fab-inline { position: static; width: 36px; height: 36px; box-shadow: none; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: spin .7s linear infinite;
}
.spinner-sm { width: 13px; height: 13px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Kerangka aplikasi ──────────────────────────────────────────────── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.menu-toggle { display: none; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-name { font-weight: 900; letter-spacing: .14em; font-size: .95rem; }
.brand-school {
  color: var(--muted); font-size: .82rem; padding-left: 12px; margin-left: 4px;
  border-left: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; min-width: 0; }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.clock-time { font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; }
.clock-date { color: var(--muted); font-size: .72rem; }
.user-chip { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--primary-ink);
  font-weight: 900; font-size: .82rem; letter-spacing: .03em;
}
.avatar-sm { width: 32px; height: 32px; font-size: .76rem; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-meta strong { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.user-meta small { color: var(--muted); font-size: .72rem; }

.shell { flex: 1; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 0; }
.sidebar {
  position: sticky; top: var(--topbar-h); align-self: start;
  height: calc(100dvh - var(--topbar-h));
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 14px; border-right: 1px solid var(--border);
  background: var(--surface);
}
.sidebar nav { display: grid; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 700; font-size: .88rem;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); }
.nav-item.is-disabled { opacity: .72; }
.nav-item svg { flex: 0 0 auto; }
.nav-badge {
  margin-left: auto; font-size: .62rem; font-weight: 900; letter-spacing: .04em;
  text-transform: uppercase; color: var(--hint);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px;
}
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user strong { display: block; font-size: .84rem; }
.sidebar-user small { display: block; color: var(--muted); font-size: .72rem; }
.sidebar-note { margin-top: 10px; color: var(--hint); font-size: .74rem; line-height: 1.4; }
.scrim { display: none; }

.content { padding: 28px 28px 56px; max-width: 1320px; width: 100%; margin: 0 auto; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .68rem; font-weight: 900; color: var(--primary); margin-bottom: 4px; }
.page-sub { color: var(--muted); margin-top: 6px; font-size: .9rem; }

/* ── Kartu ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head p { font-size: .82rem; margin-top: 3px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { display: flex; align-items: flex-start; gap: 14px; }
.stat-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-indigo { background: var(--primary-soft); color: var(--primary); }
.icon-blue { background: rgba(29, 78, 216, .1); color: var(--blue); }
.icon-green { background: var(--green-soft); color: var(--green); }
.icon-red { background: var(--red-soft); color: var(--red); }
.stat-label { color: var(--muted); font-size: .78rem; font-weight: 700; }
.stat-value { font-size: 1.3rem; font-weight: 900; letter-spacing: -.02em; margin-top: 3px; }
.stat-sub { color: var(--hint); font-size: .74rem; margin-top: 4px; display: flex; gap: 5px; flex-wrap: wrap; }

.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }

.progress { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--primary-strong)); transition: width .5s ease; }
.progress-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--muted); font-size: .78rem; }
.progress-legend b { color: var(--text); }
.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.mini-grid > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.mini-grid small { display: block; color: var(--muted); font-size: .72rem; }
.mini-grid strong { display: block; margin-top: 3px; font-size: 1.05rem; }

.kv { display: grid; gap: 2px; margin: 0; }
.kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: .84rem; }
.kv dd { margin: 0; font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; }
.kv-total dt, .kv-total dd { color: var(--text); font-weight: 900; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 900; }
.pill-indigo { background: var(--primary-soft); color: var(--primary); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-red { background: var(--red-soft); color: var(--red); }

/* ── Tabel ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
thead th {
  text-align: left; padding: 9px 12px; color: var(--muted);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tbody strong { font-size: .86rem; }

/* ── Keadaan kosong / alert ─────────────────────────────────────────── */
.empty-state { padding: 26px 14px; text-align: center; color: var(--muted); }
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px; margin-bottom: 10px;
  background: var(--surface-3); color: var(--hint); font-weight: 900; font-size: .86rem;
}
.empty-icon-lg { width: 58px; height: 58px; border-radius: 16px; }
.empty-state p { font-size: .88rem; }
.alert { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .88rem; font-weight: 700; }
.alert-error { background: var(--red-soft); color: var(--red); }
.coming-soon { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 54px 22px; }
.coming-soon p { max-width: 520px; color: var(--muted); line-height: 1.55; }
.coming-soon .btn { margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 80; background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-size: .84rem; font-weight: 700;
  box-shadow: var(--shadow);
}

/* ── Responsif ──────────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .split-grid { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); z-index: 30;
    width: min(300px, 84vw); transform: translateX(-102%);
    transition: transform .2s ease; box-shadow: var(--shadow);
    height: calc(100dvh - var(--topbar-h));
  }
  .sidebar.is-open { transform: none; }
  .scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 25; background: rgba(15, 23, 42, .42); }
  .content { padding: 22px 18px 48px; }
  .clock { display: none; }
  .brand-school { display: none; }
  .user-meta { display: none; }
}
@media (max-width: 620px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-name { font-size: .84rem; }
  .stat-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { align-self: flex-start; }
  .login-card { padding: 30px 22px 22px; }
  .topbar-right { gap: 8px; }
  .btn-sm { padding: 7px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}