/* ═══════════════════════════════════════════
   Design tokens
═══════════════════════════════════════════ */
:root {
    --brand:        #0e6b5f;
    --brand-dark:   #09503a;
    --brand-dim:    #e5f2f0;
    --accent:       #1a6fa8;
    --accent-dim:   #e8f2fa;
    --danger:       #b92b27;
    --danger-dim:   #fdf2f2;
    --success:      #0a6640;
    --success-dim:  #ebf7f0;

    --bg:           #eef2f5;
    --surface:      #ffffff;
    --surface-2:    #f6f9fb;
    --border:       #d8e3ea;
    --border-input: #c2cfd8;

    --text-1:       #1a2730;
    --text-2:       #4a5e6b;
    --text-3:       #7a8e99;

    --radius:       8px;
    --radius-sm:    5px;
    --radius-xs:    3px;

    --shadow-xs:    0 1px 2px rgba(0,0,0,.06);
    --shadow-sm:    0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:    0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);

    --t:            150ms ease;
}

/* ═══════════════════════════════════════════
   Reset
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text-1);
    font-family: 'Segoe UI', system-ui, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a, button { font: inherit; }
img       { display: block; }

/* ═══════════════════════════════════════════
   HEADER
═══════════════════════════════════════════ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 14px 6px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    text-decoration: none;
}

.brand img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    flex: 0 0 auto;
    border-radius: 6px;
}

.brand-text { min-width: 0; }

.brand-text strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.25;
    letter-spacing: .01em;
    white-space: nowrap;
}

.brand-text span {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* nav */
.topbar nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 34px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--t), color var(--t);
}
.nav-link:hover { background: var(--surface-2); color: var(--brand); }
.nav-link.active {
    background: var(--brand-dim);
    color: var(--brand);
}
.nav-link svg { width: 15px; height: 15px; flex: 0 0 auto; }

/* divider between nav items */
.nav-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 4px;
}

/* ═══════════════════════════════════════════
   PAGE
═══════════════════════════════════════════ */
.page {
    width: min(1160px, calc(100% - 32px));
    margin: 24px auto 40px;
}

/* ═══════════════════════════════════════════
   CARD / PANEL
═══════════════════════════════════════════ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.card-header h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.3;
}
.card-header p {
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--text-3);
}

.card-body { padding: 22px; }

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 18px;
    height: 36px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
    user-select: none;
}
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.btn-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    box-shadow: 0 2px 8px rgba(14,107,95,.30);
}

.btn-outline {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-2);
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }

.btn-danger {
    background: var(--surface);
    border-color: var(--danger);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; gap: 5px; }
.btn-sm svg { width: 13px; height: 13px; }

/* ── icon-only action buttons ── */
.act-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--text-3);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
    flex: 0 0 auto;
}
.act-btn svg { width: 14px; height: 14px; }

/* tooltip */
.act-btn::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #1c2b35;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t), transform var(--t);
    z-index: 400;
}
.act-btn::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 5px solid transparent;
    border-top-color: #1c2b35;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t), transform var(--t);
    z-index: 400;
}
.act-btn:hover::after,
.act-btn:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.act-view:hover  { border-color: var(--brand);  color: var(--brand);  background: var(--brand-dim); }
.act-edit:hover  { border-color: #b45309;       color: #b45309;       background: #fef3c7; }
.act-pdf:hover   { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.act-del:hover   { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }

/* ═══════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: 13.5px;
}
.alert svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.alert-success { border-color: #9dd4b5; background: var(--success-dim); color: var(--success); }
.alert-error   { border-color: #f0b0ae; background: var(--danger-dim);  color: var(--danger); }

/* ═══════════════════════════════════════════
   TABLE
═══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    padding: 10px 16px;
    background: var(--surface-2);
    border-bottom: 2px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
    letter-spacing: .07em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 13.5px;
    color: var(--text-1);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td      { background: #f4f8fa; }

.cell-id     { font-weight: 600; color: var(--brand); font-size: 13px; }
.cell-sub    { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.cell-muted  { color: var(--text-3); font-size: 13px; }
.cell-date   { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.cell-acts   { display: flex; align-items: center; gap: 6px; }

.tbl-empty td {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-3);
}
.tbl-empty .empty-icon {
    width: 36px; height: 36px;
    margin: 0 auto 10px;
    color: var(--border);
}

/* ═══════════════════════════════════════════
   FORM
═══════════════════════════════════════════ */
.form-body { padding: 4px 0; }

.form-section {
    padding: 22px;
    border-bottom: 1px solid var(--border);
}
.form-section:last-child { border-bottom: none; }

.section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.section-head h3 {
    font-size: 11px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: .09em;
    text-transform: uppercase;
}
.section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brand-dim);
    color: var(--brand);
    font-size: 10px;
    font-weight: 700;
    flex: 0 0 auto;
}

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

.f-field { display: flex; flex-direction: column; gap: 5px; }

.f-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-2);
    letter-spacing: .01em;
}
.f-label .req { color: var(--danger); margin-left: 2px; }

input, textarea, select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-1);
    font: inherit;
    font-size: 13.5px;
    transition: border-color var(--t), box-shadow var(--t);
    appearance: none;
}
textarea {
    height: auto;
    padding: 7px 10px;
    resize: vertical;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(14,107,95,.13);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

.full { grid-column: 1 / -1; }

.form-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 22px;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════
   DETAIL / VIEW
═══════════════════════════════════════════ */
.view-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 268px;
    gap: 20px;
    align-items: start;
}

.view-main { display: flex; flex-direction: column; gap: 16px; }

.info-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.info-title {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: .09em;
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--border);
}

dl { display: grid; grid-template-columns: 155px minmax(0, 1fr); gap: 8px 14px; }
dt { font-size: 12px; font-weight: 600; color: var(--text-3); line-height: 1.5; }
dd { font-size: 13.5px; color: var(--text-1); line-height: 1.5; margin: 0; word-break: break-word; }

/* QR sidebar */
.qr-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.qr-panel img {
    width: 100%;
    max-width: 200px;
    height: auto;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    align-self: center;
}

.qr-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: .07em;
    text-transform: uppercase;
}

.qr-payload {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

.qr-note {
    font-size: 11.5px;
    color: var(--text-3);
    line-height: 1.45;
    text-align: center;
}

/* ═══════════════════════════════════════════
   UTILITY
═══════════════════════════════════════════ */
.row     { display: flex; align-items: center; gap: 8px; }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 720px) {
    .two-col { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════
   VERIFIKATOR – form rows
═══════════════════════════════════════════ */
.verifikator-list { display: flex; flex-direction: column; gap: 8px; }

.verifikator-row {
    display: grid;
    grid-template-columns: 1fr 1fr 36px;
    gap: 10px;
    align-items: end;
}

.vf-field { display: flex; flex-direction: column; gap: 5px; }

.vf-del { display: flex; flex-direction: column; gap: 5px; }

.btn-vdel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-3);
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
    padding: 0;
    flex: 0 0 auto;
}
.btn-vdel:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }
.btn-vdel:disabled { opacity: .3; cursor: default; }
.btn-vdel svg { width: 14px; height: 14px; }

.btn-vadd {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 14px;
    margin-top: 6px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-3);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--t), color var(--t), background var(--t);
}
.btn-vadd:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-dim); }
.btn-vadd svg { width: 14px; height: 14px; flex: 0 0 auto; }

/* ═══════════════════════════════════════════
   VERIFIKATOR – view / detail
═══════════════════════════════════════════ */
.verifikator-view-list { display: flex; flex-direction: column; gap: 8px; }

.verifikator-view-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vv-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--brand-dim);
    color: var(--brand);
    font-size: 10px;
    font-weight: 700;
    flex: 0 0 auto;
}

.vv-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.vv-nama {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-1);
}

.vv-jabatan {
    font-size: 11.5px;
    color: var(--text-3);
}

@media (max-width: 720px) {
    .verifikator-row { grid-template-columns: 1fr 36px; }
    .verifikator-row .vf-jabatan { display: none; }
}

/* ═══════════════════════════════════════════
   DATABASE SETUP
═══════════════════════════════════════════ */
.db-setup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.db-setup-table thead th {
    padding: 9px 18px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-3);
    background: var(--surface-2);
    border-bottom: 1.5px solid var(--border);
}
.db-setup-table tbody tr { border-bottom: 1px solid var(--border); }
.db-setup-table tbody tr:last-child { border-bottom: none; }
.db-setup-table td { padding: 11px 18px; vertical-align: middle; }

.db-setup-table code {
    font-size: 12.5px;
    font-weight: 700;
    font-family: ui-monospace, 'Cascadia Code', monospace;
    color: var(--text-1);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
}
.db-desc  { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.db-type  { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.db-extra { font-size: 11px; color: var(--text-3); margin-left: 6px; }
.db-action { text-align: right; white-space: nowrap; }

.db-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
}
.db-badge.ok   { background: var(--success-dim); color: var(--success); }
.db-badge.warn { background: #fff7ed;             color: #b96200; }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 960px) {
    .view-layout { grid-template-columns: 1fr; }
    .qr-panel { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
    .qr-panel img { max-width: 140px; }
}

@media (max-width: 720px) {
    .form-grid               { grid-template-columns: 1fr; }
    .full                    { grid-column: 1; }
    dl                       { grid-template-columns: 1fr; row-gap: 2px; }
    dt                       { font-size: 11px; }
    dd                       { margin-bottom: 6px; }
}

@media (max-width: 620px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 8px 14px;
        gap: 6px;
    }
    .brand img { width: 56px; height: 56px; }
    .brand-text strong { font-size: 13px; white-space: normal; line-height: 1.3; }
    .brand-text span   { font-size: 10px; }
    .topbar nav { justify-content: flex-end; }
    .nav-link { padding: 0 10px; height: 32px; font-size: 12.5px; }
    .page { width: calc(100% - 24px); margin: 14px auto 28px; }
    .card-header { flex-wrap: wrap; }
}
