/* Halo IPDS — gaya "Lembut & lapang" (opsi A) */
:root {
  --accent: #2F54D6;
  --accent-hover: #2443B5;
  --accent-soft: #EEF2FD;
  --accent-ring: #BCC9F5;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --field: #F2F4F9;
  --field-hover: #E9EDF5;
  --line: #EEF0F5;
  --text: #18203A;
  --text-2: #3A4362;
  --muted: #5B6480;
  --danger: #B42318;
  --danger-soft: #FEF0EE;
  --ok: #17703F;
  --ok-soft: #E5F6EC;
  --shadow-sm: 0 1px 3px rgba(24, 32, 58, 0.08);
  --shadow: 0 10px 30px rgba(24, 32, 58, 0.07);
  --shadow-lg: 0 30px 80px rgba(24, 32, 58, 0.28);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.m0 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
body.lock { overflow: hidden; }

/* ---------- Top bar ---------- */
.topbar { max-width: 560px; margin: 0 auto; padding: 22px 20px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar.start { justify-content: flex-start; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.brand-tag { font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 10px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow-sm); }
.pill-link {
  min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow-sm);
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; text-decoration: none; color: var(--accent);
}
.pill-link:hover { background: var(--accent-soft); }
.back {
  width: 44px; height: 44px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text);
}
.back:hover { color: var(--accent); }

/* ---------- Layout ---------- */
.wrap { max-width: 560px; margin: 0 auto; padding: 8px 20px 32px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.hero { display: flex; flex-direction: column; gap: 4px; padding: 10px 0 6px; }
.hero h1 { margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.2; }
.hero p { margin: 0; font-size: 15px; color: var(--muted); }
.card { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 20px; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 13px; font-weight: 700; }
.label .opt { font-weight: 500; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; border: 1.5px solid transparent; border-radius: 14px; background: var(--field);
  font: inherit; font-size: 16px; color: var(--text); transition: background .15s, border-color .15s;
}
.input, .select { height: 50px; padding: 0 14px; }
.textarea { padding: 12px 14px; resize: vertical; min-height: 104px; line-height: 1.5; }
.input:hover, .textarea:hover, .select:hover { background: var(--field-hover); }
.input:focus, .textarea:focus, .select:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: #8890A8; }
.field.invalid .input, .field.invalid .textarea { border-color: var(--danger); background: var(--danger-soft); }
.field.invalid .tiles .tile-choice { box-shadow: inset 0 0 0 1.5px #F3B4AC; }
.field-error { font-size: 13px; font-weight: 500; color: var(--danger); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile-choice {
  position: relative; min-height: 80px; border-radius: 16px; background: var(--field); padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-2); text-align: center; cursor: pointer;
  transition: background .15s, transform .1s;
}
.tile-choice:hover { background: var(--field-hover); }
.tile-choice:active { transform: scale(0.98); }
.tile-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile-choice:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: inset 0 0 0 2px var(--accent); }
.tile-choice:has(input:focus-visible) { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.skeleton { min-height: 80px; border-radius: 16px; background: linear-gradient(90deg, #EBEEF5, #F4F6FA, #EBEEF5); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 5px; background: var(--field); border: 1px solid #DDE1EA; }
.photo-preview.flash { animation: flash .6s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--accent); } }
.soft-btn {
  min-height: 50px; border: 0; border-radius: 14px; background: var(--field); padding: 0 12px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none;
}
.soft-btn:hover { background: var(--field-hover); color: var(--text); }
.soft-btn.on { background: var(--accent-soft); color: var(--accent); }
.photo-preview { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 16px; background: var(--field); }
.photo-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; flex: none; }
.photo-preview .meta { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 54px; padding: 0 20px; border: 0; border-radius: 16px; background: var(--accent); color: #fff;
  font: inherit; font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; box-shadow: 0 8px 20px rgba(47, 84, 214, 0.26); transition: background .15s, transform .1s;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.65; cursor: progress; }
.btn.block { width: 100%; }
.btn.sm { min-height: 48px; font-size: 15px; border-radius: 14px; }
.btn.ghost { background: var(--field); color: var(--text); box-shadow: none; font-weight: 600; }
.btn.ghost:hover { background: var(--field-hover); color: var(--text); }
.text-link { display: block; text-align: center; font-size: 14px; font-weight: 600; padding: 10px; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.ghost .spinner { border-color: rgba(24,32,58,.2); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Alerts & badges ---------- */
.alert { padding: 12px 14px; border-radius: 14px; font-size: 14px; background: var(--danger-soft); color: var(--danger); font-weight: 500; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.st-baru { background: #FFF1E6; color: #A83F0B; }
.st-diproses { background: #EAF0FF; color: #2443AE; }
.st-selesai { background: var(--ok-soft); color: var(--ok); }
.st-tidak { background: #EEF0F4; color: #4B5468; }

/* ---------- Success ---------- */
.success-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-soft); display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.ticket-no { font-family: var(--mono); font-size: 32px; font-weight: 600; letter-spacing: 0.5px; }
.caps { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; }
.kv { display: flex; flex-direction: column; gap: 12px; font-size: 14px; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.kv dt { color: var(--muted); margin: 0; }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }

/* ---------- Status page ---------- */
.search-row { display: flex; gap: 8px; }
.search-row .input { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--card); box-shadow: var(--shadow-sm); font-family: var(--mono); font-size: 13px; color: var(--text); cursor: pointer; }
.chip:hover { background: var(--accent-soft); color: var(--accent); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; }
.timeline .dot { width: 16px; height: 16px; border-radius: 50%; margin-top: 3px; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex: none; }
.timeline .dot.off { background: #fff; box-shadow: inset 0 0 0 2px #C3C8D6; }
.timeline .line { width: 2px; flex: 1; margin: 4px 0; background: var(--accent); border-radius: 2px; }
.timeline .line.off { background: #DDE1EA; }
.timeline .body { padding-bottom: 18px; }
.timeline li:last-child .body { padding-bottom: 0; }
.timeline .t { font-size: 15px; font-weight: 700; }
.timeline .s { font-size: 13px; color: var(--muted); }
.ticket-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ticket-id { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---------- Dashboard ---------- */
.dash .topbar, .dash .wrap { max-width: 1320px; }
.dash .topbar { flex-wrap: wrap; padding: 20px 24px; }
.dash .wrap { padding: 0 24px 32px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.updated { font-size: 13px; color: var(--muted); }
.top-btn {
  min-height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--card); box-shadow: var(--shadow-sm);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.top-btn:hover { background: var(--accent-soft); color: var(--accent); }
.login-card { max-width: 400px; margin: 40px auto; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border-radius: 20px; box-shadow: 0 8px 24px rgba(24,32,58,0.05); padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.kpi-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; }
.kpi-k { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-v { font-size: 28px; font-weight: 800; line-height: 1.15; letter-spacing: -0.5px; }
.ic-baru { background: #FFF1E6; color: #A83F0B; }
.ic-proses { background: #EAF0FF; color: var(--accent); }
.ic-ok { background: var(--ok-soft); color: var(--ok); }
.ic-time { background: var(--field); color: var(--text-2); }

.panel { background: var(--card); border-radius: 22px; box-shadow: 0 8px 24px rgba(24,32,58,0.05); overflow: hidden; }
.toolbar { padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--field); border-radius: 14px; }
.seg {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { background: var(--card); color: var(--text); font-weight: 700; box-shadow: var(--shadow-sm); }
.seg .n { margin-left: 4px; font-weight: 500; opacity: 0.8; }
.search { margin-left: auto; width: 280px; max-width: 100%; height: 44px; font-size: 14px; }

.table-wrap { overflow-x: auto; }
table.tickets { width: 100%; min-width: 820px; border-collapse: collapse; font-size: 14px; }
.tickets th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; }
.tickets th:first-child, .tickets td:first-child { padding-left: 20px; }
.tickets th:last-child, .tickets td:last-child { padding-right: 20px; }
.tickets td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: middle; color: var(--text-2); }
.tickets tr.row { cursor: pointer; transition: background .12s; }
.tickets tr.row:hover td { background: #F8F9FD; }
.tickets .id { font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; }
.tickets .id button { all: unset; cursor: pointer; }
.tickets .id button:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; border-radius: 4px; }
.tickets .sub { font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--muted); }
.tickets .nama { font-weight: 600; color: var(--text); white-space: nowrap; }
.tickets .nowrap { white-space: nowrap; }
.tickets .desc { max-width: 340px; }
.tickets .unassigned { color: #8890A8; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(24, 32, 58, 0.38);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .15s ease-out;
}
.modal {
  width: 920px; max-width: 100%; max-height: calc(100vh - 48px); overflow: auto;
  background: var(--card); border-radius: 28px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.modal-head { position: sticky; top: 0; z-index: 1; background: var(--card); padding: 20px 26px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.modal-head .ticket-id { font-size: 20px; }
.icon-btn { margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 14px; background: var(--field); color: var(--text-2); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--field-hover); color: var(--text); }
.modal-body { display: flex; flex-wrap: wrap; }
.modal-info { flex: 1 1 400px; min-width: 0; padding: 22px 26px; display: flex; flex-direction: column; gap: 16px; background: #FAFBFD; }
.modal-form { flex: 1 1 360px; min-width: 0; padding: 22px 26px; display: flex; flex-direction: column; gap: 14px; }
.person { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.person-name { font-weight: 700; }
.wa-btn { min-height: 40px; padding: 0 14px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; text-decoration: none; flex: none; }
.wa-btn:hover { background: #D3EFDE; color: var(--ok); }
.desc-text { margin: 0; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.photo-box { display: block; border-radius: 18px; overflow: hidden; background: #E8EBF2; }
.photo-box img { display: block; width: 100%; max-height: 320px; object-fit: contain; }
.no-photo { height: 84px; border-radius: 18px; border: 1.5px dashed #D3D8E4; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); }
.meta-list { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.status-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.status-pick label { position: relative; min-height: 44px; border-radius: 12px; background: var(--field); display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.status-pick label:hover { background: var(--field-hover); }
.status-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.status-pick label:has(input:focus-visible) { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.status-pick label.st-baru:has(input:checked) { background: #FFF1E6; color: #A83F0B; box-shadow: inset 0 0 0 2px #E8935F; }
.status-pick label.st-diproses:has(input:checked) { background: #EAF0FF; color: #2443AE; box-shadow: inset 0 0 0 2px #7C95EA; }
.status-pick label.st-selesai:has(input:checked) { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 2px #6CC394; }
.status-pick label.st-tidak:has(input:checked) { background: #EEF0F4; color: #4B5468; box-shadow: inset 0 0 0 2px #A5ACBC; }
.status-pick label.st-baru, .status-pick label.st-diproses, .status-pick label.st-selesai, .status-pick label.st-tidak { background: var(--field); color: var(--text-2); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px rgba(24,32,58,0.3); max-width: calc(100% - 32px);
}
.toast.err { background: var(--danger); }

@media (max-width: 720px) {
  .dash .topbar { padding: 16px; }
  .dash .wrap { padding: 0 16px 24px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .kpi-icon { width: 38px; height: 38px; border-radius: 12px; }
  .kpi-v { font-size: 24px; }
  .search { margin-left: 0; width: 100%; }
  .updated { width: 100%; order: 3; }

  /* tabel menjadi kartu */
  table.tickets { min-width: 0; }
  .tickets thead { display: none; }
  .tickets, .tickets tbody { display: block; }
  .tickets tr.row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px;
    grid-template-areas: "id status" "nama nama" "desc desc" "jenis petugas";
    padding: 14px 16px; border-top: 1px solid var(--line);
  }
  .tickets tr.row td { display: block; padding: 0 !important; border: 0; background: none !important; }
  .tickets .c-id { grid-area: id; }
  .tickets .c-status { grid-area: status; justify-self: end; }
  .tickets .c-nama { grid-area: nama; }
  .tickets .c-desc { grid-area: desc; max-width: none; }
  .tickets .c-jenis { grid-area: jenis; font-size: 13px; color: var(--muted); }
  .tickets .c-petugas { grid-area: petugas; justify-self: end; font-size: 13px; }

  /* popup menjadi layar penuh dari bawah */
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 24px 24px 0 0; }
  .modal-head { padding: 16px 18px; }
  .modal-info, .modal-form { padding: 18px; }
}
