/* ============================================================
   Noor Travel — lapisan komponen.

   Tailwind Play CDN tetap dipakai untuk tata letak (flex/grid/spacing),
   tapi ANATOMI komponen yang berulang (kartu, tabel, chip, badge ikon)
   ditulis sekali di sini. Alasannya: pola yang sama muncul di 20+ berkas
   .ejs — kalau ditulis sebagai rentetan utility di tiap tempat, satu
   perubahan radius/border harus dikejar ke semua berkas dan pasti ada
   yang tertinggal.
   ============================================================ */

:root {
    --canvas: #eceae7;
    --surface: #ffffff;
    --surface-2: #f7f5f3;
    --surface-3: #f1eeea;
    --ink: #141210;
    --ink-2: #3f3a35;
    --muted: #8b857e;
    --line: #eae6e1;
    --line-strong: #ddd7d0;

    --primary: #974d28;
    --primary-dark: #6e3a1e;
    --primary-bright: #b85a2b;
    --primary-soft: #faefe8;
    --accent: #ffcc00;

    --success: #12805c;
    --success-soft: #e6f4ee;
    --danger: #c0392b;
    --danger-soft: #fbeae8;
    --warning: #8a5d00;
    --warning-soft: #fbf2dc;
    --info: #0f6e8c;
    --info-soft: #e8f1f5;
}

body {
    background: var(--canvas);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.011em;
}

/* ── Shell ─────────────────────────────────────────── */
/* Latar bertekstur — resep yang SAMA dengan TexturedBg di aplikasi Flutter
   (noor-mobile/lib/images.dart): motif geometris Islami diulang pada setengah
   ukuran aslinya, ditutup gradasi putih → krem → peach yang hampir buram,
   supaya motifnya samar dan kartu putih tetap menonjol di atasnya.
   Motif: Wikimedia Commons, "Islamic geometric pattern.svg" oleh Moelja — CC BY-SA 4.0. */
.shell,
.latar-pola {
    background-color: #fbf8f4;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.93) 0%, rgba(251, 248, 244, 0.9) 50%, rgba(252, 237, 227, 0.88) 100%),
        url('/img/pattern.png');
    background-size: 100% 100%, 250px 212px;
    background-repeat: no-repeat, repeat;
}
.shell {
    border-radius: 28px;
    box-shadow: 0 1px 2px rgba(20, 18, 16, 0.04), 0 18px 48px -32px rgba(20, 18, 16, 0.28);
}
@media (max-width: 1023px) {
    .shell { border-radius: 0; box-shadow: none; }
}

/* ── Kartu ─────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
}
.card-quiet {
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: 18px;
}
.card-accent {
    background: linear-gradient(145deg, var(--primary-bright) 0%, var(--primary) 62%, var(--primary-dark) 100%);
    border: 1px solid transparent;
    border-radius: 20px;
    color: #fff;
}
.card-hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
}
.card-hd h3 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.card-hd p { font-size: 14px; color: var(--muted); margin-top: 2px; }
.card-bd { padding: 0 20px 20px; }
.card-pad { padding: 20px; }

/* ── Badge ikon bulat di pojok kartu metrik ────────── */
/* Ikon polos — TANPA lingkaran/kotak latar, sedikit diperbesar. Sama dengan
   gaya ikon di aplikasi Flutter. Ukuran svg ditetapkan di sini (bukan dari
   kelas h-4 w-4 di <i>) supaya seragam di semua halaman & semua role. */
.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    color: var(--ink-2);
    line-height: 0;
}
.icon-badge svg { width: 22px; height: 22px; stroke-width: 1.9; }
.icon-badge-lg svg { width: 52px; height: 52px; stroke-width: 1.6; }
.card-accent .icon-badge { color: #fff; }

/* ── Angka metrik ──────────────────────────────────── */
.metric-label { font-size: 15px; font-weight: 500; color: var(--ink-2); }
.card-accent .metric-label { color: rgba(255, 255, 255, 0.92); }
.metric-value {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.card-accent .metric-value { color: #fff; }
.metric-value-sm { font-size: 22px; }
.metric-foot { font-size: 13px; color: var(--muted); }
.card-accent .metric-foot { color: rgba(255, 255, 255, 0.78); }

/* ── Chip naik/turun ───────────────────────────────── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.chip-up { background: var(--success-soft); color: var(--success); }
.chip-down { background: var(--danger-soft); color: var(--danger); }
.chip-flat { background: var(--surface-3); color: var(--muted); }
.chip-warn { background: var(--warning-soft); color: var(--warning); }
.card-accent .chip-up,
.card-accent .chip-down,
.card-accent .chip-flat { background: rgba(255, 255, 255, 0.2); color: #fff; }

/* ── Pill status ───────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-transform: capitalize;
}
.pill::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: currentColor;
    flex: none;
}
.pill-plain::before { display: none; }
.pill-neutral { background: var(--surface-3); color: var(--muted); }
.pill-ok { background: var(--success-soft); color: var(--success); }
.pill-warn { background: var(--warning-soft); color: var(--warning); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-brand { background: var(--primary-soft); color: var(--primary); }

/* ── Tombol ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.btn-sm { height: 32px; padding: 0 13px; font-size: 14px; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #2b2622; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-soft { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-soft:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }
.btn-ghost-danger { background: transparent; color: var(--danger); border: 1px solid rgba(192, 57, 43, 0.28); }
.btn-ghost-danger:hover { background: var(--danger-soft); }

/* ── Input ─────────────────────────────────────────── */
.field-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.input {
    height: 42px;
    width: 100%;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 15px;
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s, background-color 0.15s;
}
.input:focus { background: var(--surface); border-color: var(--primary); }
textarea.input { height: auto; padding: 11px 14px; resize: vertical; }
select.input { appearance: none; background-image: none; }

.searchbox {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: 999px;
    transition: border-color 0.15s, background-color 0.15s;
}
.searchbox:focus-within { background: var(--surface); border-color: var(--line-strong); }
.searchbox input { background: transparent; border: 0; outline: none; font-size: 14.5px; width: 100%; color: var(--ink); }
.searchbox input::placeholder { color: var(--muted); }

/* ── Tabel ─────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
.tbl thead th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    padding: 11px 18px;
    white-space: nowrap;
}
.tbl thead th:first-child { border-top-left-radius: 14px; border-bottom-left-radius: 14px; }
.tbl thead th:last-child { border-top-right-radius: 14px; border-bottom-right-radius: 14px; }
.tbl tbody td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-2);
    vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(247, 245, 243, 0.7); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.tbl-wrap { overflow-x: auto; padding: 8px; }
/* Pesan tabel kosong: tabel lebar di HP digulir ke samping, jadi teks yang
   ditengahkan ke lebar TABEL jatuh di luar layar. Isi pesan ditempel (sticky)
   di kiri area gulir & selebar area yang terlihat (100cqw) supaya tetap utuh. */
.tbl-wrap:has(.tbl-kosong) { container-type: inline-size; }
.tbl td.tbl-kosong { padding-left: 0; padding-right: 0; }
.tbl-kosong-isi { position: sticky; left: 0; width: calc(100cqw - 16px); padding: 0 16px; }


/* ── Avatar inisial ────────────────────────────────── */
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11.5px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

/* ── Rail ikon kiri ────────────────────────────────── */
.rail-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: background-color 0.15s, color 0.15s;
}
.rail-btn:hover { background: var(--surface-2); color: var(--ink); }
.rail-btn.is-active { background: var(--ink); color: #fff; }

/* ── Pill nav atas ─────────────────────────────────── */
.navpill {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    color: var(--muted);
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.navpill:hover { color: var(--ink); }
.navpill.is-active { background: var(--ink); color: #fff; font-weight: 600; }

/* ── Progress ──────────────────────────────────────── */
.bar { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; border-radius: 999px; }
.bar-striped {
    background-image: repeating-linear-gradient(115deg, transparent 0 4px, rgba(139, 133, 126, 0.22) 4px 6px);
}

/* ── Lain-lain ─────────────────────────────────────── */
.tnum { font-variant-numeric: tabular-nums; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
::selection { background: rgba(151, 77, 40, 0.18); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Pilihan bersegmen (radio berlabel, mis. absensi Hadir/Izin/Alpha) ── */
.seg { display: inline-flex; gap: 4px; padding: 4px; margin: 0; border: 0; border-radius: 999px; background: var(--surface-3); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; min-width: 64px; padding: 7px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; text-align: center; color: var(--muted); transition: background-color 0.15s, color 0.15s; }
.seg label:hover span { color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.seg input[value="hadir"]:checked + span { background: var(--success); color: #fff; }
.seg input[value="izin"]:checked + span { background: var(--warning); color: #fff; }
.seg input[value="alpha"]:checked + span { background: var(--danger); color: #fff; }

/* ── Popup (elemen <dialog> bawaan browser) ────────────────────────────
   Dibuka lewat data-buka-dialog="idDialog" (lihat /js/dialog.js). Esc &
   klik di luar kotak menutup; fokus dikunci di dalam popup oleh browser. */
.dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 0; border: 0; border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(20, 18, 16, 0.22); }
.dialog::backdrop { background: rgba(20, 18, 16, 0.45); }
.dialog[open] { animation: dialog-masuk 0.16s ease-out; }
.dialog-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 4px; }
.dialog-hd h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.dialog-hd p { margin-top: 2px; font-size: 13.5px; color: var(--muted); }
.dialog-bd { display: flex; flex-direction: column; gap: 14px; padding: 16px 24px; }
.dialog-ft { display: flex; justify-content: flex-end; gap: 8px; padding: 4px 24px 22px; }
.dialog-tutup { flex: none; display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 999px; color: var(--muted); }
.dialog-tutup:hover { background: var(--surface-2); color: var(--ink); }
@keyframes dialog-masuk { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dialog[open] { animation: none; } }

/* Pesan berhasil / gagal setelah menyimpan (dari ?ok= / ?error=). */
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px; margin-bottom: 16px; border-radius: 18px; font-size: 14px; }
.notice-ok { background: var(--success-soft); color: var(--success); }
.notice-err { background: var(--danger-soft); color: var(--danger); }

.dialog-lebar { width: min(640px, calc(100vw - 32px)); }

/* Atribut hidden harus menang atas kelas display Tailwind (grid/flex). */
[hidden] { display: none !important; }
