:root {
    --ink: #17212b;
    --muted: #5d6975;
    --line: #d7dee5;
    --paper: #ffffff;
    --soft: #f4f7f9;
    --navy: #153a5b;
    --red: #b4232d;
    --green: #1e7651;
    --gold: #bc7b18;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--soft);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
}

.site-header {
    align-items: center;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    min-height: 76px;
    padding: 10px max(20px, calc((100vw - 1180px) / 2));
}

.brand {
    align-items: center;
    display: flex;
    gap: 12px;
    text-decoration: none;
}

.brand img {
    height: 52px;
    object-fit: contain;
    width: 52px;
}

.brand span {
    display: grid;
}

.brand strong {
    color: var(--navy);
    font-size: 18px;
}

.brand small {
    color: var(--muted);
}

nav {
    align-items: center;
    display: flex;
    gap: 20px;
}

nav a,
nav button {
    background: none;
    border: 0;
    color: var(--navy);
    cursor: pointer;
    font: inherit;
    padding: 8px 0;
    text-decoration: none;
}

.local-banner {
    background: #e8f4ee;
    border-bottom: 1px solid #b8dbc9;
    color: #155c3d;
    padding: 8px 20px;
    text-align: center;
}

main {
    min-height: calc(100vh - 166px);
}

.welcome-band,
.admin-heading {
    background: var(--navy);
    color: var(--paper);
    display: grid;
    gap: 36px;
    grid-template-columns: minmax(0, 1fr) 330px;
    padding: 56px max(20px, calc((100vw - 1180px) / 2));
}

.welcome-band h1,
.admin-heading h1,
.auth-copy h1,
.post-detail h1 {
    font-size: clamp(30px, 5vw, 52px);
    line-height: 1.12;
    margin: 8px 0 14px;
    max-width: 900px;
}

.architecture {
    align-content: center;
    border-left: 4px solid var(--gold);
    display: grid;
    gap: 8px;
    padding-left: 22px;
}

.architecture span {
    color: #d8e8f3;
}

.eyebrow {
    color: var(--red);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0;
    text-transform: uppercase;
}

.welcome-band .eyebrow,
.admin-heading .eyebrow,
.auth-copy .eyebrow {
    color: #ffb1a9;
}

.content-section,
.post-detail {
    margin: 0 auto;
    max-width: 1180px;
    padding: 38px 20px;
}

.section-heading {
    align-items: end;
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-heading h2 {
    margin: 2px 0 0;
}

.button {
    background: var(--red);
    border: 1px solid var(--red);
    border-radius: 6px;
    color: var(--paper);
    cursor: pointer;
    display: inline-block;
    font: inherit;
    font-weight: 700;
    padding: 10px 16px;
    text-decoration: none;
}

.button-secondary {
    background: var(--paper);
    border-color: var(--line);
    color: var(--navy);
}

.button-danger {
    background: var(--red);
    border-color: var(--red);
}

.flash-message {
    background: #dff5e8;
    border-bottom: 1px solid #a9d8bc;
    color: #155c3d;
    font-weight: 700;
    padding: 12px 20px;
    text-align: center;
}

.metric-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.metric-grid article,
.post-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 20px;
}

.metric-grid strong {
    color: var(--navy);
    display: block;
    font-size: 30px;
}

.metric-grid span,
.post-meta {
    color: var(--muted);
}

.post-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.post-card h3 {
    line-height: 1.3;
    margin: 8px 0;
}

.post-card h3 a {
    color: var(--navy);
    text-decoration: none;
}

.empty-state {
    background: var(--paper);
    border: 1px dashed var(--line);
    padding: 24px;
}

.auth-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 480px);
    margin: 0 auto;
    max-width: 1180px;
    min-height: 620px;
}

.auth-copy {
    align-content: center;
    background: var(--navy);
    color: var(--paper);
    display: grid;
    padding: 52px;
}

.auth-form {
    align-content: center;
    background: var(--paper);
    display: grid;
    gap: 10px;
    padding: 52px;
}

input,
select,
textarea {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--ink);
    font: inherit;
    min-width: 0;
    padding: 11px 12px;
    width: 100%;
}

textarea {
    line-height: 1.6;
    resize: vertical;
}

input[type="checkbox"] {
    width: auto;
}

label {
    color: var(--navy);
    display: grid;
    font-weight: 700;
    gap: 6px;
}

label small {
    color: var(--muted);
    font-weight: 400;
}

.check-row {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 6px 0;
}

.field-error {
    color: var(--red);
    margin: 0;
}

.admin-heading {
    align-items: center;
}

.status-pill {
    background: #dff5e8;
    border-radius: 999px;
    color: var(--green);
    justify-self: end;
    padding: 6px 12px;
}

.action-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.action-grid a {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 6px;
    padding: 20px;
    text-decoration: none;
}

.action-grid strong {
    color: var(--navy);
    font-size: 18px;
}

.action-grid span,
.table-subtext {
    color: var(--muted);
}

.filter-bar {
    align-items: end;
    background: var(--paper);
    border: 1px solid var(--line);
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(140px, 190px)) auto auto;
    margin-bottom: 18px;
    padding: 16px;
}

.filter-bar.skm-filter-bar {
    grid-template-columns: minmax(220px, 1fr) auto minmax(260px, auto);
}

.skm-export-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.button-export-excel {
    background: #1f7a4d;
    border-color: #1f7a4d;
}

.skm-month-summary {
    align-items: center;
    background: #eaf1f7;
    border: 1px solid #cbd9e5;
    color: var(--navy);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 11px 14px;
}

.skm-month-summary span {
    color: var(--muted);
    font-size: 13px;
}

.table-wrap {
    background: var(--paper);
    border: 1px solid var(--line);
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    min-width: 700px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
}

.table-subtext {
    display: block;
    font-size: 12px;
    font-weight: 400;
    margin-top: 2px;
}

.content-status {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
}

.content-status-published {
    background: #dff5e8;
    color: var(--green);
}

.content-status-draft {
    background: #fff3d9;
    color: #8b5709;
}

.table-actions {
    display: flex;
    gap: 14px;
}

.table-actions a {
    color: var(--navy);
    font-weight: 700;
}

.pagination {
    justify-content: space-between;
    margin-top: 18px;
}

.pagination a {
    color: var(--navy);
    font-weight: 700;
}

.validation-errors {
    background: #fff0f0;
    border: 1px solid #ecc0c3;
    color: #8f1720;
    margin-bottom: 18px;
    padding: 14px 18px;
}

.validation-errors ul {
    margin-bottom: 0;
}

.operator-guide {
    background: linear-gradient(135deg, #eef7fb, #f7fbfd);
    border: 1px solid #bed8e5;
    border-left: 4px solid #1e718f;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(190px, .4fr) minmax(0, 1fr);
    margin-bottom: 20px;
    padding: 16px 18px;
}

.operator-guide > div {
    display: grid;
    gap: 4px;
}

.operator-guide-label {
    color: #1e718f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.operator-guide strong {
    color: var(--navy);
    line-height: 1.35;
}

.operator-guide ul {
    color: var(--muted);
    display: grid;
    gap: 5px;
    margin: 0;
    padding-left: 18px;
}

.operator-guide li {
    line-height: 1.45;
}

.content-editor {
    display: grid;
    gap: 18px;
}

.editor-layout {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 330px);
}

.form-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    display: grid;
    gap: 16px;
    padding: 20px;
}

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-grid {
    display: grid;
    gap: 18px;
}

.form-grid-settings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setting-field {
    display: grid;
    gap: 6px;
}

.setting-field input {
    width: 100%;
}

.setting-field small {
    color: var(--muted);
    line-height: 1.45;
}

.hero-slides-field {
    grid-column: 1 / -1;
}

.hero-slides-heading {
    align-items: start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.hero-slides-heading > div {
    display: grid;
    gap: 5px;
}

.hero-slides-heading > div > span {
    font-weight: 700;
}

.hero-slide-count {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 9px;
}

.hero-slide-count.is-over-limit {
    background: #fff1ef;
    border-color: #d7887e;
    color: #a33b34;
}

.hero-existing-slides,
.hero-new-slides {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-new-slides:empty {
    display: none;
}

.hero-slide-editor {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    grid-template-columns: minmax(120px, 42%) minmax(0, 1fr);
    overflow: hidden;
}

.hero-slide-editor-new {
    border-color: rgba(200, 151, 58, .45);
}

.hero-slide-editor > img {
    height: 100%;
    min-height: 150px;
    object-fit: cover;
    width: 100%;
}

.hero-slide-editor-body {
    align-content: start;
    display: grid;
    gap: 12px;
    padding: 14px;
}

.hero-slide-editor-body label {
    display: grid;
    gap: 5px;
}

.hero-slide-editor-body label > span {
    color: var(--muted);
    font-size: 12px;
}

.hero-slide-editor-body input[type="number"] {
    width: 100%;
}

.hero-slide-editor-body .hero-remove-option {
    align-items: center;
    display: flex;
    gap: 7px;
}

.hero-slide-editor-body .hero-remove-option input {
    margin: 0;
    width: auto;
}

.hero-slide-editor-body .hero-remove-option span {
    color: #a33b34;
}

.hero-upload-box {
    background: rgba(200, 151, 58, .05);
    border: 1px dashed rgba(200, 151, 58, .55);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 16px;
}

.hero-upload-box > span {
    font-weight: 700;
}

.hero-upload-box input[type="file"] {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
}

.currency-preview {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold, #c8973a);
    background: rgba(200, 151, 58, .08);
    border: 1px solid rgba(200, 151, 58, .18);
    padding: 3px 10px;
    border-radius: 6px;
    letter-spacing: .02em;
}

.form-sidebar {
    position: sticky;
    top: 18px;
}

.cover-preview-admin {
    display: grid;
    gap: 8px;
}

.cover-preview-admin > span {
    color: var(--navy);
    font-weight: 700;
}

.cover-preview-admin img {
    aspect-ratio: 16 / 10;
    background: var(--soft);
    border: 1px solid var(--line);
    object-fit: cover;
    width: 100%;
}

.inline-check {
    align-items: center;
    display: flex;
    font-weight: 400;
    gap: 8px;
}

.standalone-help {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    margin-top: -10px;
}

.editor-help {
    background: var(--soft);
    border-left: 4px solid var(--gold);
    padding: 12px 14px;
}

.editor-help p {
    color: var(--muted);
    margin: 4px 0 0;
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.delete-panel {
    align-items: center;
    background: #fff0f0;
    border: 1px solid #ecc0c3;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-top: 30px;
    padding: 18px 20px;
}

.delete-panel p {
    color: var(--muted);
    margin: 2px 0 0;
}

.post-detail {
    background: var(--paper);
    margin-bottom: 40px;
    margin-top: 40px;
}

.post-detail img {
    max-height: 520px;
    object-fit: cover;
    width: 100%;
}

.lead {
    color: var(--navy);
    font-size: 20px;
    font-weight: 700;
}

footer {
    background: #101a23;
    color: #d7e0e7;
    padding: 24px 20px;
    text-align: center;
}

@media (max-width: 760px) {
    .site-header,
    .section-heading {
        align-items: flex-start;
        gap: 14px;
    }

    .site-header {
        flex-direction: column;
    }

    .site-header nav {
        flex-wrap: wrap;
        gap: 8px 18px;
    }

    .welcome-band,
    .admin-heading,
    .auth-wrap,
    .action-grid,
    .editor-layout,
    .filter-bar,
    .form-grid,
    .operator-guide {
        grid-template-columns: 1fr;
    }

    .admin-heading {
        padding-bottom: 36px;
        padding-top: 36px;
    }

    .architecture {
        border-left: 0;
        border-top: 4px solid var(--gold);
        padding-left: 0;
        padding-top: 18px;
    }

    .auth-copy,
    .auth-form {
        padding: 34px 22px;
    }

    .status-pill {
        justify-self: start;
    }

    .form-sidebar {
        position: static;
    }

    .filter-bar .button {
        text-align: center;
        width: 100%;
    }

    .skm-export-actions,
    .skm-month-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .skm-export-actions .button {
        text-align: center;
        width: 100%;
    }

    .delete-panel {
        align-items: stretch;
        flex-direction: column;
    }
}

/* --- Multi-image upload admin --- */
.images-upload-section {
    margin-top: 18px;
}

.images-upload-section > span,
.existing-images-preview > span {
    color: var(--navy);
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.images-upload-section small {
    display: block;
    margin-top: 4px;
}

.insert-image-button { margin: .55rem; width: calc(100% - 1.1rem); justify-content: center; }
#new-images-preview { margin-top: 1rem; }
.content-body-field textarea { font-family: inherit; line-height: 1.65; }

.images-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    margin-top: 8px;
}

.image-card {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    display: grid;
    gap: 8px;
    padding: 10px;
    transition: border-color .15s;
}

.image-card:has(input:checked) {
    border-color: var(--red);
    background: #fff0f0;
}

.image-card img {
    aspect-ratio: 4 / 3;
    border-radius: 4px;
    object-fit: cover;
    width: 100%;
}

.image-card .inline-check {
    font-size: .85rem;
    justify-content: center;
}

/* --- SKM badge di tabel admin --- */
.skm-badge {
    display: inline-block;
    background: #f1f5f9;
    color: #334155;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .8rem;
    white-space: nowrap;
}

/* =========================================================
   POPUP IMAGE OVERLAY
   ========================================================= */
.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    padding: 20px;
    animation: popupFadeIn .3s ease;
}

@keyframes popupFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.popup-full-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    display: block;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.45);
    animation: popupScaleIn .35s cubic-bezier(.22, .68, .28, 1.05);
}

@keyframes popupScaleIn {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.popup-close {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10001;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    line-height: 1;
    cursor: pointer;
    transition: background .2s, transform .2s;
    -webkit-tap-highlight-color: transparent;
}

.popup-close:hover,
.popup-close:active {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.7);
    transform: scale(1.1);
}

.popup-close svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 2.6;
    stroke-linecap: round;
}

.popup-check-row {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.popup-check-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ffffff;
    cursor: pointer;
    flex-shrink: 0;
}

.popup-check-row label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .popup-overlay {
        padding: 12px;
    }

    .popup-full-image {
        max-height: 70vh;
    }

    .popup-close {
        top: 10px;
        right: 10px;
        width: 34px;
        height: 34px;
    }

    .popup-close svg {
        width: 16px;
        height: 16px;
    }

    .popup-check-row {
        bottom: 16px;
        padding: 6px 14px;
    }

    .popup-check-row label {
        font-size: 12px;
    }
}

/* File input styles for web setting */
.setting-field-file {
    display: grid;
    gap: 8px;
}

.setting-field-file > span {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
}

.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
}

.file-input-wrapper input[type="file"]::file-selector-button {
    padding: 6px 16px;
    margin-right: 12px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.file-input-wrapper input[type="file"]::file-selector-button:hover {
    opacity: 0.85;
}

.popup-current-preview,
.file-input-preview {
    margin-top: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--soft);
}

.popup-current-preview img,
.file-input-preview img {
    display: block;
    width: 100%;
    max-width: 320px;
    height: auto;
    object-fit: contain;
    max-height: 220px;
}

.popup-current-preview span,
.file-input-preview span {
    display: block;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--muted);
    background: var(--soft);
    border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
    .hero-existing-slides,
    .hero-new-slides {
        grid-template-columns: 1fr;
    }

    .hero-slide-editor {
        grid-template-columns: 1fr;
    }

    .hero-slide-editor > img {
        max-height: 220px;
    }
}
