/* ========================================================================
   LAPOR IT MAFINDO — Stylesheet
   Warna semantik (merah/amber/biru/hijau) hanya dipakai untuk urgensi &
   status, sehingga selalu membawa makna. Aksen antarmuka = teal (sistem/IT).
   ======================================================================== */

:root {
  color-scheme: light dark;

  --ink: #16202e;
  --ink-2: #3a4759;
  --muted: #647183;
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: #d9e0e8;
  --line-strong: #c3cdd8;

  --brand: #0e7c86;
  --brand-strong: #0a5a62;
  --brand-tint: #e3f2f3;

  --danger: #d12b3a;  --danger-bg: #fdeced;
  --warn:   #b86a07;  --warn-bg:   #fbf0dd;
  --info:   #2563a8;  --info-bg:   #e8f0fb;
  --ok:     #1f8a4c;  --ok-bg:     #e5f4ec;
  --neutral:#5b6878;  --neutral-bg:#eceff3;

  --shadow-sm: 0 1px 2px rgba(22, 32, 46, .06), 0 1px 3px rgba(22, 32, 46, .05);
  --shadow-md: 0 4px 16px rgba(22, 32, 46, .10);
  --shadow-lg: 0 18px 48px rgba(22, 32, 46, .22);

  --radius: 12px;
  --radius-sm: 8px;
  --maxw-form: 760px;
  --maxw-wide: 1160px;

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8edf3;
    --ink-2: #c0cad6;
    --muted: #93a1b2;
    --bg: #0d1420;
    --surface: #152030;
    --surface-2: #1a2838;
    --line: #26374b;
    --line-strong: #324860;

    --brand: #2bb5c0;
    --brand-strong: #52c7d1;
    --brand-tint: #123238;

    --danger: #ff6b76;  --danger-bg: #351a1e;
    --warn:   #e0a44a;  --warn-bg:   #352a16;
    --info:   #6ba6e8;  --info-bg:   #16263c;
    --ok:     #52c07e;  --ok-bg:     #15301f;
    --neutral:#9aa7b6;  --neutral-bg:#1e2c3c;

    --shadow-md: 0 4px 16px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 90px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--brand-strong); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--maxw-wide); margin: 0 auto;
  padding: 14px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark {
  width: 44px; height: 44px; flex: 0 0 auto;
  object-fit: contain; display: block;
}
.brand-text h1 { font-size: 17px; font-weight: 800; }
.brand-text span { font-size: 12.5px; color: var(--muted); }

.nav { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.nav button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--muted);
  padding: 8px 14px; border-radius: 7px; transition: background .15s, color .15s;
}
.nav button:hover { color: var(--ink); }
.nav button.active { background: var(--surface); color: var(--brand-strong); box-shadow: var(--shadow-sm); }

/* ---------- Layout ---------- */
main { max-width: var(--maxw-form); margin: 0 auto; padding: 28px 20px 80px; }
main.wide { max-width: var(--maxw-wide); }
.view { display: none; animation: enter .25s ease both; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

.view-head { margin-bottom: 22px; }
.view-head h2 { font-size: 24px; font-weight: 800; }
.view-head p { color: var(--muted); margin-top: 6px; font-size: 15px; }

/* ---------- Card & form ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.section { padding: 22px; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }
.section > h3 { font-size: 13px; font-weight: 700; color: var(--brand-strong); margin-bottom: 4px; }
.section > .section-note { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field .req { color: var(--danger); }
.field .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; gap: 0; } }

input, select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--muted); }

/* ---------- Screenshot ---------- */
.drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 18px; text-align: center; color: var(--muted); font-size: 14px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-tint); }
.drop input { display: none; }
.preview-thumb { margin-top: 12px; display: none; align-items: center; gap: 12px; }
.preview-thumb.show { display: flex; }
.preview-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.preview-thumb .meta { font-size: 13px; }
.preview-thumb button { margin-left: auto; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 700; font-size: 15px;
  border-radius: var(--radius-sm); padding: 11px 18px; border: 1px solid transparent;
  transition: background .15s, box-shadow .15s, transform .06s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.form-actions { padding: 20px 22px; display: flex; gap: 12px; align-items: center; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.b-KRITIS, .b-Eskalasi { color: var(--danger); background: var(--danger-bg); }
.b-SEDANG { color: var(--warn); background: var(--warn-bg); }
.b-MINOR, .b-Diterima { color: var(--info); background: var(--info-bg); }
.b-Selesai { color: var(--ok); background: var(--ok-bg); }
.b-Baru, .b-Ditangani { color: var(--neutral); background: var(--neutral-bg); }
.b-BELUM { color: var(--neutral); background: var(--neutral-bg); }
.b-Ditangani { color: var(--warn); background: var(--warn-bg); }
.badge-lewat { color: var(--danger); background: var(--danger-bg); }

/* ---------- Hasil lapor / cek ---------- */
.result-card { text-align: center; padding: 30px 24px; }
.result-ok { width: 54px; height: 54px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin: 0 auto 14px; }
.ticket-no {
  font-size: 30px; font-weight: 800; letter-spacing: 0.02em; color: var(--brand-strong);
  margin: 8px 0; user-select: all;
}
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-top: 18px; text-align: left; }
.result-grid .cell { background: var(--surface); padding: 12px 14px; }
.result-grid .cell .k { font-size: 12px; color: var(--muted); }
.result-grid .cell .v { font-weight: 700; font-size: 14.5px; margin-top: 2px; }
@media (max-width: 480px) { .result-grid { grid-template-columns: 1fr; } }

/* ---------- Detail tiket (cek & dashboard) ---------- */
.detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.detail-head .ticket-id { font-size: 20px; font-weight: 800; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 10px; } }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 24px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 16px; bottom: -2px; width: 1.5px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .t-aksi { font-weight: 700; font-size: 14px; }
.timeline .t-meta { font-size: 12.5px; color: var(--muted); }
.timeline .t-note { font-size: 13px; margin-top: 2px; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.alert .n { color: var(--danger); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select { width: auto; flex: 0 1 auto; }
.toolbar .search { flex: 1 1 220px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
thead th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.cell-no { font-weight: 700; color: var(--brand-strong); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- Gate dashboard ---------- */
.gate { max-width: 400px; margin: 40px auto; text-align: center; }
.gate .lock { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-strong); display: grid; place-items: center; margin: 0 auto 14px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(12, 18, 28, .55);
  display: none; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 640px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: enter .2s ease both; margin: auto;
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; margin-right: auto; }
.modal-body { padding: 20px; }
.modal-body section + section { margin-top: 18px; }
.modal-body h4 { font-size: 12px; color: var(--brand-strong); margin-bottom: 8px; font-weight: 700; }
.icon-btn { appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 6px; line-height: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--surface); padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 80; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14.5px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.inline-err { color: var(--danger); font-size: 13px; margin-top: 8px; display: none; }
.inline-err.show { display: block; }

.site-footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 24px 20px 40px; }
.config-warn {
  max-width: var(--maxw-form); margin: 16px auto -8px; background: var(--warn-bg); color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 13.5px; font-weight: 600; display: none;
}
.config-warn.show { display: block; }
