:root {
    --bocr-primary: #2563eb;
    --bocr-bg: #f1f5f9;
    --bocr-sidebar: #0f172a;
    --bocr-sidebar-hover: #1e293b;
    --bocr-border: #e2e8f0;
    --bocr-text-muted: #64748b;
}

* { box-sizing: border-box; }
body {
    background: var(--bocr-bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: var(--bocr-sidebar);
    color: #cbd5e1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1040;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.25rem 1.25rem;
    font-size: 1.15rem; font-weight: 700; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { color: var(--bocr-primary); font-size: 1.4rem; }
.sidebar-nav { padding: .75rem; overflow-y: auto; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: .65rem;
    padding: .6rem .85rem; margin-bottom: .15rem;
    border-radius: .5rem; color: #cbd5e1; text-decoration: none;
    font-size: .925rem; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bocr-sidebar-hover); color: #fff; }
.nav-item.active { background: var(--bocr-primary); color: #fff; }
.nav-item i { font-size: 1.05rem; }
.nav-section {
    text-transform: uppercase; font-size: .7rem; letter-spacing: .05em;
    color: #64748b; padding: 1rem .85rem .35rem; font-weight: 600;
}

.app-main { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-width: 0; }

/* ---------- Topbar ---------- */
.topbar {
    background: #fff; border-bottom: 1px solid var(--bocr-border);
    padding: .75rem 1.5rem; display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 1030;
}
.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; flex: 1; }
.btn-icon {
    background: none; border: none; font-size: 1.4rem; color: #475569;
    display: none; cursor: pointer; padding: 0;
}
.user-chip {
    display: flex; align-items: center; gap: .5rem;
    background: var(--bocr-bg); border: 1px solid var(--bocr-border);
    border-radius: 2rem; padding: .3rem .75rem .3rem .35rem; cursor: pointer;
    font-size: .9rem;
}
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--bocr-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .85rem;
}
.role-badge {
    background: #e0e7ff; color: #3730a3; font-size: .7rem; font-weight: 600;
    padding: .1rem .5rem; border-radius: 1rem;
}

/* ---------- Content ---------- */
.content { padding: 1.5rem; flex: 1; }

/* ---------- Panels ---------- */
.panel {
    background: #fff; border: 1px solid var(--bocr-border);
    border-radius: .75rem; overflow: hidden;
}
.panel-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--bocr-border); }
.panel-head h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.panel-body { padding: 1.25rem; }
.panel-body.p-0 { padding: 0; }

/* ---------- Stat cards ---------- */
.stat-card {
    background: #fff; border: 1px solid var(--bocr-border); border-radius: .75rem;
    padding: 1.1rem; height: 100%;
}
.stat-icon { font-size: 1.5rem; line-height: 1; }
.stat-value { font-size: 1.75rem; font-weight: 700; margin-top: .35rem; }
.stat-label { color: var(--bocr-text-muted); font-size: .8rem; }

/* ---------- Tables ---------- */
.table thead th {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .03em;
    color: var(--bocr-text-muted); border-bottom: 1px solid var(--bocr-border);
    background: #f8fafc;
}

/* ---------- Detail list ---------- */
.detail-list { margin: 0; }
.detail-list dt { font-size: .75rem; text-transform: uppercase; color: var(--bocr-text-muted); margin-top: .85rem; letter-spacing: .03em; }
.detail-list dt:first-child { margin-top: 0; }
.detail-list dd { margin: .15rem 0 0; }

/* ---------- Product chips ---------- */
.product-chip {
    background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe;
    padding: .3rem .7rem; border-radius: 1rem; font-size: .85rem;
}

/* ---------- Dropzone ---------- */
.dropzone {
    border: 2px dashed #cbd5e1; border-radius: .75rem; padding: 2.5rem 1.5rem;
    text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--bocr-primary); background: #eff6ff; }
.dropzone-icon { font-size: 2.75rem; color: #94a3b8; }
.dropzone-text { margin: .75rem 0 .25rem; font-weight: 500; }
.dropzone-hint { color: var(--bocr-text-muted); font-size: .85rem; margin: 0; }

/* ---------- Raw OCR text ---------- */
.raw-text {
    background: #f8fafc; border: 1px solid var(--bocr-border); border-radius: .5rem;
    padding: 1rem; font-size: .8rem; max-height: 520px; overflow: auto;
    white-space: pre-wrap; word-break: break-word; margin: 0;
}

/* ---------- Guest pages ---------- */
.guest-body {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.guest-wrap { width: 100%; max-width: 410px; padding: 1.5rem; }
.guest-card { background: #fff; border-radius: 1rem; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.guest-brand { text-align: center; margin-bottom: 1.5rem; }
.guest-brand i { font-size: 2.5rem; color: var(--bocr-primary); }
.guest-brand h1 { font-size: 1.4rem; font-weight: 700; margin: .5rem 0 .15rem; }
.guest-brand p { color: var(--bocr-text-muted); font-size: .85rem; margin: 0; }
.guest-footer { text-align: center; color: #94a3b8; font-size: .8rem; margin-top: 1.25rem; }
.guest-form .form-label { font-weight: 500; font-size: .9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .btn-icon { display: inline-block; }
}
