/* ============================================================
   Scanner Monitoring HP Area Steril Lapas
   Tampilan operasional desktop 1920x1080 — tanpa scrolling
   ============================================================ */

:root {
    --navy: #102a43;
    --navy-soft: #243b53;
    --ink: #1f2933;
    --gray-700: #3e4c59;
    --gray-600: #52606d;
    --gray-500: #7b8794;
    --gray-400: #9aa5b1;
    --gray-300: #cbd2d9;
    --gray-200: #e4e7eb;
    --gray-100: #f5f7fa;
    --gray-50: #fafbfc;
    --white: #ffffff;
    --bg: #f7f8fa;

    --green: #1e7a4c;
    --green-bg: #edf7f1;
    --green-border: #bcdcc9;

    --red: #b42318;
    --red-bg: #fdf0ee;
    --red-border: #f2c7c2;

    --radius: 4px;
    --border: 1px solid var(--gray-200);
    --shadow: 0 1px 2px rgba(16, 42, 67, 0.05);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ---------- Header ---------- */

.app-header {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-logo {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--navy);
    overflow: hidden;
}

/* Dukung logo gambar (img) maupun SVG inline */
.brand-logo img,
.brand-logo svg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-divider {
    width: 1px;
    height: 34px;
    background: var(--gray-200);
    flex: 0 0 auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.brand-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.09em;
    line-height: 1;
    color: var(--navy);
    text-transform: uppercase;
}

.brand-subtitle {
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.13em;
    line-height: 1;
    color: var(--gray-500);
    text-transform: uppercase;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 22px;
    flex: 0 0 auto;
}

.clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
}

.clock-time {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.clock-date {
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.11em;
    line-height: 1;
    color: var(--gray-500);
    text-transform: uppercase;
}

.header-divider {
    width: 1px;
    height: 30px;
    background: var(--gray-200);
}

.connection {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 128px;
}

.connection-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px var(--green-bg);
    flex: 0 0 auto;
}

.connection-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--gray-600);
    text-transform: uppercase;
}

.connection.is-offline .connection-dot {
    background: var(--red);
    box-shadow: 0 0 0 3px var(--red-bg);
}

.connection.is-offline .connection-label {
    color: var(--red);
}

/* ---------- Workspace ---------- */

.workspace {
    height: calc(100vh - 72px);
    padding: 18px 30px 22px;
    display: grid;
    grid-template-rows: 72px minmax(0, 1fr) 344px;
    gap: 16px;
}

.panel {
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-heading {
    flex: 0 0 auto;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 18px;
    border-bottom: 1px solid var(--gray-200);
}

.eyebrow {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.11em;
    color: var(--gray-500);
    text-transform: uppercase;
    line-height: 1;
}

.panel-heading-meta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.09em;
    color: var(--gray-500);
    text-transform: uppercase;
    line-height: 1;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    flex: 0 0 auto;
}

/* ---------- Ringkasan ---------- */

.summary-bar {
    height: 72px;
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 0 20px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.summary-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.35;
    color: var(--gray-500);
    text-transform: uppercase;
    white-space: nowrap;
}

.summary-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.summary-divider {
    width: 1px;
    height: 34px;
    background: var(--gray-200);
    flex: 0 0 auto;
}

.summary-meta {
    margin-left: auto;
    font-size: 10.5px;
    color: var(--gray-500);
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

/* ---------- Grid utama ---------- */

.main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
}

/* ---------- Panel scan ---------- */

.scan-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.scan-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 28px 18px;
    text-align: center;
}

.scan-icon {
    color: var(--gray-400);
    margin-bottom: 10px;
}

.scan-icon svg {
    display: block;
    width: 64px;
    height: 64px;
}

.scan-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1.2;
    color: var(--navy);
    text-transform: uppercase;
}

.scan-desc {
    margin: 8px 0 20px;
    max-width: 580px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--gray-600);
}

.scan-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: min(640px, 100%);
    height: 54px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--gray-50);
    transition: border-color 0.15s ease, box-shadow 0.15s ease,
        background-color 0.15s ease;
}

.scan-input-wrap:focus-within {
    border-color: var(--navy);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(16, 42, 67, 0.08);
}

.scan-input-wrap.is-busy {
    border-color: var(--gray-400);
    background: var(--gray-100);
}

.scan-input-icon {
    flex: 0 0 auto;
    margin-left: 16px;
    color: var(--gray-500);
}

#scanInput {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--navy);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
        monospace;
    font-size: 15px;
    letter-spacing: 0.02em;
}

#scanInput::placeholder {
    color: var(--gray-400);
    letter-spacing: 0.01em;
}

#scanInput:disabled {
    cursor: wait;
}

.scan-input-hint {
    flex: 0 0 auto;
    margin-right: 12px;
    padding: 3px 7px;
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    background: var(--white);
    color: var(--gray-500);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.scan-note {
    margin: 8px 0 0;
    font-size: 10.5px;
    letter-spacing: 0.02em;
    color: var(--gray-500);
}

/* ---------- Panel hasil ---------- */

.result-panel {
    --result-accent: var(--navy);
    --result-bg: var(--gray-50);
    --result-border: var(--gray-200);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.result-panel[data-state="masuk"] {
    --result-accent: var(--green);
    --result-bg: var(--green-bg);
    --result-border: var(--green-border);
}

.result-panel[data-state="keluar"] {
    --result-accent: var(--red);
    --result-bg: var(--red-bg);
    --result-border: var(--red-border);
}

.result-panel[data-state="error"] {
    --result-accent: var(--red);
    --result-bg: var(--red-bg);
    --result-border: var(--red-border);
}

.result-body {
    flex: 1;
    min-height: 0;
    display: flex;
    padding: 18px;
}

.result-idle {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.result-idle svg {
    color: var(--gray-300);
    margin-bottom: 10px;
}

.result-idle-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
}

.result-idle-desc {
    margin: 0;
    max-width: 430px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--gray-500);
}

.result-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.result-banner {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid var(--result-border);
    border-left: 3px solid var(--result-accent);
    border-radius: 3px;
    background: var(--result-bg);
}

.result-status {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--result-accent);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1;
    text-transform: uppercase;
}

.result-status svg {
    flex: 0 0 auto;
}

.result-scan-time {
    flex: 0 0 auto;
    font-size: 11.5px;
    color: var(--gray-600);
    font-variant-numeric: tabular-nums;
}

.icon-keluar {
    display: none;
}

.result-panel[data-state="keluar"] .icon-masuk {
    display: none;
}

.result-panel[data-state="keluar"] .icon-keluar {
    display: inline-block;
}

.result-detail {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 22px;
    align-items: center;
}

.device-photo {
    flex: 0 0 176px;
    height: 216px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    background: var(--gray-100);
}

.device-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 24px;
    padding-top: 2px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.field--wide {
    grid-column: 1 / -1;
}

.field-label {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.11em;
    line-height: 1;
    color: var(--gray-500);
    text-transform: uppercase;
}

.field-value {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    word-break: break-word;
}

.field-value.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
        monospace;
    font-size: 12.5px;
    letter-spacing: 0.02em;
    color: var(--gray-700);
}

.field-value.status-change {
    color: var(--result-accent);
}

/* ---------- Hasil error ---------- */

.result-error {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    text-align: center;
}

.result-error-icon {
    color: var(--red);
}

.result-error-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--red);
    text-transform: uppercase;
}

.result-error-desc {
    margin: 0;
    max-width: 460px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--gray-600);
}

.result-error-code {
    margin-top: 4px;
    padding: 6px 10px;
    border: 1px solid var(--red-border);
    border-radius: 3px;
    background: var(--red-bg);
    color: var(--red);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
        monospace;
    font-size: 12px;
    letter-spacing: 0.02em;
    word-break: break-all;
    max-width: 100%;
}

/* ---------- Riwayat ---------- */

.history-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.history-count {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.09em;
    color: var(--gray-500);
    text-transform: uppercase;
}

.table-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
}

.history-table {
    width: 100%;
    height: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.history-table th {
    height: 38px;
    padding: 0 14px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.history-table td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    font-size: 12px;
    line-height: 1.35;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.history-table tbody tr:hover {
    background: var(--gray-50);
}

.history-table .col-time {
    width: 156px;
}

.history-table .col-owner {
    width: 260px;
}

.history-table .col-device {
    width: auto;
}

.history-table .col-activity {
    width: 132px;
}

.history-table tbody tr.history-placeholder:hover {
    background: transparent;
}

.cell-time {
    font-variant-numeric: tabular-nums;
    color: var(--gray-600);
    font-size: 11.5px;
}

.cell-owner {
    font-weight: 500;
    color: var(--ink);
}

.cell-device {
    color: var(--gray-600);
}

.history-empty {
    color: var(--gray-500) !important;
    font-size: 12px !important;
    text-align: center;
    letter-spacing: 0.02em;
}

.activity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-600);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
}

.activity::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.activity--masuk {
    color: var(--green);
}

.activity--keluar {
    color: var(--red);
}

/* ---------- Penyesuaian layar ---------- */

@media (max-height: 900px) {
    .workspace {
        grid-template-rows: 64px minmax(0, 1fr) 296px;
    }

    .scan-icon svg {
        width: 48px;
        height: 48px;
    }

    .scan-title {
        font-size: 20px;
    }

    .device-photo {
        flex-basis: 148px;
        height: 176px;
    }
}

@media (max-width: 1500px) {
    .workspace {
        padding-left: 22px;
        padding-right: 22px;
    }

    .main-grid {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    }

    .history-table .col-time {
        width: 136px;
    }

    .history-table .col-owner {
        width: 210px;
    }

    .history-table .col-activity {
        width: 112px;
    }
}
