/* ==========================================================================
   Bhada — Item Rental & Stock Management System (Vanilla CSS)
   ========================================================================== */

:root {
    --bg-canvas: #faf7f4;
    --bg-surface: #ffffff;
    --bg-subtle: #f4ede6;
    --bg-sidebar: #3b0f1b;
    --bg-sidebar-hover: #521727;
    --bg-sidebar-active: #732035;

    --brand-primary: #6b1d2f;
    --brand-primary-dark: #501321;
    --brand-accent: #d97706;
    --brand-accent-soft: #fef3c7;

    --text-main: #1f171a;
    --text-muted: #6b5b61;
    --text-soft: #918086;

    --border: #e8ddd4;
    --border-strong: #d6c5b8;

    --success-fg: #0f766e;
    --success-bg: #e6f7f4;
    --warning-fg: #b45309;
    --warning-bg: #fef3c7;
    --danger-fg: #be123c;
    --danger-bg: #ffe4e6;
    --info-fg: #3730a3;
    --info-bg: #eef2ff;
    --neutral-fg: #57534e;
    --neutral-bg: #f3f1ef;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(31, 23, 26, 0.05), 0 1px 2px rgba(31, 23, 26, 0.04);
    --shadow-md: 0 10px 25px -8px rgba(59, 15, 27, 0.12), 0 4px 10px -4px rgba(31, 23, 26, 0.06);
    --transition-fast: 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-canvas);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ---------- Animations ---------- */
@keyframes fadeUpIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-up {
    animation: fadeUpIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }

/* ---------- Layout Shell & Mobile Drawer ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 5, 8, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 48;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.nav-open {
    overflow: hidden !important;
    touch-action: none;
}

.sidebar {
    width: 252px;
    background: var(--bg-sidebar);
    color: #f9eef1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    z-index: 49;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-brand {
    padding: 18px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    transform: scale(1.05);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-emblem {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #2b0a12;
    font-weight: 800;
    font-size: 16px;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #ffffff;
}

.brand-sub {
    font-size: 11px;
    color: rgba(255, 240, 244, 0.68);
    margin-top: 1px;
}

.sidebar-nav {
    padding: 14px 12px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 232, 238, 0.48);
    padding: 12px 12px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 9px;
    color: rgba(255, 244, 247, 0.84);
    font-weight: 500;
    transition: background var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
}

.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: #ffffff;
    transform: translateX(2px);
}

.nav-link.active {
    background: var(--bg-sidebar-active);
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #fbbf24;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: rgba(255, 235, 240, 0.65);
}

.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.mobile-menu-btn {
    display: none;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    flex-shrink: 0;
    padding: 0;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--border);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

.mobile-menu-btn .menu-icon {
    width: 22px;
    height: 22px;
}

.topbar-titles {
    min-width: 0;
    flex: 1;
}

.page-title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-subtitle {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.content-wrap {
    padding: 24px 28px 96px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ---------- Modern Mobile Bottom Navigation ---------- */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    z-index: 45;
    box-shadow: 0 -4px 20px rgba(59, 15, 27, 0.08);
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    padding: 6px 2px 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: var(--brand-primary);
}

.bottom-nav-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
    transition: transform 0.15s ease;
}

.bottom-nav-item.active .bottom-nav-icon {
    transform: scale(1.12);
    stroke-width: 2.3;
}

.bottom-nav-fab {
    position: relative;
    top: -12px;
}

.fab-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.45);
    margin-bottom: 2px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bottom-nav-fab:hover .fab-circle,
.bottom-nav-fab.active .fab-circle {
    transform: scale(1.06);
    box-shadow: 0 6px 18px rgba(217, 119, 6, 0.55);
}

.bottom-nav-fab .bottom-nav-icon {
    width: 22px;
    height: 22px;
    margin-bottom: 0;
    color: #ffffff;
}

/* ---------- Cards & Grids ---------- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-title {
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.kpi-value {
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 6px;
    color: var(--text-main);
}

.kpi-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--brand-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(107, 29, 47, 0.25);
}

.btn-primary:hover {
    background: var(--brand-primary-dark);
    color: #ffffff;
}

.btn-accent {
    background: var(--brand-accent);
    color: #ffffff;
}

.btn-accent:hover {
    background: #b45309;
    color: #ffffff;
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-main);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--bg-subtle);
    color: var(--text-main);
}

.btn-danger {
    background: #fff1f2;
    color: var(--danger-fg);
    border-color: #fecdd3;
}

.btn-danger:hover {
    background: #ffe4e6;
}

.btn-success {
    background: var(--success-fg);
    color: #ffffff;
}

.btn-success:hover {
    background: #115e59;
    color: #ffffff;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12.5px;
    border-radius: 6px;
}

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

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

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

label, .form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
}

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text-main);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ---------- Tables ---------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-subtle);
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: #fcfaf7;
}

tbody tr:last-child td {
    border-bottom: none;
}

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

/* ---------- Badges, Pills, Code Chips & Progress ---------- */
.code-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f5ebe3;
    color: var(--brand-primary);
    border: 1px solid #e4cfc2;
    letter-spacing: 0.02em;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-available, .badge-returned, .badge-paid, .badge-success {
    color: var(--success-fg);
    background: var(--success-bg);
}

.badge-rented, .badge-active, .badge-partial, .badge-warning {
    color: var(--warning-fg);
    background: var(--warning-bg);
}

.badge-booked, .badge-info {
    color: var(--info-fg);
    background: var(--info-bg);
}

.badge-maintenance, .badge-unpaid, .badge-danger, .badge-overdue {
    color: var(--danger-fg);
    background: var(--danger-bg);
}

.badge-retired, .badge-cancelled, .badge-neutral {
    color: var(--neutral-fg);
    background: var(--neutral-bg);
}

.profit-pos {
    color: var(--success-fg);
    font-weight: 700;
}

.profit-neg {
    color: var(--danger-fg);
    font-weight: 700;
}

.recovery-bar {
    width: 100%;
    max-width: 110px;
    height: 6px;
    background: #ede4dc;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}

.recovery-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-accent) 0%, var(--success-fg) 100%);
    transition: width 0.4s ease;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 18px;
    font-size: 13.5px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border-color: #99f6e4;
}

.alert-error {
    background: var(--danger-bg);
    color: #9f1239;
    border-color: #fecdd3;
}

.alert ul {
    margin: 6px 0 0 18px;
    padding: 0;
}

/* ---------- Filter Bar ---------- */
.filter-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.filter-field {
    flex: 1 1 160px;
    min-width: 140px;
}

.filter-field label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* ---------- Sticky Bulk Action Bar ---------- */
.bulk-bar {
    position: fixed;
    left: 252px;
    right: 0;
    bottom: 0;
    background: #2b0b14;
    color: #ffffff;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    z-index: 35;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.22);
    transform: translateY(110%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.bulk-bar.visible {
    transform: translateY(0);
}

.bulk-bar-count {
    font-weight: 700;
    font-size: 14px;
}

.bulk-bar-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- Modals ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 8, 12, 0.55);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 60;
}

.modal-backdrop.open {
    display: flex;
}

.modal-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    animation: fadeUpIn 0.2s ease both;
}

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

.modal-body {
    padding: 20px;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 6px;
}

/* ---------- Lookup Results & Chips ---------- */
.lookup-results {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    max-height: 220px;
    overflow-y: auto;
    background: #ffffff;
    margin-top: 6px;
    display: none;
}

.lookup-results.open {
    display: block;
}

.lookup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    gap: 10px;
}

.lookup-item:hover {
    background: var(--bg-subtle);
}

.lookup-item:last-child {
    border-bottom: none;
}

/* ---------- Pagination ---------- */
.pagination-wrap {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-wrap nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-wrap svg {
    width: 16px;
    height: 16px;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border-radius: 7px;
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-main);
    background: #fff;
}

.pagination li.active span {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
    font-weight: 700;
}

.pagination li.disabled span {
    opacity: 0.45;
}

.pagination-mobile-controls {
    display: none;
    align-items: center;
    gap: 10px;
}

.pagination-page-indicator {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

@media (max-width: 640px) {
    .pagination-desktop-list {
        display: none !important;
    }
    .pagination-mobile-controls {
        display: flex !important;
        width: 100%;
        justify-content: space-between;
    }
    .pagination-wrap {
        padding: 10px 14px;
    }
    .pagination-wrap nav {
        flex-direction: column;
        gap: 8px;
    }
}

/* ---------- Empty States ---------- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    margin: 0 0 6px;
    color: var(--text-main);
}

/* ---------- Print Tag Sheet & Receipt ---------- */
.tag-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.tag-card {
    border: 1.5px dashed #9e8a7c;
    border-radius: 10px;
    padding: 12px 14px;
    background: #ffffff;
    text-align: center;
    break-inside: avoid;
}

.tag-card svg {
    max-width: 100%;
    height: auto;
}

.tag-shop {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-primary);
}

.tag-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin: 4px 0 6px;
    color: #181214;
}

.tag-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #1f171a;
    margin-top: 6px;
}

.tag-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #ece3dc;
    font-size: 12px;
}

.tag-price {
    font-weight: 800;
    color: var(--brand-primary);
}

@media print {
    body {
        background: #ffffff !important;
    }
    .sidebar, .topbar, .no-print, .bulk-bar {
        display: none !important;
    }
    .content-wrap {
        padding: 0 !important;
        max-width: 100% !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    .tag-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

/* ---------- Filter Toggle (Mobile Friendly) ---------- */
.filter-toggle-wrap {
    display: none;
    margin-bottom: 12px;
}

.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    min-height: 44px;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.filter-toggle-btn:hover {
    background: var(--bg-subtle);
}

.filter-toggle-badge {
    background: var(--brand-accent-soft);
    color: var(--brand-accent);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

/* ---------- Comprehensive Responsive System ---------- */
@media (max-width: 1200px) {
    .content-wrap {
        padding: 20px 22px 96px;
    }
}

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

@media (max-width: 768px) {
    /* Touch Target & Input Protection (Prevents iOS Zoom) */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="tel"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
        min-height: 44px;
    }

    button, .btn {
        min-height: 44px;
    }

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

    /* Mobile Sidebar Drawer */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-width: 84vw;
        height: 100vh;
        height: 100dvh;
        transform: translateX(-100%);
        z-index: 50;
        box-shadow: 6px 0 28px rgba(0, 0, 0, 0.45);
        transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close-btn {
        display: flex;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    /* Mobile Bottom Navigation Bar */
    .mobile-bottom-nav {
        display: flex;
    }

    /* Main Area & Content Wrap */
    .content-wrap {
        padding: 14px 14px calc(76px + env(safe-area-inset-bottom, 0px));
        width: 100%;
        max-width: 100%;
    }

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

    .topbar-titles {
        min-width: 0;
        flex: 1;
    }

    .page-title {
        font-size: 16.5px;
    }

    .page-subtitle {
        display: none;
    }

    .topbar-actions {
        width: 100%;
        display: flex;
        gap: 8px;
        justify-content: stretch;
        padding-top: 4px;
    }

    .topbar-actions > * {
        flex: 1 1 auto;
        min-height: 42px;
        justify-content: center;
        text-align: center;
        font-size: 12.5px;
        padding: 8px 10px;
    }

    /* Cards & Spacing */
    .card {
        border-radius: var(--radius-md);
        margin-bottom: 16px;
    }

    .card-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    .card-body {
        padding: 14px;
    }

    /* KPI Cards */
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        margin-bottom: 16px;
    }

    .kpi-card {
        padding: 12px 12px !important;
        border-radius: var(--radius-md);
    }

    .kpi-label {
        font-size: 10.5px;
    }

    .kpi-value {
        font-size: clamp(16px, 4.4vw, 22px);
        margin-top: 4px;
    }

    .kpi-meta {
        font-size: 10.5px;
        margin-top: 3px;
    }

    /* Grids & Forms */
    .form-grid, .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .form-actions > * {
        width: 100%;
        justify-content: center;
    }

    /* Collapsible Mobile Filter */
    .filter-toggle-wrap {
        display: block;
    }

    .filter-bar.collapsible-mobile {
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
        gap: 12px;
    }

    .filter-bar.collapsible-mobile.open {
        display: flex;
    }

    .filter-field {
        width: 100% !important;
        flex: 1 1 100% !important;
    }

    .filter-bar > div:last-child {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .filter-bar > div:last-child .btn {
        flex: 1;
        justify-content: center;
    }

    /* Sticky Bulk Action Bar - Elevated Above Mobile Bottom Nav */
    .bulk-bar {
        left: 0 !important;
        right: 0 !important;
        bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
        padding: 10px 14px;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
        background: rgba(31, 23, 26, 0.96);
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.35);
        border-radius: 12px 12px 0 0;
    }

    .bulk-bar-count {
        font-size: 12px;
        text-align: center;
    }

    .bulk-bar-controls {
        display: flex;
        gap: 6px;
        width: 100%;
        flex-wrap: wrap;
    }

    .bulk-bar-controls > * {
        flex: 1 1 calc(50% - 6px);
        font-size: 12px;
        padding: 9px 8px;
        text-align: center;
        justify-content: center;
        min-height: 40px;
    }

    .bulk-bar-controls #bulkClearBtn {
        flex: 1 1 100%;
    }

    /* Table Touch Scrolling & Minimum Readability */
    .table-wrap {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }

    .table-wrap table:not(.table-cards-mobile) {
        min-width: 620px;
    }

    /* Responsive Form Tables (Card Transformation) */
    .table-cards-mobile thead {
        display: none !important;
    }

    .table-cards-mobile,
    .table-cards-mobile tbody,
    .table-cards-mobile tr,
    .table-cards-mobile td {
        display: block !important;
        width: 100% !important;
    }

    .table-cards-mobile tr {
        background: #ffffff;
        border: 1.5px solid var(--border);
        border-radius: var(--radius-md);
        padding: 14px 14px 12px;
        margin-bottom: 14px;
        position: relative;
        box-shadow: var(--shadow-sm);
    }

    .table-cards-mobile tr:hover {
        background: #ffffff;
    }

    .table-cards-mobile td {
        padding: 5px 0 !important;
        border-bottom: none !important;
        text-align: left !important;
    }

    .table-cards-mobile td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.04em;
        margin-bottom: 3px;
    }

    .table-cards-mobile td.card-remove-cell {
        position: absolute;
        top: 10px;
        right: 12px;
        width: auto !important;
        padding: 0 !important;
    }

    .table-cards-mobile td.card-remove-cell::before {
        display: none !important;
    }

    .table-cards-mobile .card-field-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .table-cards-mobile .card-field-row.cols-3 {
        grid-template-columns: 1fr 1fr 1fr;
    }

    /* Pagination Mobile */
    .pagination-wrap {
        padding: 10px 14px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .pagination-wrap nav {
        justify-content: center;
    }

    .pagination li:not(.active):not(:first-child):not(:last-child) {
        display: none;
    }

    /* Print Tag Grid on Mobile Preview */
    .tag-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Small Mobile Screen Optimizations (320px - 360px) */
@media (max-width: 360px) {
    .kpi-grid {
        grid-template-columns: 1fr !important;
    }

    .topbar-actions > * {
        flex: 1 1 100%;
    }

    .bulk-bar-controls > * {
        flex: 1 1 100%;
    }

    .bottom-nav-item span {
        font-size: 10px;
    }
}

/* ---------- Sidebar User & Logout ---------- */
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #d97706;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    color: rgba(255, 235, 240, 0.65);
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-btn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 235, 240, 0.85);
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.sidebar-logout-btn:hover {
    background: #be123c;
    color: #ffffff;
    transform: translateY(-1px);
}

/* ---------- Auth & Login Screen ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: 
        radial-gradient(circle at 10% 20%, rgba(107, 29, 47, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(217, 119, 6, 0.07) 0%, transparent 45%),
        #faf7f4;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(107, 29, 47, 0.06) 0%, transparent 70%);
    top: -150px;
    right: -100px;
    pointer-events: none;
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.auth-brand-badge {
    text-align: center;
    margin-bottom: 24px;
}

.auth-brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, #6b1d2f 0%, #3b0f1b 100%);
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    border: 2px solid rgba(217, 119, 6, 0.4);
    box-shadow: 0 10px 25px -5px rgba(59, 15, 27, 0.35);
    margin-bottom: 12px;
    transition: transform var(--transition-fast);
}

.auth-brand-logo:hover {
    transform: scale(1.05) rotate(-2deg);
}

.auth-brand-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--brand-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.auth-brand-subtitle {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 45px -10px rgba(59, 15, 27, 0.12), 0 0 0 1px rgba(107, 29, 47, 0.03);
    padding: 32px 30px;
    position: relative;
}

.auth-card-header {
    margin-bottom: 22px;
    text-align: left;
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.auth-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}

.auth-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 13px;
    color: var(--text-soft);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.auth-input-group input {
    padding-left: 40px !important;
    padding-right: 42px !important;
    height: 44px;
    font-size: 14px;
    border-radius: 9px;
}

.auth-input-group:focus-within .auth-input-icon {
    color: var(--brand-primary);
}

.auth-toggle-pwd {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-soft);
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.auth-toggle-pwd:hover {
    color: var(--text-main);
    background: var(--bg-subtle);
}

.auth-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 10px 0 20px 0;
    font-size: 13px;
}

.auth-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    user-select: none;
}

.auth-checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--brand-primary);
    cursor: pointer;
    border-radius: 4px;
}

.auth-submit-btn {
    width: 100%;
    height: 44px;
    font-size: 14.5px;
    font-weight: 700;
    border-radius: 9px;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(107, 29, 47, 0.3);
}

.auth-demo-helper {
    margin-top: 24px;
    padding: 14px 16px;
    background: #fffcf9;
    border: 1px dashed #e2cbb8;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-accent);
}

.auth-demo-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    color: var(--text-main);
    gap: 8px;
    flex-wrap: wrap;
}

.auth-demo-cred {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #f4ede6;
    padding: 3px 7px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 12px;
}

.auth-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 12px;
    color: var(--text-soft);
}

.auth-logout-topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 640px) {
    .auth-logout-text {
        display: none;
    }
}

