:root {
    --navy: #172033;
    --navy-2: #23304a;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --cyan: #0ea5e9;
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
    --text: #172033;
    --muted: #6b7280;
    --line: #e5e7eb;
    --surface: #ffffff;
    --background: #f3f6fb;
    --radius: 18px;
    --shadow: 0 12px 35px rgba(23, 32, 51, .08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 90% -10%, rgba(37, 99, 235, .08), transparent 28rem),
        var(--background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.hidden {
    display: none !important;
}

.topbar {
    position: fixed;
    z-index: 20;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: stretch;
    flex-direction: column;
    width: 238px;
    padding: 28px 20px 22px;
    color: #fff;
    background: rgba(23, 32, 51, .96);
    box-shadow: 8px 0 24px rgba(15, 23, 42, .14);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 4px 26px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 1rem;
}

.brand small {
    margin-top: 2px;
    color: #aebbd2;
    font-size: .76rem;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    box-shadow: 0 10px 25px rgba(37, 99, 235, .28);
    font-weight: 900;
    letter-spacing: -.04em;
}

.topbar nav {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
    margin-top: 24px;
}

.topbar nav a {
    padding: 12px 14px;
    border-radius: 11px;
    color: #cbd5e1;
    font-size: .9rem;
    font-weight: 650;
}

.topbar nav a:hover,
.topbar nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.sidebar-note {
    margin: auto 4px 0;
    color: #8fa0bd;
    font-size: .72rem;
    line-height: 1.5;
}

.container {
    width: auto;
    max-width: 1640px;
    margin-left: 238px;
    padding: 34px 3vw 50px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.page-heading.compact {
    margin-bottom: 20px;
}

.page-heading h1 {
    margin: 5px 0 8px;
    font-size: clamp(1.65rem, 2.6vw, 2.5rem);
    line-height: 1.15;
    letter-spacing: -.035em;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--blue) !important;
    font-size: .75rem;
    font-weight: 850;
    letter-spacing: .14em;
}

.system-pill,
.success-pill,
.protected-pill,
.station-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    color: #15803d;
    background: #f0fdf4;
    font-size: .78rem;
    font-weight: 750;
    white-space: nowrap;
}

.station-pill {
    border-color: #bfdbfe;
    color: #1d4ed8;
    background: #eff6ff;
}

.protected-pill {
    border-color: #fde68a;
    color: #a16207;
    background: #fffbeb;
}

.heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sound-active {
    border-color: #86efac !important;
    color: #15803d !important;
    background: #f0fdf4 !important;
}

.system-pill.disk-warning,
.system-pill.disk-critical,
.system-pill.disk-stop {
    border-color: #fed7aa;
    color: #c2410c;
    background: #fff7ed;
}

.system-pill.disk-critical,
.system-pill.disk-stop {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fef2f2;
}

.system-pill.disk-warning span,
.system-pill.disk-critical span,
.system-pill.disk-stop span {
    background: #f97316;
    box-shadow: 0 0 0 5px rgba(249, 115, 22, .12);
}

.system-pill.disk-critical span,
.system-pill.disk-stop span {
    background: #ef4444;
    box-shadow: 0 0 0 5px rgba(239, 68, 68, .12);
}

.mode-banner,
.disk-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 13px 16px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    color: #1e40af;
    background: #eff6ff;
    font-size: .84rem;
}

.disk-alert.warning {
    border-color: #fde68a;
    color: #a16207;
    background: #fffbeb;
}

.disk-alert.critical,
.disk-alert.stop {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fef2f2;
}

.system-pill span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 5px rgba(34, 197, 94, .12);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    padding: 17px 19px;
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 15px;
    background: rgba(255, 255, 255, .85);
    box-shadow: 0 5px 20px rgba(23, 32, 51, .04);
}

.stat-card span,
.stat-card small,
.stat-card strong {
    display: block;
}

.stat-card span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 650;
}

.stat-card strong {
    margin: 4px 0 1px;
    font-size: 1.45rem;
    letter-spacing: -.03em;
}

.stat-card small {
    color: #94a3b8;
    font-size: .72rem;
}

.panel {
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.recorder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(340px, .75fr);
    gap: 18px;
}

.camera-panel,
.workflow-panel,
.search-panel,
.table-panel,
.detail-card,
.video-result {
    padding: 21px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.panel-head h2,
.workflow-panel h2,
.detail-card h2 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.panel-head p,
.workflow-panel > p {
    margin: 0;
    font-size: .84rem;
}

.panel-head select {
    max-width: 280px;
    padding: 9px 32px 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: #fff;
}

.video-stage {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    background: #0f172a;
}

.video-stage video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-placeholder,
.countdown-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    place-items: center;
    text-align: center;
}

.camera-placeholder {
    color: #cbd5e1;
    background: radial-gradient(circle, #26344f, #101827 72%);
}

.camera-placeholder span {
    margin-bottom: 10px;
    color: #60a5fa;
    font-size: 2.5rem;
}

.camera-placeholder small {
    margin-top: 4px;
    color: #7f8da5;
}

.countdown-overlay {
    color: #fff;
    background: rgba(15, 23, 42, .7);
    backdrop-filter: blur(4px);
}

.countdown-overlay small {
    font-size: .75rem;
    font-weight: 850;
    letter-spacing: .16em;
}

.countdown-overlay strong {
    font-size: clamp(5rem, 12vw, 9rem);
    line-height: 1;
    text-shadow: 0 10px 35px rgba(0, 0, 0, .35);
}

.recording-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border-radius: 9px;
    color: #fff;
    background: rgba(15, 23, 42, .8);
    font-size: .78rem;
    font-weight: 800;
    backdrop-filter: blur(8px);
}

.recording-metadata-overlay {
    position: absolute;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 4;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    pointer-events: none;
}

.recording-metadata-overlay span {
    max-width: 58%;
    overflow: hidden;
    padding: 7px 10px;
    border-radius: 7px;
    color: #fff;
    background: rgba(0, 0, 0, .68);
    font-size: clamp(.7rem, 1.4vw, .9rem);
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
    white-space: nowrap;
}

.recording-metadata-overlay span:last-child {
    flex: 0 0 auto;
    max-width: none;
}

.scanner-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid rgba(134, 239, 172, .32);
    border-radius: 9px;
    color: #dcfce7;
    background: rgba(20, 83, 45, .82);
    font-size: .73rem;
    font-weight: 800;
    backdrop-filter: blur(8px);
}

.barcode-guide.during-recording {
    background: transparent;
}

.barcode-guide.during-recording .barcode-frame {
    opacity: .62;
}

.barcode-guide.during-recording > strong,
.barcode-guide.during-recording > small {
    display: none;
}

.scanner-badge span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 5px rgba(74, 222, 128, .17);
    animation: pulse 1.2s infinite;
}

.barcode-guide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    background: radial-gradient(ellipse at center, transparent 20%, rgba(15, 23, 42, .3) 85%);
    pointer-events: none;
}

.barcode-frame {
    position: relative;
    overflow: hidden;
    width: min(45%, 360px);
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, .88);
    border-radius: 13px;
    box-shadow:
        0 0 0 999px rgba(15, 23, 42, .13),
        0 0 26px rgba(14, 165, 233, .2);
}

.barcode-frame::before,
.barcode-frame::after {
    position: absolute;
    z-index: 2;
    width: 30px;
    height: 30px;
    border-color: #38bdf8;
    content: "";
}

.barcode-frame::before {
    top: -2px;
    left: -2px;
    border-top: 5px solid;
    border-left: 5px solid;
    border-radius: 12px 0 0;
}

.barcode-frame::after {
    right: -2px;
    bottom: -2px;
    border-right: 5px solid;
    border-bottom: 5px solid;
    border-radius: 0 0 12px;
}

.barcode-frame span {
    position: absolute;
    top: 7%;
    left: 4%;
    width: 92%;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, #38bdf8 12%, #fff 50%, #38bdf8 88%, transparent);
    box-shadow: 0 0 12px #38bdf8;
    animation: scan-line 1.8s ease-in-out infinite alternate;
}

.barcode-guide > strong {
    margin-top: 17px;
    padding: 7px 11px;
    border-radius: 8px;
    background: rgba(15, 23, 42, .66);
    font-size: .84rem;
}

.barcode-guide > small {
    margin-top: 6px;
    color: #dbeafe;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}

@keyframes scan-line {
    from { top: 7%; }
    to { top: 93%; }
}

.recording-badge span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 5px rgba(239, 68, 68, .18);
    animation: pulse 1s infinite;
}

.recording-badge b {
    min-width: 43px;
    font-variant-numeric: tabular-nums;
}

@keyframes pulse {
    50% { opacity: .35; }
}

.recording-progress,
.mini-progress {
    overflow: hidden;
    height: 7px;
    margin-top: 13px;
    border-radius: 999px;
    background: #e9eef7;
}

.recording-progress div {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ef4444, #f97316);
    transition: width .2s linear;
}

.step-badge {
    display: inline-block;
    margin-bottom: 10px;
    padding: 6px 8px;
    border-radius: 7px;
    color: var(--blue);
    background: #eff6ff;
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .1em;
}

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

.workflow-panel form {
    margin-top: 20px;
}

label {
    display: block;
    margin-bottom: 7px;
    font-size: .8rem;
    font-weight: 750;
}

.scan-input {
    display: flex;
    align-items: center;
    overflow: hidden;
    min-height: 52px;
    border: 2px solid #dbe3f1;
    border-radius: 12px;
    background: #fff;
    transition: border .15s, box-shadow .15s;
}

.scan-input:focus-within {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}

.scan-input > span {
    padding-left: 14px;
    color: var(--blue);
    font-size: 1.2rem;
}

.scan-input input {
    width: 100%;
    min-width: 0;
    padding: 13px 14px;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font-weight: 700;
    text-transform: uppercase;
}

.scan-input input::placeholder {
    color: #9aa6b7;
    font-weight: 500;
    text-transform: none;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: .86rem;
    font-weight: 750;
    transition: transform .12s, background .12s, box-shadow .12s;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: .55;
    transform: none;
}

.button.primary {
    color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    box-shadow: 0 8px 20px rgba(37, 99, 235, .2);
}

.button.secondary {
    border-color: #dbe3f1;
    color: #1e3a5f;
    background: #f8fafc;
}

.button.ghost {
    color: var(--muted);
    background: transparent;
}

.button.danger-outline {
    border-color: #fecaca;
    color: var(--red);
    background: #fff;
}

.button.success-outline {
    border-color: #bbf7d0;
    color: #15803d;
    background: #f0fdf4;
}

.button.warning-outline {
    border-color: #fde68a;
    color: #a16207;
    background: #fffbeb;
}

.button.full {
    width: 100%;
    margin-top: 11px;
}

.button.mini {
    min-height: 34px;
    padding: 6px 11px;
    font-size: .76rem;
}

.status-box {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 18px;
    padding: 13px;
    border: 1px solid #dbe3f1;
    border-radius: 12px;
    background: #f8fafc;
}

.status-box > span {
    display: grid;
    flex: 0 0 26px;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    background: #64748b;
    font-weight: 900;
}

.status-box strong {
    display: block;
    margin-bottom: 2px;
    font-size: .84rem;
}

.status-box p {
    margin: 0;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.45;
}

.status-box.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.status-box.success > span,
.status-box.idle > span {
    background: var(--green);
}

.status-box.working {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.status-box.working > span {
    background: var(--blue);
    animation: pulse 1s infinite;
}

.status-box.warning {
    border-color: #fde68a;
    background: #fffbeb;
}

.status-box.warning > span {
    background: var(--amber);
}

.status-box.danger {
    border-color: #fecaca;
    background: #fef2f2;
}

.status-box.danger > span {
    background: var(--red);
}

.upload-box {
    margin-top: 12px;
    padding: 12px;
    border-radius: 11px;
    background: #eff6ff;
}

.upload-box > div:first-child {
    display: flex;
    justify-content: space-between;
    font-size: .77rem;
    font-weight: 750;
}

.mini-progress {
    height: 6px;
    margin-top: 8px;
    background: #dbeafe;
}

.mini-progress div {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
    transition: width .2s;
}

.action-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
}

.tips {
    margin-top: 20px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
}

.tips strong {
    font-size: .78rem;
}

.tips ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.65;
}

.search-panel {
    margin-bottom: 18px;
}

.search-form,
.table-tools {
    display: flex;
    gap: 10px;
}

.search-form .scan-input {
    flex: 1;
}

.result-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(290px, .65fr);
    gap: 18px;
}

.video-result video {
    display: block;
    width: 100%;
    max-height: 70vh;
    border-radius: 13px;
    background: #0f172a;
}

.detail-card dl,
.config-list {
    margin: 17px 0 0;
}

.detail-card dl div,
.config-list div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.detail-card dt,
.config-list dt {
    color: var(--muted);
    font-size: .78rem;
}

.detail-card dd,
.config-list dd {
    margin: 0;
    text-align: right;
    font-size: .8rem;
    font-weight: 750;
    word-break: break-word;
}

.directory-status {
    min-height: 18px;
    margin: 10px 2px 0;
    font-size: .73rem;
    line-height: 1.45;
}

.success-text {
    color: var(--green);
}

.danger-text {
    color: var(--red);
}

.last-preview {
    display: grid;
    grid-template-columns: minmax(220px, .55fr) minmax(0, 1.45fr);
    gap: 22px;
    margin-top: 18px;
    padding: 20px;
}

.last-preview-copy {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
}

.last-preview h2 {
    margin: 5px 0;
    word-break: break-word;
}

.last-preview-copy > p {
    margin-top: 0;
}

.last-preview video {
    width: 100%;
    max-height: 360px;
    border-radius: 13px;
    background: #0f172a;
}

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

.settings-card {
    padding: 24px;
}

.settings-card h2 {
    margin: 0 0 7px;
}

.settings-card form {
    margin-top: 20px;
}

.settings-card label {
    margin-top: 13px;
}

.text-control {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #dbe3f1;
    border-radius: 10px;
    outline: none;
    color: var(--text);
    background: #fff;
}

.text-control:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}

.disk-meter {
    overflow: hidden;
    height: 12px;
    margin: 20px 0 4px;
    border-radius: 999px;
    background: #e2e8f0;
}

.disk-meter div {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #0ea5e9);
}

.pin-dialog {
    width: min(430px, calc(100vw - 30px));
    padding: 0;
    border: 0;
    border-radius: 18px;
    color: var(--text);
    box-shadow: 0 30px 90px rgba(15, 23, 42, .35);
}

.pin-dialog::backdrop {
    background: rgba(15, 23, 42, .66);
    backdrop-filter: blur(3px);
}

.pin-dialog form {
    position: relative;
    padding: 28px;
}

.pin-dialog h2 {
    margin: 5px 0 7px;
}

.pin-dialog label {
    margin-top: 19px;
}

.dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    color: #64748b;
    background: #f1f5f9;
    cursor: pointer;
    font-size: 1.3rem;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
}

.empty-state > span {
    display: block;
    color: #94a3b8;
    font-size: 3rem;
}

.empty-state h2 {
    margin: 6px 0;
}

.empty-state p {
    margin: 0 auto 20px;
    color: var(--muted);
}

.table-tools {
    margin-bottom: 17px;
}

.small-input {
    min-height: 44px;
    width: min(420px, 100%);
    border-width: 1px;
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: .8rem;
    white-space: nowrap;
}

th {
    color: var(--muted);
    background: #f8fafc;
    font-size: .72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.align-right {
    text-align: right;
}

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

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 18px;
    font-size: .8rem;
}

.pagination a {
    color: var(--blue);
    font-weight: 750;
}

.footer {
    margin-left: 238px;
    padding: 25px 3vw 30px;
    color: #94a3b8;
    text-align: center;
    font-size: .75rem;
}

.setup-body {
    display: grid;
    place-items: center;
    padding: 30px;
}

.setup-card {
    width: min(470px, 100%);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow);
}

.setup-card .brand-mark {
    margin-bottom: 20px;
}

.setup-card h1 {
    margin: 0 0 8px;
    letter-spacing: -.03em;
}

.setup-card > p {
    margin: 0 0 20px;
}

.alert {
    margin: 18px 0;
    padding: 13px;
    border: 1px solid;
    border-radius: 11px;
    font-size: .82rem;
    line-height: 1.5;
}

.alert.success {
    border-color: #bbf7d0;
    color: #166534;
    background: #f0fdf4;
}

.alert.danger {
    border-color: #fecaca;
    color: #991b1b;
    background: #fef2f2;
}

.alert.warning {
    border-color: #fde68a;
    color: #a16207;
    background: #fffbeb;
}

.small {
    font-size: .75rem;
}

@media (max-width: 980px) {
    .recorder-layout,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 760px) {
    .topbar {
        position: sticky;
        bottom: auto;
        width: 100%;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding-right: 3vw;
        padding-left: 3vw;
        padding-top: 14px;
        padding-bottom: 12px;
        box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
    }

    .brand {
        width: 100%;
        padding: 0 0 12px;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        font-size: .9rem;
    }

    .topbar nav {
        align-items: center;
        flex-direction: row;
        width: 100%;
        margin-top: 0;
    }

    .topbar nav a {
        flex: 1;
        padding: 8px;
        text-align: center;
    }

    .container {
        width: min(94vw, 100%);
        max-width: none;
        margin: 0 auto;
        padding-right: 0;
        padding-left: 0;
        padding-top: 24px;
    }

    .sidebar-note {
        display: none;
    }

    .footer {
        margin-left: 0;
        padding-right: 3vw;
        padding-left: 3vw;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .heading-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .last-preview {
        grid-template-columns: 1fr;
    }

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

    .camera-panel,
    .workflow-panel,
    .search-panel,
    .table-panel,
    .detail-card,
    .video-result {
        padding: 15px;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-head select {
        width: 100%;
        max-width: none;
    }

    .search-form,
    .table-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .small-input {
        width: 100%;
    }
}


/* Panel unboxing retur */
.return-station-pill {
    border-color: #fdba74;
    color: #9a3412;
    background: #fff7ed;
}

.return-primary {
    background: linear-gradient(135deg, #ea580c, #c2410c);
}

.return-primary:hover {
    filter: brightness(1.04);
}

.return-step {
    color: #c2410c;
    background: #ffedd5;
}

.return-camera-panel .recording-progress > div {
    background: linear-gradient(90deg, #f97316, #ea580c);
}

.return-workflow-panel label {
    display: block;
    margin: 14px 0 7px;
    font-size: .78rem;
    font-weight: 750;
    color: #334155;
}

.return-workflow-panel .text-control {
    width: 100%;
}

.return-notes {
    min-height: 88px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.45;
}

.return-note-value {
    max-width: 340px;
    white-space: normal;
    line-height: 1.5;
}

.return-video-result .panel-head {
    border-bottom-color: #fed7aa;
}

@media (max-width: 760px) {
    .topbar nav {
        flex-wrap: wrap;
    }

    .topbar nav a {
        min-width: 30%;
    }
}


/* iPhone / PWA */
body {
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
}
.remote-url {
    display: grid;
    gap: 6px;
    margin: 16px 0;
    padding: 12px;
    border-radius: 12px;
    background: #f8fafc;
}
.remote-url small { color: var(--muted); font-weight: 700; }
.remote-url code { overflow-wrap: anywhere; color: #1d4ed8; font-size: .78rem; }
.iphone-steps { margin: 12px 0 0; padding-left: 22px; color: #334155; line-height: 1.75; }
.ios-install-hint {
    position: fixed;
    z-index: 80;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px));
    left: max(12px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    color: #172033;
    background: rgba(255,255,255,.96);
    box-shadow: 0 18px 45px rgba(15,23,42,.2);
    backdrop-filter: blur(18px);
}
.ios-install-hint div { display: grid; gap: 3px; }
.ios-install-hint strong { font-size: .85rem; }
.ios-install-hint span { color: var(--muted); font-size: .72rem; line-height: 1.4; }
.ios-install-hint button { border: 0; border-radius: 50%; width: 30px; height: 30px; color: #475569; background: #f1f5f9; font-size: 1.25rem; }

@media (max-width: 760px) {
    body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
    .topbar {
        position: sticky;
        top: 0;
        padding-top: calc(10px + env(safe-area-inset-top));
        padding-bottom: 8px;
    }
    .topbar .brand { border-bottom: 0; padding-bottom: 0; }
    .topbar .brand small { display: none; }
    .topbar nav {
        position: fixed;
        z-index: 60;
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        width: 100%;
        margin: 0;
        padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        background: rgba(23,32,51,.98);
        box-shadow: 0 -8px 24px rgba(15,23,42,.16);
        -webkit-overflow-scrolling: touch;
    }
    .topbar nav a {
        flex: 0 0 auto;
        min-width: 82px !important;
        padding: 9px 10px;
        font-size: .76rem;
        white-space: nowrap;
    }
    .video-stage { min-height: 42vh; }
    .camera-panel .video-stage video { max-height: 58vh; }
    .iphone-grid { grid-template-columns: 1fr; }
}


/* Terminal 3 - HP */
.terminal3-grid { align-items: start; }
.terminal3-main-card { text-align: center; }
.terminal3-phone-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 14px;
    border-radius: 24px;
    color: #fff;
    background: #172033;
    font-size: 1.35rem;
    font-weight: 900;
    box-shadow: 0 14px 30px rgba(15, 23, 42, .18);
}
.terminal3-open { margin-top: 14px; }
.terminal-mobile .stats-grid { display: none; }
.terminal-mobile .page-heading { margin-bottom: 12px; }
.terminal-mobile .page-heading .heading-actions .system-pill { display: none; }
.terminal-mobile .recorder-layout { gap: 12px; }
.terminal-mobile .camera-panel { order: 1; }
.terminal-mobile .workflow-panel { order: 2; }
.terminal-mobile .video-stage { min-height: 48vh; }
.terminal-mobile .barcode-frame { width: min(68vw, 290px); height: min(68vw, 290px); }
.terminal-mobile .camera-panel .panel-head select { max-width: 46%; }

@media (max-width: 760px) {
    .terminal-mobile .container { padding: 10px 10px 90px; }
    .terminal-mobile .page-heading h1 { font-size: 1.35rem; }
    .terminal-mobile .page-heading p { font-size: .82rem; }
    .terminal-mobile .heading-actions { display: none; }
    .terminal-mobile .video-stage { min-height: 52vh; border-radius: 18px; }
    .terminal-mobile .workflow-panel { padding: 14px; }
    .terminal-mobile .tips { display: none; }
    .terminal-mobile #lastPreviewPanel { display: none; }
    .terminal-mobile .recording-metadata-overlay { font-size: .66rem; }
}

/* Multi-Terminal HP */
.mobile-terminal-form { display: grid; gap: 10px; margin-top: 18px; text-align: left; }
.mobile-terminal-form .button { margin-top: 2px; }
.mobile-terminal-form + .alert { margin-top: 12px; }

/* Terminal HP v2 - tampilan sederhana untuk operator mobile */
.mobile-terminal-hero,
.mobile-terminal-nav,
.mobile-scan-caption,
.mobile-camera-tools,
.mobile-lens-switch {
    display: none;
}

@media (max-width: 760px) {
    body.terminal-mobile {
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
        background: #eef2f7;
    }

    .terminal-mobile .topbar,
    .terminal-mobile .page-heading,
    .terminal-mobile .footer {
        display: none;
    }

    .terminal-mobile .container {
        width: 100%;
        margin: 0;
        padding: calc(10px + env(safe-area-inset-top)) 10px calc(94px + env(safe-area-inset-bottom));
    }

    .mobile-terminal-hero {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 0 2px 10px;
        padding: 4px 2px;
    }

    .mobile-terminal-id {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .mobile-terminal-id div {
        display: grid;
        gap: 1px;
        min-width: 0;
    }

    .mobile-terminal-id small {
        color: #64748b;
        font-size: .64rem;
        font-weight: 850;
        letter-spacing: .12em;
    }

    .mobile-terminal-id strong {
        overflow: hidden;
        color: #111827;
        font-size: 1.05rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-live-dot {
        width: 10px;
        height: 10px;
        border-radius: 999px;
        background: #22c55e;
        box-shadow: 0 0 0 5px rgba(34,197,94,.12);
    }

    .mobile-terminal-settings {
        display: grid;
        flex: 0 0 42px;
        place-items: center;
        width: 42px;
        height: 42px;
        border: 1px solid #dbe3ee;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(15,23,42,.07);
        font-size: 1rem;
    }

    .terminal-mobile .recorder-layout {
        display: block;
    }

    .terminal-mobile .camera-panel {
        padding: 10px;
        border: 0;
        border-radius: 22px;
        background: #fff;
        box-shadow: 0 10px 30px rgba(15,23,42,.08);
    }

    .terminal-mobile .camera-panel .panel-head {
        align-items: center;
        flex-direction: row;
        gap: 8px;
        margin: 0 2px 9px;
    }

    .terminal-mobile .camera-panel .panel-head > div:first-child {
        min-width: 0;
    }

    .terminal-mobile .camera-panel .panel-head h2 {
        margin: 0;
        font-size: .9rem;
    }

    .terminal-mobile .camera-panel .panel-head p {
        overflow: hidden;
        max-width: 43vw;
        color: #64748b;
        font-size: .64rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-camera-tools {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 7px;
        margin-left: auto;
    }

    .mobile-lens-switch {
        display: inline-flex;
        padding: 3px;
        border-radius: 999px;
        background: #eef2f7;
    }

    .mobile-lens-switch button {
        min-width: 47px;
        height: 34px;
        padding: 0 10px;
        border: 0;
        border-radius: 999px;
        color: #475569;
        background: transparent;
        font-size: .78rem;
        font-weight: 850;
    }

    .mobile-lens-switch button.active {
        color: #fff;
        background: #111827;
        box-shadow: 0 3px 9px rgba(15,23,42,.2);
    }

    .mobile-lens-switch button:disabled {
        color: #a8b0bc;
        opacity: .65;
    }

    .terminal-mobile .camera-panel .panel-head select {
        width: 38px;
        max-width: 38px;
        height: 34px;
        padding: 0;
        border: 1px solid #dbe3ee;
        border-radius: 999px;
        color: transparent;
        background-color: #fff;
        background-position: center;
        cursor: pointer;
    }

    .terminal-mobile .video-stage {
        min-height: 0;
        height: auto;
        aspect-ratio: 4 / 3;
        border-radius: 17px;
        background: #0b1020;
    }

    .terminal-mobile .video-stage video {
        max-height: none;
        object-fit: cover;
    }

    .terminal-mobile .barcode-frame {
        width: min(58vw, 250px);
        height: min(58vw, 250px);
        border-width: 2px;
        border-radius: 18px;
    }

    .terminal-mobile .barcode-guide > strong {
        margin-top: 14px;
        font-size: .8rem;
    }

    .terminal-mobile .barcode-guide > small {
        margin-top: 4px;
        font-size: .66rem;
    }

    .terminal-mobile .scanner-badge {
        top: 10px;
        right: 10px;
        padding: 7px 9px;
        border-radius: 999px;
        font-size: .62rem;
    }

    .terminal-mobile .recording-badge {
        top: 10px;
        left: 10px;
        padding: 7px 10px;
        border-radius: 999px;
        font-size: .7rem;
    }

    .mobile-scan-caption {
        position: absolute;
        z-index: 4;
        right: 10px;
        bottom: 10px;
        left: 10px;
        display: block;
        overflow: hidden;
        padding: 7px 10px;
        border-radius: 999px;
        color: rgba(255,255,255,.9);
        background: rgba(15,23,42,.58);
        font-size: .62rem;
        font-weight: 700;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
        pointer-events: none;
        backdrop-filter: blur(8px);
    }

    .terminal-mobile .recording-metadata-overlay {
        right: 10px;
        bottom: 44px;
        left: 10px;
    }

    .terminal-mobile .recording-progress {
        height: 5px;
        margin-top: 7px;
        border-radius: 99px;
    }

    .terminal-mobile .workflow-panel {
        margin-top: 10px;
        padding: 12px;
        border: 0;
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 8px 24px rgba(15,23,42,.06);
    }

    .terminal-mobile .workflow-panel > .step-badge,
    .terminal-mobile .workflow-panel > h2,
    .terminal-mobile .workflow-panel > p {
        display: none;
    }

    .terminal-mobile .status-box {
        order: -1;
        margin-top: 0;
        padding: 11px 12px;
        border-radius: 14px;
    }

    .terminal-mobile .status-box strong {
        font-size: .82rem;
    }

    .terminal-mobile .status-box p {
        font-size: .69rem;
    }

    .mobile-manual-entry {
        margin-top: 10px;
        border-top: 1px solid #edf1f5;
    }

    .mobile-manual-entry summary {
        padding: 10px 2px 3px;
        color: #64748b;
        cursor: pointer;
        font-size: .72rem;
        font-weight: 750;
        list-style-position: inside;
    }

    .terminal-mobile .mobile-manual-entry form {
        margin-top: 8px;
    }

    .terminal-mobile .mobile-manual-entry label {
        display: none;
    }

    .terminal-mobile .scan-input {
        min-height: 46px;
    }

    .terminal-mobile #processButton {
        min-height: 44px;
        margin-top: 8px;
    }

    .terminal-mobile .upload-box {
        margin-top: 9px;
    }

    .terminal-mobile .action-row {
        grid-template-columns: 1fr 1fr;
        margin-top: 9px;
    }

    .terminal-mobile .action-row .button {
        min-height: 48px;
        border-radius: 13px;
        font-size: .78rem;
    }

    .terminal-mobile #lastVideoButton {
        grid-column: 1 / -1;
    }

    .mobile-terminal-nav {
        position: fixed;
        z-index: 90;
        right: 10px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        left: 10px;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        padding: 6px;
        border: 1px solid rgba(226,232,240,.92);
        border-radius: 20px;
        background: rgba(255,255,255,.94);
        box-shadow: 0 12px 32px rgba(15,23,42,.16);
        backdrop-filter: blur(16px);
    }

    .mobile-terminal-nav a {
        display: grid;
        place-items: center;
        gap: 2px;
        min-height: 48px;
        border-radius: 15px;
        color: #64748b;
        font-size: .66rem;
        font-weight: 750;
    }

    .mobile-terminal-nav a span {
        font-size: 1rem;
        line-height: 1;
    }

    .mobile-terminal-nav a.active {
        color: #fff;
        background: #172033;
    }

    .terminal-mobile .tips,
    .terminal-mobile #lastPreviewPanel,
    .terminal-mobile .stats-grid {
        display: none !important;
    }
}


/* Safe Upload - Station 1/2 */
.safe-upload-panel {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #d7e4da;
    border-radius: 16px;
    background: #f8fbf8;
}
.safe-upload-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.safe-upload-head > div { display: grid; gap: 3px; }
.safe-upload-head strong { font-size: 13px; letter-spacing: .08em; }
.safe-upload-head small { color: #66716a; line-height: 1.35; }
.safe-upload-ready {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 999px;
    background: #e7f6eb;
    color: #26713a;
    font-size: 11px;
    font-weight: 800;
}
.safe-upload-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.safe-upload-stats > div {
    padding: 10px 8px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5ebe7;
    text-align: center;
}
.safe-upload-stats span { display: block; font-size: 10px; color: #758079; letter-spacing: .04em; }
.safe-upload-stats b { display: block; margin-top: 3px; font-size: 20px; }
.safe-upload-stats > div:nth-child(2) b { color: #a56b00; }
.safe-upload-stats > div:nth-child(3) b { color: #b53030; }
.safe-upload-panel .warning-outline {
    margin-top: 10px;
    border-color: #d18a00;
    color: #8a5b00;
    background: #fff8e8;
}
.safe-upload-panel.has-failure {
    border-color: #e2b3b3;
    background: #fff8f8;
}

.safe-upload-stats-six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.safe-upload-stats-six > div:nth-child(2) b,
.safe-upload-stats-six > div:nth-child(3) b,
.safe-upload-stats-six > div:nth-child(4) b { color: #a56b00; }
.safe-upload-stats-six > div:nth-child(5) b { color: #26713a; }
.safe-upload-stats-six > div:nth-child(6) b { color: #b53030; }
