/* ==========================================================================
   components.css — elemen yang dipakai ulang di banyak halaman.
   Urutan: tombol, formulir, kartu, daftar, tabel, lencana, avatar, pemberitahuan,
   menu, tooltip, tab, modal, toast, keadaan kosong, halaman bernomor, meter.
   ========================================================================== */

/* --- Tombol ----------------------------------------------------------------
   Dasar .btn = tombol sekunder (putih + garis 1px). .btn-primary = warna utama (#22577A). */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
    height: var(--control-h); padding: 0 12px;
    border: 0; border-radius: var(--r);
    background: var(--grad-card); box-shadow: var(--sh-1); color: var(--ink-2);
    font-size: var(--fs-md); font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none;
    cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
    transition: box-shadow .14s var(--ease), color .14s, background-color .14s, transform .08s;
}
.btn:hover { box-shadow: var(--sh-2); color: var(--ink); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; box-shadow: var(--sh-1); }
.btn .icon { width: 14px; height: 14px; margin-left: -1px; }
.btn-secondary { /* sama dengan .btn; dipertahankan supaya markup lama tetap berarti */ }
.btn-primary { background: var(--primary); color: #FFFFFF; box-shadow: var(--sh-ink); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: #FFFFFF; box-shadow: var(--sh-ink); }
.btn-primary:active:not(:disabled) { background: var(--primary-press); }
.btn-primary:disabled { box-shadow: var(--sh-ink); }
.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: rgba(19, 41, 61, .05); box-shadow: none; }
.btn-danger { color: var(--st-hot); }
.btn-danger:hover:not(:disabled) { color: var(--st-hot); background: var(--st-hot-bg); box-shadow: 0 0 0 1px var(--st-hot-ln); }
.btn-ghost.btn-danger { background: transparent; box-shadow: none; }
.btn-ghost.btn-danger:hover:not(:disabled) { background: var(--st-hot-bg); box-shadow: none; }
/* Merah solid hanya untuk tombol konfirmasi di dialog. */
dialog .btn-danger { background: var(--red); color: #FFFFFF; box-shadow: var(--sh-ink); }
dialog .btn-danger:hover:not(:disabled) { background: #C93B40; color: #FFFFFF; box-shadow: var(--sh-ink); }
.btn-sm { height: var(--control-h-sm); padding: 0 9px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-sm .icon { width: 13px; height: 13px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: var(--fs-base); border-radius: 10px; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid; place-items: center; flex: none;
    width: var(--control-h); height: var(--control-h); padding: 0;
    border: 0; border-radius: var(--r);
    background: transparent; color: var(--ink-2);
    transition: background-color .12s, color .12s;
}
.icon-btn:hover { background: rgba(19, 41, 61, .05); color: var(--ink); }
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn-sm { width: var(--control-h-sm); height: var(--control-h-sm); border-radius: var(--r-sm); }
.icon-btn-sm .icon { width: 14px; height: 14px; }
.icon-btn.is-boxed { background: var(--grad-card); box-shadow: var(--sh-1); }
.icon-btn.is-boxed:hover { box-shadow: var(--sh-2); }

.link-btn {
    display: inline-flex; align-items: center; gap: 4px;
    border: 0; padding: 0; background: none; color: var(--primary);
    font-size: var(--fs-md); font-weight: 500; text-decoration: underline; text-decoration-color: var(--primary-line); text-underline-offset: 3px;
}
.link-btn:hover { color: var(--primary-hover); text-decoration-color: var(--primary); }
.link-btn .icon { width: 13px; height: 13px; }

/* Tombol Google mengikuti panduan merek Google (logo resmi di kiri, teks "Masuk dengan Google"). */
.btn-google { background: #FFFFFF; color: var(--ink); gap: 10px; box-shadow: var(--sh-2); }
.btn-google:hover { color: var(--ink); box-shadow: var(--sh-3); }
.btn-google img { width: 17px; height: 17px; }


/* --- Formulir ------------------------------------------------------------- */

.field { display: grid; gap: 5px; min-width: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
.field > span:not(.field-hint):not(.field-error), .field-label { font-size: var(--fs-md); font-weight: 500; color: var(--ink); }
.field-hint { font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.45; }
.field-error { font-size: var(--fs-sm); color: var(--st-hot); }

.input, .select, .textarea {
    width: 100%; min-height: var(--control-h); padding: 5px 10px;
    border: 0; border-radius: var(--r);
    background: var(--surface); color: var(--ink); box-shadow: var(--sh-1);
    font-size: var(--fs-base); line-height: 1.35;
    transition: box-shadow .14s var(--ease);
}
.textarea { min-height: 76px; resize: vertical; line-height: 1.5; padding-top: 7px; padding-bottom: 7px; }
.select {
    appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6B64' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
    text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
.input:hover, .select:hover, .textarea:hover { box-shadow: 0 0 0 1px rgba(19, 41, 61, .14), 0 1px 1.5px rgba(19, 41, 61, .05); }
.input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: 0 0 0 1px rgba(19, 41, 61, .45), var(--focus-ring); }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); opacity: 1; }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-alt); color: var(--ink-3); cursor: not-allowed; }
.input[type="date"] { font-family: var(--font-mono); font-size: var(--fs-md); }
.input-sm, .select-sm { min-height: var(--control-h-sm); padding-top: 3px; padding-bottom: 3px; font-size: var(--fs-md); border-radius: var(--r-sm); }
.select-sm { width: auto; }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-base); line-height: 1.4; cursor: pointer; }
.check input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--black); flex: none; cursor: pointer; }

.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: start; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.form-actions .muted { margin-right: auto; font-size: var(--fs-sm); }

/* iOS memperbesar layar bila teks input < 16px. */
@media (max-width: 640px) {
    .input, .select, .textarea { font-size: 16px; }
}


/* --- Kartu -----------------------------------------------------------------
   ::after = garis putih tipis di tepi atas; ini yang membuat kartu terasa timbul. */

.panel, .card {
    position: relative; min-width: 0;
    background: var(--grad-card); border-radius: var(--r-lg); box-shadow: var(--sh-2);
}
.panel::after, .card::after {
    content: ""; position: absolute; inset: 0 0 auto; height: 1px; pointer-events: none;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .9) 22%, rgba(255, 255, 255, .9) 78%, transparent);
}
.panel-head {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
    min-height: 44px; padding: 11px 15px 8px;
}
.panel-head h2 { margin-right: auto; font-size: var(--fs-base); font-weight: 500; letter-spacing: -.15px; }
.panel-head .muted, .panel-head .small { font-size: var(--fs-sm); color: var(--ink-3); }
.panel-head-actions { display: flex; align-items: center; gap: 6px; }
.panel-head.has-line { border-bottom: 1px solid var(--line-soft); padding-bottom: 10px; }
.panel-body { padding: 4px 15px 15px; }
.panel-body.is-padded { padding-top: 14px; }
.panel-foot {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 10px 15px; border-top: 1px solid var(--line-soft);
    border-radius: 0 0 var(--r-lg) var(--r-lg); background: rgba(243, 246, 248, .5);
}
.panel-foot .muted { margin-right: auto; font-size: var(--fs-sm); }

/* Judul bagian di luar kartu */
.section { display: grid; gap: 8px; }
.section-title { display: flex; align-items: center; gap: 8px; padding: 0 2px; font-size: var(--fs-base); font-weight: 500; }
.section-title .muted { margin-left: auto; font-size: var(--fs-sm); font-weight: 400; }
.section-foot { padding: 2px; font-size: var(--fs-sm); color: var(--ink-3); }


/* --- Daftar baris dalam kartu --------------------------------------------- */

.list-rows { position: relative; background: var(--grad-card); border-radius: var(--r-lg); box-shadow: var(--sh-2); }
.list-row {
    position: relative; display: flex; align-items: center; gap: 11px;
    min-height: 50px; padding: 9px 15px;
    color: inherit;
}
.list-row + .list-row { border-top: 1px solid var(--line-soft); }
a.list-row { transition: background-color .1s; }
a.list-row:hover { background: rgba(19, 41, 61, .025); text-decoration: none; color: inherit; }
.list-row:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.list-row:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.list-row-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.list-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.list-row-meta { font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.45; }
.list-row-value { font-size: var(--fs-md); color: var(--ink-3); white-space: nowrap; }
.list-row-trail { display: flex; align-items: center; gap: 8px; flex: none; }
.list-row-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.list-row-actions form { margin: 0; }
.list-row.is-muted .list-row-main strong { color: var(--ink-3); }
.list-chevron { width: 14px !important; height: 14px !important; color: var(--ink-4); }
.meta-facts { display: flex; flex-wrap: wrap; gap: 0 12px; }
.meta-facts > span { white-space: nowrap; }


/* --- Tabel ------------------------------------------------------------------ */

.table-wrap { position: relative; overflow: auto; background: var(--grad-card); border-radius: var(--r-lg); box-shadow: var(--sh-2); }
.table { width: 100%; font-size: var(--fs-md); }
.table th, .table td { padding: 9px 12px; text-align: left; vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 15px; }
.table th:last-child, .table td:last-child { padding-right: 15px; }
.table thead th {
    position: sticky; top: 0; z-index: 1;
    padding-top: 10px; padding-bottom: 8px;
    background: var(--surface-sub); font-size: var(--fs-sm); font-weight: 500; color: var(--ink-3); white-space: nowrap;
    box-shadow: inset 0 -1px 0 var(--line-soft);
}
.table tbody td, .table tbody th { border-top: 1px solid var(--line-soft); }
.table tbody tr:first-child td, .table tbody tr:first-child th { border-top: 0; }
.table tbody tr { transition: background-color .1s; }
.table tbody tr:hover { background: rgba(19, 41, 61, .022); }
.table .num, .table td.num, .table th.num { text-align: right; font-family: var(--font-mono); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.table th.num { font-family: var(--font-sans); }
.panel > .table-wrap { box-shadow: none; background: transparent; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.panel > .table-wrap .table thead th { background: transparent; }


/* --- Lencana (pill) -----------------------------------------------------------
   .badge = pill status. Warna bermakna: lihat tokens.css. */

.badge {
    display: inline-flex; align-items: center; gap: 4px; flex: none;
    padding: 2px 8px; border-radius: var(--r-pill);
    font-size: var(--fs-sm); font-weight: 500; line-height: 1.35; white-space: nowrap;
    background: var(--st-cold-bg); color: var(--st-cold); box-shadow: inset 0 0 0 1px var(--st-cold-ln);
}
.badge .icon { width: 11px; height: 11px; stroke-width: 2; }
.badge-comment, .status-replied { background: var(--st-info-bg); color: var(--st-info); box-shadow: inset 0 0 0 1px var(--st-info-ln); }
.badge-mention { background: var(--st-mention-bg); color: var(--st-mention); box-shadow: inset 0 0 0 1px var(--st-mention-ln); }
.status-open, .badge-warning { background: var(--st-warm-bg); color: var(--st-warm); box-shadow: inset 0 0 0 1px var(--st-warm-ln); }
.status-solved, .badge-success { background: var(--st-cool-bg); color: var(--st-cool); box-shadow: inset 0 0 0 1px var(--st-cool-ln); }
.status-closed { background: var(--st-cold-bg); color: var(--st-cold); box-shadow: inset 0 0 0 1px var(--st-cold-ln); }
.badge-danger { background: var(--st-hot-bg); color: var(--st-hot); box-shadow: inset 0 0 0 1px var(--st-hot-ln); }
.badge-dark { background: var(--black); color: #FFFFFF; box-shadow: none; }
.badge-outline { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.badge-pro { padding: 1px 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; background: var(--black); color: #FFFFFF; box-shadow: none; vertical-align: 1px; }
.badge-sm { padding: 1px 6px; font-size: var(--fs-xs); }

/* Status & prioritas tiket (dipakai di daftar tiket, detail tiket, dan panel Interaction) */
.tstatus-open { background: var(--st-warm-bg); color: var(--st-warm); box-shadow: inset 0 0 0 1px var(--st-warm-ln); }
.tstatus-in_progress { background: var(--st-info-bg); color: var(--st-info); box-shadow: inset 0 0 0 1px var(--st-info-ln); }
.tstatus-waiting { background: var(--st-mention-bg); color: var(--st-mention); box-shadow: inset 0 0 0 1px var(--st-mention-ln); }
.tstatus-resolved { background: var(--st-cool-bg); color: var(--st-cool); box-shadow: inset 0 0 0 1px var(--st-cool-ln); }
.tstatus-closed { background: var(--st-cold-bg); color: var(--st-cold); box-shadow: inset 0 0 0 1px var(--st-cold-ln); }
.prio-badge { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.prio-badge.prio-high { color: var(--st-warm); box-shadow: inset 0 0 0 1px var(--st-warm-ln); background: var(--st-warm-bg); }
.prio-badge.prio-urgent { color: var(--st-hot); box-shadow: inset 0 0 0 1px var(--st-hot-ln); background: var(--st-hot-bg); }

/* Titik status kecil */
.dot { display: inline-block; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--c, var(--ink-4)); }
.dot-open { --c: var(--amber); }
.dot-replied { --c: var(--blue); }
.dot-solved { --c: var(--green); }
.dot-closed { --c: var(--ink-4); }


/* --- Avatar: persegi membulat, inisial di latar netral ----------------------- */

.avatar { flex: none; border-radius: 8px; object-fit: cover; background: var(--surface-alt); box-shadow: var(--sh-1); }
.avatar-xs { width: 18px; height: 18px; border-radius: 5px; font-size: 9px; }
.avatar-sm { width: 22px; height: 22px; border-radius: 6px; font-size: 10px; }
.avatar-md { width: 28px; height: 28px; font-size: var(--fs-sm); }
.avatar-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; }
.avatar-initial { display: inline-grid; place-items: center; font-weight: 600; color: var(--ink-2); }
.avatar-initial .icon { width: 14px; height: 14px; }


/* --- Pemberitahuan (flash & info di halaman) ------------------------------------ */

.notice {
    position: relative; overflow: hidden;
    display: flex; gap: 9px; align-items: flex-start;
    padding: 9px 12px 9px 14px; border-radius: var(--r);
    background: var(--grad-card); box-shadow: var(--sh-1);
    font-size: var(--fs-md); line-height: 1.5; color: var(--ink-2);
}
.notice::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ink-4); }
.notice > .icon { width: 15px; height: 15px; margin-top: 1px; flex: none; color: var(--ink-3); }
.notice-success::before { background: var(--green); }
.notice-success > .icon { color: var(--st-cool); }
.notice-error::before { background: var(--red); }
.notice-error > .icon { color: var(--st-hot); }
.notice-error { color: var(--st-hot); }
.notice-warning::before { background: var(--amber); }
.notice-warning > .icon { color: var(--st-warm); }
.notice-info::before { background: var(--blue); }
.notice-info > .icon { color: var(--st-info); }
.notice-locked::before { background: var(--black); }
.notice a { color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }


/* --- Menu tarik (details/summary) ------------------------------------------------ */

.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel {
    position: absolute; z-index: 50; top: calc(100% + 6px); left: 0;
    min-width: 220px; padding: 5px;
    background: var(--surface); border-radius: 11px; box-shadow: var(--sh-3);
    animation: menu-in .14s var(--ease);
}
.dropdown-label { padding: 6px 9px 3px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.dropdown-item {
    display: flex; align-items: center; gap: 9px; width: 100%; min-height: 30px;
    padding: 5px 9px; border: 0; border-radius: var(--r-sm);
    background: transparent; color: var(--ink); font-size: var(--fs-md); text-align: left; text-decoration: none;
}
.dropdown-item:hover { background: var(--surface-alt); color: var(--ink); text-decoration: none; }
.dropdown-item.is-current { font-weight: 500; }
.dropdown-item .icon { width: 14px; height: 14px; color: var(--ink-3); }
.dropdown-item .muted { margin-left: auto; font-size: var(--fs-sm); }
.dropdown-item.is-danger { color: var(--st-hot); }
.dropdown-item.is-danger .icon { color: currentColor; }
.dropdown-sep { height: 1px; margin: 4px 2px; background: var(--line-soft); }
.dropdown-panel form { margin: 0; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-3px); } }


/* --- Tooltip murni CSS: tulis isinya di data-tip. .tip.r untuk dekat tepi kanan ------- */

.tip { position: relative; }
.tip::after, .tip::before { position: absolute; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .13s ease; }
.tip::after {
    content: attr(data-tip);
    top: calc(100% + 7px); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: 240px; padding: 7px 10px; border-radius: 8px;
    background: var(--ink); color: #F3F6F8; box-shadow: var(--sh-3);
    font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: 400; line-height: 1.45; text-align: left; letter-spacing: 0; text-transform: none;
}
.tip::before {
    content: ""; top: calc(100% + 2px); left: 50%; transform: translateX(-50%) rotate(45deg);
    width: 7px; height: 7px; background: var(--ink); border-radius: 1.5px;
}
.tip:hover::after, .tip:hover::before, .tip:focus-visible::after, .tip:focus-visible::before { opacity: 1; }
.tip.r::after { left: auto; right: 0; transform: none; }
.tip.r::before { left: auto; right: 14px; transform: rotate(45deg); }
.qm {
    display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%;
    background: var(--line); color: var(--ink-3); font-size: 9.5px; font-weight: 600; cursor: help; vertical-align: 1px;
    transition: background .12s, color .12s;
}
.tip:hover .qm, .qm.tip:hover { background: var(--black); color: #FFFFFF; }


/* --- Tab garis bawah (tampilan dalam halaman) & segmen (pilihan kecil) -------------- */

.tabs { display: flex; align-items: center; gap: 18px; max-width: 100%; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex; align-items: center; gap: 6px; flex: none;
    padding: 6px 0 8px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent;
    background: none; color: var(--ink-3); font-size: var(--fs-md); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-active, .tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--black); }
.tab .count { padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-alt); box-shadow: inset 0 0 0 1px var(--line); font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-3); }
.tab .count:empty { display: none; }

.segmented {
    display: inline-flex; align-items: center; gap: 2px; max-width: 100%;
    padding: 2px; border-radius: 9px; background: var(--surface-alt); box-shadow: inset 0 0 0 1px var(--line-soft);
    overflow-x: auto; scrollbar-width: none;
}
.segment {
    display: inline-flex; align-items: center; gap: 6px; flex: none;
    height: 24px; padding: 0 10px; border: 0; border-radius: 7px;
    background: transparent; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.segment:hover { color: var(--ink); text-decoration: none; }
.segment.is-active, .segment[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.segment .count { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); }

/* Pil filter (aktif = hitam), mis. status di daftar */
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill-btn {
    display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
    border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2);
    font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; text-decoration: none;
}
.pill-btn:hover { background: rgba(19, 41, 61, .05); color: var(--ink); text-decoration: none; }
.pill-btn.is-active, .pill-btn[aria-selected="true"] { background: var(--black); color: #FFFFFF; }
.pill-btn .count { font-family: var(--font-mono); font-size: var(--fs-xs); opacity: .75; }
.pill-btn .count:empty { display: none; }


/* --- Modal (<dialog>) ----------------------------------------------------------- */

dialog.modal {
    text-align: left;
    width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0;
    border: 0; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--sh-3);
    overflow: auto;
}
dialog.modal[open] { animation: modal-in .18s var(--ease); }
dialog.modal::backdrop { background: rgba(19, 41, 61, .32); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 6px 18px; }
.modal-head h2 { font-size: 15px; font-weight: 600; }
.modal-body { display: grid; gap: 14px; padding: 8px 18px 16px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 11px 18px; border-top: 1px solid var(--line-soft); background: var(--surface-sub); }
.modal-foot .muted { margin-right: auto; font-size: var(--fs-sm); }
.modal-foot-start { margin: 0 auto 0 0; }
dialog.modal > form.modal-body { margin: 0; }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }


/* --- Toast ---------------------------------------------------------------------- */

.toast {
    position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%);
    max-width: min(460px, calc(100vw - 32px)); padding: 9px 14px 9px 12px; border-radius: 10px;
    background: var(--ink); color: #FFFFFF; box-shadow: var(--sh-3);
    font-size: var(--fs-md); font-weight: 500;
    animation: toast-in .2s var(--ease);
}
.toast[data-tone="success"] { box-shadow: var(--sh-3), inset 3px 0 0 var(--emerald); }
.toast[data-tone="error"] { background: var(--st-hot); }
/* Dialog konfirmasi (App.confirm). */
dialog.modal.modal-sm { width: min(420px, calc(100vw - 32px)); }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-text { font-size: var(--fs-base); line-height: 1.55; color: var(--ink-2); }
.confirm-dialog .modal-body { padding-top: 18px; }
/* Input bermasalah & tombol sibuk. */
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { box-shadow: 0 0 0 1px var(--st-hot), 0 0 0 3px rgba(229, 72, 77, .14); }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid currentColor; border-color: rgba(255, 255, 255, .9) rgba(255, 255, 255, .9) transparent transparent;
    animation: spin .7s linear infinite;
}
.btn:not(.btn-primary):not(.btn-danger).is-busy::after { border-color: var(--ink-3) var(--ink-3) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }


/* --- Keadaan kosong ---------------------------------------------------------------- */

.empty { display: grid; justify-items: center; gap: 4px; padding: 34px 20px; text-align: center; color: var(--ink-3); }
.empty-icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 6px; border-radius: 10px; background: var(--surface-alt); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); }
.empty-icon .icon { width: 16px; height: 16px; }
.empty-title { color: var(--ink); font-size: var(--fs-base); font-weight: 500; }
.empty-text { max-width: 44ch; font-size: var(--fs-md); }
.empty .btn { margin-top: 8px; }


/* --- Halaman bernomor ---------------------------------------------------------------- */

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0; font-size: var(--fs-md); }
.page-link { display: inline-flex; align-items: center; gap: 4px; height: var(--control-h-sm); padding: 0 9px; border-radius: var(--r-sm); background: var(--grad-card); box-shadow: var(--sh-1); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; }
.page-link:hover { color: var(--ink); box-shadow: var(--sh-2); text-decoration: none; }
.page-link.is-disabled { color: var(--ink-4); box-shadow: inset 0 0 0 1px var(--line-soft); background: transparent; }
.page-link .icon { width: 13px; height: 13px; }
.page-info { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-3); }


/* --- Meter (kuota, pemakaian) ---------------------------------------------------------- */

.meter { height: 4px; border-radius: var(--r-pill); background: var(--ch-track); overflow: hidden; box-shadow: inset 0 1px 2px rgba(19, 41, 61, .08); }
.meter i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--black); }
.meter i.is-full { background: var(--red); }


/* --- Pasangan label/nilai ------------------------------------------------------------------ */

.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; font-size: var(--fs-md); }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv code { padding: 1px 6px; border-radius: 5px; background: var(--surface-alt); box-shadow: inset 0 0 0 1px var(--line-soft); font-size: var(--fs-sm); }
@media (max-width: 560px) {
    .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .kv dd { margin-bottom: 8px; }
}


/* --- Saklar on/off (checkbox asli tetap bisa difokus & dibaca pembaca layar) --------- */

.switch { position: relative; display: inline-flex; flex: none; width: 34px; height: 20px; }
.switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: relative; width: 100%; height: 100%; border-radius: var(--r-pill); background: var(--line-strong); transition: background-color .15s var(--ease); }
.switch i::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: #FFFFFF; box-shadow: 0 1px 2px rgba(19, 41, 61, .28); transition: transform .15s var(--ease);
}
.switch input:checked + i { background: var(--black); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { box-shadow: var(--focus-ring); }

/* Baris pengaturan: teks di kiri, kontrol di kanan. */
.setting-list { display: grid; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid var(--line-soft); cursor: pointer; }
.setting-row:first-child { padding-top: 2px; border-top: 0; }
.setting-row:last-child { padding-bottom: 2px; }
.setting-text { display: grid; gap: 2px; min-width: 0; cursor: pointer; }
.setting-text strong { font-size: var(--fs-base); font-weight: 500; color: var(--ink); }
.setting-text span { max-width: 62ch; font-size: var(--fs-md); line-height: 1.5; color: var(--ink-3); }
.setting-row .select { flex: none; width: 168px; }

/* --- Tombol aksi ikon di baris tabel (rata kanan, tooltip di atas supaya tidak terpotong tabel) --- */

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.row-actions form { display: contents; margin: 0; }
.row-btn {
    display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0;
    border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-3); cursor: pointer; text-decoration: none;
    transition: background-color .12s, color .12s;
}
.row-btn .icon { width: 15px; height: 15px; }
.row-btn:hover { background: rgba(19, 41, 61, .06); color: var(--ink); text-decoration: none; }
.row-btn.is-danger:hover { background: var(--st-hot-bg); color: var(--st-hot); }
.row-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.row-btn.tip::after { top: auto; bottom: calc(100% + 7px); left: auto; right: 0; transform: none; white-space: nowrap; }
.row-btn.tip::before { top: auto; bottom: calc(100% + 2px); left: auto; right: 10px; transform: rotate(45deg); }

/* Badge bernada (tone sama dengan status-pill). */
.badge.tone-cool { background: var(--st-cool-bg); color: var(--st-cool); box-shadow: inset 0 0 0 1px var(--st-cool-ln); }
.badge.tone-warm { background: var(--st-warm-bg); color: var(--st-warm); box-shadow: inset 0 0 0 1px var(--st-warm-ln); }
.badge.tone-hot { background: var(--st-hot-bg); color: var(--st-hot); box-shadow: inset 0 0 0 1px var(--st-hot-ln); }
.badge.tone-info { background: var(--st-info-bg); color: var(--st-info); box-shadow: inset 0 0 0 1px var(--st-info-ln); }
.badge.tone-cold { background: var(--st-cold-bg); color: var(--st-cold); box-shadow: inset 0 0 0 1px var(--st-cold-ln); }
.text-warn { color: var(--st-warm) !important; }
.kv-tight { grid-template-columns: 120px minmax(0, 1fr); gap: 6px 14px; }
.panel-body > p + .kv { margin-top: 12px; }

/* --- Tabel bertumpuk di HP: tiap baris jadi kartu ringkas ------------------------------
   Pakai: <table class="table table-stack">, sel utama .cell-main (tampil paling atas),
   sel lain diberi data-label, aksi di .cell-actions (pojok kanan atas). Kolom .col-opt tetap disembunyikan. */
@media (max-width: 640px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody { display: block; width: 100%; }
    .table-stack tr { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 11px 14px; border-top: 1px solid var(--line-soft); }
    .table-stack tbody tr:first-child { border-top: 0; }
    .table-stack td { display: block; padding: 0 !important; border: 0 !important; text-align: left !important; white-space: normal; }
    .table-stack td.cell-main { order: -1; padding-right: 64px !important; }
    .table-stack td[data-label] { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: var(--fs-md); }
    .table-stack td[data-label]::before { content: attr(data-label); flex: none; min-width: 84px; font-size: var(--fs-sm); color: var(--ink-3); }
    .table-stack td.num { font-family: inherit; }
    .table-stack td.cell-actions { position: absolute; top: 8px; right: 8px; }
    .table-stack td.cell-actions:empty { display: none; }
    .table-stack .contact-sub { max-width: 100%; }
}

/* Baris centang sederhana di formulir/dialog. */
.check-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); cursor: pointer; }
.check-row input { width: 15px; height: 15px; margin: 0; accent-color: var(--black); }
.setting-row .select.select-wide { width: 320px; }
@media (max-width: 640px) { .setting-row .select.select-wide { width: 100%; } .setting-row:has(.select-wide) { flex-direction: column; align-items: stretch; } }

/* --- Pilihan bahasa "ID | EN" ------------------------------------------------------ */
.lang-switch { display: inline-flex; align-items: center; gap: 1px; padding: 2px; border-radius: 8px; background: var(--surface-alt); box-shadow: inset 0 0 0 1px var(--line-soft); }
.lang-switch a { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 6px; border-radius: 6px; font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; color: var(--ink-3); text-decoration: none; }
.lang-switch a:hover { color: var(--ink); text-decoration: none; }
.lang-switch a.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.auth-top-actions { display: flex; align-items: center; gap: 14px; }
