/* Kidang Kencana WiFi — tema merah-emas
   Font di-self-host dari /static/fonts (CSP default-src 'self', tanpa CDN). */

/* ---------- Font ---------- */
@font-face {
  font-family: "Work Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/WorkSans-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Work Sans"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/static/fonts/WorkSans-Italic.woff2") format("woff2");
}
@font-face {
  font-family: "Work Sans"; font-style: normal; font-weight: 600 700; font-display: swap;
  src: url("/static/fonts/WorkSans-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "Work Sans"; font-style: italic; font-weight: 600 700; font-display: swap;
  src: url("/static/fonts/WorkSans-BoldItalic.woff2") format("woff2");
}
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/BricolageGrotesque-Bold.woff2") format("woff2");
}

/* ---------- Token ---------- */
:root {
  --merah: #b3121f;
  --merah-tua: #7d0c15;
  --merah-terang: #d42636;
  --emas: #e8b23a;
  --emas-tua: #c6901c;
  --emas-muda: #fff4d6;
  --teks: #241c18;
  --muted: #6b625b;
  --garis: #ebe2d6;
  --garis-kuat: #ddd0bd;
  --latar: #f6f1e9;
  --latar-2: #fbf7f1;
  --putih: #fff;
  --ok: #1f7a3a;
  --error: #b3121f;

  --font-teks: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-judul: "Bricolage Grotesque", "Work Sans", system-ui, sans-serif;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(63, 24, 10, .06), 0 1px 3px rgba(63, 24, 10, .08);
  --shadow-md: 0 4px 12px rgba(63, 24, 10, .10), 0 2px 4px rgba(63, 24, 10, .06);
  --shadow-lg: 0 14px 40px rgba(63, 24, 10, .18);
  --ring: 0 0 0 3px rgba(232, 178, 58, .45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 15px/1.6 var(--font-teks);
  letter-spacing: .005em;
  color: var(--teks);
  background: var(--latar);
  background-image:
    radial-gradient(1200px 500px at 100% -10%, rgba(232, 178, 58, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(179, 18, 31, .05), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--merah); text-underline-offset: 2px; }
a:hover { color: var(--merah-tua); }
h1, h2, h3, legend { font-family: var(--font-judul); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; line-height: 1.15; margin: 0 0 .5rem; color: var(--merah-tua); }
h2 { font-size: 1.2rem; margin: 1.75rem 0 .6rem; }
code { font-size: .9em; font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  background: var(--emas-muda); padding: .05em .35em; border-radius: 5px; border: 1px solid #f0e3bf; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--emas-tua); outline-offset: 2px; border-radius: 4px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem;
  padding: .6rem 1.25rem;
  background: linear-gradient(120deg, var(--merah-tua), var(--merah) 60%, var(--merah-terang));
  color: var(--putih);
  border-bottom: 3px solid var(--emas);
  box-shadow: var(--shadow-md);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; }
.brand-logo { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--putih);
  border: 2px solid var(--emas); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-text strong { font-family: var(--font-judul); font-size: 1.05rem; letter-spacing: -.01em; }
.brand-text small { color: var(--emas-muda); font-size: .72rem; letter-spacing: .02em; }
.mainnav { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1; }
.mainnav a, .mainnav .soon {
  padding: .4rem .8rem; border-radius: 999px; color: var(--putih); text-decoration: none;
  font-weight: 600; font-size: .92rem; transition: background .15s ease, color .15s ease;
}
.mainnav a:hover { background: rgba(255, 255, 255, .15); color: var(--putih); }
.mainnav a.active { background: var(--emas); color: var(--merah-tua); box-shadow: var(--shadow-sm); }
.mainnav .soon { opacity: .55; cursor: default; }
.usermenu { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; font-size: .9rem; }
.usermenu .who { display: inline-flex; align-items: center; gap: .4rem; }
.usermenu a, .usermenu .linklike { color: var(--emas-muda); }
.usermenu a:hover, .usermenu .linklike:hover { color: var(--putih); }
.usermenu form { margin: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Layout ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.25rem 3.5rem; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.panel { background: var(--putih); border: 1px solid var(--garis); border-radius: var(--radius); padding: 1.35rem; box-shadow: var(--shadow-sm); }
.narrow { max-width: 480px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; margin-top: 1.1rem; }
.card {
  display: block; background: var(--putih); border: 1px solid var(--garis); border-top: 4px solid var(--emas);
  border-radius: var(--radius); padding: 1.15rem 1.2rem; color: inherit; text-decoration: none;
  box-shadow: var(--shadow-sm); transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card h2 { margin-top: 0; color: var(--merah-tua); }
.card-link:hover { transform: translateY(-3px); border-top-color: var(--merah); box-shadow: var(--shadow-md); }
.card-soon { opacity: .72; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .12rem .6rem; border-radius: 999px;
  background: var(--emas-muda); color: var(--merah-tua); border: 1px solid var(--emas); }

/* ---------- Form ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .9rem; }
.form label small { font-weight: 400; color: var(--muted); }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; }
input, select {
  font: inherit; padding: .62rem .75rem; border: 1px solid var(--garis-kuat); border-radius: var(--radius-sm);
  background: var(--putih); font-weight: 400; color: var(--teks); transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: #a99e92; }
input:hover, select:hover { border-color: var(--emas-tua); }
input:focus, select:focus { outline: none; border-color: var(--emas-tua); box-shadow: var(--ring); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; padding: .6rem 1.15rem; border-radius: var(--radius-sm);
  border: 1px solid var(--merah); background: var(--putih); color: var(--merah); cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-sm); transition: background .15s ease, color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--emas-muda); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--merah-terang), var(--merah)); color: var(--putih); border-color: var(--merah-tua); }
.btn-primary:hover { background: linear-gradient(180deg, var(--merah), var(--merah-tua)); color: var(--putih); }
.btn-block { width: 100%; }

.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid; box-shadow: var(--shadow-sm);
  font-size: .92rem; display: flex; align-items: center; gap: .55rem; animation: alert-in .45s cubic-bezier(.2, .8, .2, 1) both; }
.alert::before { font-weight: 700; flex-shrink: 0; }
.alert-ok { background: #e9f6ed; border-color: #b6dfc2; color: var(--ok); }
.alert-ok::before { content: "✓"; display: inline-flex; align-items: center; justify-content: center;
  width: 1.4em; height: 1.4em; border-radius: 50%; background: var(--ok); color: #fff; font-size: .85em;
  animation: pop-in .5s .15s both; }
.alert-error { background: #fdecee; border-color: #f2b8be; color: var(--error); }
.alert-error::before { content: "!"; display: inline-flex; align-items: center; justify-content: center;
  width: 1.4em; height: 1.4em; border-radius: 50%; background: var(--error); color: #fff; font-size: .85em; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { 0% { transform: scale(0); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; background: var(--putih); border: 1px solid var(--garis); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--garis); white-space: nowrap; }
.table th { background: linear-gradient(180deg, #fff7e2, var(--emas-muda)); font-size: .78rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--merah-tua); border-bottom: 2px solid var(--emas); }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:nth-child(even) td { background: #fcf9f3; }
.table tbody tr:hover td { background: var(--emas-muda); }
.table tr:last-child td { border-bottom: 0; }
.row-off td { color: var(--muted); }

.role { font-size: .72rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; letter-spacing: .02em; }
.role-owner { background: var(--emas); color: var(--merah-tua); }
.role-admin { background: var(--merah); color: var(--putih); }
.role-teknisi { background: #ece5db; color: var(--teks); }
.status-on { color: var(--ok); font-weight: 600; }
.status-off { color: var(--muted); }

/* ---------- Login ---------- */
.login-wrap {
  position: relative; overflow: hidden;
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: var(--merah-tua);
}

/* Latar animasi gelombang merah-putih (potongan kertas) — murni CSS/SVG, tanpa JS */
.login-wave { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.login-wave svg { width: 100%; height: 100%; display: block; }
.login-wave path { will-change: transform; }
.login-wave .w1 { animation: wave-drift 26s linear infinite; }
.login-wave .w2 { animation: wave-drift 20s linear infinite reverse; }
.login-wave .w3 { animation: wave-drift 32s linear infinite; }
.login-wave .w4 { animation: wave-drift 23s linear infinite reverse; }
.login-wave .w5 { animation: wave-drift 29s linear infinite; }
@keyframes wave-drift { from { transform: translateX(0); } to { transform: translateX(-720px); } }
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 390px; background: var(--putih); border-radius: var(--radius-lg); padding: 2.25rem 1.75rem;
  border-top: 5px solid var(--emas); text-align: center; box-shadow: var(--shadow-lg);
}
.login-card .form { text-align: left; }
.login-card { animation: card-in .55s cubic-bezier(.2, .8, .2, 1) both; }
.login-card.shake { animation: card-shake .55s cubic-bezier(.36, .07, .19, .97) both; }
.login-logo { width: 112px; height: 112px; border-radius: var(--radius-lg); box-shadow: 0 6px 18px rgba(125, 12, 21, .28);
  animation: logo-float 4.5s ease-in-out infinite; }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes card-shake {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-9px); } 40%, 60% { transform: translateX(9px); }
}
@keyframes logo-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.login-card h1 { color: var(--merah-tua); margin-top: .6rem; }
.tagline { color: var(--muted); margin-top: 0; font-style: italic; }

/* ---------- Auto Regist ---------- */
fieldset { border: 1px solid var(--garis); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; margin: 0;
  display: flex; flex-direction: column; gap: 1rem; background: var(--latar-2); }
legend { font-weight: 700; color: var(--merah-tua); padding: 0 .4rem; font-size: 1.02rem; }
.req { color: var(--merah); }
.field-error { color: var(--error); font-weight: 600; font-size: .85rem; }
input.upper { text-transform: uppercase; }
input[type="file"] { padding: .5rem; background: var(--latar); border-style: dashed; }
.alert-warn { background: #fff7e0; border-color: var(--emas); color: #6b4a00; }
.badge-busy { background: #fde7c4; border-color: #e7a33a; color: #7a4e00; }
.btn-small { padding: .3rem .65rem; font-size: .8rem; box-shadow: none; }
form.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
.panel + .panel, .panel + .actions { margin-top: 1rem; }
.ask h2 { margin-top: 0; }
.danger-zone { margin-top: 2rem; font-size: .85rem; }
.danger-zone .linklike { color: var(--muted); }

.summary { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.1rem; margin: 0 0 1rem; }
.summary dt { color: var(--muted); font-size: .85rem; padding-top: .1rem; }
.summary dd { margin: 0; overflow-wrap: anywhere; }
code.big { font-size: 1.05rem; padding: .1rem .4rem; }
@media (max-width: 480px) { .summary { grid-template-columns: 1fr; } .summary dd { margin-bottom: .4rem; } }

.thumbs { display: flex; flex-wrap: wrap; gap: .7rem; }
.thumbs figure { margin: 0; width: 120px; }
.thumbs img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--garis); box-shadow: var(--shadow-sm); }
.thumbs figcaption { font-size: .75rem; color: var(--muted); text-align: center; }

.sn-list { display: flex; flex-direction: column; gap: .55rem; }
.sn-item { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center;
  gap: .1rem .7rem; background: var(--putih); border: 1px solid var(--garis-kuat); border-radius: var(--radius);
  padding: .75rem .95rem; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .14s ease, box-shadow .14s ease; }
.sn-item:hover { border-color: var(--emas-tua); }
.sn-item input[type="radio"] { grid-row: 1 / 3; width: 1.2rem; height: 1.2rem; accent-color: var(--merah); }
.sn-item .btn-small { grid-row: 1 / 3; grid-column: 3; }
.sn-item:has(input:checked) { border-color: var(--merah); box-shadow: 0 0 0 2px var(--emas-muda), var(--shadow-sm); }
.sn-main { font-weight: 600; }
.sn-meta { grid-column: 2; font-size: .85rem; color: var(--muted); }
.sn-busy { opacity: .6; cursor: not-allowed; }

.center { text-align: center; }
.spinner { width: 42px; height: 42px; margin: .5rem auto 1rem; border-radius: 50%;
  border: 4px solid var(--emas-muda); border-top-color: var(--merah); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-danger { background: var(--merah-tua); border-color: var(--merah-tua); color: var(--putih); }
.btn-danger:hover { background: #640910; color: var(--putih); }
strong.big { font-size: 1.1rem; }
.choice { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
.choice h2 { margin: 0; }
.choice label.check { display: flex; align-items: flex-start; gap: .6rem; font-weight: 400; cursor: pointer; }
.choice input[type="radio"] { margin-top: .25rem; accent-color: var(--merah); }
.page-head .actions { margin: 0; }
td .btn-small { margin: .1rem .15rem .1rem 0; }

/* ---------- Riwayat ---------- */
.searchbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.searchbar input { flex: 1 1 260px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; }
.src { font-size: .72rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; letter-spacing: .02em; }
.src-web { background: var(--merah); color: var(--putih); }
.src-telegram { background: #e3f0fb; color: #1d5f99; }
.src-impor { background: #ece5db; color: var(--teks); }
pre.script { background: #211a16; color: #f6eedd; padding: 1.1rem; border-radius: var(--radius); overflow-x: auto;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: .85rem; line-height: 1.5; border-left: 4px solid var(--emas); box-shadow: var(--shadow-sm); }

/* ---------- Dashboard: hero, statistik, kartu ber-ikon ---------- */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 1.75rem 1.9rem; margin-bottom: 1.5rem;
  border-radius: var(--radius-lg); border: 1px solid var(--garis);
  background:
    radial-gradient(520px 240px at 92% -30%, rgba(232, 178, 58, .22), transparent 70%),
    linear-gradient(135deg, #fffdf8, var(--latar-2) 55%, #fdeede);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.hero-text { min-width: 0; }
.hero-eyebrow { margin: 0 0 .25rem; font-size: .76rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--emas-tua); }
.hero h1 { margin: 0 0 .35rem; font-size: 1.9rem; }
.hero-sub { margin: 0; color: var(--muted); max-width: 52ch; }
.hero-logo { width: 110px; height: 110px; border-radius: var(--radius-lg); flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(125, 12, 21, .22); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat {
  position: relative; background: var(--putih); border: 1px solid var(--garis);
  border-left: 4px solid var(--emas); border-radius: var(--radius); padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: .15rem;
}
.stat-num { font-family: var(--font-judul); font-size: 2.1rem; line-height: 1; color: var(--merah-tua); }
.stat-label { font-size: .85rem; color: var(--muted); }
.stat-accent { border-left-color: var(--merah); background: linear-gradient(180deg, #fff, #fff6f6); }
.stat-accent .stat-num { color: var(--merah); }

.section-title { display: flex; align-items: center; gap: .6rem; margin: 0 0 .9rem; }
.section-title::after { content: ""; flex: 1; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--emas), transparent); }

.dash .card { display: flex; flex-direction: column; gap: .35rem; padding: 1.3rem 1.3rem 1.2rem; }
.card-icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px;
  border-radius: 12px; background: var(--emas-muda); color: var(--merah); border: 1px solid #f0e3bf; margin-bottom: .4rem; }
.dash .card h2 { margin: 0; }
.dash .card p { margin: 0; color: var(--muted); font-size: .92rem; }
.card-go { margin-top: .5rem; font-weight: 600; font-size: .9rem; color: var(--merah); }
.card-link:hover .card-icon { background: var(--merah); color: var(--putih); border-color: var(--merah-tua); transition: background .16s ease, color .16s ease; }

@media (max-width: 560px) {
  .hero { flex-direction: column-reverse; align-items: flex-start; text-align: left; padding: 1.4rem 1.3rem; }
  .hero h1 { font-size: 1.6rem; }
  .hero-logo { width: 84px; height: 84px; }
}

/* ---------- Judul seksi + lihat semua ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2rem; }
.section-head .section-title { flex: 1; margin: 0 0 .9rem; }
.see-all { font-weight: 600; font-size: .9rem; white-space: nowrap; }

/* ---------- Footer situs ---------- */
.sitefoot { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  max-width: 1120px; margin: 1rem auto 0; padding: 1.1rem 1.25rem 1.5rem;
  border-top: 1px solid var(--garis); color: var(--muted); }
.sitefoot img { border-radius: 50%; border: 2px solid var(--emas); background: var(--putih); }
.sitefoot-text { display: flex; flex-direction: column; line-height: 1.2; }
.sitefoot-text strong { font-family: var(--font-judul); color: var(--merah-tua); }
.sitefoot-text span { font-size: .82rem; }
.sitefoot-meta { margin-left: auto; font-size: .8rem; }

/* ---------- Kontrol bot (dashboard) ---------- */
.botbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  background: var(--putih); border: 1px solid var(--garis); border-radius: var(--radius);
  padding: .9rem 1.15rem; margin-bottom: 1.75rem; box-shadow: var(--shadow-sm); }
.botbar-info { display: flex; align-items: center; gap: .7rem; }
.botbar-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.bot-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: var(--muted); box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
.bot-active { background: #1f9d4d; box-shadow: 0 0 0 3px rgba(31,157,77,.18); }
.bot-inactive { background: #b9b0a6; }
.bot-failed { background: var(--merah); box-shadow: 0 0 0 3px rgba(179,18,31,.18); }

/* ---------- Aksesibilitas gerak ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
