/* Font tambahan untuk template ID Card (dipakai di editor & preview) —
   file dihosting sendiri (bukan CDN) supaya aplikasi tetap jalan offline
   di server lokal, dan hasilnya identik dengan yang dipakai TCPDF di PDF. */
@font-face { font-family: "Poppins"; src: url("/assets/fonts/poppins-regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/assets/fonts/poppins-bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/assets/fonts/montserrat-regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/assets/fonts/montserrat-bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("/assets/fonts/roboto-regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("/assets/fonts/roboto-bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Oswald"; src: url("/assets/fonts/oswald-regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Oswald"; src: url("/assets/fonts/oswald-bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Bebas Neue"; src: url("/assets/fonts/bebasneue-regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Bebas Neue"; src: url("/assets/fonts/bebasneue-bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Quicksand"; src: url("/assets/fonts/quicksand-regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Quicksand"; src: url("/assets/fonts/quicksand-bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("/assets/fonts/lora-regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("/assets/fonts/lora-bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
    --color-bg: #f4f5f7;
    --color-surface: #ffffff;
    --color-border: #e2e4e9;
    --color-text: #1c1f26;
    --color-text-muted: #6b7280;
    --color-primary: #2f5d50;
    --color-primary-hover: #24473d;
    --color-primary-contrast: #ffffff;
    --color-danger: #b3261e;
    --color-danger-bg: #fdecea;
    --color-info: #2b5f8a;
    --color-info-bg: #eaf2f8;
    --color-success: #2f6d4c;
    --color-success-bg: #eaf5ee;
    --radius-sm: 6px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.08);
    --font-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

h1, h2, h3, p {
    margin: 0;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
    background: var(--color-primary);
    color: var(--color-primary-contrast);
}

.btn--primary:hover {
    background: var(--color-primary-hover);
}

.btn--ghost {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn--ghost:hover {
    background: var(--color-bg);
}

.btn--block {
    width: 100%;
}

/* ── Forms ───────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(47, 93, 80, 0.15);
}

/* ── Alerts / Notices ────────────────────────────────── */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    text-align: left;
}

.alert--error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.notice {
    margin-top: 24px;
    padding: 14px 16px;
    background: var(--color-info-bg);
    color: var(--color-info);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* ── Auth (login) ────────────────────────────────────── */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #eef1f0 0%, #f4f5f7 100%);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 32px 28px;
}

.auth-card__header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-card__header h1 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-card__header p {
    color: var(--color-text-muted);
    font-size: 13px;
}

/* ── Admin layout ────────────────────────────────────── */
.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: #1c2b26;
    color: #dde5e1;
    padding: 24px 16px;
}

.admin-sidebar__brand {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 24px;
    padding: 0 8px;
    color: #ffffff;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-nav__link {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: #c3cec8;
    font-size: 13px;
    font-weight: 500;
}

.admin-nav__link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.admin-nav__link.is-active {
    background: var(--color-primary);
    color: #ffffff;
}

.admin-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.admin-topbar__user {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text-muted);
}

.admin-content {
    padding: 28px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

.page-subtitle {
    color: var(--color-text-muted);
    font-size: 13px;
    margin-top: 4px;
}

/* ── Stat cards ──────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card__value {
    font-size: 26px;
    font-weight: 700;
}

.stat-card--info .stat-card__value { color: var(--color-info); }
.stat-card--success .stat-card__value { color: var(--color-success); }
.stat-card--muted .stat-card__value { color: var(--color-text-muted); }

/* ── Toolbar / Filter ────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.toolbar__actions {
    display: flex;
    gap: 10px;
}

.filter-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-form input,
.filter-form select {
    padding: 9px 12px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

/* ── Multi-select (filter Kategori, bisa pilih lebih dari satu) ───── */
.multi-select {
    position: relative;
}

.multi-select__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: inherit;
    cursor: pointer;
    min-width: 160px;
    justify-content: space-between;
}

.multi-select__caret {
    font-size: 10px;
    color: var(--color-text-muted);
}

.multi-select__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 20;
    min-width: 220px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    padding: 6px;
}

.multi-select__option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.multi-select__option:hover {
    background: var(--color-bg);
}

.multi-select__option--all {
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 4px;
    padding-bottom: 9px;
}

.multi-select__empty {
    font-size: 13px;
    color: var(--color-text-muted);
    padding: 6px 8px;
    margin: 0;
}

.alert--success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

/* ── Table ───────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    background: var(--color-bg);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--color-bg);
}

.table__actions {
    display: flex;
    gap: 6px;
}

.table__empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--color-text-muted);
}

/* ── Badge ───────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge--muted { background: #eceef1; color: var(--color-text-muted); }
.badge--info { background: var(--color-info-bg); color: var(--color-info); }
.badge--success { background: var(--color-success-bg); color: var(--color-success); }

code.access-code {
    font-family: "Consolas", "Courier New", monospace;
    background: var(--color-bg);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* ── Pagination ──────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.pagination__links {
    display: flex;
    gap: 8px;
}

/* ── Buttons tambahan ────────────────────────────────── */
.btn--sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn--danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.btn--danger:hover {
    background: #f8d7d4;
}

.btn--secondary {
    background: var(--color-info);
    color: #ffffff;
}

.btn--secondary:hover {
    opacity: 0.9;
}

.btn--disabled {
    pointer-events: none;
    opacity: 0.4;
}

/* ── Form error ──────────────────────────────────────── */
.field-error {
    color: var(--color-danger);
    font-size: 12px;
    margin-top: 4px;
}

.form-group input.has-error,
.form-group select.has-error,
.form-group textarea.has-error {
    border-color: var(--color-danger);
}

.form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px 28px;
    max-width: 560px;
    margin-top: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

/* ── Detail page ─────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    margin-top: 20px;
}

.detail-photo {
    width: 200px;
    height: 240px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 12px;
    text-align: center;
    background: var(--color-bg);
    overflow: hidden;
}

.detail-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row__label {
    color: var(--color-text-muted);
}

.detail-row__value {
    font-weight: 600;
    text-align: right;
}

/* ── Dropzone import ─────────────────────────────────── */
.dropzone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 40px 24px;
    text-align: center;
    background: var(--color-surface);
    margin-top: 20px;
}

/* ── Template grid (daftar template) ─────────────────── */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.template-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.template-card--active {
    border-color: var(--color-primary);
}

.template-card__preview {
    position: relative;
    aspect-ratio: 1.585 / 1;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 12px;
    overflow: hidden;
}

.template-card__preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.template-card__badge {
    position: absolute;
    top: 8px;
    right: 8px;
}

.template-card__body {
    padding: 14px 16px;
}

.template-card__body h3 {
    font-size: 14px;
    font-weight: 700;
}

.template-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* ── Template editor ──────────────────────────────────── */
.template-meta-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 16px;
    font-size: 13px;
}

.template-meta-form summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--color-text);
}

.editor-tabs {
    display: flex;
    gap: 4px;
    margin-top: 20px;
    border-bottom: 1px solid var(--color-border);
}

.editor-tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
}

.editor-tab.is-active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.editor-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    margin-top: 20px;
    align-items: start;
}

.editor-canvas-col {
    min-width: 0;
}

.editor-canvas-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}

.editor-canvas {
    position: relative;
    width: 100%;
    /* Dibatasi supaya template potret (tinggi > lebar) tidak memanjang
       tak terkendali ke bawah — kanvas tetap muat di layar & nyaman
       dipakai drag/resize, apa pun rasio gambar template-nya. */
    max-width: 420px;
    max-height: 75vh;
    margin: 0 auto;
    background: #222;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
    user-select: none;
}

.editor-canvas__bg {
    display: block;
    width: 100%;
    height: 100%;
    /* object-fit: fill (bukan cover) — sengaja meregang persis mengisi
       ukuran fisik kartu, sama seperti perilaku TCPDF Image() saat cetak,
       supaya editor/preview akurat merepresentasikan hasil PDF walau
       rasio gambar template tidak sama persis dengan rasio kartu. */
    object-fit: fill;
    pointer-events: none;
    user-select: none;
}

.field-box {
    position: absolute;
    box-sizing: border-box;
    border: 1.5px dashed rgba(47, 93, 80, 0.85);
    background: rgba(47, 93, 80, 0.12);
    cursor: move;
    touch-action: none;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.field-box--photo {
    background: rgba(43, 95, 138, 0.18);
    border-color: rgba(43, 95, 138, 0.85);
    justify-content: center;
}

.field-box.is-selected {
    border-color: var(--color-primary);
    background: rgba(47, 93, 80, 0.22);
    box-shadow: 0 0 0 2px rgba(47, 93, 80, 0.3);
    z-index: 2;
}

.field-box--hidden {
    opacity: 0.45;
    border-style: dotted;
    background: repeating-linear-gradient(
        45deg,
        rgba(120, 120, 120, 0.15),
        rgba(120, 120, 120, 0.15) 6px,
        rgba(120, 120, 120, 0.3) 6px,
        rgba(120, 120, 120, 0.3) 12px
    );
}

.field-box--locked {
    cursor: not-allowed;
    border-style: solid;
    border-color: rgba(180, 120, 10, 0.9);
}

.field-box--locked .field-box__resize-handle {
    display: none;
}

.field-box__label {
    padding: 2px 4px;
    width: 100%;
    /* #141414 — samakan dengan default TCPDF (SetTextColor(20,20,20)) dan
       nilai default color-picker (lihat inputTextColor di template-editor.js)
       saat admin belum set warna kustom untuk field ini. */
    color: #141414;
    /* Boleh membungkus ke beberapa baris (bukan lagi 1 baris + ellipsis) —
       supaya editor menampilkan wrapping yang sama seperti hasil cetak PDF
       (lihat cascade shift di template-editor.js), bukan menyembunyikan
       kelebihan teks. */
    white-space: normal;
    overflow-wrap: break-word;
    overflow: visible;
    pointer-events: none;
}

.field-box__resize-handle {
    position: absolute;
    right: -5px;
    bottom: -5px;
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: se-resize;
    touch-action: none;
}

.editor-sidebar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    position: sticky;
    top: 20px;
}

.editor-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ── Student (mobile-first) ──────────────────────────── */
.student-body {
    background: var(--color-bg);
}

.student-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.student-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.student-topbar__brand {
    font-weight: 700;
    font-size: 14px;
}

.student-content {
    padding: 20px;
    flex: 1;
}

.student-hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(180deg, #eef1f0 0%, #f4f5f7 100%);
}

.student-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px 20px;
    max-width: 420px;
    margin: 0 auto;
}

.student-photo-frame {
    width: 160px;
    height: 200px;
    margin: 0 auto 16px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--color-border);
    background: var(--color-bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 12px;
    text-align: center;
}

.student-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.student-name {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.student-category {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--color-primary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.student-detail-list {
    margin: 16px 0 20px;
}

.student-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}

.student-detail-row:last-child {
    border-bottom: none;
}

.student-detail-row span {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.student-detail-row strong {
    text-align: right;
}

/* ── Photo cropper ───────────────────────────────────── */
.dropzone--tap {
    display: block;
    cursor: pointer;
    text-align: center;
    color: var(--color-text);
}

.cropper-frame {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 3 / 4;
    margin: 0 auto;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: #111;
}

.cropper-frame canvas,
.cropper-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    touch-action: none;
}

.cropper-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 16px 0;
}

/* ── Print preview (baca-saja, pakai container query units) ─── */
.preview-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    margin-top: 20px;
}

.preview-card-wrap {
    width: 100%;
    max-width: 380px;
}

.preview-card {
    position: relative;
    width: 100%;
    container-type: inline-size;
    background: #000;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.preview-card__bg {
    display: block;
    width: 100%;
    height: 100%;
    /* fill (bukan cover) — samakan dengan perilaku TCPDF Image() saat
       cetak: gambar template selalu diregangkan pas ke ukuran fisik kartu. */
    object-fit: fill;
}

.preview-field {
    /* overflow VISIBLE by default — samakan dengan TCPDF yang tidak pernah
       memotong teks (nilai boleh membungkus/meluber melewati kotak yang
       diatur admin). Hanya foto yang perlu diklip (lihat .preview-field--foto)
       supaya sudut tumpul (border-radius) berfungsi. */
    position: absolute;
    overflow: visible;
    /* #141414 — samakan dengan default TCPDF (SetTextColor(20,20,20)) saat
       field tidak diberi warna kustom, supaya preview & hasil cetak PDF
       sama persis untuk kasus warna default. */
    color: #141414;
    line-height: 1.15;
}

.preview-field--foto {
    overflow: hidden;
}

.preview-field__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        display: flex;
        align-items: center;
        overflow-x: auto;
    }

    .admin-nav {
        flex-direction: row;
    }

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

    .editor-sidebar {
        position: static;
    }

    .admin-sidebar__brand {
        display: none;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-photo {
        width: 100%;
        max-width: 220px;
        margin: 0 auto;
    }
}
