@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    --font-sans: 'Source Sans 3', ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    --sidebar-width: 236px;
    --sidebar-collapsed-width: 72px;
    --sidebar-bg: #191b1d;
    --sidebar-border: rgba(255, 255, 255, 0.07);
    --accent: #2c5282;
    --accent-hover: #1a365d;
    --accent-soft: rgba(44, 82, 130, 0.1);
    --surface: #ffffff;
    --surface-muted: #f4f3f0;
    --border: #e4e1db;
    --text: #1c1917;
    --text-muted: #6b6560;
    --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05);
    --shadow-md: 0 10px 28px rgba(28, 25, 23, 0.06);
    --radius: 8px;
    --header-height: 64px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

html {
    font-size: 17px;
}

body {
    font-family: var(--font-sans);
    background: #efeeeb;
    color: var(--text);
    min-height: 100vh;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    font-size: 1rem;
}

a {
    color: var(--accent);
}

.auth-body {
    background: #f3f2ef;
}

.auth-wrapper {
    position: relative;
    z-index: 1;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    border: 1px solid #e6e3dc;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(28, 25, 23, 0.08);
}

.auth-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #1c1917;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.75rem;
}

.auth-title {
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    color: #1c1917;
}

.auth-input {
    position: relative;
}

.auth-input i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8a847c;
    z-index: 2;
}

.auth-input .form-control {
    padding-left: 2.4rem;
    min-height: 44px;
    border-color: #e6e3dc;
    background: #fafaf8;
}

.auth-input .form-control:focus {
    border-color: #2c5282;
    box-shadow: 0 0 0 0.2rem rgba(44, 82, 130, 0.12);
    background: #fff;
}

.auth-submit {
    min-height: 44px;
    font-weight: 650;
}

.auth-panel {
    padding: 2rem 1.75rem 1.85rem;
}

.app-wrapper {
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    transform: translateX(0);
    transition: transform 0.2s ease, width 0.2s ease;
}

.app-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    transition: margin-left 0.2s ease, width 0.2s ease;
}

body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .app-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

.sidebar-collapse-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.78);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: rgba(44, 82, 130, 0.35);
    color: #fff;
}

body.sidebar-collapsed .sidebar-brand {
    flex-direction: column;
    align-items: center;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
}

body.sidebar-collapsed .sidebar-brand-link {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-link span,
body.sidebar-collapsed .sidebar-section,
body.sidebar-collapsed .sidebar-brand-mark {
    display: none;
}

body.sidebar-collapsed .sidebar-brand-compact {
    display: inline-block;
}

body.sidebar-collapsed .sidebar-nav {
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
}

body.sidebar-collapsed .sidebar-link i {
    width: auto;
    margin: 0;
}

body.sidebar-collapsed .sidebar-collapse-btn i {
    transform: scaleX(-1);
}

.sidebar-brand {
    border-bottom: 1px solid var(--sidebar-border) !important;
}

.sidebar-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    background: #2c5282;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-compact {
    display: none;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #d6d3cd;
}

.sidebar-brand .brand-name {
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.1rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.68);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link i {
    width: 1.1rem;
    text-align: center;
    opacity: 0.9;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    box-shadow: inset 3px 0 0 #d6d3cd;
}

.sidebar-section {
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    font-weight: 600;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: var(--header-height);
    flex-shrink: 0;
    background: #fff !important;
    border-bottom: 1px solid var(--border) !important;
}

.app-main {
    max-width: none;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 0.9rem;
}

.stat-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    animation: dashIn 0.45s ease both;
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--accent);
    opacity: 0.85;
}

.stat-card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
    border-color: #d7dee8;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.stat-hint {
    margin-top: 0.45rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.stat-card:hover .stat-hint {
    opacity: 1;
    transform: translateY(0);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.stat-card-teal::before,
.stat-icon.tone-teal { background: rgba(44, 82, 130, 0.12); color: #2c5282; }
.stat-card-teal .stat-icon { background: rgba(44, 82, 130, 0.12); color: #2c5282; }
.stat-card-teal::before { background: #2c5282; }

.stat-card-green::before,
.stat-card-green .stat-icon,
.stat-icon.tone-green { background: rgba(22, 163, 74, 0.14); color: #15803d; }
.stat-card-green::before { background: #16a34a; }

.stat-card-amber::before,
.stat-card-amber .stat-icon { background: rgba(217, 119, 6, 0.14); color: #b45309; }
.stat-card-amber::before { background: #d97706; }

.stat-card-rose::before,
.stat-card-rose .stat-icon { background: rgba(225, 29, 72, 0.12); color: #be123c; }
.stat-card-rose::before { background: #e11d48; }

.stat-card-violet::before,
.stat-card-violet .stat-icon { background: rgba(124, 58, 237, 0.12); color: #6d28d9; }
.stat-card-violet::before { background: #7c3aed; }

.stat-card-slate::before,
.stat-card-slate .stat-icon,
.stat-icon.tone-slate { background: rgba(71, 85, 105, 0.12); color: #334155; }
.stat-card-slate::before { background: #64748b; }

.dashboard-hero {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.dashboard-hero .text-muted {
    color: var(--text-muted) !important;
}

.dashboard-kicker {
    color: var(--accent);
    letter-spacing: 0.04em;
}

.dashboard-metric {
    background: #f7f6f3;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem 1rem;
}

.dashboard-metric.is-alert {
    background: rgba(251, 113, 133, 0.14);
    border-color: rgba(251, 113, 133, 0.28);
}

.dashboard-metric.is-ok {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.24);
}

.dashboard-metric-value {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.dashboard-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    overflow: hidden;
}

.dashboard-progress .progress-bar {
    background: var(--accent);
}

.dashboard-activity-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1.15rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.dashboard-activity-row:last-child {
    border-bottom: 0;
}

.dashboard-activity-row:hover {
    background: #f8fafc;
}

.dashboard-activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    flex-shrink: 0;
}

.dashboard-activity-icon.tone-reconciled {
    background: rgba(22, 163, 74, 0.14);
    color: #15803d;
}

.dashboard-activity-icon.tone-pending_review,
.dashboard-activity-icon.tone-received,
.dashboard-activity-icon.tone-processing {
    background: rgba(217, 119, 6, 0.14);
    color: #b45309;
}

.dashboard-activity-icon.tone-invalid,
.dashboard-activity-icon.tone-error,
.dashboard-activity-icon.tone-duplicate {
    background: rgba(225, 29, 72, 0.12);
    color: #be123c;
}

.dashboard-activity-icon.tone-no_statement_match,
.dashboard-activity-icon.tone-possible_duplicate {
    background: rgba(124, 58, 237, 0.12);
    color: #6d28d9;
}

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

.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8125rem;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-outline-primary {
    color: var(--accent);
    border-color: rgba(44, 82, 130, 0.35);
}

.btn-outline-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.form-control,
.form-select {
    border-radius: 8px;
    border-color: #dbe3ee;
    padding: 0.45rem 0.7rem;
    font-size: 0.875rem;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(44, 82, 130, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(44, 82, 130, 0.12);
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.7rem 0.9rem;
    vertical-align: middle;
}

.table-compact > :not(caption) > * > * {
    padding: 0.7rem 0.9rem;
}

.table thead th {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9aa3b2;
    font-weight: 650;
    background: #fafbfc;
    border-bottom-color: var(--border);
    white-space: nowrap;
}

.nav-pills .nav-link {
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.nav-pills .nav-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-pills .nav-link.active {
    background: var(--accent);
    color: #fff;
}

.log-detail {
    background: #f8fafc;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.log-metadata {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    max-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
}

.collapse-row > td {
    background: transparent;
}

.filter-panel {
    background: var(--surface);
}

.form-control-sm,
.form-select-sm {
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
}

.badge {
    border-radius: 999px;
    font-weight: 600;
    padding: 0.4em 0.7em;
}

.badge-soft-success { background: #dcfce7; color: #166534; }
.badge-soft-danger { background: #fee2e2; color: #991b1b; }
.badge-soft-warning { background: #ffedd5; color: #9a3412; }
.badge-soft-info { background: #e0f2fe; color: #075985; }
.badge-soft-primary { background: #e4ebf3; color: #1a365d; }
.badge-soft-secondary { background: #e2e8f0; color: #334155; }

.mono {
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.receipt-thumb {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    overflow: hidden;
    border: 1px solid var(--border);
}

.receipt-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-frame {
    width: 100%;
    min-height: 520px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #0f172a;
}

.preview-frame img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    background: #fff;
}

.preview-frame iframe {
    width: 100%;
    min-height: 520px;
    border: 0;
    background: #fff;
}

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.filter-panel .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.detail-meta dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-meta dd {
    margin-bottom: 0.85rem;
}

.timeline-item {
    position: relative;
    padding-left: 1.25rem;
    border-left: 2px solid #e2e8f0;
    padding-bottom: 1rem;
    margin-left: 0.35rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 0.35rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1035;
}

.sidebar-backdrop.show {
    display: block;
}

.breadcrumb {
    font-size: 0.875rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #94a3b8;
}

.upload-dropzone {
    border: 1.5px dashed #cbd5e1;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    padding: 2rem;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-dropzone:hover {
    border-color: var(--accent);
    background: #f4f6f8;
}

.btn-group form {
    display: inline;
}

.notification-bell {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.notification-menu {
    width: min(360px, calc(100vw - 1.5rem));
}

.notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f5f9;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item.is-unread {
    background: #f3f6f9;
}

.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2c5282;
    margin-top: 0.4rem;
    flex-shrink: 0;
}

.notification-dot.is-read {
    background: #cbd5e1;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    body.sidebar-collapsed .sidebar-brand-text,
    body.sidebar-collapsed .sidebar-link span,
    body.sidebar-collapsed .sidebar-section {
        display: initial;
    }

    body.sidebar-collapsed .sidebar-brand-mark {
        display: inline-flex;
    }

    body.sidebar-collapsed .sidebar-brand {
        flex-direction: row;
        align-items: center;
    }

    body.sidebar-collapsed .sidebar-link {
        justify-content: flex-start;
    }
}

.app-sidebar {
    background: var(--sidebar-bg);
}

.app-header {
    background: #fff !important;
}

.app-main {
    max-width: none;
    padding: 1rem 1.25rem 1.15rem;
}

.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.page-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.2rem;
}

.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.15rem 1.2rem;
    background: #fff;
    margin-bottom: 1rem;
}

.form-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: 0.85rem;
}

.form-label,
.filter-panel .form-label {
    font-size: 0.75rem;
    font-weight: 650;
    color: #475569;
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    min-height: 36px;
    background: #f8fafc;
    border-color: #dbe3ee;
}

.form-control-sm,
.form-select-sm {
    min-height: 38px;
}

.input-group-text {
    background: #f1f5f9;
    border-color: #dbe3ee;
    color: #64748b;
}

.table-shell {
    overflow: hidden;
}

.table tbody tr {
    transition: background 0.12s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 1.15rem;
    align-items: start;
}

@media (max-width: 1199.98px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

.workspace-preview {
    position: sticky;
    top: 0;
}

.recon-banner {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid #bbf7d0;
    background: linear-gradient(180deg, #f0fdf4, #ffffff);
    margin-bottom: 1.15rem;
}

.recon-banner-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #dcfce7;
    color: #166534;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.recon-banner h2 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
}

.data-cell .data-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.15rem;
}

.data-cell .data-value {
    display: block;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}

.match-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
    margin-bottom: 0.85rem;
}

.match-card.is-confirmed {
    border-color: #86efac;
    background: #f8fdf9;
}

.match-card.is-probable {
    border-color: #fdba74;
    background: #fffbf5;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 650;
}

.search-toolbar {
    background: #f8fafc;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.15rem;
}

@media (max-width: 991.98px) {
    .kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.kpi-tile {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.95rem 1rem;
}

.kpi-tile .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kpi-tile .value {
    font-size: 1.15rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    margin-top: 0.2rem;
}

.queue-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.queue-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: #475569;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 650;
}

.queue-tabs a:hover {
    border-color: rgba(44, 82, 130, 0.35);
    color: var(--accent);
}

.queue-tabs a.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.queue-tabs .count {
    background: rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-size: 0.72rem;
}

.queue-tabs a.active .count {
    background: rgba(255, 255, 255, 0.18);
}

.action-stack form + form {
    padding-top: 0.7rem;
    border-top: 1px solid var(--border);
    margin-top: 0.7rem;
}

.breadcrumb {
    display: none;
}

.filter-panel {
    margin-bottom: 0.75rem;
}

.filter-panel > .card-body {
    padding: 0.7rem 0.85rem;
}

.filter-toolbar-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.65rem;
}

.filter-toolbar-header .text-muted {
    font-size: 0.8rem;
}

.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.4rem 0.5rem;
}

.filter-toolbar .filter-grow {
    flex: 0 1 260px;
    min-width: 180px;
    max-width: 320px;
}

.filter-toolbar .filter-sm {
    flex: 0 1 128px;
    min-width: 108px;
}

.filter-toolbar .filter-md {
    flex: 0 1 160px;
    min-width: 132px;
}

.filter-toolbar .filter-date {
    flex: 0 1 138px;
    min-width: 126px;
}

.filter-toolbar .filter-xs {
    flex: 0 1 104px;
    min-width: 88px;
}

.filter-toolbar .filter-action {
    display: flex;
    flex: 0 0 auto;
    gap: 0.4rem;
    align-items: flex-end;
}

.filter-toolbar .form-label {
    margin-bottom: 0.15rem;
    font-size: 0.7rem;
    line-height: 1.2;
}

.filter-toolbar .form-control,
.filter-toolbar .form-select,
.filter-toolbar textarea {
    min-height: 34px;
    padding: 0.25rem 0.5rem;
    font-size: 0.84rem;
}

.filter-toolbar .btn {
    min-height: 34px;
    padding: 0.28rem 0.8rem;
}

.form-section {
    padding: 0.75rem 0.85rem 0.85rem;
    margin-bottom: 0.75rem;
}

.form-section-title {
    margin-bottom: 0.55rem;
}

.modal-compact .modal-header,
.modal-compact .modal-footer {
    padding: 0.75rem 1rem;
}

.modal-compact .modal-body {
    padding: 0.85rem 1rem;
}

.modal-compact .form-label {
    margin-bottom: 0.2rem;
}

.modal-compact .upload-dropzone {
    padding: 1rem 0.85rem;
    margin-bottom: 0.75rem !important;
}

.modal-compact .row {
    --bs-gutter-y: 0.55rem;
    --bs-gutter-x: 0.65rem;
}

.upload-dropzone {
    padding: 1.15rem 1rem;
}

/* —— App shell fill —— */
.app-main.p-3,
.app-main.p-lg-4 {
    padding: 1rem 1.25rem 1.15rem !important;
}

.page-fill {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.page-fill > .alert {
    flex-shrink: 0;
    margin-bottom: 0;
}

.page-board {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    overflow: hidden;
}

.board-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.55rem 0.65rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    flex-shrink: 0;
}

.board-toolbar .filter-toolbar {
    flex: 1 1 auto;
    min-width: 0;
}

.board-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
    padding-bottom: 0;
}

.board-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.board-scroll .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fafbfc;
    box-shadow: 0 1px 0 var(--border);
}

.board-footer {
    flex-shrink: 0;
    padding: 0.55rem 1rem;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.65rem;
    margin-bottom: 0;
    flex-shrink: 0;
}

.page-toolbar h1,
.page-title {
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    margin: 0;
    line-height: 1.25;
}

.page-toolbar .text-muted,
.page-lede {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0;
}

.cell-title {
    font-weight: 600;
    color: #111827;
    line-height: 1.25;
}

.cell-sub {
    font-size: 0.75rem;
    color: #8b95a5;
    margin-top: 0.12rem;
    font-variant-numeric: tabular-nums;
}

.cell-num {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #1f2937;
}

.cell-muted {
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.count-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.65rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.count-chip.is-warn {
    background: #fff7ed;
    color: #c2410c;
}

.count-chip.is-ok {
    background: #ecfdf5;
    color: #047857;
}

.table-link {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    color: var(--accent);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.table-link:hover {
    color: var(--accent-hover);
}

.table tbody tr[data-href] {
    cursor: pointer;
}

.table tbody tr[data-href]:hover {
    background: #f5f4f1;
}

.format-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.02em;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.2rem 0.55rem 0.2rem 0.25rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #111827;
    font-size: 0.8125rem;
    font-weight: 550;
}

.user-chip:hover,
.user-chip:focus {
    background: #f8fafc;
    border-color: #d1d5db;
}

.icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: #4b5563;
}

.icon-btn:hover {
    background: #f8fafc;
    color: #111827;
}

.empty-state {
    padding: 3.5rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: #eef2f6;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 0.85rem;
    border: 1px solid #d9e2ec;
}

.header-title {
    font-size: 0.95rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.1rem 0 0;
}

.stat-card {
    border-radius: 12px;
}

.stat-value {
    font-size: 1.55rem;
}

.dashboard-hero {
    border-radius: 14px;
}

.dashboard-hero .card-body {
    padding: 1.15rem 1.25rem !important;
}

.dashboard-metric {
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
}

.dashboard-metric-value {
    font-size: 1.4rem;
}

.kpi-tile {
    padding: 0.75rem 0.9rem;
}

.queue-tabs {
    margin-bottom: 0;
}

.btn-ghost {
    background: #fff;
    border: 1px solid var(--border);
    color: #374151;
}

.btn-ghost:hover {
    background: #f8fafc;
    border-color: #d1d5db;
    color: #111827;
}

.card {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.badge {
    padding: 0.32em 0.62em;
    font-size: 0.7rem;
    letter-spacing: 0.01em;
}

@media (max-width: 991.98px) {
    .app-wrapper {
        height: auto;
        overflow: visible;
    }

    .app-content {
        height: auto;
        overflow: visible;
    }

    .app-main {
        overflow: visible;
    }

    .page-fill,
    .page-board,
    .board-scroll {
        min-height: auto;
        flex: none;
        overflow: visible;
    }

    .board-toolbar-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}

.board-footer nav,
.board-footer .pagination {
    margin-bottom: 0;
}

.table {
    font-size: 0.8125rem;
}

.sidebar-brand-mark i {
    font-size: 0.85rem;
}

.user-chip.dropdown-toggle::after {
    margin-left: 0.2rem;
    vertical-align: middle;
}

.page-fill > .d-flex,
.page-fill > .alert,
.page-fill > .page-toolbar,
.page-fill > .queue-tabs {
    flex-shrink: 0;
}

.dropdown-menu {
    border-radius: 10px;
    border-color: var(--border);
}

.stat-hint {
    opacity: 1;
    transform: none;
    margin-top: 0.25rem;
}

.queue-tabs {
    row-gap: 0.4rem;
}

.page-board {
    width: 100%;
}

.app-header {
    min-height: var(--header-height);
}

.coverage-meter {
    margin-top: 0.75rem;
}

.coverage-meter-bar {
    height: 8px;
    border-radius: 999px;
    background: #eef1f4;
    overflow: hidden;
}

.coverage-meter-bar span {
    display: block;
    height: 100%;
    background: var(--accent);
}

.coverage-meter-meta {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: #64748b;
}

.receipt-pick {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    cursor: pointer;
}

.receipt-pick input[type="checkbox"] {
    margin-top: 0.35rem;
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #2c5282;
}

.receipt-pick:hover {
    border-color: rgba(44, 82, 130, 0.35);
}

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

.device-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.15rem 1.2rem;
}

.device-qr {
    width: 220px;
    height: 220px;
    margin: 0.75rem auto;
    padding: 0.65rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-qr img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.device-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.device-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.device-status-dot.is-on {
    background: #15803d;
}

.device-status-dot.is-wait {
    background: #b45309;
}

@media (max-width: 991.98px) {
    .device-grid {
        grid-template-columns: 1fr;
    }
}

/* Operator scale: larger type and controls */
.sidebar-link {
    font-size: 1rem;
}

.sidebar-section {
    font-size: 0.78rem;
}

.header-title {
    font-size: 1.15rem;
}

.header-subtitle,
.page-subtitle,
.page-lede {
    font-size: 0.95rem;
}

.page-title,
.page-toolbar h1 {
    font-size: 1.2rem;
}

.table thead th {
    font-size: 0.8rem;
}

.cell-title {
    font-size: 1rem;
}

.cell-sub {
    font-size: 0.85rem;
}

.btn {
    font-size: 0.95rem;
    min-height: 40px;
}

.btn-sm {
    font-size: 0.9rem;
    min-height: 38px;
    padding: 0.4rem 0.85rem;
}

.form-control,
.form-select {
    font-size: 1rem;
    min-height: 42px;
}

.form-label,
.filter-panel .form-label,
.filter-toolbar .form-label,
.modal-compact .form-label {
    font-size: 0.85rem;
}

.filter-toolbar .form-control,
.filter-toolbar .form-select,
.filter-toolbar textarea {
    min-height: 40px;
    font-size: 1rem;
    padding: 0.35rem 0.65rem;
}

.filter-toolbar .btn {
    min-height: 40px;
}

.data-cell .data-label {
    font-size: 0.82rem;
}

.data-cell .data-value {
    font-size: 1.05rem;
}

.kpi-tile .label {
    font-size: 0.85rem;
}

.kpi-tile .value {
    font-size: 1.35rem;
}

.queue-tabs a {
    font-size: 0.95rem;
}

.queue-tabs .count {
    font-size: 0.8rem;
}

.badge {
    font-size: 0.8rem;
}

.auth-title {
    font-size: 1.65rem;
}

.auth-input .form-control {
    min-height: 48px;
    font-size: 1.05rem;
}

.modal-remote {
    max-width: min(1280px, 96vw);
}

.modal-remote .modal-body {
    max-height: calc(100vh - 8rem);
}

.modal-remote .workspace-preview {
    position: static;
}

.modal-remote .preview-frame,
.modal-remote .preview-frame iframe {
    min-height: 360px;
}

.embed-root .page-toolbar {
    margin-bottom: 0.85rem;
}

.notification-time {
    font-size: 0.8rem;
}

