:root {
    --bg: #f0f4f8;
    --bg-subtle: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 50%, #f5f7fa 100%);
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --primary: #0d9b7a;
    --primary-light: #e6f7f2;
    --primary-hover: #0a7d63;
    --primary-glow: rgba(13, 155, 122, 0.25);
    --sidebar-bg: linear-gradient(180deg, #0a1628 0%, #0f2744 50%, #0a1f38 100%);
    --sidebar-text: #94a3b8;
    --sidebar-active: rgba(13, 155, 122, 0.2);
    --sidebar-active-border: #14b8a6;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #059669;
    --success-light: #ecfdf5;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --info: #2563eb;
    --info-light: #eff6ff;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --topbar-h: 3.75rem;
    --sidebar-w: 16rem;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body, .app-body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    background-image: var(--bg-subtle);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.container { max-width: 1400px; margin: 0 auto; padding: 1rem 1.5rem; }

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

.app-topbar {
    height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    padding: 0 1.25rem 0 1rem;
    position: sticky;
    top: 0;
    z-index: 300;
    gap: 1rem;
}

.app-topbar-left, .app-topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.app-topbar-left { justify-self: start; min-width: 0; }
.app-topbar-center {
    justify-self: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.65rem;
    width: auto;
    max-width: min(100%, 520px);
}
.app-topbar-right { justify-self: end; min-width: 0; }

.app-topbar-center .branch-select-wrap {
    width: 100%;
    min-width: 160px;
    max-width: 240px;
}

.sidebar-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--border-light); border-color: #cbd5e1; }
.sidebar-toggle svg { width: 1.25rem; height: 1.25rem; }

.topbar-brand { display: flex; align-items: center; gap: 0.75rem; color: inherit; text-decoration: none; }
.topbar-brand:hover { text-decoration: none; color: inherit; }
.topbar-logo { border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.topbar-brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-brand-text strong { font-size: 0.78rem; letter-spacing: 0.06em; font-weight: 700; color: var(--text); }
.topbar-brand-text small { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

.branch-select-wrap { width: 100%; }
.branch-select {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    transition: all var(--transition);
}

.branch-select:hover:not(:disabled) {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-sm);
}

.branch-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.branch-select-readonly { cursor: default; opacity: 0.85; }

.topbar-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
    border: 1px solid transparent;
}
.topbar-icon-btn:hover { background: var(--border-light); color: var(--text); text-decoration: none; }
.topbar-icon-btn svg { width: 1.15rem; height: 1.15rem; }

.topbar-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    min-width: 1.1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.topbar-user { display: flex; align-items: center; gap: 0.65rem; padding-left: 0.5rem; border-left: 1px solid var(--border); }
.topbar-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-light), #d1fae5);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid #fff;
    box-shadow: var(--shadow-sm);
}
.topbar-user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-user-meta strong { font-size: 0.82rem; font-weight: 600; }
.topbar-user-meta small { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

/* ─── Sidebar ─── */
.app-body-row { display: flex; flex: 1; min-height: calc(100vh - var(--topbar-h)); }

.app-sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(10, 22, 40, 0.15);
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), margin 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.app-shell.sidebar-collapsed .app-sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    box-shadow: none;
}

.sidebar-nav { padding: 1rem 0.75rem; flex: 1; }

.sidebar-link, .sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.7rem 0.85rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: all var(--transition);
}

.sidebar-link:hover, .sidebar-group-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
    color: #e2e8f0;
}

.sidebar-link.is-active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--sidebar-active-border);
}

.sidebar-icon {
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.85;
}
.sidebar-icon svg { width: 1.1rem; height: 1.1rem; stroke-width: 1.75; }

.sidebar-group { margin-bottom: 0.25rem; }
.sidebar-chevron { margin-left: auto; transition: transform var(--transition); font-size: 0.75rem; opacity: 0.6; }
.sidebar-group.is-open .sidebar-chevron { transform: rotate(90deg); }

.sidebar-sub { display: none; padding: 0.25rem 0 0.5rem 2.5rem; }
.sidebar-group.is-open .sidebar-sub { display: block; }

.sidebar-sub a {
    display: block;
    padding: 0.45rem 0.75rem;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin: 1px 0;
    transition: all var(--transition);
}
.sidebar-sub a:hover, .sidebar-sub a.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.sidebar-stats {
    padding: 1rem 1.1rem;
    margin: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    font-size: 0.8rem;
}
.sidebar-stats-title { color: #64748b; margin-bottom: 0.15rem; font-weight: 500; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.sidebar-stats-total { font-size: 1.75rem; font-weight: 700; color: #fff; margin-bottom: 0.65rem; letter-spacing: -0.02em; }
.sidebar-stats-list { list-style: none; margin: 0; padding: 0; }
.sidebar-stats-list li { display: flex; align-items: center; gap: 0.45rem; padding: 0.25rem 0; font-size: 0.78rem; }
.sidebar-stats-list strong { margin-left: auto; color: #e2e8f0; font-weight: 600; }

.dot { width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; }
.dot-green { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
.dot-orange { background: #f97316; box-shadow: 0 0 6px rgba(249, 115, 22, 0.5); }
.dot-purple { background: #a855f7; box-shadow: 0 0 6px rgba(168, 85, 247, 0.5); }
.dot-red { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
.dot-blue { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.5); }

/* ─── Main content ─── */
.app-main-wrap { flex: 1; min-width: 0; overflow: auto; background: #f5f7fa; }
.app-main {
    padding: 1.25rem 1.5rem 2rem;
    width: 100%;
    max-width: none;
    animation: fadeIn 0.35s ease;
}
.app-main-fluid { max-width: none; }

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

/* ─── Page headers ─── */
.page-header, .page-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0;
    border-bottom: none;
}

.page-hero-content { flex: 1; min-width: 0; }

.page-header h1, .page-title {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.2;
}

.page-header p, .page-subtitle {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.page-hero-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.page-header > .btn, .page-header > a.btn { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.breadcrumb {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-weight: 500;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

.section-title, .app-main > h2 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.app-main > h2::before {
    content: '';
    width: 4px;
    height: 1.1rem;
    background: linear-gradient(180deg, var(--primary), #14b8a6);
    border-radius: 2px;
}

/* ─── Cards & panels ─── */
.card, .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition);
}

.card:hover, .panel:hover { box-shadow: var(--shadow-md); }

.card:has(> .table), .panel:has(> .table), .data-table-wrap {
    padding: 0;
    overflow: hidden;
}

.card-header, .panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--border-light);
}

/* ─── Stats grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #14b8a6);
    opacity: 0.85;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.25rem;
}

/* ─── Tables ─── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th, .table td {
    padding: 0.75rem 1.15rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: #f8fafc;
    white-space: nowrap;
}

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

.table td a { font-weight: 500; }

.table th.col-actions,
.table td.col-actions,
.table th:last-child:empty,
.table td:last-child:has(.btn),
.table td:last-child:has(form) {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    padding-right: 1.25rem;
}

.table th.col-numeric,
.table td.col-numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table td.col-actions .btn + .btn,
.table td:last-child .btn + .btn,
.table td:last-child form + form {
    margin-left: 0.35rem;
}

.data-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1.25rem; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:hover { background: var(--border-light); text-decoration: none; color: var(--text); border-color: #cbd5e1; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #0a7d63 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #086b54 100%);
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, var(--danger));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}
.btn-danger:hover { color: #fff; transform: translateY(-1px); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.78rem; }
.btn-muted { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-muted:hover { background: var(--border-light); color: var(--text); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-block { width: 100%; }

.btn svg { width: 1rem; height: 1rem; }

/* ─── Forms ─── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.15rem;
}

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

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    transition: all var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group textarea { min-height: 90px; resize: vertical; }
.form-actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }

.form-section-title {
    grid-column: 1 / -1;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    padding-bottom: 0.5rem;
    margin-top: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.filters, .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.filters input, .filters select, .filter-bar input, .filter-bar select {
    padding: 0 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.875rem;
    background: var(--border-light);
    min-width: 160px;
    min-height: 2.625rem;
    transition: all var(--transition);
}

.filter-bar input[type="text"] {
    flex: 1 1 200px;
    min-width: 180px;
    max-width: 320px;
}

.filter-bar select {
    flex: 0 1 auto;
}

.filter-bar .btn, .filters .btn {
    min-height: 2.625rem;
    align-self: center;
}

.filters input:focus, .filters select:focus, .filter-bar input:focus, .filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
}

/* ─── Alerts ─── */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid;
    animation: slideDown 0.3s ease;
}

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

.alert-success { background: var(--success-light); color: #065f46; border-color: var(--success); }
.alert-error { background: var(--danger-light); color: #991b1b; border-color: var(--danger); }

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: #e2e8f0;
    color: #475569;
}

.badge-success { background: #d1fae5; color: #047857; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-muted { background: #f1f5f9; color: #64748b; }

/* ─── Detail views ─── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }

.detail-list {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 0.5rem 1.25rem;
    margin: 0;
}

.detail-list dt { font-weight: 600; font-size: 0.82rem; color: var(--text-muted); }
.detail-list dd { margin: 0; font-size: 0.9rem; color: var(--text); }

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.image-grid img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition);
}

.image-grid img:hover { transform: scale(1.02); }
.image-grid figcaption { font-size: 0.75rem; text-align: center; margin-top: 0.35rem; color: var(--text-muted); font-weight: 500; }

.qr-preview { max-width: 160px; margin-top: 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); }

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

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

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}
.empty-state svg { width: 3rem; height: 3rem; margin-bottom: 1rem; opacity: 0.4; }

/* ─── Reports ─── */
.report-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}
.report-row:last-child { border-bottom: none; }
.report-row:hover { background: #f8fafc; margin: 0 -1.5rem; padding-left: 1.5rem; padding-right: 1.5rem; }
.report-row span:not(.report-icon) { flex: 1; min-width: 200px; font-weight: 500; font-size: 0.9rem; }
.report-row input,
.report-row select {
    min-height: 2.375rem;
    padding: 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.85rem;
    background: var(--border-light);
}
.report-row .btn { flex-shrink: 0; margin-left: auto; }

.report-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.report-icon svg { width: 1.15rem; height: 1.15rem; }

/* ─── Label page ─── */
.label-page { text-align: center; padding: 2rem; }
.label-card { display: inline-block; border: 2px solid #000; padding: 1.5rem; margin-bottom: 1rem; border-radius: var(--radius-sm); }
.label-qr { width: 200px; height: 200px; }
.pdf-thumb { width: 100%; height: 120px; display: flex; align-items: center; justify-content: center; background: var(--border-light); border-radius: var(--radius-sm); font-weight: 700; color: var(--text-muted); }

/* ─── Login page ─── */
.login-page {
    margin: 0;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: #fff;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    min-height: 100vh;
}

.login-aside {
    background: linear-gradient(160deg, #0a1628 0%, #0f2744 40%, #0d9b7a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.login-aside::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 150%;
    background: radial-gradient(ellipse, rgba(20, 184, 166, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.login-aside::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -20%;
    width: 60%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.login-aside-inner {
    max-width: 24rem;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

.login-aside-logo {
    display: block;
    margin: 0 auto 1.5rem;
    max-width: 5rem;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.login-aside-kicker {
    margin: 0 0 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #5eead4;
}

.login-aside-title {
    margin: 0 0 0.85rem;
    font-size: 1.85rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.login-aside-text {
    margin: 0;
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.65;
    font-weight: 500;
}

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: #fafbfc;
}

.login-card {
    width: 100%;
    max-width: 26rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem 2rem;
    box-shadow: var(--shadow-lg);
}

.login-heading {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.login-lede {
    margin: 0 0 1.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.login-form .form-group { margin-bottom: 1.15rem; }

.login-form .form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-form .form-group input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--border-light);
    transition: all var(--transition);
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
}

.login-password-wrap { position: relative; }
.login-password-wrap input { padding-right: 2.75rem; }

.login-password-toggle {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color var(--transition);
}
.login-password-toggle:hover { color: var(--text); }

.btn-login {
    width: 100%;
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, #0a7d63 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    margin-top: 0.5rem;
    box-shadow: 0 4px 14px var(--primary-glow);
    transition: all var(--transition);
}
.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #086b54 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

/* ─── Asset detail page ─── */
.asset-detail-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.asset-detail-toolbar-left { display: flex; align-items: center; gap: 0.85rem; }
.asset-detail-toolbar-left h1 { margin: 0; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.asset-detail-toolbar-right { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.asset-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.25rem;
    align-items: start;
}

.asset-main-card {
    padding: 0;
    overflow: hidden;
}

.asset-main-card .asset-hero {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

.asset-main-card .asset-tabs {
    border-radius: 0;
    margin: 0;
}

.asset-main-card .asset-tab-panels {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.overview-panel h3,
.overview-section h3 {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.overview-section {
    margin-bottom: 1.75rem;
}

.overview-section:last-child { margin-bottom: 0; }

.overview-timeline .timeline-list.full li:first-child { padding-top: 0; }

.condition-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #d1fae5;
    color: #047857;
}

.condition-badge.is-warning { background: #fef3c7; color: #b45309; }
.condition-badge.is-danger { background: #fee2e2; color: #b91c1c; }

.asset-hero {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
}

.asset-hero-media { display: flex; flex-direction: column; gap: 0.85rem; }

.asset-hero-img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--border-light);
    box-shadow: var(--shadow-sm);
}

.asset-hero-placeholder {
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-light);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
}

.asset-hero-qr {
    text-align: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--border-light);
    transition: all var(--transition);
}
.asset-hero-qr:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.asset-hero-qr img { width: 72px; height: 72px; display: block; margin: 0 auto 0.3rem; }

.asset-hero-title { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.15rem; }
.asset-hero-title h2 { margin: 0; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }

.asset-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem 1.25rem;
}

.asset-meta-grid label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
    font-weight: 600;
}

.asset-meta-grid span, .asset-meta-grid strong { font-size: 0.9rem; font-weight: 500; }

.asset-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    margin: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 0.5rem;
    background: var(--border-light);
    border-radius: var(--radius) var(--radius) 0 0;
}

.asset-tab {
    padding: 0.75rem 1.15rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.asset-tab:hover { color: var(--text); text-decoration: none; background: rgba(255,255,255,0.5); }
.asset-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); background: var(--surface); }

.asset-tab-panels {
    padding: 1.5rem;
    margin-top: 0;
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.asset-thumb-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.85rem; margin-bottom: 1.25rem; }
.asset-thumb-row.large { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.asset-thumb-row img {
    width: 100%;
    height: 105px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.asset-thumb-row figcaption { font-size: 0.72rem; text-align: center; margin-top: 0.3rem; color: var(--text-muted); font-weight: 500; }

.timeline-list { list-style: none; margin: 0; padding: 0; }
.timeline-list.compact li { padding: 0.4rem 0; display: flex; gap: 0.6rem; font-size: 0.875rem; }
.timeline-list.full li { display: flex; gap: 0.85rem; padding: 0.85rem 0; border-bottom: 1px solid var(--border-light); }
.timeline-list.full li:last-child { border-bottom: none; }
.timeline-list.full .tl-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--primary); margin-top: 0.4rem; flex-shrink: 0; box-shadow: 0 0 8px var(--primary-glow); }
.timeline-list.full time { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.timeline-list.full p { margin: 0.2rem 0 0; font-size: 0.9rem; }

.asset-detail-aside {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: calc(var(--topbar-h) + 1.25rem);
}

.aside-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    box-shadow: var(--shadow);
}

.aside-card h3 { margin: 0 0 0.85rem; font-size: 0.9rem; font-weight: 700; letter-spacing: -0.01em; }

.quick-info-list { margin: 0; }
.quick-info-list dt { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.55rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.quick-info-list dt:first-child { margin-top: 0; }
.quick-info-list dd { margin: 0.15rem 0 0; font-size: 0.9rem; font-weight: 500; }

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-item { padding: 0.55rem 0.75rem; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 500; margin-bottom: 0.45rem; }
.alert-item.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-item.alert-danger { background: var(--danger-light); color: #991b1b; }
.alert-item.alert-info { background: var(--info-light); color: #1e40af; }

.action-list { display: flex; flex-direction: column; gap: 0.45rem; }

.action-btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    background: var(--border-light);
    transition: all var(--transition);
}

.action-btn:hover { text-decoration: none; transform: translateX(2px); box-shadow: var(--shadow-sm); }
.action-orange { border-color: #fed7aa; background: #fff7ed; color: #c2410c; }
.action-blue { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.action-green { border-color: #bbf7d0; background: #f0fdf4; color: #047857; }
.action-purple { border-color: #e9d5ff; background: #faf5ff; color: #7c3aed; }
.action-teal { border-color: #99f6e4; background: #f0fdfa; color: #0f766e; }

/* ─── Mobile overlay ─── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 240;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.is-visible { display: block; }

/* ─── Print ─── */
@media print {
    .app-topbar, .app-sidebar, .no-print, .btn, .sidebar-overlay { display: none !important; }
    .container, .app-main { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

@media (max-width: 1100px) {
    .asset-detail-layout { grid-template-columns: 1fr; }
    .asset-detail-aside { position: static; }
    .asset-hero { grid-template-columns: 1fr; }
    .asset-meta-grid { grid-template-columns: repeat(2, 1fr); }
    .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .app-topbar {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "left right"
            "center center";
        row-gap: 0.5rem;
        height: auto;
        min-height: var(--topbar-h);
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
    }
    .app-topbar-left { grid-area: left; }
    .app-topbar-right { grid-area: right; }
    .app-topbar-center {
        grid-area: center;
        justify-self: stretch;
        max-width: none;
    }
    .app-topbar-center .branch-select-wrap { max-width: none; }
}

@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: var(--topbar-h);
        bottom: 0;
        z-index: 250;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .app-sidebar.is-open { transform: translateX(0); }
    .topbar-user-meta { display: none; }
    .detail-list { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; }
    .login-aside { display: none; }
    .asset-meta-grid { grid-template-columns: 1fr; }
    .app-main { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
