:root {
    color-scheme: light;
    --ink: #15263d;
    --muted: #56657a;
    --border: #dbe2eb;
    --gold: #d2a962;
    --navy: #123054;
    --paper: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: #f0f3f8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; font-weight: 650; }

button, input, select, textarea {
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--ink);
}

button:hover:not(:disabled) { background: #eaf0f8; }
button:disabled { opacity: .53; cursor: default; }
:focus-visible { outline: 3px solid #a46c25; outline-offset: 2px; }
.primary { background: #15365b; color: white; border-color: transparent; }
.primary:hover:not(:disabled) { background: #214a76; }

.site-header {
    padding: 14px max(18px, calc((100vw - 1540px) / 2));
    min-height: 76px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    background: linear-gradient(115deg, #0b1a30, #17416c);
    border-bottom: 2px solid var(--gold);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand div span { display: block; }
.brand strong { font-size: 14px; letter-spacing: .07em; }
.brand div span { font-size: 12px; color: #d0deed; margin-top: 3px; }

.brand-logo {
    display: block;
    flex-shrink: 0;
    width: 112px;
    height: 54px;
    padding: 5px 8px;
    object-fit: contain;
    border: 1px solid #d2a962;
    border-radius: 8px;
    background: #fff;
}

.shell {
    max-width: 1580px;
    margin: auto;
    padding: 24px clamp(12px, 2vw, 22px) 32px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

h1, h2, p, dl, dd { margin: 0; }

h1 {
    font-family: Georgia, serif;
    font-weight: 600;
    font-size: clamp(29px, 4vw, 42px);
    letter-spacing: -.035em;
}

h2 { font-size: 17px; }
.page-heading p { margin-top: 4px; color: var(--muted); font-size: 14px; }

.metrics {
    display: flex;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: white;
}

.metrics div { min-width: 74px; padding: 8px 13px; text-align: center; }
.metrics div + div { border-left: 1px solid var(--border); }
.metrics dt { font-size: 12px; color: var(--muted); }
.metrics dd { font-size: 21px; font-weight: 720; }

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 315px;
    align-items: start;
    gap: 16px;
}

.map-card, .inspector {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 7px 19px #10243a0a;
}

.toolbar, .map-tools, .map-footer {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar { border-bottom: 1px solid var(--border); }
.search { flex: 1 1 200px; position: relative; }
.search input { width: 100%; }

.results {
    position: absolute;
    z-index: 5;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    min-width: 235px;
    max-height: 275px;
    overflow: auto;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: 0 6px 18px #14283f25;
}

.results button, .results p {
    width: 100%;
    display: block;
    border: 0;
    border-radius: 0;
    padding: 9px 12px;
    text-align: left;
}

.results button + button { border-top: 1px solid #edf0f5; }
.results small { display: block; color: var(--muted); margin-top: 2px; font-weight: 500; }

.map-tools {
    justify-content: space-between;
    padding-block: 8px;
    background: #f8f9fc;
}

.map-tools p, .map-footer { font-size: 13px; color: var(--muted); }
.zoom { display: flex; align-items: center; gap: 4px; }
.zoom button { min-height: 44px; min-width: 44px; padding: 4px 9px; }

#zoom-level {
    text-align: center;
    min-width: 44px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.map-viewport {
    --map-viewport-height: min(70vh, 850px);
    overflow: auto;
    max-height: var(--map-viewport-height);
    min-height: 180px;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    background: #eef1f6;
}

#map {
    display: block;
    width: 100%;
    height: auto;
    margin-inline: auto;
    user-select: none;
}

.table { cursor: grab; outline: none; }
.table.is-dragging { cursor: grabbing; }

.table-core {
    fill: #e5edf6;
    stroke: #3c5879;
    stroke-width: 1.7;
    touch-action: none;
}

.table.is-selected .table-core, .table:focus-visible .table-core {
    fill: #183e66;
    stroke: #b68137;
    stroke-width: 3;
}

.table-number {
    pointer-events: none;
    fill: #142d4d;
    font-size: 14px;
    font-weight: 800;
}

.table.is-selected .table-number, .table:focus-visible .table-number { fill: white; }

.chair {
    fill: #f8fbff;
    stroke: #65819e;
    stroke-width: 1.2;
    cursor: pointer;
    touch-action: manipulation;
}

.chair.is-filled { fill: #d9a654; stroke: #855617; }
.chair.is-active { stroke: #142d4d; stroke-width: 2.5; }

.map-footer {
    justify-content: space-between;
    border-top: 1px solid var(--border);
    min-height: 46px;
}

.legend { display: flex; align-items: center; gap: 13px; }
.legend span { display: flex; align-items: center; gap: 5px; }

.legend i {
    border: 1px solid #65819e;
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: #f8fbff;
}

.legend .chair-filled { background: #d9a654; border-color: #855617; }

#status[data-error="true"] { color: #a42a2a; font-weight: 650; }
.inspector { padding: 15px; }

.inspector-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.selected-label {
    padding: 4px 8px;
    background: #f4e9d8;
    color: #64451f;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
}

#empty { font-size: 14px; line-height: 1.55; color: var(--muted); }
#details > input, .seat-entry textarea { width: 100%; }
label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 650; }

.seat-settings {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 11px;
    margin-top: 13px;
}

.seat-settings label { margin: 0; }
.seat-entry { margin-top: 13px; }
.seat-entry textarea { resize: vertical; margin-top: 8px; line-height: 1.5; }
.seat-entry p { font-size: 12px; color: var(--muted); line-height: 1.45; }
#bulk-message:not(:empty) { margin-top: 5px; }
#bulk-message.is-error { color: #a42a2a; }

.seat-roster {
    border-top: 1px solid var(--border);
    margin-top: 14px;
    padding-top: 11px;
}

.seat-roster h3 { font-size: 14px; margin: 0 0 8px; }

#chair-detail {
    background: #f4e9d8;
    color: #61401d;
    border-radius: 8px;
    padding: 8px 9px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.seat-list {
    display: grid;
    gap: 2px;
    margin: 7px 0 0;
    padding: 0;
    list-style: none;
}

.seat-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: baseline;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 5px;
    font-size: 13px;
}

.seat-row span, .seat-row .is-empty { color: var(--muted); }
.seat-row .is-empty { font-weight: 400; }
.seat-row strong { overflow-wrap: anywhere; }
.seat-row.is-active { background: #f9edda; }
.danger { color: #a42a2a; border-color: #edd1d1; margin-top: 13px; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (max-width: 1010px) {
    .workspace { grid-template-columns: minmax(0, 1fr) 265px; gap: 11px; }
}

@media (max-width: 810px) {
    .workspace { grid-template-columns: minmax(0, 1fr); }
    .inspector { max-width: none; }

    .map-viewport {
        --map-viewport-height: 60vh;
        --map-viewport-height: 60svh;
        overscroll-behavior: auto;
    }

    .map-controls { width: 100%; }
    input, select, textarea { font-size: 16px; }
}

@media (max-width: 450px) {
    .site-header { min-height: 64px; }
    .brand-logo { width: 88px; height: 44px; }
    .shell { padding-top: 16px; }
    .toolbar, .map-tools, .map-footer { padding-inline: 9px; }
    .toolbar .search { flex-basis: 100%; }
    .toolbar > button { flex: 1; }
    .metrics div { min-width: 66px; padding: 5px 9px; }
}

.table-name-map {
    fill: #fff;
    font-size: 11px;
    font-weight: 750;
    pointer-events: none;
}

.table-badge rect { fill: #a44706; pointer-events: none; }

.map-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.public-seating .table, .public-seating .table-core {
    cursor: pointer;
    touch-action: manipulation;
}

.public-seating .workspace { grid-template-columns: minmax(0, 1fr); }
.dpd-label { margin-top: 11px; }

.map-orientation { display: flex; align-items: center; gap: 6px; }
.map-orientation label { margin: 0; }
.map-orientation select { min-height: 44px; padding: 4px 8px; }
#map.is-vertical .table-labels { transform: rotate(-90deg); transform-origin: 0 0; }
#save-names { margin-top: 9px; width: 100%; }
#seat-save-status:not(:empty) { margin-top: 5px; }
#seat-save-status.is-error { color: #a42a2a; }

/* Pop-up detail meja RAKERNAS REI */
.seat-dialog {
    width: min(510px, calc(100% - 24px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: auto;
    color: var(--ink);
    border: 1px solid #dbe4ef;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 72px rgba(6, 20, 38, .35);
}

.seat-dialog::backdrop {
    background: rgba(9, 24, 45, .60);
    backdrop-filter: blur(3px);
}

.seat-dialog .seat-roster {
    margin: 0;
    padding: 0 22px 22px;
    border: 0;
}

.seat-dialog .seat-dialog-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 14px 12px;
    margin: 0 -22px 16px;
    padding: 18px 22px;
    color: #fff;
    background: linear-gradient(135deg, #10243e, #1b4a73);
    border-bottom: 3px solid #d6a857;
}

.seat-dialog .seat-dialog-header::before {
    content: "";
    grid-column: 1 / -1;
    justify-self: center;
    box-sizing: border-box;
    width: 152px;
    height: 58px;
    padding: 7px 12px;
    border: 1px solid #eed9ad;
    border-radius: 12px;
    background: #fff url("https://rei.or.id/rakernas2026/logo_rakernas2026.png")
        center / contain no-repeat content-box;
    background-clip: border-box;
}

.seat-dialog .seat-dialog-header h2 {
    margin: 0;
    font-size: clamp(22px, 5vw, 28px);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

#roster-dpd, #roster-summary {
    color: var(--muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.seat-dialog #roster-dpd {
    margin-top: 5px;
    color: #f4d99d;
    font-size: 13px;
    font-weight: 700;
}

.seat-dialog #close-seats {
    min-height: 44px;
    padding: 7px 13px;
    color: #fff;
    background: #ffffff14;
    border: 1px solid #ffffff55;
    border-radius: 10px;
}

.seat-dialog #close-seats:hover,
.seat-dialog #close-seats:focus-visible {
    background: #ffffff29;
}

.seat-dialog #roster-summary {
    margin: 0 0 12px;
    font-weight: 600;
}

.seat-dialog #seat-list {
    display: grid;
    gap: 6px;
    margin: 0;
}

.seat-dialog .seat-row,
.seat-dialog .seat-row + .seat-row {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid #e4ebf4;
    border-radius: 10px;
    background: #f6f8fc;
    font-size: 14px;
}

.seat-dialog .seat-row > span {
    font-weight: 600;
}

.seat-dialog .seat-row.is-active {
    border-color: #e3bd75;
    background: #fff4dc;
}

@media (max-width: 480px) {
    .seat-dialog .seat-roster {
        padding: 0 14px 14px;
    }

    .seat-dialog .seat-dialog-header {
        margin-right: -14px;
        margin-left: -14px;
        padding: 14px;
    }
}