/* =========================================================
   DATA VOUCHER KLOOK — style
   ========================================================= */
:root {
    --brand: #ff5b00;
    --brand-dark: #e04f00;
    --brand-soft: #fff1e8;
    --ink: #1d2433;
    --ink-2: #4a5468;
    --muted: #7b8497;
    --line: #e6e8ee;
    --bg: #f5f6f9;
    --card: #ffffff;
    --success: #0f8a4b;
    --success-soft: #e6f6ee;
    --warning: #b25e00;
    --warning-soft: #fff4e0;
    --danger: #c62828;
    --danger-soft: #fdecec;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(20, 30, 50, .05), 0 4px 16px rgba(20, 30, 50, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.text-danger { color: var(--danger) !important; }
.req { color: var(--danger); font-weight: 600; }

/* ---------- Topbar ---------- */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand-logo {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--brand); color: #fff; font-weight: 800;
    display: grid; place-items: center; font-size: 18px;
}
.brand-text { font-weight: 600; letter-spacing: .02em; font-size: 15px; }
.brand-text b { color: var(--brand); }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav-link {
    padding: 8px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important;
}
.nav-link:hover { background: var(--bg); }
.nav-link.active { color: var(--brand-dark); background: var(--brand-soft); }
.nav-count {
    min-width: 22px; padding: 0 6px; height: 20px; border-radius: 10px;
    background: var(--line); color: var(--ink-2); font-size: 12px; font-weight: 600;
    display: inline-grid; place-items: center;
}
.nav-link.active .nav-count { background: var(--brand); color: #fff; }
.nav-cta { background: var(--brand); color: #fff !important; margin-left: 6px; }
.nav-cta:hover, .nav-cta.active { background: var(--brand-dark); color: #fff; }
.nav-toggle { display: none; margin-left: auto; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--ink); }

.main { padding-top: 24px; padding-bottom: 40px; }
.footer { color: var(--muted); font-size: 13px; padding-bottom: 28px; text-align: center; }

/* ---------- Header halaman ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 2px 0 4px; }
.page-head p { margin: 0; max-width: 640px; }

/* ---------- Tombol ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid transparent; border-radius: 10px;
    padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
    text-decoration: none !important; white-space: nowrap;
    transition: background .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-outline { background: #fff; color: var(--brand-dark); border-color: #ffc8a6; }
.btn-outline:hover:not(:disabled) { background: var(--brand-soft); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a61f1f; }
.btn-icon {
    border: 0; background: none; cursor: pointer; color: var(--muted);
    font-size: 15px; padding: 2px 4px; border-radius: 6px; line-height: 1;
}
.btn-icon:hover { color: var(--brand-dark); background: var(--brand-soft); }
.btn-icon.copied { color: var(--success); }

/* ---------- Alert ---------- */
.alert {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 500;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: #bfe6d0; }
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: #f5c2c2; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #f4d9a8; }
.alert-close { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* ---------- Statistik ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-value.accent { color: var(--brand-dark); }
.stat-warn { border-color: #f4d9a8; background: var(--warning-soft); }
.stat-warn .stat-value { color: var(--warning); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-search { flex: 1 1 260px; }
input[type=text], input[type=search], input[type=date], input[type=number], select, textarea {
    font: inherit; color: var(--ink);
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.toolbar select { width: auto; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 91, 0, .15);
}
input[type=file] { font: inherit; font-size: 13px; width: 100%; color: var(--ink-2); }
input[type=file]::file-selector-button {
    font: inherit; font-weight: 600; margin-right: 10px; padding: 7px 12px;
    border-radius: 8px; border: 1px solid #ffc8a6; background: var(--brand-soft); color: var(--brand-dark); cursor: pointer;
}
.input-sm { padding: 6px 10px !important; font-size: 13px !important; border-radius: 8px !important; flex: 1 1 220px; width: auto !important; }

/* ---------- Card ---------- */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card-title { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card-title + .muted { margin-top: -8px; }
.step {
    width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff;
    display: inline-grid; place-items: center; font-size: 13px;
}

/* ---------- Badge ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-muted   { background: #eef0f4; color: var(--ink-2); }

/* ---------- Kartu voucher ---------- */
.voucher-list { display: grid; gap: 14px; }
.voucher { padding: 0; overflow: hidden; margin: 0; }
.voucher.is-expired { border-color: #f5c2c2; }
.voucher-head { display: flex; gap: 20px; justify-content: space-between; padding: 18px 20px 14px; flex-wrap: wrap; }
.voucher-title { flex: 1 1 380px; min-width: 0; }
.voucher-title h2 { font-size: 18px; margin-bottom: 6px; }
.voucher-title h2 a { color: var(--ink); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--ink-2); font-size: 13px; }
.link-pdf { font-weight: 600; }
.note { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); background: var(--bg); padding: 6px 10px; border-radius: 8px; }
.voucher-progress { flex: 0 0 210px; }
.progress-label { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.progress-label b { color: var(--ink); font-size: 16px; }
.progress { height: 8px; background: #eef0f4; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.progress-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.progress-sub b { color: var(--brand-dark); }

.items { border-top: 1px dashed var(--line); }
.item {
    display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px;
    padding: 10px 20px; border-bottom: 1px solid #f0f1f5; cursor: pointer;
    transition: background .12s;
}
.item:hover { background: #fcfcfd; }
.item:has(.item-check:checked) { background: var(--brand-soft); }
.item.is-checked { background: var(--brand-soft); }
.item-check { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.item-body { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-width: 0; }
.item-code { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.item-code code {
    font-size: 14px; font-weight: 600; background: #f3f4f7; padding: 3px 8px; border-radius: 6px;
    word-break: break-all;
}
.item-value { font-weight: 600; color: var(--ink-2); font-size: 14px; }
.item-used-info { flex-basis: 100%; font-size: 12.5px; color: var(--muted); }
.item-used .item-code code { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.3); color: var(--ink-2); }

.thumb {
    width: 56px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line);
    background: #f3f4f7; cursor: zoom-in; display: block;
}
.thumb-empty { display: grid; place-items: center; color: var(--muted); cursor: default; font-size: 12px; text-align: center; line-height: 1.2; }
.thumb-lg { width: 110px; height: 80px; }

.item-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
    padding: 12px 20px; background: #fafbfc;
}
.check-all { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check-all input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------- Kosong ---------- */
.empty { text-align: center; padding: 50px 20px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-icon { font-size: 40px; }
.empty h3 { margin: 8px 0 4px; }
.empty .btn { margin-top: 12px; }

/* ---------- Form ---------- */
.form .card-title:not(:first-of-type) { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-inline { flex-direction: row; align-items: center; gap: 12px; margin-bottom: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.check-inline { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--danger); margin-top: 6px; }

.stepper { display: flex; align-items: stretch; max-width: 170px; }
.stepper input { text-align: center; border-radius: 0; border-left: 0; border-right: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button {
    width: 42px; border: 1px solid var(--line); background: #fff; font-size: 18px; cursor: pointer; color: var(--ink-2);
}
.stepper button:first-child { border-radius: 10px 0 0 10px; }
.stepper button:last-child { border-radius: 0 10px 10px 0; }
.stepper button:hover { background: var(--brand-soft); color: var(--brand-dark); }

.item-rows { display: grid; gap: 10px; }
.item-row {
    display: grid; grid-template-columns: 34px 1.3fr 1fr 1.4fr; gap: 12px; align-items: start;
    padding: 12px; background: #fafbfc; border: 1px solid var(--line); border-radius: 12px;
    animation: fadeIn .2s ease;
}
.item-no {
    width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
    display: grid; place-items: center; font-weight: 700; font-size: 13px; margin-top: 24px;
}
.field-file { position: relative; }
.thumb-preview { width: 100%; max-height: 90px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.form-summary { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.form-summary .warn { color: var(--warning); font-weight: 600; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Detail ---------- */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.detail-grid .card { margin-bottom: 0; }
.detail-grid + .card { margin-top: 16px; }
.danger-zone { border-color: #f5c2c2; }
.danger-zone .card-title { color: var(--danger); }
.edit-items { display: grid; gap: 10px; }
.edit-item {
    display: grid; grid-template-columns: 34px 1fr auto; grid-template-areas: "no fields side" "no actions actions";
    gap: 10px 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc;
}
.edit-item .item-no { grid-area: no; }
.edit-item.is-used { background: #f6f7f9; }
.edit-item.is-used .item-no { background: #eef0f4; color: var(--muted); }
.edit-item-fields { grid-area: fields; display: grid; grid-template-columns: 1.3fr 1fr 1.4fr; gap: 12px; }
.edit-item-side { grid-area: side; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.edit-item-actions { grid-area: actions; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 22, .85);
    display: grid; place-items: center; padding: 30px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.4); background: #fff; }
.lightbox-close {
    position: absolute; top: 14px; right: 18px; border: 0; background: rgba(255,255,255,.15); color: #fff;
    width: 40px; height: 40px; border-radius: 50%; font-size: 26px; cursor: pointer;
}

/* ---------- Mata uang ---------- */
.input-money { display: flex; align-items: stretch; }
.input-prefix {
    display: grid; place-items: center; padding: 0 12px; min-width: 46px;
    border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px;
    background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.input-money input { border-radius: 0 10px 10px 0; }
.stat-multi { font-size: 18px; line-height: 1.35; }
.is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(198, 40, 40, .15) !important; }
.btn-link { border: 0; background: none; padding: 0; color: var(--brand-dark); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.card-flush { padding: 0; overflow: hidden; }
.card-title small { font-weight: 500; font-size: 13px; }

/* ---------- Lokasi & peta ---------- */
.loc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; }
.loc-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
    background: #eef6ff; color: #1d5fa8; font-size: 13px; font-weight: 600; text-decoration: none !important;
    border: 1px solid #d3e6fb; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.loc-chip:hover { background: #dcecff; }

.loc-map { height: 340px; border-radius: 12px; border: 1px solid var(--line); background: #e9eef2; z-index: 0; }
.loc-map-card { height: 260px; margin-top: 12px; }
.loc-map-view { height: 320px; margin-bottom: 14px; }
.loc-map-big { height: 480px; border: 0; border-radius: 0; }
.loc-map-offline { display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px; }

.map-pin span {
    display: block; width: 26px; height: 26px; margin: 1px;
    background: #9aa3b2; border: 3px solid #fff; border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.map-pin-active span { background: var(--brand); }
.map-pin:not(.map-pin-active) span { background: #1d5fa8; }
.map-popup { font-family: inherit; font-size: 13px; min-width: 190px; }
.map-popup b { font-size: 14px; }
.map-popup-voucher { margin-top: 4px; font-weight: 600; }
.map-popup-info { color: var(--ink-2); margin-top: 2px; }
.map-popup-addr { color: var(--muted); margin-top: 4px; }
.map-popup-links { display: flex; gap: 12px; margin-top: 8px; font-weight: 600; }

.loc-picker { display: grid; gap: 14px; }
.loc-picker-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.loc-picker-map { position: relative; }
.loc-search { display: flex; gap: 8px; margin-bottom: 8px; }
.loc-results {
    position: absolute; top: 48px; left: 0; right: 0; z-index: 1000;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
    max-height: 280px; overflow: auto;
}
.loc-result {
    display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
    padding: 10px 14px; border: 0; border-bottom: 1px solid #f0f1f5; background: #fff; font: inherit; cursor: pointer;
}
.loc-result:hover { background: var(--brand-soft); }
.loc-result span { font-size: 12.5px; color: var(--muted); }
.loc-hint { margin: 8px 0 0; }
.loc-picker-form { display: grid; gap: 8px; }

.loc-list, .loc-saved { display: grid; gap: 8px; }
.loc-saved { margin-bottom: 14px; }
.loc-item {
    display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 12px; background: #fafbfc;
}
.loc-item-pin { font-size: 18px; line-height: 1.3; }
.loc-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.loc-item-body span { overflow-wrap: anywhere; }
.loc-links { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; font-weight: 600; }
.loc-item > .loc-links { flex-shrink: 0; }
.loc-add > summary { list-style: none; display: inline-flex; }
.loc-add > summary::-webkit-details-marker { display: none; }
.loc-add[open] > summary { margin-bottom: 14px; }
.loc-add-form { border-top: 1px dashed var(--line); padding-top: 14px; }
.loc-group { padding: 0; overflow: hidden; margin: 0; }
.loc-group-head { padding: 16px 20px 10px; }
.loc-group-head h2 { font-size: 17px; margin-bottom: 4px; }
.loc-group-head h2 a { color: var(--ink); }
.loc-group .loc-item { border: 0; border-top: 1px solid #f0f1f5; border-radius: 0; background: #fff; padding: 12px 20px; align-items: center; }

/* ---------- Responsif ---------- */
@media (max-width: 860px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .loc-picker-grid { grid-template-columns: 1fr; }
    .edit-item-fields { grid-template-columns: 1fr 1fr; }
    .edit-item-fields .field-file { grid-column: span 2; }
}
@media (max-width: 720px) {
    .nav-toggle { display: block; }
    .nav {
        display: none; position: absolute; top: 62px; left: 0; right: 0;
        background: #fff; border-bottom: 1px solid var(--line);
        flex-direction: column; align-items: stretch; padding: 8px 16px 14px; gap: 2px;
    }
    .nav.open { display: flex; }
    .nav-cta { margin: 6px 0 0; justify-content: center; }
    .page-head h1 { font-size: 22px; }
    .grid-2 { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .item-row { grid-template-columns: 30px 1fr; }
    .item-row .field { grid-column: 2; }
    .item-row .item-no { grid-row: span 3; margin-top: 0; }
    .voucher-progress { flex-basis: 100%; }
    .item { grid-template-columns: auto 1fr auto; padding: 10px 14px; }
    .item > .btn { grid-column: 2 / -1; justify-self: start; }
    .item-actions { padding: 12px 14px; }
    .voucher-head { padding: 16px 14px 12px; }
    .edit-item { grid-template-columns: 30px 1fr; grid-template-areas: "no fields" "no side" "actions actions"; }
    .edit-item-fields { grid-template-columns: 1fr; }
    .edit-item-fields .field-file { grid-column: auto; }
    .edit-item-side { flex-direction: row; justify-content: flex-start; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
    .loc-map { height: 280px; }
    .loc-map-big { height: 380px; }
    .loc-group .loc-item { flex-wrap: wrap; padding: 12px 14px; }
    .loc-group .loc-item > .loc-links { width: 100%; padding-left: 28px; }
    .loc-group-head { padding: 14px 14px 8px; }
}
@media (max-width: 420px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-value { font-size: 18px; }
    .brand-text { font-size: 13px; }
}
