/* Halaman depan (sebelum login) & halaman admin -- token warna & font sama dengan aplikasi (style.css). */
@font-face { font-family: "Geist"; font-weight: 400; font-display: swap; src: url("/static/fonts/geist-sans-400.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 600; font-display: swap; src: url("/static/fonts/geist-sans-600.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 700; font-display: swap; src: url("/static/fonts/geist-sans-700.woff2") format("woff2"); }

:root {
  --bg: #0d1017; --panel: #141926; --panel-2: #1a2133; --border: #262e40;
  --text: #e9ebf2; --muted: #8993ab; --muted-2: #6b7590;
  --accent: #d9a441; --accent-soft: rgba(217, 164, 65, 0.14); --accent-text: #f0c674;
  --positive: #4fae7c; --positive-soft: rgba(79, 174, 124, 0.14); --negative: #e1685f; --negative-soft: rgba(225, 104, 95, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 24px 60px -24px rgba(0, 0, 0, 0.6);
}
/* tema terang: dipilih eksplisit di aplikasi (data-theme="light"), atau ikut sistem bila belum memilih */
:root[data-theme="light"] {
    --bg: #f5f6fa; --panel: #ffffff; --panel-2: #eef0f6; --border: #dfe3ee;
    --text: #1b2030; --muted: #626b82; --muted-2: #8991a6;
    --accent: #b8792e; --accent-soft: rgba(184, 121, 46, 0.12); --accent-text: #7a5320;
    --positive: #2f8f5c; --negative: #c94a41; --negative-soft: rgba(201, 74, 65, 0.1);
    --shadow: 0 1px 2px rgba(20, 24, 38, 0.04), 0 18px 40px -20px rgba(20, 24, 38, 0.2);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6fa; --panel: #ffffff; --panel-2: #eef0f6; --border: #dfe3ee;
    --text: #1b2030; --muted: #626b82; --muted-2: #8991a6;
    --accent: #b8792e; --accent-soft: rgba(184, 121, 46, 0.12); --accent-text: #7a5320;
    --positive: #2f8f5c; --negative: #c94a41; --negative-soft: rgba(201, 74, 65, 0.1);
    --shadow: 0 1px 2px rgba(20, 24, 38, 0.04), 0 18px 40px -20px rgba(20, 24, 38, 0.2);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.55;
  background-image: radial-gradient(ellipse 70% 50% at 85% -10%, var(--accent-soft), transparent 70%);
}
button, input { font: inherit; }

/* nav */
.ld-nav { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem clamp(1rem, 4vw, 3rem); }
.ld-brand { display: flex; align-items: center; gap: 0.5rem; font-size: 1.05rem; letter-spacing: -0.01em; }
.ld-brand b { color: var(--accent-text); }
.ld-mark { color: var(--accent); font-size: 1.2rem; }

/* tombol */
.ld-btn { height: 40px; padding: 0 1.1rem; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.ld-btn.primary { width: 100%; background: var(--accent); color: #1a1408; }
.ld-btn.primary:hover { filter: brightness(1.06); }
.ld-btn.primary:disabled { opacity: 0.6; cursor: wait; }
.ld-btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.ld-btn.ghost:hover { border-color: var(--accent); color: var(--accent-text); }

/* layout utama */
.ld-main { flex: 1; width: min(1180px, 100%); margin: 0 auto; padding: clamp(1rem, 4vw, 3rem) clamp(1rem, 4vw, 3rem) 2rem;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 420px); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
@media (max-width: 900px) { .ld-main { grid-template-columns: 1fr; } }

.ld-eyebrow { margin: 0 0 0.8rem; color: var(--accent-text); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.ld-hero h1 { margin: 0; font-size: clamp(1.9rem, 4.2vw, 3.1rem); line-height: 1.12; letter-spacing: -0.025em; font-weight: 700; max-width: 18ch; }
.ld-lead { margin: 1.1rem 0 1.8rem; color: var(--muted); font-size: 1.02rem; max-width: 56ch; }

.ld-features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
@media (max-width: 560px) { .ld-features { grid-template-columns: 1fr; } }
.ld-features li { display: flex; gap: 0.75rem; padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--panel) 70%, transparent); }
.ld-features b { display: block; font-size: 0.92rem; margin-bottom: 0.15rem; }
.ld-features span:not(.ld-ico) { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.ld-ico { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-size: 0.95rem; }
.ld-note { margin: 1.4rem 0 0; color: var(--muted-2); font-size: 0.78rem; }

/* kartu masuk/daftar */
.ld-card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 1.6rem; }
.ld-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 10px; background: var(--panel-2); margin-bottom: 1.3rem; }
.ld-tabs button { height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.86rem; cursor: pointer; }
.ld-tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.ld-title { margin: 0 0 1.1rem; font-size: 1.25rem; letter-spacing: -0.01em; }

.ld-google { display: flex; align-items: center; justify-content: center; gap: 0.6rem; height: 42px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.ld-google:hover { border-color: var(--accent); }
.ld-or { display: flex; align-items: center; gap: 0.8rem; margin: 1.1rem 0; color: var(--muted-2); font-size: 0.76rem; }
.ld-or::before, .ld-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.ld-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.ld-field input { height: 42px; padding: 0 0.85rem; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-size: 0.92rem; font-weight: 500; outline: none; }
.ld-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ld-field input::placeholder { color: var(--muted-2); font-weight: 400; }

.ld-error { min-height: 1.2em; margin: 0 0 0.7rem; color: var(--negative); font-size: 0.82rem; }
.ld-error:empty { margin: 0; min-height: 0; }
.ld-closed { margin: 0 0 1rem; padding: 0.7rem 0.85rem; border-radius: 10px; background: var(--negative-soft); color: var(--negative); font-size: 0.82rem; }
.ld-switch { margin: 1rem 0 0; text-align: center; color: var(--muted); font-size: 0.84rem; }
.ld-switch button { border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 600; cursor: pointer; }

/* mode daftar / masuk */
.ld-card[data-mode="login"] [data-for="signup"], .ld-card[data-mode="signup"] [data-for="login"] { display: none; }

.ld-foot { padding: 1.4rem; text-align: center; color: var(--muted-2); font-size: 0.75rem; }

/* ---------------- halaman admin ---------------- */
.cx-wrap { width: min(1180px, 100%); margin: 0 auto; padding: 0.5rem clamp(1rem, 4vw, 3rem) 3rem; }
.cx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: 0.5rem 0 1.4rem; flex-wrap: wrap; }
.cx-head h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.cx-head p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.cx-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem 1.3rem; margin-bottom: 1.1rem; }
.cx-card h2 { margin: 0 0 0.9rem; font-size: 1rem; }
.cx-settings { display: flex; flex-wrap: wrap; gap: 1.2rem 2rem; align-items: flex-end; }
.cx-setting { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.cx-setting small { font-weight: 400; color: var(--muted-2); }
.cx-setting input[type="number"] { width: 140px; height: 38px; padding: 0 0.7rem; border-radius: 9px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); }
.cx-switch { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); font-weight: 600; font-size: 0.86rem; cursor: pointer; }
.cx-switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.cx-table-wrap { overflow-x: auto; }
.cx-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.cx-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.75rem; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.cx-table td { padding: 0.65rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cx-table tr:last-child td { border-bottom: 0; }
.cx-table select { height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); padding: 0 0.4rem; }
.cx-user { display: flex; align-items: center; gap: 0.6rem; }
.cx-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; overflow: hidden; flex: none; }
.cx-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cx-user small { display: block; color: var(--muted); }
.cx-tag { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 0.7rem; font-weight: 700; }
.cx-muted { color: var(--muted-2); }
.cx-msg { min-height: 1.2em; font-size: 0.82rem; color: var(--positive); }
.cx-msg.err { color: var(--negative); }
.hidden { display: none !important; }
.cx-tabs { display: inline-flex; padding: 4px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.cx-tabs button { height: 34px; padding: 0 1rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.86rem; cursor: pointer; }
.cx-tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.cx-card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.cx-card-head h2 { margin: 0; }
.cx-search, .cx-filters select, .cx-table input[type="date"] { height: 34px; padding: 0 0.6rem; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; font-size: 0.84rem; color-scheme: light dark; }
.cx-search { width: min(260px, 100%); }
.cx-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; margin-bottom: 1.1rem; }
.cx-stat { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem 1rem; }
.cx-stat span { display: block; color: var(--muted); font-size: 0.76rem; font-weight: 600; }
.cx-stat b { font-size: 1.35rem; letter-spacing: -0.01em; }
.cx-hint { margin: 0.8rem 0 0; color: var(--muted-2); font-size: 0.78rem; }
.cx-tag.warn { background: var(--negative-soft); color: var(--negative); }
.cx-link { border: 0; background: none; padding: 0; color: var(--accent-text); font: inherit; font-weight: 600; font-size: 0.82rem; cursor: pointer; }
.cx-kinds { display: flex; flex-wrap: wrap; gap: 0.25rem 0.8rem; font-size: 0.78rem; color: var(--muted); max-width: 420px; }
.cx-kinds b { color: var(--text); }
.cx-log { display: flex; flex-direction: column; gap: 0.4rem; }
.cx-log-item { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.cx-log-item summary { display: grid; grid-template-columns: 150px minmax(120px, 200px) auto minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; padding: 0.6rem 0.8rem; cursor: pointer; font-size: 0.82rem; list-style: none; }
.cx-log-item summary::-webkit-details-marker { display: none; }
.cx-log-time { color: var(--muted); white-space: nowrap; }
.cx-log-user { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-log-q { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.cx-log-cost { font-variant-numeric: tabular-nums; color: var(--muted); }
.cx-log-body { padding: 0 0.9rem 0.9rem; display: grid; gap: 0.7rem; }
.cx-log-body h4 { margin: 0.4rem 0 0.3rem; font-size: 0.76rem; color: var(--muted); }
.cx-log-body pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 0.84rem; line-height: 1.55; max-height: 420px; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.8rem; }
@media (max-width: 760px) { .cx-log-item summary { grid-template-columns: 1fr auto; } .cx-log-user, .cx-log-time { display: none; } }
.ld-fine { margin: 0.9rem 0 0; color: var(--muted-2); font-size: 0.74rem; line-height: 1.5; text-align: center; }

/* ---------------- AI Log (gaya daftar member) ---------------- */
.cx-period { margin: -0.4rem 0 1rem; color: var(--muted); font-size: 0.88rem; }
.cx-period b { color: var(--text); }
.cx-stats-4 { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.4fr); }
@media (max-width: 900px) { .cx-stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cx-stat small { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.76rem; }
.cx-stat b.pos { color: var(--positive); }
.cx-spark svg { display: block; width: 100%; height: 54px; margin-top: 0.3rem; }
.cx-spark-line { fill: none; stroke: var(--positive); stroke-width: 2; vector-effect: non-scaling-stroke; }
.cx-spark-area { fill: var(--positive); opacity: 0.12; }
.cx-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.cx-search.grow { flex: 1 1 260px; width: auto; height: 38px; }
.cx-range { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.cx-range input[type="date"], .cx-toolbar select { height: 38px; padding: 0 0.6rem; border-radius: 9px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-size: 0.84rem; color-scheme: light dark; }
:root[data-theme="dark"] .cx-range input[type="date"], :root[data-theme="dark"] .cx-table input[type="date"] { color-scheme: dark; }
:root[data-theme="light"] .cx-range input[type="date"], :root[data-theme="light"] .cx-table input[type="date"] { color-scheme: light; }
.cx-chip { height: 38px; padding: 0 0.8rem; border-radius: 9px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.cx-chip:hover { color: var(--text); }
.cx-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.cx-members { display: flex; flex-direction: column; gap: 0.55rem; }
.cx-empty { padding: 1.5rem; text-align: center; }
.cx-mrow { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cx-mrow.open { border-color: var(--accent); }
.cx-mhead { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto 90px minmax(80px, 150px) 80px 18px; gap: 0.9rem; align-items: center;
  padding: 0.8rem 1rem; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.cx-mhead:hover { background: var(--panel-2); }
.cx-mname { min-width: 0; }
.cx-mname b { display: block; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-mname small { color: var(--muted); font-size: 0.78rem; }
.cx-tier { padding: 0.2rem 0.55rem; border-radius: 6px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; background: var(--panel-2); color: var(--muted); }
.cx-tier.pro, .cx-tier.basic { background: var(--positive-soft, rgba(79, 174, 124, 0.14)); color: var(--positive); }
.cx-tier.admin { background: var(--accent-soft); color: var(--accent-text); }
.cx-mq { text-align: right; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.cx-mq b { color: var(--text); }
.cx-bar { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.cx-bar i { display: block; height: 100%; border-radius: 99px; background: var(--positive); }
.cx-mcost { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.cx-mcost.mid { color: var(--accent-text); }
.cx-mcost.hi { color: var(--negative); }
.cx-caret { color: var(--muted); transition: transform 0.15s; }
.cx-mrow.open .cx-caret { transform: rotate(90deg); }
.cx-mbody { display: none; padding: 0.2rem 1rem 1rem; border-top: 1px solid var(--border); }
.cx-mrow.open .cx-mbody { display: flex; flex-direction: column; gap: 0.45rem; }
.cx-kinds { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0.7rem 0 0.3rem; font-size: 0.78rem; color: var(--muted); }
.cx-kinds b { color: var(--text); }
.cx-chat { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.cx-chat summary { display: grid; grid-template-columns: 150px auto minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; padding: 0.55rem 0.8rem; cursor: pointer; font-size: 0.82rem; list-style: none; }
.cx-chat summary::-webkit-details-marker { display: none; }
.cx-chat-time { color: var(--muted); white-space: nowrap; }
.cx-chat-q { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-chat-cost { color: var(--muted); font-variant-numeric: tabular-nums; }
.cx-chat-body { padding: 0 0.9rem 0.9rem; display: grid; gap: 0.6rem; }
.cx-chat-body h4 { margin: 0.4rem 0 0.3rem; font-size: 0.76rem; color: var(--muted); }
.cx-chat-body pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 0.84rem; line-height: 1.55; max-height: 420px; overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.8rem; }
@media (max-width: 760px) {
  .cx-mhead { grid-template-columns: auto minmax(0, 1fr) auto 18px; }
  .cx-mhead .cx-tier, .cx-mhead .cx-bar, .cx-mhead .cx-mq { display: none; }
  .cx-chat summary { grid-template-columns: minmax(0, 1fr) auto; }
  .cx-chat-time, .cx-chat summary .cx-tag { display: none; }
}

.cx-exp { display: flex; align-items: center; gap: 0.35rem; }
.cx-chip.sm { height: 34px; padding: 0 0.55rem; font-size: 0.74rem; white-space: nowrap; }
.cx-table .cx-tag.warn { display: inline-block; margin-top: 0.3rem; }
