:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-subtle: #fafafa;
    --border: #d4d4d8;
    --border-light: #e4e4e7;
    --text: #18181b;
    --text-secondary: #52525b;
    --muted: #71717a;
    --dark: #0d264f;
    --primary: #0d264f;
    --primary-hover: #16386e;
    --primary-soft: #eef3fb;
    --accent: #f47b34;
    --accent-soft: #fff4ed;
    --success: #15803d;
    --success-bg: #dcfce7;
    --success-border: #86efac;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-bg: #fef2f2;
    --danger-border: #fca5a5;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.01em;
}

/* Topbar */
.topbar {
    background: var(--dark);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 2px solid var(--accent);
    box-shadow: 0 4px 16px rgba(13, 38, 79, 0.16);
}

.topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}

.topbar-logo-wide {
    height: 30px;
    width: auto;
    display: block;
    object-fit: contain;
}

.topbar-app-tag {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: rgba(244, 123, 52, 0.22);
    border: 1px solid rgba(244, 123, 52, 0.45);
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.brand h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.subtitle {
    margin: 0;
    font-size: 12px;
    color: #a1a1aa;
}

.tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.07);
    padding: 3px;
    border-radius: 9px;
}

.tab-btn {
    border: none;
    background: transparent;
    color: #a1a1aa;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    background: #fff;
    color: var(--dark);
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #d4d4d8;
}

.sound-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
}

.clock {
    font-family: ui-monospace, monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.btn-topbar-logout {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-weight: 600;
}

.btn-topbar-logout:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    touch-action: manipulation;
}

.hamburger-drawer {
    background: #0a1e40;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hamburger-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #e2e8f0;
    font-size: 13px;
}

.hamburger-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hamburger-link {
    width: 100%;
    text-align: left;
    padding: 11px 12px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.hamburger-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

/* Container */
.container {
    max-width: 1440px;
    margin: 16px auto 90px;
    padding: 0 20px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-accepted .stat-value {
    color: var(--success);
}

.stat-rejected .stat-value {
    color: var(--danger);
}

/* Views & Cards */
.tab-view {
    display: none;
}

.tab-view.active {
    display: block;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.card-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.step-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--dark);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Brand Selector Grid */
.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.brand-pill {
    border: 1.5px solid var(--border-light);
    background: var(--surface-subtle);
    color: var(--text);
    border-radius: 10px;
    padding: 11px 12px;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.brand-pill:hover {
    border-color: var(--border);
    background: #fff;
}

.brand-pill.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.15);
}

.brand-pill-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.brand-pill-code {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    font-family: ui-monospace, monospace;
}

.brand-pill.selected .brand-pill-name {
    color: var(--primary);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

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

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.req {
    color: var(--danger);
}

input[type="text"],
input[type="search"],
input[type="date"],
select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 15px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 44px;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.input-lg {
    font-size: 15px !important;
    font-weight: 600;
}

.hint {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}

.input-with-action {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.scanner-bar {
    margin-bottom: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 9px 14px;
    min-height: 40px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    min-height: 34px;
    padding: 6px 11px;
    font-size: 12px;
}

.btn-xl {
    min-height: 48px;
    padding: 12px 22px;
    font-size: 15px;
}

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

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

.btn-dark {
    background: var(--dark);
    color: #fff;
}

.btn-dark:hover {
    background: #27272a;
}

.btn-secondary {
    background: #e4e4e7;
    color: var(--text);
}

.btn-secondary:hover {
    background: #d4d4d8;
}

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

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

.btn-ghost {
    background: #fff;
    color: var(--text-secondary);
    border-color: var(--border-light);
}

.btn-ghost:hover {
    background: var(--surface-subtle);
    color: var(--text);
}

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

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

.btn-success-outline {
    background: #fff;
    color: var(--success);
    border-color: var(--success-border);
}

.btn-success-outline:hover {
    background: var(--success-bg);
}

.file-label {
    cursor: pointer;
}

/* Items List */
.empty-state {
    text-align: center;
    padding: 24px 14px;
    color: var(--muted);
    background: var(--surface-subtle);
    border: 1px dashed var(--border);
    border-radius: 10px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-state[hidden] {
    display: none;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-card {
    border: 1.5px solid var(--border-light);
    border-radius: 10px;
    padding: 12px;
    background: #fff;
}

.item-card.is-rejected {
    border-color: var(--danger-border);
    background: var(--danger-bg);
}

.item-card.flash-new {
    animation: flashHighlight 0.55s ease;
}

@keyframes flashHighlight {
    0% { box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.3); }
    100% { box-shadow: none; }
}

.item-row-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.item-index {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #f4f4f5;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-barcode {
    font-size: 15px;
    font-weight: 700;
    margin-right: auto;
    word-break: break-all;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.qty-control button {
    border: none;
    background: var(--surface-subtle);
    width: 34px;
    height: 34px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text);
}

.qty-control button:hover {
    background: #e4e4e7;
}

.qty-control span {
    min-width: 32px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
}

.status-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.status-toggle button {
    border: none;
    background: transparent;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    color: var(--muted);
    min-height: 34px;
}

.status-toggle button.active-accept {
    background: var(--success);
    color: #fff;
}

.status-toggle button.active-reject {
    background: var(--danger);
    color: #fff;
}

.btn-remove-item {
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-item:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* Rejection Panel */
.item-reject-panel {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--danger-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reason-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.reason-chip {
    border: 1px solid var(--danger-border);
    background: #fff;
    color: #991b1b;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.reason-chip.active,
.reason-chip:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.reject-controls-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.reject-controls-row input {
    flex: 1;
    min-width: 200px;
}

.photo-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.photo-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.thumb-wrap {
    position: relative;
    width: 84px;
    height: 84px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
}

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

.thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(24, 24, 27, 0.85);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

/* General Photo Box */
.general-photo-box {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--danger-border);
    background: var(--danger-bg);
    border-radius: 10px;
}

.general-photo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.general-photo-header h3 {
    margin: 0 0 2px;
    font-size: 14px;
    color: #991b1b;
}

/* Submit bar */
.submit-bar {
    position: sticky;
    bottom: 12px;
    background: var(--dark);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 20;
}

.submit-summary {
    font-size: 13px;
    font-weight: 600;
    color: #e4e4e7;
}

/* Brand Admin Form */
.brand-form {
    display: grid;
    grid-template-columns: 1.5fr 1fr 2fr auto;
    gap: 12px;
    align-items: end;
}

.brand-form-actions {
    display: flex;
    gap: 8px;
}

/* Return Session Banner & Cargo List */
.session-active-card {
    border-left: 4px solid var(--primary);
    background: #f8fafc;
}

.session-banner-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.session-banner-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.session-banner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.session-start-bar {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.session-cargos-wrap {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.session-cargos-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 8px;
}

.session-cargos-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.session-cargo-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    flex-wrap: wrap;
}

.session-cargo-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-success {
    background: #16a34a;
    color: #fff;
    border: 1px solid #16a34a;
}

.btn-success:hover {
    background: #15803d;
}

/* History Grouped by Session */
.history-groups-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 12px;
}

.history-group-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-group-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.history-group-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.history-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.history-group-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.history-group-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.modal-cargo-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
}

.modal-cargo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.modal-cargo-body {
    padding: 10px 12px;
}

.row-rejected {
    background: #fef2f2;
    color: #991b1b;
}

/* Login Screen */
[hidden] {
    display: none !important;
}

.login-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background:
        radial-gradient(circle at 18% 18%, rgba(244, 123, 52, 0.20), transparent 45%),
        radial-gradient(circle at 82% 82%, rgba(59, 130, 246, 0.14), transparent 45%),
        linear-gradient(135deg, #091b3a 0%, #0d264f 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: 0 24px 48px rgba(2, 6, 23, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.08);
    border-top: 4px solid var(--accent);
}

.login-brand-pill {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.login-logo-img {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: contain;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(13, 38, 79, 0.18);
}

.login-brand-pill h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.2;
}

.login-brand-pill p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 3px 0 0 0;
}

.login-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    color: #64748b;
    display: inline-flex;
    pointer-events: none;
}

.login-input-wrap .login-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px 12px 44px;
    font-size: 16px;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input-wrap .login-input-password {
    padding-right: 46px;
}

.login-input-wrap .login-input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 38, 79, 0.15);
}

.login-eye-btn {
    position: absolute;
    right: 6px;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
}

.login-eye-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.login-submit-btn {
    width: 100%;
    min-height: 50px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    margin-top: 4px;
    touch-action: manipulation;
}

.login-footnote {
    margin: 18px 0 0 0;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

@media (max-width: 480px) {
    .login-card {
        padding: 22px 18px;
        border-radius: 16px;
    }

    .topbar-meta {
        gap: 6px;
    }

    #currentUserBadge {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* SMTP Settings */
.smtp-toggle-row {
    margin-bottom: 14px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.smtp-actions-row {
    margin-top: 14px;
    display: flex;
    gap: 8px;
}

.smtp-test-box {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

/* History Filter & Table */
.filter-bar {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 8px;
    margin-bottom: 12px;
}

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

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

.data-table th,
.data-table td {
    padding: 10px 9px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    vertical-align: middle;
}

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

.data-table tbody tr:hover {
    background: var(--surface-subtle);
}

.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.muted { color: var(--muted); }

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.badge-accepted { background: var(--success-bg); color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-partial { background: var(--warning-bg); color: #92400e; }
.badge-neutral { background: #f4f4f5; color: #3f3f46; }

/* Mobile Bottom Nav */
.mobile-nav {
    display: none;
}

/* Modals */
.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.72);
}

.modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-lg {
    max-width: 720px;
}

.modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    padding: 0 4px;
}

.modal-body {
    padding: 14px 16px;
    overflow-y: auto;
}

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.spacer {
    margin-right: auto;
}

.barcode-reader-box {
    position: relative;
    width: 100%;
    max-width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    height: clamp(220px, 50dvh, 360px);
}

.quagga-target {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.barcode-reader-box video,
.barcode-reader-box canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    display: block;
}

.barcode-reader-box canvas.drawingBuffer {
    display: none !important;
}

.scan-guide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
}

.scan-guide-box {
    width: 90%;
    height: 78%;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.38);
    position: relative;
    overflow: hidden;
}

.scan-laser {
    position: absolute;
    left: 6%;
    right: 6%;
    top: 50%;
    height: 2px;
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.9);
}

.barcode-last-scan {
    margin-top: 10px;
    padding: 9px 12px;
    background: var(--success-bg);
    color: #166534;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.camera-stage {
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    max-height: 55dvh;
}

.camera-stage video,
.camera-stage img {
    width: 100%;
    max-width: 100%;
    max-height: 55dvh;
    object-fit: contain;
    display: block;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: var(--surface-subtle);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}

.detail-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.detail-photo-card {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    text-decoration: none;
}

.detail-photo-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.detail-photo-card p {
    margin: 0;
    padding: 6px 8px;
    font-size: 11px;
    color: var(--muted);
}

/* Toast */
.toast-container {
    position: fixed;
    top: 68px;
    right: 14px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
}

.toast {
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    animation: slideIn 0.2s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--dark); }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    .desktop-tabs,
    .topbar-meta {
        display: none;
    }

    .hamburger-btn {
        display: inline-flex;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    html,
    body {
        overflow-x: hidden;
    }

    input,
    select,
    textarea {
        font-size: 16px;
        min-width: 0;
    }

    .topbar-inner {
        padding: 10px 12px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .brand h1 {
        font-size: 15px;
    }

    .topbar-meta {
        gap: 8px;
        margin-left: auto;
    }

    .desktop-tabs {
        display: none;
    }

    .mobile-nav {
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid var(--border-light);
        box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
        z-index: 80;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-nav-btn {
        flex: 1;
        min-height: 56px;
        border: none;
        background: transparent;
        padding: 8px 4px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: 11px;
        font-weight: 600;
        color: var(--muted);
        cursor: pointer;
        touch-action: manipulation;
    }

    .mobile-nav-btn.active {
        color: var(--accent);
    }

    .container {
        padding: 12px;
        margin-bottom: calc(155px + env(safe-area-inset-bottom));
    }

    .card {
        padding: 14px;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .scanner-input-wrap,
    .input-with-action {
        flex-wrap: wrap;
    }

    .scanner-input-wrap input,
    .input-with-action input {
        flex: 1 1 160px;
    }

    .submit-bar {
        bottom: calc(64px + env(safe-area-inset-bottom));
        left: 12px;
        right: 12px;
    }

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

    .form-grid,
    .filter-bar,
    .brand-form,
    .detail-meta {
        grid-template-columns: 1fr;
    }

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

    .modal {
        padding: 8px;
    }

    .modal-dialog {
        margin: 0;
        width: 100%;
        max-width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
    }

    .toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .clock {
        display: none;
    }
}
