:root {
    --green-primary: #2e7d32;
    --green-dark: #1b5e20;
    --green-light: #4caf50;
    --green-bg: #e8f5e9;
    --green-accent: #388e3c;
    --gray-bg: #f0f0f0;
    --gray-light: #f5f5f5;
    --gray-border: #e0e0e0;
    --text-dark: #1a1a1a;
    --text-mid: #555;
    --text-light: #888;
    --white: #ffffff;
    --red: #d32f2f;
    --orange: #f57c00;
    --yellow: #f9a825;
    --blue: #1565c0;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--gray-bg);
    color: var(--text-dark);
    min-height: 100vh;
}

/* NAVBAR */
.navbar {
    background: var(--green-primary);
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

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

.nav-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
    background: white;
    mix-blend-mode: multiply;
}

.brand-name {
    color: white;
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}

.nav-link:hover { background: rgba(255,255,255,0.15); color: white; }
.nav-link.active { background: rgba(255,255,255,0.2); color: white; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background 0.15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.15); color: white; }

/* MAIN CONTENT */
.main-content {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

.page-header .subtitle {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 4px;
}

/* STAT CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-border);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: var(--green-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--green-primary);
    flex-shrink: 0;
}

.stat-icon.orange { background: #fff3e0; color: var(--orange); }
.stat-icon.red { background: #ffebee; color: var(--red); }

.stat-info {}
.stat-label { font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text-dark); line-height: 1; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.15s;
    font-family: 'DM Sans', sans-serif;
}

.btn-primary {
    background: var(--green-primary);
    color: white;
}
.btn-primary:hover { background: var(--green-dark); }

.btn-outline {
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--gray-border);
}
.btn-outline:hover { background: var(--gray-light); }

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* TOOLBAR */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 360px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-box input {
    width: 100%;
    padding: 9px 12px 9px 38px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    font-size: 14px;
    background: white;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.15s;
}
.search-box input:focus { border-color: var(--green-primary); }

select.filter-select {
    padding: 9px 32px 9px 12px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    font-size: 14px;
    background: white;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    cursor: pointer;
    appearance: auto;
    transition: border-color 0.15s;
}
select.filter-select:focus { border-color: var(--green-primary); }

/* TABLE */
.table-wrap {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-border);
    overflow: hidden;
}

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

thead tr {
    background: var(--green-primary);
    color: white;
}

thead th {
    padding: 13px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

tbody tr {
    border-bottom: 1px solid var(--gray-border);
    transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

tbody td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-dark);
}

td.asset-code {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--text-mid);
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
}

.badge-good, .badge-active, .badge-functional { background: var(--green-bg); color: var(--green-primary); border-color: #c8e6c9; }
.badge-fair { background: #fff8e1; color: #856404; border-color: #ffe082; }
.badge-poor, .badge-high { background: #ffebee; color: var(--red); border-color: #ffcdd2; }
.badge-medium { background: #fff3e0; color: var(--orange); border-color: #ffcc80; }
.badge-low { background: var(--green-bg); color: var(--green-primary); border-color: #c8e6c9; }
.badge-open { background: #f5f5f5; color: #555; border-color: #ddd; }
.badge-in-progress { background: #e3f2fd; color: var(--blue); border-color: #bbdefb; }
.badge-resolved { background: var(--green-bg); color: var(--green-primary); border-color: #c8e6c9; }
.badge-closed { background: #f5f5f5; color: #888; border-color: #ddd; }
.badge-created { background: var(--green-bg); color: var(--green-primary); border-color: #c8e6c9; }
.badge-updated { background: #fff8e1; color: #856404; border-color: #ffe082; }
.badge-issued { background: #e3f2fd; color: var(--blue); border-color: #bbdefb; }
.badge-returned { background: #f3e5f5; color: #7b1fa2; border-color: #e1bee7; }
.badge-inactive { background: #f5f5f5; color: #888; border-color: #ddd; }
.badge-lost { background: #ffebee; color: #b71c1c; border-color: #ffcdd2; }
.badge-transferred { background: #e3f2fd; color: #0d47a1; border-color: #bbdefb; }

.audit-status { display:inline-flex; align-items:center; padding:4px 9px; border-radius:999px; font-size:11px; font-weight:700; border:1px solid transparent; }
.audit-status.draft { background:#f5f5f5; color:#616161; border-color:#ddd; }
.audit-status.active { background:#e8f5e9; color:#1b5e20; border-color:#a5d6a7; }
.audit-status.completed { background:#fff8e1; color:#8a5b00; border-color:#ffe082; }
.audit-status.finalized { background:#e3f2fd; color:#0d47a1; border-color:#90caf9; }
.audit-status.archived { background:#eceff1; color:#455a64; border-color:#cfd8dc; }

/* ACTION ICONS */
.action-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 5px;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}
.icon-btn:hover { background: var(--gray-light); color: var(--text-dark); }
.icon-btn.delete:hover { background: #ffebee; color: var(--red); }

/* SCAN HISTORY TABLE */
.scan-table-wrap {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-border);
    overflow: hidden;
}

.scan-table-header {
    background: var(--green-primary);
    color: white;
    padding: 14px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 40px 16px;
}
.modal-overlay.open { display: flex; }

/* Prevent the page behind a dialog from scrolling while the dialog is open. */
body.dialog-open { overflow: hidden; }

.modal-overlay[aria-busy="true"] .modal {
    cursor: progress;
}

.modal-overlay[aria-busy="true"] .modal-close,
.modal-overlay[aria-busy="true"] .modal-footer button[type="button"] {
    cursor: not-allowed;
    opacity: .55;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 32px);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
    display: flex;
    flex-direction: column;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h3 { font-size: 18px; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}
.modal-close:hover { background: var(--gray-light); color: var(--text-dark); }

/* Forms inside modals must participate in the modal flex layout.
   Without this, tall forms (such as Bulk Add) can push the footer outside
   the dialog instead of making only the body scroll. */
.modal > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-border); display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0; }

/* QR CODE IN MODAL */
.qr-display {
    text-align: center;
    padding: 16px;
    background: var(--gray-light);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.qr-display img { width: 160px; height: 160px; }
.qr-display .qr-code-text {
    margin-top: 8px;
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: var(--green-primary);
    font-weight: 600;
}

/* FORM */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-mid); }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.15s;
    background: white;
    color: var(--text-dark);
}
.form-control:focus { border-color: var(--green-primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* BULK ADD — quantity selector */
.bulk-only { display: none; }
#add-modal.bulk-mode .bulk-only { display: block; }

.item-entry { padding-top: 4px; }

.qty-selector { display: flex; align-items: center; gap: 10px; }
.qty-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.qty-btn:hover { background: #f2f7f2; border-color: var(--green-primary); }
.qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.qty-btn:disabled:hover { background: white; border-color: var(--gray-border); }
#add-quantity {
    width: 72px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 700;
}

/* BULK ADD — validation error highlighting */
.item-entry.has-error {
    border-left: 3px solid #c0392b;
    padding-left: 13px;
    margin-left: -16px;
    background: #fff6f5;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.item-entry-error { color: #c0392b; font-size: 12.5px; font-weight: 600; margin: -2px 0 12px; }
.item-entry-error:empty { display: none; margin: 0; }
.form-control.field-error { border-color: #c0392b; background: #fff6f5; }

/* LOGIN PAGE */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-bg);
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--gray-light);
    display: block;
}

.login-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: var(--text-light); font-size: 14px; margin-bottom: 28px; }

.login-form { text-align: left; }

.login-input-group { margin-bottom: 16px; }
.login-input-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-mid); }

.input-icon-wrap { position: relative; }
.input-icon-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); }
.input-icon-wrap input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    background: var(--gray-light);
    outline: none;
    transition: border-color 0.15s;
}
.input-icon-wrap input:focus { border-color: var(--green-primary); background: white; }

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--green-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.15s;
    margin-top: 8px;
}
.login-btn:hover { background: var(--green-dark); }

.login-footer { margin-top: 20px; font-size: 13px; color: var(--text-light); }

.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.alert-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.alert-error { background: #ffebee; color: var(--red); border: 1px solid #ffcdd2; }
.alert-success { background: var(--green-bg); color: var(--green-primary); border: 1px solid #c8e6c9; }
.alert-undo-form { margin: 0; }
.alert-undo-btn {
    background: none;
    border: none;
    border-bottom: 1px solid currentColor;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: inherit;
    padding: 0;
    font-family: 'DM Sans', sans-serif;
}
.alert-undo-btn:hover { opacity: 0.75; }
.alert-undo-btn:disabled {
    cursor: default;
    opacity: 0.45;
    border-bottom-style: dotted;
}
.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    color: inherit;
    opacity: 0.6;
    flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }

/* REPORTS */
.report-section {
    margin-bottom: 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-border);
    overflow: hidden;
}

.report-section-header {
    background: var(--green-primary);
    color: white;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 14px;
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

/* TOOLTIP / CONFIRM */
.confirm-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
.confirm-dialog.open { display: flex; }
.confirm-box {
    background: white;
    border-radius: 10px;
    padding: 28px;
    max-width: 360px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.confirm-box h4 { font-size: 18px; margin-bottom: 8px; }
.confirm-box p { color: var(--text-mid); font-size: 14px; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* RESPONSIVE IMAGES (global safety net) */
img { max-width: 100%; height: auto; }

/* Prevent any accidental horizontal scroll site-wide */
html, body { max-width: 100%; overflow-x: hidden; }

/* ── Hamburger toggle button (hidden by default; shown on mobile) ── */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    margin-left: auto;
    flex-shrink: 0;
}
.nav-toggle:hover { background: rgba(255,255,255,0.15); }

/* ===================================================================
   RESPONSIVE BREAKPOINTS
   Mobile:  320px – 767px
   Tablet:  768px – 1023px
   Laptop:  1024px – 1439px
   Desktop: 1440px and above (base styles above already target this)
   =================================================================== */

/* LAPTOPS (1024px–1439px): slightly tighter spacing than desktop */
@media (max-width: 1439px) {
    .main-content { padding: 28px; }
}

/* TABLETS (768px–1023px) */
@media (max-width: 1023px) {
    .main-content { padding: 24px 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-links .nav-link span { display: none; }
    .nav-link { padding: 6px 10px; gap: 0; }
    .nav-brand { margin-right: 8px; }
    .brand-name { font-size: 14px; }
    .form-row { grid-template-columns: 1fr 1fr; gap: 10px; }
    .users-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* MOBILE PHONES (320px–767px) */
@media (max-width: 767px) {
    .main-content { padding: 16px; }

    /* Page header */
    .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
    .page-header h1 { font-size: 22px; }
    .page-header .btn { width: 100%; justify-content: center; }

    /* Stat cards */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; }
    .stat-icon svg { width: 20px; height: 20px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 11px; }

    /* Toolbar / filters */
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-box { max-width: 100%; }
    select.filter-select { width: 100%; }
    .toolbar > div[style*="margin-left:auto"] { margin-left: 0 !important; width: 100%; }
    .toolbar > div[style*="margin-left:auto"] .btn { flex: 1; justify-content: center; }

    /* Tables — allow horizontal scroll instead of squeezing/breaking */
    .table-wrap, .scan-table-wrap, .asset-table-wrap, .room-card,
    .group-units-panel, .report-section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-wrap table, .scan-table-wrap table, .asset-table-wrap table,
    .room-card table {
        min-width: 620px;
    }

    /* Buttons — comfortable tap targets */
    .btn { padding: 10px 16px; }
    .btn-sm { padding: 8px 12px; }
    .icon-btn { padding: 8px; }

    /* Forms */
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .modal-body, .modal-header, .modal-footer { padding-left: 18px; padding-right: 18px; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; justify-content: center; }

    /* Modals — never touch screen edges, never exceed viewport */
    .modal-overlay { padding: 16px; align-items: flex-start; padding-top: 40px; }
    .modal, .modal-lg { max-width: 100%; width: 100%; }
    .confirm-box { max-width: 100%; width: 100%; padding: 22px; }

    /* Login page */
    .login-page { padding: 16px; }
    .login-card { padding: 28px 20px; }

    /* User cards */
    .users-grid { grid-template-columns: 1fr; }

    /* QR modal (defined per-page but shares these class names) */
    .qr-modal-box { width: 100%; max-width: 340px; padding: 28px 20px 22px; }
    .qr-modal-overlay { padding: 16px; }

    /* ── Navbar → hamburger menu ── */
    .navbar {
        flex-wrap: wrap;
        padding: 0 16px;
        height: auto;
        min-height: 56px;
    }
    .nav-toggle { display: flex; }
    .nav-links, .nav-user {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        flex: none;
    }
    .navbar.nav-open .nav-links,
    .navbar.nav-open .nav-user { display: flex; }
    .nav-links {
        order: 4;
        gap: 2px;
        padding: 8px 0 6px;
        border-top: 1px solid rgba(255,255,255,0.15);
        margin-top: 8px;
    }
    .nav-links .nav-link span { display: inline; }
    .nav-link { padding: 10px 12px; font-size: 15px; gap: 10px; }
    .nav-user {
        order: 5;
        margin-left: 0;
        gap: 8px;
        padding-bottom: 12px;
    }
    .user-info { padding: 6px 12px; font-size: 13px; }
    .logout-btn { padding: 8px 12px; }
}

/* Ensure hamburger is hidden and full nav restored from tablet width up */
@media (min-width: 768px) {
    .nav-toggle { display: none; }
    .nav-links, .nav-user { display: flex; }
}

@media print {
    .navbar, .toolbar, .btn, .action-btns { display: none !important; }
    .main-content { padding: 0; }
}

/* ── LOGO FIX (black bg removal via mix-blend-mode) ── */
.nav-logo-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    mix-blend-mode: multiply;
}
.login-logo-wrap {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    border: 3px solid #e0e0e0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.login-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

/* ── ROLE BADGE ── */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-left: 4px;
    vertical-align: middle;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.9);
    font-size: 13px;
}

/* ── USERS PAGE ── */
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 8px; }
.user-card {
    background: white;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}
.user-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: white; flex-shrink: 0;
}
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.user-card-username { font-size: 12px; color: var(--text-light); font-family: 'DM Mono', monospace; }
.user-card-actions { display: flex; gap: 6px; margin-top: 10px; }
.badge-admin  { background: #c8e6c9; color: #1b5e20; border-color: #a5d6a7; }
.badge-staff  { background: #bbdefb; color: #0d47a1; border-color: #90caf9; }
.badge-viewer { background: #ffe0b2; color: #bf360c; border-color: #ffcc80; }
.badge-inactive-user { background: #f5f5f5; color: #888; border-color: #ddd; }

/* ── PERMISSION LOCK NOTICE ── */
.perm-notice {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff8e1; color: #856404; border: 1px solid #ffe082;
    border-radius: 6px; padding: 6px 12px; font-size: 13px; margin-bottom: 16px;
}

/* ── ASSET VALUE ── */
.input-peso-wrap { position: relative; display: flex; align-items: center; }
.peso-sign {
    position: absolute; left: 12px;
    font-weight: 600; color: var(--text-mid); font-size: 14px; pointer-events: none; z-index: 1;
}
.peso-input { padding-left: 28px !important; }

.asset-value-cell { white-space: nowrap; }
.value-tag {
    display: inline-block; background: #e8f5e9; color: #1b5e20;
    border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600;
}
.value-empty { color: #ccc; font-size: 13px; }

/* ── LARGER MODAL ── */
.modal-lg { max-width: 600px; }

/* ── PERM NOTICE ── */
.perm-notice {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff8e1; color: #856404; border: 1px solid #ffe082;
    border-radius: 6px; padding: 8px 14px; font-size: 13px;
}

/* ── FORM required star ── */
.req { color: #c62828; }

/* ── STATUS GROUP HEADERS ── */
.status-group-header td {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: #f8f9fa;
    border-top: 2px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}
.status-group-header:first-child td { border-top: none; }
.status-group-count {
    margin-left: 8px;
    color: #888;
    font-weight: 400;
    font-size: 12px;
}

/* ── Group-related ──────────────────────────────────────── */
.icon-btn.qr { color: #1565c0; }
.icon-btn.qr:hover { background: #e3f2fd; color: #0d47a1; }


/* ===================================================================
   EPCST iTrack UI Refresh
   Shared professional application shell and component refinements
   =================================================================== */
:root {
    --green-primary: #2e7d32;
    --green-dark: #1b5e20;
    --green-deep: #123f24;
    --green-soft: #edf7ef;
    --surface: #ffffff;
    --surface-soft: #f8faf9;
    --page-bg: #f3f6f4;
    --gray-border: #dfe6e1;
    --text-dark: #17211b;
    --text-mid: #526057;
    --text-light: #7b877f;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 1px 2px rgba(22, 45, 29, 0.04), 0 6px 18px rgba(22, 45, 29, 0.06);
    --shadow-lg: 0 18px 48px rgba(10, 35, 20, 0.18);
    --sidebar-width: 264px;
    --topbar-height: 68px;
}

html { background: var(--page-bg); }
body {
    background: var(--page-bg);
    color: var(--text-dark);
    line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(46, 125, 50, 0.20);
    outline-offset: 2px;
}

/* Application shell */
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    z-index: 500;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #174d2c 0%, #103c22 100%);
    color: #fff;
    box-shadow: 8px 0 28px rgba(18, 63, 36, 0.10);
}
.sidebar-brand {
    min-height: 78px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
}
.sidebar-brand .nav-logo-wrap {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}
.sidebar-brand .nav-logo { width: 40px; height: 40px; }
.sidebar-brand-copy { min-width: 0; display: flex; flex-direction: column; }
.sidebar .brand-name { font-size: 16px; line-height: 1.2; letter-spacing: -0.01em; }
.brand-subtitle {
    margin-top: 3px;
    color: rgba(255,255,255,0.62);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}
.sidebar-close {
    display: none;
    margin-left: auto;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,.78);
    padding: 7px;
    border-radius: 8px;
    cursor: pointer;
}
.sidebar-close:hover { background: rgba(255,255,255,.10); color: #fff; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 24px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.nav-section + .nav-section { margin-top: 15px; }
.nav-section-label {
    padding: 0 11px 7px;
    color: rgba(255,255,255,.46);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}
.sidebar .nav-link {
    width: 100%;
    min-height: 42px;
    padding: 10px 11px;
    border-radius: 10px;
    gap: 11px;
    color: rgba(255,255,255,.78);
    font-size: 13.5px;
    font-weight: 600;
}
.sidebar .nav-link svg { flex: 0 0 auto; opacity: .88; }
.sidebar .nav-link:hover {
    background: rgba(255,255,255,.09);
    color: #fff;
    transform: translateX(1px);
}
.sidebar .nav-link.active {
    background: #fff;
    color: var(--green-dark);
    box-shadow: 0 6px 16px rgba(0,0,0,.13);
}
.sidebar .nav-link.active svg { opacity: 1; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.10);
    background: rgba(0,0,0,.06);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px;
    border-radius: 12px;
    background: rgba(255,255,255,.07);
}
.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.17);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}
.sidebar-user-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; }
.sidebar-user-name {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}
.sidebar-user .role-badge { margin: 4px 0 0; font-size: 9px; padding: 2px 7px; }
.sidebar-logout {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    color: rgba(255,255,255,.72);
    flex: 0 0 auto;
}
.sidebar-logout:hover { background: rgba(255,255,255,.12); color: #fff; }

.app-workspace {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    min-width: 0;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 300;
    min-height: var(--topbar-height);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--gray-border);
    backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar-kicker {
    color: var(--text-light);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.topbar-title {
    color: var(--text-dark);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-user { display: flex; align-items: center; gap: 9px; }
.topbar-user-name { color: var(--text-mid); font-size: 13px; font-weight: 600; }
.topbar-user .role-badge { margin: 0; }
.topbar .nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--gray-border);
    background: #fff;
    color: var(--text-dark);
    border-radius: 10px;
}
.topbar .nav-toggle:hover { background: var(--surface-soft); color: var(--green-primary); }
.sidebar-backdrop { display: none; }

/* Main content and page hierarchy */
.main-content {
    width: 100%;
    max-width: 1640px;
    margin: 0 auto;
    padding: 30px;
}
.page-header {
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: clamp(24px, 2vw, 30px);
    line-height: 1.15;
    letter-spacing: -0.025em;
}
.page-header .subtitle {
    max-width: 760px;
    margin-top: 7px;
    color: var(--text-light);
    font-size: 13.5px;
    line-height: 1.55;
}

/* Cards and dashboard */
.stats-grid { gap: 14px; margin-bottom: 24px; }
.stat-card {
    position: relative;
    min-height: 118px;
    padding: 20px;
    border: 1px solid #e2e9e4;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat-card::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--green-primary);
    opacity: .85;
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: #d5e1d8;
    box-shadow: 0 2px 4px rgba(22,45,29,.05), 0 12px 28px rgba(22,45,29,.08);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    background: var(--green-soft);
}
.stat-value { font-size: 30px; letter-spacing: -0.04em; }
.stat-label { margin-bottom: 5px; color: var(--text-mid); font-weight: 600; }
.stats-grid .stat-card:nth-child(2) .stat-icon { background: #eef4ff; color: #315fbd; }
.stats-grid .stat-card:nth-child(2)::after { background: #315fbd; }
.stats-grid .stat-card:nth-child(3) .stat-icon { background: #f5efff; color: #7550a8; }
.stats-grid .stat-card:nth-child(3)::after { background: #7550a8; }
.stats-grid .stat-card:nth-child(4) .stat-icon { background: #eaf8f6; color: #187c70; }
.stats-grid .stat-card:nth-child(4)::after { background: #187c70; }
.stats-grid .stat-card:nth-child(5) .stat-icon { background: #fff1ee; color: #bd4d3a; }
.stats-grid .stat-card:nth-child(5)::after { background: #bd4d3a; }
.stats-grid .stat-card:nth-child(6)::after { background: var(--orange); }

/* Buttons */
.btn {
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 10px;
    justify-content: center;
    box-shadow: none;
    transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: var(--green-primary);
    box-shadow: 0 5px 12px rgba(46,125,50,.16);
}
.btn-primary:hover { background: var(--green-dark); box-shadow: 0 7px 16px rgba(46,125,50,.20); }
.btn-outline { border-color: #d6dfd9; color: #344039; }
.btn-outline:hover { background: #f7faf8; border-color: #c7d4cb; }
.btn-danger:hover { background: #b71c1c; }
.btn-sm { min-height: 34px; padding: 7px 12px; }

/* Toolbars and filters */
.toolbar {
    min-height: 58px;
    margin-bottom: 14px;
    padding: 9px;
    gap: 9px;
    background: rgba(255,255,255,.72);
    border: 1px solid #e1e8e3;
    border-radius: 14px;
}
.search-box { max-width: 420px; }
.search-box input,
select.filter-select,
.form-control {
    min-height: 42px;
    border-color: #d8e1db;
    border-radius: 10px;
    background: #fff;
    color: var(--text-dark);
}
.search-box input { padding-left: 40px; }
.search-box input:hover,
select.filter-select:hover,
.form-control:hover { border-color: #c8d5cc; }
.search-box input:focus,
select.filter-select:focus,
.form-control:focus {
    border-color: var(--green-primary);
    box-shadow: 0 0 0 3px rgba(46,125,50,.10);
}
.form-label { color: #445149; font-size: 12.5px; }
textarea.form-control { min-height: 92px; line-height: 1.5; }

/* Tables */
.table-wrap,
.scan-table-wrap,
.report-section {
    border: 1px solid #e0e7e2;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: #fff;
}
.table-wrap,
.scan-table-wrap { overflow-x: auto; }
table { background: #fff; }
thead tr { background: #f7f9f8; color: #3d4a42; }
thead th {
    padding: 12px 15px;
    border-bottom: 1px solid #dde5df;
    color: #536058;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}
tbody tr { border-bottom-color: #edf1ee; }
tbody tr:hover { background: #f8fbf9; }
tbody td { padding: 13px 15px; vertical-align: middle; }
.scan-table-header,
.report-section-header {
    background: #fff;
    color: var(--text-dark);
    border-bottom: 1px solid #e0e7e2;
    padding: 15px 18px;
    font-size: 14px;
}
.scan-table-header svg { color: var(--green-primary); }

/* Badges */
.badge {
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}
.role-badge { font-weight: 700; }

/* Action icons */
.action-btns { gap: 5px; }
.icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 9px;
}

/* Modals and confirmations */
.modal-overlay,
.confirm-dialog { background: rgba(12, 29, 18, .52); backdrop-filter: blur(3px); }
.modal {
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}
.modal-header { padding: 19px 22px 15px; }
.modal-header h3 { letter-spacing: -0.015em; }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 14px 22px 18px; background: #fafcfb; }
.modal-close {
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 9px;
}
.confirm-box { border-radius: 16px; box-shadow: var(--shadow-lg); }

/* Alerts and empty states */
.alert {
    min-height: 44px;
    padding: 11px 14px;
    border-radius: 11px;
    box-shadow: 0 4px 14px rgba(22,45,29,.04);
}
.empty-state { padding: 54px 24px; }
.empty-state p { color: var(--text-mid); }

/* User cards */
.users-grid { gap: 14px; }
.user-card {
    border-color: #e0e7e2;
    border-radius: 14px;
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}
.user-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(22,45,29,.08); }
.user-avatar { border-radius: 13px; }

/* Login polish */
.login-page {
    position: relative;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 20%, rgba(76,175,80,.13), transparent 30%),
        radial-gradient(circle at 80% 80%, rgba(46,125,50,.10), transparent 28%),
        #f3f7f4;
}
.login-card {
    max-width: 420px;
    padding: 38px;
    border: 1px solid #e0e7e2;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(24,68,39,.12);
}
.input-icon-wrap input { min-height: 44px; border-radius: 10px; background: #f8faf9; }
.input-icon-wrap input:focus { box-shadow: 0 0 0 3px rgba(46,125,50,.10); }
.login-btn { min-height: 46px; border-radius: 10px; box-shadow: 0 7px 16px rgba(46,125,50,.18); }

/* Responsive shell */
@media (max-width: 1199px) {
    :root { --sidebar-width: 250px; }
    .main-content { padding: 26px 24px; }
    .topbar { padding: 0 24px; }
}

@media (max-width: 1099px) {
    body.sidebar-open { overflow: hidden; }
    .sidebar {
        width: 280px;
        max-width: calc(100vw - 40px);
        transform: translateX(-102%);
        transition: transform .24s ease;
        box-shadow: 18px 0 50px rgba(8,30,17,.26);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-close { display: grid; place-items: center; }
    .app-workspace { margin-left: 0; }
    .topbar .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 450;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        background: rgba(7,24,14,.42);
        opacity: 0;
        visibility: hidden;
        display: block;
        transition: opacity .2s ease, visibility .2s ease;
    }
    body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
}

@media (max-width: 767px) {
    .topbar { min-height: 62px; padding: 0 16px; }
    .topbar-user { display: none; }
    .topbar-kicker { display: none; }
    .topbar-title { font-size: 15px; }
    .main-content { padding: 20px 14px 28px; }
    .page-header { align-items: stretch; flex-direction: column; margin-bottom: 18px; }
    .page-header > .btn,
    .page-header .header-actions { width: 100%; }
    .page-header .header-actions { display: flex; flex-wrap: wrap; }
    .page-header .header-actions .btn { flex: 1 1 auto; }
    .page-header h1 { font-size: 24px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { min-height: 106px; padding: 14px; }
    .toolbar { padding: 8px; }
    .modal-overlay { padding: 14px; padding-top: 24px; }
    .login-card { padding: 30px 22px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 92px; }
    .sidebar { max-width: 88vw; }
}

@media print {
    .sidebar,
    .topbar,
    .sidebar-backdrop { display: none !important; }
    .app-workspace { margin-left: 0 !important; }
    .main-content { max-width: none; padding: 0; }
}

/* ── Inventory Add/Edit modal overflow fix ─────────────────────────────
   TSV previews can substantially increase the form height. Give these
   dialogs a definite viewport-bounded height so the form body, not the
   dialog itself, becomes the scroll container. */
#add-modal .modal,
#edit-modal .modal {
    height: calc(100vh - 32px);
    height: min(860px, calc(100dvh - 32px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
}

#add-modal .modal > form,
#edit-modal .modal > form {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

#add-modal .modal-body,
#edit-modal .modal-body {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

#add-modal .modal-footer,
#edit-modal .modal-footer {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    background: #fafcfb;
}

/* Keep long msinfo32 values inside the modal width. */
#add-modal .tsv-parsed-table,
#edit-modal .tsv-parsed-table {
    table-layout: fixed;
}

#add-modal .tsv-parsed-table td,
#edit-modal .tsv-parsed-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 767px) {
    #add-modal .modal,
    #edit-modal .modal {
        height: calc(100vh - 28px);
        height: calc(100dvh - 28px);
        max-height: calc(100vh - 28px);
        max-height: calc(100dvh - 28px);
    }
}

/* ===================================================================
   EPCST iTrack 2026 design system
   Final shared layer: calm, high-contrast, green-branded SaaS interface
   =================================================================== */
:root {
    --green-primary: #28783b;
    --green-dark: #1b5e2c;
    --green-deep: #0f3621;
    --green-ink: #0d2c1b;
    --green-soft: #edf7ef;
    --green-soft-strong: #dff0e3;
    --surface: #ffffff;
    --surface-soft: #f8faf8;
    --surface-raised: #fcfdfc;
    --page-bg: #f3f6f4;
    --gray-bg: #f3f6f4;
    --gray-light: #f6f8f6;
    --gray-border: #dfe7e1;
    --text-dark: #17221b;
    --text-mid: #536158;
    --text-light: #6f7c73;
    --red: #c93636;
    --orange: #c76513;
    --blue: #2e63b6;
    --radius: 11px;
    --radius-lg: 17px;
    --radius-xl: 24px;
    --shadow: 0 1px 2px rgba(17, 46, 29, .035), 0 8px 24px rgba(17, 46, 29, .045);
    --shadow-md: 0 12px 32px rgba(14, 43, 25, .09);
    --shadow-lg: 0 28px 80px rgba(7, 30, 17, .22);
    --sidebar-width: 272px;
    --topbar-height: 72px;
    --control-height: 44px;
    --condition-functional-fg: #1d6b32;
    --condition-functional-bg: #eaf6ed;
    --condition-functional-border: #b9ddc1;
    --condition-functional-solid: #2e7d32;
    --condition-danger-fg: #ae3030;
    --condition-danger-bg: #fff0f0;
    --condition-danger-border: #edc0c0;
    --condition-danger-solid: #c93636;
    --condition-repair-fg: #8a4b08;
    --condition-repair-bg: #fff4df;
    --condition-repair-border: #edcf92;
    --condition-repair-solid: #d48700;
    --condition-disposal-fg: #5d6961;
    --condition-disposal-bg: #f2f5f3;
    --condition-disposal-border: #d5ded7;
    --condition-disposal-solid: #6f7c73;
    --condition-transfer-fg: #245c9b;
    --condition-transfer-bg: #edf4fc;
    --condition-transfer-border: #bdd2e9;
    --condition-transfer-solid: #2e63b6;
}

html {
    color-scheme: light;
    background: var(--page-bg);
    scroll-behavior: smooth;
}

body {
    color: var(--text-dark);
    background: var(--page-bg);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection { color: #fff; background: rgba(40, 120, 59, .88); }

a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

.app-body {
    background:
        radial-gradient(circle at 94% 2%, rgba(40, 120, 59, .045), transparent 23rem),
        var(--page-bg);
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 12px;
    z-index: 99999;
    padding: 10px 14px;
    border-radius: 9px;
    color: #fff;
    background: var(--green-deep);
    box-shadow: var(--shadow-md);
    transform: translateY(-160%);
    transition: transform .16s ease;
}
.skip-link:focus { transform: translateY(0); }

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid rgba(40, 120, 59, .24);
    outline-offset: 2px;
}

/* Login */
.login-body {
    min-height: 100vh;
    overflow-y: auto;
    background: #102c1d;
}
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: url('/assets/school_building.png') center / cover no-repeat;
    transform: scale(1.015);
}
.login-bg::before,
.login-bg::after {
    content: '';
    position: absolute;
    inset: 0;
}
.login-bg::before {
    background:
        linear-gradient(112deg, rgba(7, 34, 18, .86) 0%, rgba(10, 42, 24, .70) 47%, rgba(7, 26, 18, .62) 100%);
}
.login-bg::after {
    background:
        radial-gradient(circle at 20% 20%, rgba(126, 207, 134, .15), transparent 28rem),
        linear-gradient(180deg, rgba(4, 18, 11, .06), rgba(4, 18, 11, .38));
    backdrop-filter: saturate(.88);
}
.login-page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 34px;
    background: transparent;
}
.login-shell {
    width: min(1120px, 100%);
    min-height: min(690px, calc(100vh - 68px));
    display: grid;
    grid-template-columns: minmax(0, 1.13fr) minmax(390px, .87fr);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .30);
    border-radius: 28px;
    background: rgba(255, 255, 255, .12);
    box-shadow: 0 34px 100px rgba(2, 18, 9, .38);
    backdrop-filter: blur(18px);
}
.login-story {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(42px, 6vw, 72px);
    color: #fff;
    background:
        linear-gradient(145deg, rgba(10, 52, 28, .56), rgba(15, 54, 34, .12)),
        linear-gradient(180deg, transparent 50%, rgba(5, 25, 14, .32));
}
.login-story::before {
    content: '';
    position: absolute;
    z-index: -1;
    width: 330px;
    height: 330px;
    right: -165px;
    top: -130px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    box-shadow: 0 0 0 58px rgba(255,255,255,.025), 0 0 0 116px rgba(255,255,255,.018);
}
.login-story-inner { margin-top: auto; margin-bottom: auto; }
.login-eyebrow,
.page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.login-eyebrow { color: rgba(255, 255, 255, .72); }
.login-eyebrow::before {
    content: '';
    width: 23px;
    height: 1px;
    background: currentColor;
}
.login-story h1 {
    max-width: 610px;
    margin: 0;
    color: #fff;
    font-size: clamp(38px, 4.4vw, 62px);
    font-weight: 650;
    line-height: 1.04;
    letter-spacing: -.045em;
}
.login-story-inner > p {
    max-width: 520px;
    margin-top: 24px;
    color: rgba(255, 255, 255, .76);
    font-size: 16px;
    line-height: 1.7;
}
.login-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 30px;
}
.login-feature-list span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    color: rgba(255,255,255,.84);
    background: rgba(255,255,255,.075);
    font-size: 11.5px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}
.login-feature-list span::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8fd798;
    box-shadow: 0 0 0 3px rgba(143, 215, 152, .12);
}
.login-story-caption {
    color: rgba(255,255,255,.54);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.login-panel {
    display: grid;
    place-items: center;
    padding: 38px;
    background: rgba(252, 254, 252, .965);
    border-left: 1px solid rgba(255,255,255,.44);
}
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: left;
}
.login-brand-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 18px;
}
.login-logo-wrap {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    display: grid;
    place-items: center;
    overflow: hidden;
    margin: 0;
    border: 1px solid #dce7de;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(16, 58, 31, .10);
}
.login-logo {
    width: 58px;
    height: 58px;
    margin: 0;
    border: 0;
    border-radius: 16px;
    object-fit: contain;
    mix-blend-mode: multiply;
}
.login-brand-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--green-primary);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}
.login-title {
    margin: 0;
    color: var(--text-dark);
    font-size: 25px;
    line-height: 1.16;
    letter-spacing: -.03em;
}
.login-sub {
    margin: 0 0 29px;
    color: var(--text-light);
    font-size: 13.5px;
}
.login-form { text-align: left; }
.login-input-group { margin-bottom: 17px; }
.login-input-group label {
    display: block;
    margin-bottom: 7px;
    color: #3f4b43;
    font-size: 12.5px;
    font-weight: 650;
}
.input-icon-wrap { position: relative; }
.input-icon-wrap svg {
    position: absolute;
    left: 14px;
    top: 50%;
    z-index: 1;
    color: #87938b;
    transform: translateY(-50%);
    pointer-events: none;
    transition: color .16s ease;
}
.input-icon-wrap:focus-within svg { color: var(--green-primary); }
.input-icon-wrap input {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px 11px 43px;
    border: 1px solid #d6dfd8;
    border-radius: 12px;
    outline: 0;
    color: var(--text-dark);
    background: #fff;
    font-size: 14px;
    box-shadow: 0 1px 1px rgba(16, 48, 27, .025);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.input-icon-wrap input::placeholder { color: #9aa49d; }
.input-icon-wrap input:hover { border-color: #c3cec6; }
.input-icon-wrap input:focus {
    border-color: var(--green-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(40,120,59,.10), 0 5px 14px rgba(17,56,31,.06);
}
.login-btn {
    width: 100%;
    min-height: 49px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 10px;
    padding: 12px 18px;
    border: 1px solid rgba(13, 66, 30, .15);
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #2d8241, #1b642f);
    box-shadow: 0 10px 22px rgba(36, 112, 53, .19), inset 0 1px rgba(255,255,255,.15);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.login-btn:hover { filter: brightness(1.03); transform: translateY(-1px); box-shadow: 0 13px 26px rgba(36,112,53,.23); }
.login-btn:active { transform: translateY(0); }
.login-error { margin: -5px 0 22px; }
.login-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 25px;
    color: #7c8880;
    font-size: 11.5px;
}
.login-footer > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #54a968;
    box-shadow: 0 0 0 3px rgba(84,169,104,.12);
}

/* Application shell */
.app-shell { min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width);
    isolation: isolate;
    overflow: hidden;
    background:
        radial-gradient(circle at 16% 0%, rgba(113,188,121,.12), transparent 17rem),
        linear-gradient(180deg, #133f27 0%, #0d311e 100%);
    border-right: 1px solid rgba(255,255,255,.06);
    box-shadow: 10px 0 34px rgba(10, 43, 24, .075);
}
.sidebar::after {
    content: '';
    position: absolute;
    inset: auto -80px -120px auto;
    z-index: -1;
    width: 280px;
    height: 280px;
    border: 1px solid rgba(255,255,255,.045);
    border-radius: 50%;
    box-shadow: 0 0 0 54px rgba(255,255,255,.016), 0 0 0 108px rgba(255,255,255,.012);
}
.sidebar-brand {
    min-height: 84px;
    padding: 17px 18px;
    border-bottom-color: rgba(255,255,255,.075);
}
.sidebar-brand .nav-logo-wrap {
    width: 45px;
    height: 45px;
    border-color: rgba(255,255,255,.30);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,.15);
}
.sidebar-brand .nav-logo { width: 43px; height: 43px; border-radius: 13px; }
.sidebar .brand-name { font-size: 16px; letter-spacing: -.02em; }
.brand-subtitle { margin-top: 4px; color: rgba(255,255,255,.52); font-size: 9.5px; }
.sidebar-nav { padding: 16px 12px 25px; }
.nav-section + .nav-section { margin-top: 17px; }
.nav-section-label {
    padding: 0 11px 7px;
    color: rgba(255,255,255,.40);
    font-size: 9.5px;
    letter-spacing: .14em;
}
.sidebar .nav-link {
    position: relative;
    min-height: 43px;
    margin: 2px 0;
    padding: 10px 11px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: rgba(255,255,255,.70);
    font-size: 13.5px;
    font-weight: 550;
    transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
}
.sidebar .nav-link svg { width: 18px; height: 18px; opacity: .82; }
.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.075);
    border-color: rgba(255,255,255,.045);
    transform: none;
}
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.13);
    border-color: rgba(255,255,255,.10);
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 7px 18px rgba(0,0,0,.10);
}
.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #91d49b;
    box-shadow: 0 0 12px rgba(145,212,155,.40);
}
.sidebar .nav-notification-badge {
    flex: 0 0 auto;
    min-width: 20px;
    height: 20px;
    margin-left: auto;
    margin-inline-start: auto;
    padding: 0 5px;
    border: 1px solid rgba(255,255,255,.58);
    border-radius: 999px;
    color: #fff;
    background: #c73743;
    box-shadow: 0 3px 9px rgba(0,0,0,.20);
    font-size: 10px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
    line-height: 1;
}
.sidebar .nav-link:hover .nav-notification-badge {
    background: #ad2934;
    border-color: rgba(255,255,255,.78);
}
.sidebar .nav-link.active .nav-notification-badge {
    color: #942626;
    background: #fff;
    border-color: #fff;
}
@media (forced-colors: active) {
    .sidebar .nav-notification-badge {
        color: ButtonText;
        background: ButtonFace;
        border-color: ButtonText;
    }
}
.sidebar-footer {
    padding: 13px 12px 14px;
    border-top-color: rgba(255,255,255,.075);
    background: rgba(0,0,0,.055);
}
.sidebar-user {
    min-height: 60px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 14px;
    background: rgba(255,255,255,.055);
}
.sidebar-user-avatar {
    position: relative;
    width: 39px;
    height: 39px;
    border-radius: 12px;
    background: rgba(255,255,255,.13);
}
.sidebar-user-avatar::after {
    content: '';
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 9px;
    height: 9px;
    border: 2px solid #123b24;
    border-radius: 50%;
    background: #72ce83;
}
.sidebar-user-name { font-size: 12.5px; }
.sidebar-logout { border-radius: 10px; }

.app-workspace { margin-left: var(--sidebar-width); }
.topbar {
    min-height: var(--topbar-height);
    padding: 0 32px;
    background: rgba(255,255,255,.88);
    border-bottom-color: rgba(215,224,217,.88);
    box-shadow: 0 1px rgba(255,255,255,.55);
    backdrop-filter: blur(18px) saturate(1.08);
}
.topbar-title-wrap { gap: 1px; }
.topbar-kicker { color: #849087; font-size: 9.5px; letter-spacing: .12em; }
.topbar-title { font-size: 16px; letter-spacing: -.018em; }
.topbar-user {
    min-width: 0;
    gap: 10px;
    padding: 6px 8px 6px 7px;
    border: 1px solid #e2e8e3;
    border-radius: 13px;
    background: rgba(255,255,255,.72);
}
.topbar-user-avatar {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(145deg, #3b8d4d, #236c37);
    box-shadow: inset 0 1px rgba(255,255,255,.16);
    font-size: 12px;
    font-weight: 700;
}
.topbar-user-meta { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.topbar-user-name { max-width: 180px; overflow: hidden; color: #344138; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user .role-badge { margin-top: 3px; padding: 0; border: 0; background: transparent !important; font-size: 9px; }
.topbar .nav-toggle {
    width: 40px;
    height: 40px;
    border-color: #dbe4dd;
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(18,48,28,.04);
}

.main-content {
    max-width: 1580px;
    padding: 32px;
}
.page-header {
    min-height: 56px;
    margin-bottom: 24px;
    align-items: center;
}
.page-header h1 {
    color: var(--text-dark);
    font-size: clamp(25px, 2vw, 31px);
    font-weight: 680;
    letter-spacing: -.035em;
}
.page-header .subtitle { margin-top: 6px; color: var(--text-light); line-height: 1.55; }
.page-eyebrow { margin-bottom: 10px; color: var(--green-primary); }
.header-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* Shared surfaces and controls */
.stat-card,
.user-card,
.table-wrap,
.scan-table-wrap,
.report-section,
.modal,
.confirm-box {
    border-color: var(--gray-border);
    background: var(--surface);
}
.stat-card,
.user-card,
.table-wrap,
.scan-table-wrap,
.report-section { box-shadow: var(--shadow); }
.stats-grid { gap: 15px; margin-bottom: 25px; }
.stat-card {
    min-height: 124px;
    padding: 21px;
    border-radius: var(--radius-lg);
}
.stat-card::after { inset: 0 auto 0 0; width: 3px; height: auto; opacity: .72; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 47px;
    height: 47px;
    border: 1px solid rgba(40,120,59,.08);
    border-radius: 14px;
}
.stat-icon svg { width: 23px; height: 23px; }
.stat-label { color: var(--text-light); font-size: 12px; font-weight: 600; line-height: 1.35; }
.stat-value { color: #132019; font-size: 31px; font-weight: 680; letter-spacing: -.045em; }

.btn {
    min-height: 41px;
    gap: 7px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    transition: color .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.btn-primary {
    border-color: #236c36;
    background: linear-gradient(180deg, #2d8141, #28763a);
    box-shadow: 0 5px 13px rgba(40,120,59,.15), inset 0 1px rgba(255,255,255,.14);
}
.btn-primary:hover { background: linear-gradient(180deg, #28763a, #226733); box-shadow: 0 8px 18px rgba(40,120,59,.20); }
.btn-outline {
    border-color: #d5dfd7;
    color: #354239;
    background: #fff;
    box-shadow: 0 1px 2px rgba(18,48,28,.025);
}
.btn-outline:hover { border-color: #bdcec1; color: var(--green-dark); background: #f7faf7; }
.btn-danger { border-color: #bd3030; background: #c93636; }
.btn-danger:hover { background: #ad2b2b; }
.btn-sm { min-height: 34px; padding: 7px 11px; font-size: 12px; }
.btn:disabled, .icon-btn:disabled { cursor: not-allowed; opacity: .5; transform: none; }

.toolbar {
    min-height: 62px;
    padding: 10px;
    gap: 9px;
    border: 1px solid #e0e7e2;
    border-radius: 15px;
    background: rgba(255,255,255,.76);
    box-shadow: 0 1px 2px rgba(18,48,28,.025);
    backdrop-filter: blur(8px);
}
.search-box { max-width: 440px; }
.search-box svg { left: 14px; color: #7d8981; }
.search-box input,
select.filter-select,
.form-control,
.picker-group select {
    min-height: var(--control-height);
    border: 1px solid #d6e0d8;
    border-radius: 10px;
    color: var(--text-dark);
    background: #fff;
    box-shadow: 0 1px 1px rgba(20,50,31,.02);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.search-box input::placeholder,
.form-control::placeholder { color: #98a29b; }
.search-box input:hover,
select.filter-select:hover,
.form-control:hover,
.picker-group select:hover { border-color: #c3d0c6; }
.search-box input:focus,
select.filter-select:focus,
.form-control:focus,
.picker-group select:focus {
    border-color: var(--green-primary);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(40,120,59,.10);
}
.form-control:disabled,
.form-control[readonly] {
    color: #68746c;
    border-color: #e2e8e3;
    background: #f4f7f5;
    cursor: not-allowed;
}
.form-group { margin-bottom: 18px; }
.form-label {
    margin-bottom: 7px;
    color: #3f4d44;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .005em;
}
.form-group small { display: block; margin-top: 6px; color: var(--text-light) !important; font-size: 11.5px; line-height: 1.45; }
textarea.form-control { min-height: 94px; padding-top: 11px; }
.field-hint {
    display: inline;
    margin-left: 5px;
    color: #7b877f;
    font-size: 11px;
    font-weight: 500;
    white-space: normal;
}
.field-hint::before { content: none; }
.req { margin-left: 2px; color: #c63737; font-weight: 700; }

.table-wrap,
.scan-table-wrap,
.report-section {
    border-radius: var(--radius-lg);
    overflow: auto;
}
table { color: var(--text-dark); }
thead { position: relative; z-index: 2; }
thead tr { color: #47544c; background: #f6f8f6; }
thead th {
    padding: 13px 15px;
    border-bottom: 1px solid #dce5de;
    color: #5a675f;
    background: #f6f8f6;
    font-size: 10.5px;
    font-weight: 750;
    letter-spacing: .075em;
    text-transform: uppercase;
}
tbody tr { border-bottom-color: #eaf0eb; }
tbody tr:not(.status-group-header):not(.checkout-info-row):nth-child(even) { background: #fbfcfb; }
tbody tr:not(.status-group-header):hover { background: #f4f8f5; }
tbody td { padding: 13px 15px; color: #27332b; font-size: 13px; }
td.asset-code { color: #42604b; font-size: 11.5px; font-weight: 500; }
body.app-body th.sortable:hover { color: var(--green-dark); background: #edf4ef; }
th.sortable .sort-icon { display: inline-block; margin-left: 5px; color: #849087; }
.table-empty-cell {
    height: 180px;
    text-align: center;
    color: var(--text-light);
    background: #fbfcfb !important;
}
.table-empty-cell strong,
.table-empty-cell span { display: block; }
.table-empty-cell strong { margin-bottom: 4px; color: #3f4b43; font-size: 14px; }
.table-empty-cell span { font-size: 12px; }

.scan-table-header,
.report-section-header {
    min-height: 58px;
    padding: 15px 18px;
    color: var(--text-dark);
    background: #fff;
    border-bottom: 1px solid #e0e7e2;
}
.scan-table-header > span { display: flex; flex-direction: column; gap: 1px; }
.scan-table-header small { color: var(--text-light); font-size: 10.5px; font-weight: 500; }

.badge,
.audit-status,
.g-stat,
.value-tag {
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .01em;
}
.badge { min-height: 23px; padding: 3px 8px; }
.badge-good, .badge-active, .badge-functional, .badge-resolved, .badge-created, .badge-checkedin {
    color: #1d6b32;
    border-color: #b9ddc1;
    background: #eaf6ed;
}
.badge-fair, .badge-medium, .badge-in-progress, .badge-updated {
    color: #87550b;
    border-color: #efd49c;
    background: #fff7e8;
}
.badge-poor, .badge-high, .badge-not-functional, .badge-for-disposal, .badge-lost, .badge-missing {
    color: #ae3030;
    border-color: #edc0c0;
    background: #fff0f0;
}
.badge-for-repair, .badge-checkedout { color: #a14f0c; border-color: #efc59e; background: #fff3e9; }
.badge-inactive, .badge-closed, .badge-disposed { color: #5d6961; border-color: #d5ded7; background: #f2f5f3; }
.badge-transferred, .badge-issued { color: #245c9b; border-color: #bdd2e9; background: #edf4fc; }

/* Shared asset-condition palette. Text labels remain visible so color is
   supplemental, never the only way an outcome is communicated. */
.condition-functional {
    --condition-fg: var(--condition-functional-fg);
    --condition-bg: var(--condition-functional-bg);
    --condition-border: var(--condition-functional-border);
    --condition-solid: var(--condition-functional-solid);
}
.condition-missing,
.condition-not-functional {
    --condition-fg: var(--condition-danger-fg);
    --condition-bg: var(--condition-danger-bg);
    --condition-border: var(--condition-danger-border);
    --condition-solid: var(--condition-danger-solid);
}
.condition-for-repair {
    --condition-fg: var(--condition-repair-fg);
    --condition-bg: var(--condition-repair-bg);
    --condition-border: var(--condition-repair-border);
    --condition-solid: var(--condition-repair-solid);
}
.condition-for-disposal {
    --condition-fg: var(--condition-disposal-fg);
    --condition-bg: var(--condition-disposal-bg);
    --condition-border: var(--condition-disposal-border);
    --condition-solid: var(--condition-disposal-solid);
}
.condition-transferred {
    --condition-fg: var(--condition-transfer-fg);
    --condition-bg: var(--condition-transfer-bg);
    --condition-border: var(--condition-transfer-border);
    --condition-solid: var(--condition-transfer-solid);
}
.condition-badge,
.condition-kpi {
    color: var(--condition-fg);
    border-color: var(--condition-border);
    background: var(--condition-bg);
}
.condition-kpi strong,
.condition-kpi span { color: var(--condition-fg) !important; }

/* Existing badge call sites inherit the same semantic colors. Historical
   Good/Fair/Poor rows keep readable compatibility colors without remaining
   available as form choices. */
.badge-functional,
.badge-good { color: var(--condition-functional-fg); border-color: var(--condition-functional-border); background: var(--condition-functional-bg); }
.badge-missing,
.badge-lost,
.badge-not-functional,
.badge-poor { color: var(--condition-danger-fg); border-color: var(--condition-danger-border); background: var(--condition-danger-bg); }
.badge-for-repair,
.badge-fair { color: var(--condition-repair-fg); border-color: var(--condition-repair-border); background: var(--condition-repair-bg); }
.badge-for-disposal { color: var(--condition-disposal-fg); border-color: var(--condition-disposal-border); background: var(--condition-disposal-bg); }
.badge-transferred { color: var(--condition-transfer-fg); border-color: var(--condition-transfer-border); background: var(--condition-transfer-bg); }

select.condition-select-tone {
    border-left-width: 4px;
    border-left-color: var(--condition-solid, var(--gray-border));
}

select.condition-select-tone:focus {
    border-left-color: var(--condition-solid, var(--gray-border));
}

@media print {
    .condition-badge,
    .badge-functional,
    .badge-missing,
    .badge-lost,
    .badge-not-functional,
    .badge-for-repair,
    .badge-for-disposal,
    .badge-transferred {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
.role-badge-superadmin,
.badge-superadmin { border-color: #d9c7ea; background: #f3ecfb; color: #63388a; }
.role-badge-admin { border-color: #bcdcc3; background: #e9f5eb; color: #1b672f; }
.role-badge-staff { border-color: #c2d6ea; background: #edf4fb; color: #285d91; }

.action-btns { gap: 5px; }
.icon-btn {
    width: 35px;
    height: 35px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #6f7c73;
}
.icon-btn:hover { border-color: #dfe7e1; color: #314039; background: #f4f7f5; }
.icon-btn.delete:hover { border-color: #f0caca; background: #fff0f0; }

.modal-overlay,
.confirm-dialog {
    padding: 24px;
    background: rgba(8, 29, 17, .55);
    backdrop-filter: blur(7px);
}
.modal {
    border: 1px solid rgba(255,255,255,.76);
    border-radius: 19px;
    box-shadow: var(--shadow-lg);
    animation: modalIn .18s cubic-bezier(.2,.8,.2,1);
}
.modal-header { min-height: 64px; padding: 18px 22px; border-bottom-color: #e4eae5; }
.modal-header h3 { font-size: 17px; font-weight: 680; letter-spacing: -.025em; }
.modal-body { padding: 22px; }
.modal-footer {
    min-height: 67px;
    padding: 13px 22px;
    border-top-color: #e4eae5;
    background: #f8faf8;
}
.modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #758178;
}
.modal-close:hover { border-color: #e0e7e2; background: #f3f6f4; }
.confirm-box { padding: 30px; border: 1px solid #e5ebe6; border-radius: 18px; }
.confirm-box h4 { letter-spacing: -.02em; }

.alert {
    position: relative;
    min-height: 48px;
    padding: 12px 40px 12px 15px;
    border-radius: 12px;
    box-shadow: 0 7px 20px rgba(19,49,29,.05);
    font-size: 12.5px;
}
.alert-success { color: #1c6830; border-color: #b9ddc1; background: #edf8ef; }
.alert-error { color: #a92d2d; border-color: #efc3c3; background: #fff1f1; }
.alert-close { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); }
.empty-state {
    border: 1px dashed #d5dfd7;
    border-radius: var(--radius-lg);
    color: var(--text-light);
    background: linear-gradient(180deg, #fff, #fafcfa);
    box-shadow: none;
}
.empty-state h3 { color: #46534b; }

.bulk-actions-bar.open {
    min-height: 48px;
    border-color: #ebcf9e;
    border-radius: 12px;
    background: #fff8eb;
    box-shadow: 0 4px 14px rgba(126,80,14,.05);
}
.row-checkbox,
#select-all-checkbox,
.unit-row-checkbox,
.unit-select-all,
.approve-item { width: 17px; height: 17px; accent-color: var(--green-primary); }

/* Dashboard */
body.page-dashboard .main-content { padding-top: 28px; }
.dashboard-hero {
    position: relative;
    isolation: isolate;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    overflow: hidden;
    margin-bottom: 20px;
    padding: 30px 32px;
    border: 1px solid rgba(33, 105, 52, .18);
    border-radius: 21px;
    color: #fff;
    background:
        radial-gradient(circle at 82% -30%, rgba(142,211,151,.23), transparent 22rem),
        linear-gradient(122deg, #174e2b 0%, #236b38 58%, #287940 100%);
    box-shadow: 0 14px 34px rgba(26, 91, 44, .15);
}
.dashboard-hero::after {
    content: '';
    position: absolute;
    z-index: -1;
    right: -65px;
    bottom: -150px;
    width: 310px;
    height: 310px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50%;
    box-shadow: 0 0 0 52px rgba(255,255,255,.025), 0 0 0 104px rgba(255,255,255,.018);
}
.dashboard-hero .page-eyebrow { margin-bottom: 10px; color: rgba(255,255,255,.68); }
.dashboard-hero h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(27px, 3vw, 38px);
    font-weight: 650;
    line-height: 1.14;
    letter-spacing: -.04em;
}
.dashboard-hero p { max-width: 680px; margin-top: 10px; color: rgba(255,255,255,.72); font-size: 13.5px; }
.dashboard-hero-art {
    width: 86px;
    height: 86px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 24px;
    color: rgba(255,255,255,.82);
    background: rgba(255,255,255,.10);
    box-shadow: inset 0 1px rgba(255,255,255,.12);
    backdrop-filter: blur(9px);
}
body.page-dashboard .stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
body.page-dashboard .stat-card { min-height: 116px; flex-direction: column; align-items: flex-start; gap: 15px; }
body.page-dashboard .stat-info { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
body.page-dashboard .stat-label { max-width: 120px; order: 2; text-align: right; }
body.page-dashboard .stat-value { order: 1; }

/* Inventory pages */
:is(body.page-technology, body.page-furniture, body.page-utility) #items-table { min-width: 1180px; }
:is(body.page-technology, body.page-furniture, body.page-utility) .room-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 15px;
}
:is(body.page-technology, body.page-furniture, body.page-utility) .room-cards-grid .room-card {
    padding: 18px;
    border-color: var(--gray-border);
    border-radius: 15px;
    box-shadow: var(--shadow);
    cursor: pointer;
}
:is(body.page-technology, body.page-furniture, body.page-utility) .room-cards-grid .room-card:hover {
    border-color: #bfd1c2;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
:is(body.page-technology, body.page-furniture, body.page-utility) .room-card-title { color: #23362a; }
:is(body.page-technology, body.page-furniture, body.page-utility) .room-card-total { color: #1d6b32; background: #eaf6ed; }
:is(body.page-technology, body.page-furniture, body.page-utility) .room-detail-panel {
    padding: 22px;
    border-color: var(--gray-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
:is(body.page-technology, body.page-furniture, body.page-utility) .room-view-filter-bar,
body.page-groups .group-filter-bar,
body.page-reports .rpt-filters {
    min-height: 55px;
    padding: 9px;
    border: 1px solid #e0e7e2;
    border-radius: 14px;
    background: rgba(255,255,255,.76);
}
.tsv-parse-btn {
    margin-top: 7px;
    padding: 5px 9px;
    border: 1px solid #cadced;
    border-radius: 8px;
    color: #295f99;
    background: #f0f6fc;
}
.tsv-parse-btn:hover { border-color: #acc7e1; background: #e8f2fb; }

/* Groups */
body.page-groups .group-card {
    margin-bottom: 13px;
    border-color: var(--gray-border);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(17,46,29,.025);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
body.page-groups .group-card:hover { border-color: #cbd8ce; box-shadow: var(--shadow); }
body.page-groups .group-card.open { border-color: #c2d3c5; box-shadow: var(--shadow-md); }
body.page-groups .group-card-header { min-height: 72px; padding: 15px 18px; }
body.page-groups .group-card-header:hover { background: #f8faf8; }
body.page-groups .group-title { color: #223129; font-size: 14px; }
body.page-groups .group-sub { color: var(--text-light); }
body.page-groups .group-icon { width: 39px; height: 39px; border-radius: 11px; }
body.page-groups .group-units-panel { padding: 0 18px 18px; border-top-color: #e8eee9; }
body.page-groups .units-toolbar { padding: 14px 0 11px; }
body.page-groups .units-table { min-width: 880px; }
body.page-groups .units-table th,
body.page-groups .txn-table th { color: #667269; background: #f6f8f6; }
body.page-groups .units-table td { border-bottom-color: #edf1ee; }
body.page-groups .cat-filter-btn {
    min-height: 34px;
    padding: 6px 13px;
    border-color: #d7e0d9;
    border-radius: 9px;
    color: #526057;
    background: #fff;
    font-size: 12px;
}
body.page-groups .cat-filter-btn:hover { border-color: #bcd0c0; color: var(--green-dark); }
body.page-groups .cat-filter-btn.active { border-color: #236d36; color: #fff; background: #28783b; }
body.page-groups .txn-log { border-top-color: #e8eee9; }
body.page-groups .txn-log-title { color: #6f7c73; }

/* Rooms */
body.page-rooms .room-picker,
body.page-rooms .summary-card,
body.page-rooms .cond-bar-wrap,
body.page-rooms .asset-table-wrap {
    border-color: var(--gray-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
body.page-rooms .room-picker { padding: 21px; margin-bottom: 24px; }
body.page-rooms .room-picker-title { color: #354239; font-size: 13px; }
body.page-rooms .picker-group label { color: #667269; font-size: 10.5px; letter-spacing: .08em; }
body.page-rooms .btn-view { min-height: var(--control-height); height: auto; border-radius: 10px; }
body.page-rooms .summary-grid { gap: 13px; }
body.page-rooms .summary-card { position: relative; overflow: hidden; padding: 18px; border-left-width: 1px; }
body.page-rooms .summary-card::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: #829087; }
body.page-rooms .summary-card.accent-tech::after { background: #376fb8; }
body.page-rooms .summary-card.accent-furn::after { background: #c46a1c; }
body.page-rooms .summary-card.accent-util::after { background: #7451a4; }
body.page-rooms .summary-card.accent-out::after { background: #c93636; }
body.page-rooms .summary-card-label { color: #6f7c73; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; }
body.page-rooms .summary-card-value { color: #17221b; font-size: 27px; }
body.page-rooms .cond-bar-wrap { padding: 18px; }
body.page-rooms .cond-bar { height: 12px; border-radius: 999px; gap: 3px; }
body.page-rooms .cond-seg { border-radius: 999px; }
body.page-rooms .category-header { border-bottom-color: #dfe7e1; }
body.page-rooms .asset-table-wrap { overflow-x: auto; }
body.page-rooms .asset-table-wrap table { min-width: 800px; }

/* Reports */
body.page-reports .report-tabs {
    width: fit-content;
    max-width: 100%;
    gap: 4px;
    overflow-x: auto;
    margin-bottom: 20px;
    padding: 5px;
    border: 1px solid #dfe7e1;
    border-radius: 12px;
    background: rgba(255,255,255,.76);
}
body.page-reports .report-tab {
    min-height: 38px;
    margin: 0;
    padding: 8px 14px;
    border: 0;
    border-radius: 8px;
    color: #68756c;
    font-size: 12px;
}
body.page-reports .report-tab.active { color: #1f682f; background: #eaf5ec; box-shadow: inset 0 0 0 1px #d4e8d8; }
body.page-reports .bldg-stats { gap: 13px; }
body.page-reports .bstat {
    padding: 16px;
    border-color: var(--gray-border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
body.page-reports .bstat-label { color: #6f7c73; font-size: 10.5px; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
body.page-reports .bstat-value { font-size: 21px; letter-spacing: -.03em; }
body.page-reports .room-card {
    margin-bottom: 13px;
    border-color: var(--gray-border);
    border-radius: 15px;
    box-shadow: var(--shadow);
}
body.page-reports .room-card-header {
    min-height: 48px;
    padding: 11px 16px;
    color: #fff;
    background: linear-gradient(100deg, #236c37, #2d7d40);
}
body.page-reports .floor-label { color: #285c37; background: #eff6f0; border-bottom-color: #d7e7da; }
body.page-reports .room-subtotal { background: #f8faf8; }
body.page-reports .grand-total-bar { border-radius: 14px; background: linear-gradient(110deg, #174f2c, #28783b); box-shadow: 0 10px 24px rgba(31,103,48,.14); }

/* Audits */
body.page-audits .audit-summary-grid { gap: 13px; }
body.page-audits .audit-list { gap: 13px; }
body.page-audits .audit-card {
    padding: 20px;
    border-color: var(--gray-border);
    border-radius: 17px;
    box-shadow: var(--shadow);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
body.page-audits .audit-card:hover { border-color: #c8d7cb; box-shadow: var(--shadow-md); transform: translateY(-1px); }
body.page-audits .audit-title { color: #213128; font-size: 16px; letter-spacing: -.02em; }
body.page-audits .audit-meta { color: var(--text-light); }
body.page-audits .audit-progress { height: 7px; background: #edf1ee; }
body.page-audits .audit-progress > span { border-radius: inherit; background: linear-gradient(90deg, #2b7e3e, #5aa76a); }
body.page-audit .audit-hero {
    position: relative;
    overflow: hidden;
    padding: 27px;
    border: 1px solid rgba(52,130,70,.18);
    border-radius: 20px;
    background: radial-gradient(circle at 92% -25%, rgba(144,215,153,.20), transparent 20rem), linear-gradient(125deg,#154827,#2a773d);
    box-shadow: 0 14px 34px rgba(26,91,44,.14);
}
body.page-audit .audit-progress-large { height: 9px; background: rgba(255,255,255,.17); }
body.page-audit .audit-progress-large span { border-radius: inherit; background: #a9dfb0; }
body.page-audit .audit-kpis { gap: 12px; }
body.page-audit .audit-kpi {
    padding: 16px;
    border-color: var(--gray-border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
body.page-audit .audit-kpi strong { color: #1e3025; font-size: 24px; letter-spacing: -.035em; }
body.page-audit .audit-kpi span { color: var(--text-light); font-weight: 600; }
body.page-audit .table-wrap table,
body.page-audit_review .table-wrap table,
body.page-audit_history .table-wrap table { min-width: 1080px; }
body.page-audit_review .review-banner {
    padding: 18px 20px;
    border-color: var(--gray-border);
    border-radius: 15px;
    background: linear-gradient(180deg, #fff, #fafcfa);
    box-shadow: var(--shadow);
}

/* Permissions */
body.page-permissions .perm-intro,
body.page-permissions .perm-superadmin-notice {
    border-radius: 13px;
    box-shadow: 0 5px 16px rgba(18,48,28,.035);
}
body.page-permissions .perm-intro { color: #1e6832; border-color: #c8dfcc; background: #edf7ef; }
body.page-permissions .perm-superadmin-notice { color: #63407f; border-color: #ddcfea; background: #f6f0fb; }
body.page-permissions .perm-matrix {
    border-color: var(--gray-border);
    border-radius: 17px;
    box-shadow: var(--shadow);
}
body.page-permissions .perm-matrix-header {
    min-height: 54px;
    align-items: center;
    color: #fff;
    background: linear-gradient(100deg, #174e2b, #276f3a);
}
body.page-permissions .perm-group-header { color: #59665e; border-color: #e3e9e4; background: #f4f7f5; }
body.page-permissions .perm-row { border-bottom-color: #e9eeea; }
body.page-permissions .perm-row:hover { background: #f7faf8; }
body.page-permissions .perm-label { color: #29372e; font-size: 13px; }
body.page-permissions .perm-desc { color: var(--text-light); }
body.page-permissions .toggle { width: 46px; height: 25px; }
body.page-permissions .toggle-slider { background: #c9d2cb; }
body.page-permissions .toggle input:checked + .toggle-slider { background: #2b7c3e; }
body.page-permissions .toggle input:focus-visible + .toggle-slider { box-shadow: 0 0 0 4px rgba(40,120,59,.14); }
body.page-permissions .save-bar {
    bottom: 18px;
    padding: 14px 17px;
    border-color: #d8e2da;
    border-radius: 15px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 14px 34px rgba(18,55,31,.12);
    backdrop-filter: blur(12px);
}

/* Users */
.role-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.role-legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border: 1px solid var(--gray-border);
    border-radius: 12px;
    color: var(--text-mid);
    background: #fff;
    box-shadow: 0 1px 2px rgba(18,48,28,.025);
    font-size: 12px;
}
body.page-users .users-grid { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
body.page-users .user-card {
    min-height: 152px;
    padding: 18px;
    border-color: var(--gray-border);
    border-radius: 16px;
}
body.page-users .user-card:hover { box-shadow: var(--shadow-md); }
body.page-users .user-avatar { width: 47px; height: 47px; border-radius: 14px; box-shadow: inset 0 1px rgba(255,255,255,.18); }
body.page-users .user-card-name { color: #25342b; }
body.page-users .user-card-username { color: var(--text-light); }
.user-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.self-badge { padding: 2px 7px; border-radius: 999px; color: #654184; background: #f3ecf9; font-size: 10px; font-weight: 700; }

/* Tickets and log trail */
body.page-tickets .table-wrap table { min-width: 1040px; }
body.page-qr_scans .table-wrap table { min-width: 880px; }
body.page-tickets .status-group-header td {
    padding-top: 10px;
    padding-bottom: 10px;
    color: #4f5e54;
    background: #eef4ef;
}

/* QR overlays */
body.app-body .qr-modal-overlay {
    visibility: hidden;
    padding: 22px;
    background: rgba(8,29,17,.58);
    backdrop-filter: blur(7px);
    transition: opacity .18s ease, visibility .18s ease;
}
body.app-body .qr-modal-overlay.open { visibility: visible; }
body.app-body .qr-modal-box {
    width: min(380px, 100%);
    padding: 34px 28px 27px;
    border: 1px solid rgba(255,255,255,.75);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}
body.app-body .qr-modal-box h3 { color: #213b29; letter-spacing: -.02em; }
body.app-body .qr-asset-label { color: #1e6b32; background: #edf7ef; border: 1px solid #d2e8d6; }
body.app-body .qr-grid-item { border-color: #e0e8e2; border-radius: 13px; background: #fff; }

/* Responsive */
@media (max-width: 1399px) {
    body.page-dashboard .stats-grid { grid-template-columns: repeat(3, 1fr); }
    body.page-dashboard .stat-card { flex-direction: row; align-items: center; }
    body.page-dashboard .stat-info { display: block; }
    body.page-dashboard .stat-label { max-width: none; text-align: left; }
}

@media (max-width: 1199px) {
    :root { --sidebar-width: 252px; }
    .main-content { padding: 28px 24px; }
    .topbar { padding: 0 24px; }
}

@media (max-width: 1099px) {
    .sidebar {
        width: 282px;
        max-width: calc(100vw - 38px);
        visibility: hidden;
        box-shadow: 22px 0 60px rgba(5,29,15,.30);
        transition: transform .23s cubic-bezier(.2,.8,.2,1), visibility .23s ease;
    }
    body.sidebar-open .sidebar { visibility: visible; }
    .app-workspace { margin-left: 0; }
    .sidebar-backdrop { backdrop-filter: blur(2px); }
}

@media (max-width: 900px) {
    .login-page { padding: 24px; }
    .login-shell { grid-template-columns: minmax(0, 1fr) 410px; min-height: 620px; }
    .login-story { padding: 38px; }
    .login-story h1 { font-size: 40px; }
    .login-panel { padding: 31px; }
    body.page-reports .bldg-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
    .login-page { padding: 15px; }
    .login-shell { display: block; min-height: 0; border-radius: 22px; }
    .login-story { display: none; }
    .login-panel { min-height: min(620px, calc(100vh - 30px)); padding: 30px 24px; border-left: 0; }
    .login-brand-row { margin-bottom: 16px; }
    .login-sub { margin-bottom: 24px; }

    .topbar { min-height: 64px; padding: 0 14px; }
    .topbar-user { display: none; }
    .main-content { padding: 20px 14px 30px; }
    .page-header { min-height: 0; margin-bottom: 19px; align-items: stretch; }
    .page-header h1 { font-size: 24px; }
    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1 1 auto; }

    .dashboard-hero { min-height: 168px; padding: 24px; border-radius: 18px; }
    .dashboard-hero h1 { font-size: 28px; }
    .dashboard-hero-art { display: none; }
    body.page-dashboard .stats-grid { grid-template-columns: 1fr 1fr; }
    body.page-dashboard .stat-card { min-height: 104px; padding: 15px; }

    .toolbar { align-items: stretch; flex-wrap: wrap; }
    .toolbar .search-box { flex: 1 0 100%; max-width: none; }
    .toolbar .filter-select { flex: 1 1 calc(50% - 5px); min-width: 0; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .modal-overlay, .confirm-dialog { padding: 13px; }
    .modal { max-height: calc(100dvh - 26px); border-radius: 17px; }
    .modal-header { padding: 16px 17px; }
    .modal-body { padding: 18px 17px; }
    .modal-footer { padding: 12px 17px; }
    .modal-footer .btn { flex: 1 1 auto; }

    body.page-reports .bldg-stats { grid-template-columns: 1fr 1fr; }
    body.page-permissions .perm-matrix { overflow-x: auto; }
    body.page-permissions .perm-matrix-header,
    body.page-permissions .perm-row { min-width: 520px; }
    body.page-groups .group-card-header { align-items: flex-start; flex-wrap: wrap; }
    body.page-groups .group-title-block { min-width: calc(100% - 90px); }
    body.page-groups .group-stats { margin-left: 32px; }
    body.page-groups .group-actions { margin-left: auto; }
}

@media (max-width: 480px) {
    .login-panel { padding: 27px 20px; }
    .login-logo-wrap { width: 56px; height: 56px; flex-basis: 56px; }
    .login-logo { width: 52px; height: 52px; }
    .login-title { font-size: 22px; }
    .dashboard-hero { padding: 22px 19px; }
    body.page-dashboard .stats-grid { grid-template-columns: 1fr; }
    body.page-dashboard .stat-card { min-height: 92px; flex-direction: row; }
    body.page-rooms .summary-grid,
    body.page-audits .audit-summary-grid,
    body.page-audit .audit-kpis,
    body.page-reports .bldg-stats { grid-template-columns: 1fr 1fr; }
    .alert { align-items: flex-start; }
}

@media (max-height: 720px) and (min-width: 768px) {
    .login-page { padding: 20px; }
    .login-shell { min-height: calc(100vh - 40px); }
    .login-story { padding-top: 34px; padding-bottom: 34px; }
    .login-feature-list { margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

@media print {
    .dashboard-hero { color: #111; border: 1px solid #ccc; background: #fff; box-shadow: none; }
    .dashboard-hero h1, .dashboard-hero p, .dashboard-hero .page-eyebrow { color: #111; }
    .stat-card, .table-wrap, .scan-table-wrap, .report-section { box-shadow: none; }
}

/* Shared badge/chip alignment
   Keep badge content centered without changing the alignment of its parent
   table cell, card, toolbar, or navigation component. The app-body prefix
   also lets this shared rule win over legacy page-local inline styles. */
body.app-body :is(
    .badge,
    .nav-notification-badge,
    .audit-status,
    .audit-row-status,
    .verification-method,
    .condition-badge,
    .role-badge,
    .role-badge-admin,
    .role-badge-staff,
    .self-badge,
    .tab-badge,
    .room-badge,
    .room-value-total,
    .room-card-total,
    .room-type-count,
    .room-cond-chip,
    .g-stat,
    .txn-badge-in,
    .txn-badge-out,
    .value-tag
) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    vertical-align: middle;
}

/* This legacy group-membership chip is emitted with an inline display value
   and no reusable class, so only its display declaration needs escalation. */
body.app-body a[title^="Part of group:"] {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    vertical-align: middle;
}
