/* ═══════════════════════════════════════════════════════════════════
   GardenHub — core.css
   Single source of truth: variables, reset, layout, sidebar, forms,
   buttons, cards, badges, flash, tables, pagination, print, responsive.
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ───────────────────────────────────────────────── */
:root {
    /* Brand Greens */
    --green-900: #1a3a0a;
    --green-800: #2d5016;
    --green-700: #3d6b1f;
    --green-600: #4a7c1f;
    --green-500: #5a9a24;
    --green-400: #7cb342;
    --green-300: #a4d65e;
    --green-100: #e8f5e9;

    /* Earth Tones */
    --earth-900: #3e2723;
    --earth-700: #5d4037;
    --earth-500: #8d6e63;
    --earth-100: #f5f0eb;
    --earth-50:  #faf7f4;

    /* Semantic Colors — ONE value each, used everywhere */
    --color-success:    #22c55e;
    --color-success-dk: #16a34a;
    --color-success-bg: #dcfce7;
    --color-success-tx: #166534;

    --color-danger:     #ef4444;
    --color-danger-dk:  #dc2626;
    --color-danger-bg:  #fee2e2;
    --color-danger-tx:  #991b1b;

    --color-warning:    #f59e0b;
    --color-warning-dk: #d97706;
    --color-warning-bg: #fef3c7;
    --color-warning-tx: #92400e;

    --color-info:       #3b82f6;
    --color-info-dk:    #2563eb;
    --color-info-bg:    #dbeafe;
    --color-info-tx:    #1e40af;

    --color-purple:     #8b5cf6;
    --color-purple-bg:  #ede9fe;
    --color-purple-tx:  #5b21b6;

    /* Neutrals */
    --text:       #1e293b;
    --text-secondary: #555;
    --text-muted: #888;
    --text-faint: #aaa;
    --border:     #e2e8f0;
    --border-dark:#d1d5db;
    --card-bg:    #fff;
    --page-bg:    #faf7f4;

    /* Layout */
    --sidebar-width:     240px;
    --sidebar-collapsed: 60px;
    --top-bar-height:    56px;
    --content-max-width: 1200px;
    --radius:     8px;
    --radius-lg:  10px;
    --radius-xl:  12px;

    /* Shadows */
    --shadow:    0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}


/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.6;
}
a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-500); }
hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
img { max-width: 100%; }


/* ═════════════════════════════════════════════════════════════════
   SIDEBAR
   Uses #sidebar ID selector for specificity.
   HTML: <aside id="sidebar" class="sidebar collapsed">
   ═════════════════════════════════════════════════════════════════ */
#sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    height: 100vh !important;
    min-height: 100vh !important;
    width: var(--sidebar-width);
    background: var(--green-900); color: #fff;
    z-index: 100; display: flex; flex-direction: column;
    overflow: hidden;
}
.sidebar-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: var(--top-bar-height);
}
.sidebar-header button {
    background: none; border: none; color: #fff; font-size: 18px;
    cursor: pointer; width: 28px; min-width: 28px; text-align: center;
}
.sidebar-title { font-weight: 700; font-size: 16px; white-space: nowrap; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; color: rgba(255,255,255,0.8);
    white-space: nowrap; transition: background 0.15s, color 0.15s;
    font-size: 14px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-nav a.active { background: var(--green-700); color: #fff; font-weight: 600; }
.sidebar-nav a i { width: 28px; min-width: 28px; text-align: center; font-size: 16px; }

.sidebar-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 16px; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; color: rgba(255,255,255,0.6); font-size: 14px;
}
.sidebar-footer a:hover { color: #fff; background: rgba(255,255,255,0.05); }

/* Mobile overlay helpers */
.mobile-hamburger { display: none; }
.sidebar-backdrop {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 99;
}
.sidebar-backdrop.active { display: block; }


/* ═════════════════════════════════════════════════════════════════
   MAIN CONTENT AREA
   ═════════════════════════════════════════════════════════════════ */
#main-content {
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}
.top-bar {
    position: sticky; top: 0; z-index: 50;
    height: var(--top-bar-height); background: var(--card-bg);
    border-bottom: 1px solid #e0e0e0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; gap: 16px;
}
.search-bar {
    display: flex; align-items: center; gap: 8px;
    background: var(--earth-100); border-radius: 20px;
    padding: 6px 16px; flex: 1; max-width: 400px;
}
.search-bar i { color: #999; }
.search-bar input {
    border: none; background: none; outline: none;
    font-size: 14px; width: 100%; font-family: inherit;
}
.user-info { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.user-name { font-weight: 600; }
.zone-badge {
    background: var(--green-100); color: var(--green-800);
    padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600;
}
.role-badge {
    padding: 2px 8px; border-radius: 10px; font-size: 11px;
    font-weight: 600; text-transform: uppercase;
}
.role-admin { background: #ffcdd2; color: #c62828; }
.role-moderator { background: var(--color-warning-bg); color: #e65100; }
.role-user { background: var(--green-100); color: var(--green-800); }

.content-area { padding: 24px; max-width: var(--content-max-width); }


/* ═════════════════════════════════════════════════════════════════
   AUTH OVERLAY (Login / Register)
   ═════════════════════════════════════════════════════════════════ */
.auth-overlay {
    position: fixed; inset: 0; display: flex;
    align-items: center; justify-content: center; z-index: 1000;
}
.auth-bg {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 50%, var(--earth-700) 100%);
}
.auth-modal {
    position: relative; background: var(--card-bg); border-radius: var(--radius-xl);
    padding: 32px; width: 90%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-header h1 { font-size: 28px; color: var(--green-800); margin-bottom: 4px; }
.auth-header p { color: #666; font-size: 14px; }
.auth-tabs { display: flex; margin-bottom: 20px; border-bottom: 2px solid #eee; }
.auth-tab {
    flex: 1; padding: 10px; text-align: center;
    border: none; background: none; cursor: pointer;
    font-size: 15px; font-weight: 600; color: #999;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.auth-tab.active { color: var(--green-700); border-bottom-color: var(--green-700); }


/* ═════════════════════════════════════════════════════════════════
   FLASH MESSAGES
   ═════════════════════════════════════════════════════════════════ */
.flash-container { padding: 0 24px; }
.flash {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-radius: var(--radius); margin-bottom: 8px;
    font-size: 14px; animation: slideDown 0.3s ease;
}
.flash-success { background: var(--color-success-bg); color: var(--color-success-tx); border: 1px solid #a5d6a7; }
.flash-error   { background: var(--color-danger-bg);  color: var(--color-danger-tx);  border: 1px solid #ef9a9a; }
.flash-info    { background: var(--color-info-bg);     color: var(--color-info-tx);    border: 1px solid #90caf9; }
.flash-warning { background: var(--color-warning-bg);  color: var(--color-warning-tx); border: 1px solid #fde68a; }
.flash-close { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }


/* ═════════════════════════════════════════════════════════════════
   PAGE LAYOUT HELPERS
   ═════════════════════════════════════════════════════════════════ */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; color: var(--green-900); margin-bottom: 4px; }
.page-header p { color: #666; }
.back-link { font-size: 14px; color: var(--green-600); display: inline-block; margin-bottom: 8px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
.section-title { font-size: 18px; color: var(--green-800); margin: 24px 0 12px; }
.card-header-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; }
.form-help { display: block; font-size: 13px; color: var(--text-muted); margin-top: 4px; }


/* ═════════════════════════════════════════════════════════════════
   CARDS
   Single definition. Used everywhere.
   ═════════════════════════════════════════════════════════════════ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #e8e8e8;
}
.card h2 { font-size: 18px; color: var(--green-800); margin-bottom: 12px; }
.card h3 { font-size: 16px; color: var(--green-800); margin-bottom: 8px; }
.card h4 { font-size: 15px; margin-bottom: 6px; }
.card p  { margin-bottom: 8px; }
.card-warning   { border-left: 4px solid var(--color-warning); background: var(--color-warning-bg); }
.card-highlight { border-left: 4px solid var(--color-success); background: var(--green-100); }

/* Card with structured header (admin/phase6 style) */
.card-header {
    margin: -20px -20px 12px;
    padding: 10px 16px;
    background: #f8f9f0;
    border-bottom: 1px solid #e8e8e8;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-header h3 { margin: 0; font-size: 1rem; color: var(--green-800); }


/* ═════════════════════════════════════════════════════════════════
   BUTTONS
   Single definition. All sizes, all variants.
   ═════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: none; border-radius: var(--radius);
    font-size: 14px; font-weight: 600; cursor: pointer;
    text-decoration: none; font-family: inherit;
    transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }

/* Variants */
.btn-primary   { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-600); color: #fff; }
.btn-secondary { background: #e0e0e0; color: var(--text); }
.btn-secondary:hover { background: #d0d0d0; color: var(--text); }
.btn-success   { background: var(--color-success); color: #fff; }
.btn-success:hover { background: var(--color-success-dk); color: #fff; }
.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: var(--color-danger-dk); color: #fff; }

/* Sizes */
.btn-sm   { padding: 4px 10px; font-size: 12px; }
.btn-xs   { padding: 2px 8px; font-size: 11px; }
.btn-lg   { padding: 12px 24px; font-size: 16px; }
.btn-full { width: 100%; justify-content: center; padding: 10px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* Utility buttons */
.btn-icon {
    background: none; border: none; cursor: pointer;
    font-size: 16px; padding: 4px 6px; border-radius: 4px;
    color: var(--text-muted); transition: background 0.15s;
}
.btn-icon:hover { background: #f1f5f9; }
.inline-form { display: inline; }


/* ═════════════════════════════════════════════════════════════════
   FORMS
   ═════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 8px 12px; border: 1px solid #ddd;
    border-radius: var(--radius); font-size: 14px; font-family: inherit;
    transition: border-color 0.2s; box-sizing: border-box;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(90,154,36,0.1);
}
.form-control {
    width: 100%; padding: 8px 12px; border: 1px solid #ccc;
    border-radius: var(--radius); font-size: 14px;
    font-family: inherit; box-sizing: border-box;
}
.form-control:focus { border-color: var(--color-success); outline: none; }
.form-sm { padding: 4px 8px; font-size: 14px; height: auto; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }
.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 0; cursor: pointer; font-size: 14px;
}
.action-form { margin-bottom: 12px; }
.action-form .form-control { margin-bottom: 6px; }


/* ═════════════════════════════════════════════════════════════════
   BADGES
   ═════════════════════════════════════════════════════════════════ */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    background: #eee; color: #666;
}
/* Plant category badges */
.badge-vegetable   { background: #e8f5e9; color: #2e7d32; }
.badge-herb        { background: #f3e5f5; color: #7b1fa2; }
.badge-fruit       { background: var(--color-warning-bg); color: #e65100; }
.badge-flower      { background: #fce4ec; color: #c62828; }
.badge-tree        { background: #e0f2f1; color: #00695c; }
.badge-shrub       { background: #e8eaf6; color: #283593; }
/* Difficulty badges */
.badge-beginner    { background: #e8f5e9; color: #2e7d32; }
.badge-intermediate{ background: var(--color-warning-bg); color: #e65100; }
.badge-advanced    { background: var(--color-danger-bg); color: #c62828; }
/* Type badges */
.badge-pest        { background: var(--color-danger-bg); color: #c62828; }
.badge-disease     { background: var(--color-warning-bg); color: #e65100; }
.badge-fungal      { background: #f3e5f5; color: #7b1fa2; }
.badge-organic     { background: #e8f5e9; color: #2e7d32; }
/* Semantic badges */
.badge-info        { background: var(--color-info-bg);    color: var(--color-info-tx); }
.badge-success     { background: var(--color-success-bg); color: var(--color-success-tx); }
.badge-warning     { background: var(--color-warning-bg); color: var(--color-warning-tx); }
.badge-danger      { background: var(--color-danger-bg);  color: var(--color-danger-tx); }
.badge-overdue     { background: var(--color-danger-bg);  color: var(--color-danger-tx); font-weight: 600; }
.badge-auto        { background: #e0e7ff; color: #4338ca; font-size: 10px; }
.badge-indoor      { background: #e8eaf6; color: #3949ab; padding: 1px 6px; font-size: 10px; }
/* Status badges (planting lifecycle) */
.badge-planned     { background: #e0e7ff; color: #4338ca; }
.badge-started,
.badge-sprouted    { background: var(--color-success-bg); color: var(--color-success-tx); }
.badge-growing     { background: var(--color-success-bg); color: var(--color-success-tx); }
.badge-flowering   { background: #fce7f3; color: #9d174d; }
.badge-fruiting    { background: #ffedd5; color: #9a3412; }
.badge-harvesting  { background: #fef9c3; color: #854d0e; }
.badge-done        { background: #f1f5f9; color: #475569; }
.badge-failed      { background: var(--color-danger-bg); color: var(--color-danger-tx); }
.badge-yes         { background: var(--color-success-bg); color: var(--color-success-tx); }
.badge-no          { background: var(--color-danger-bg); color: var(--color-danger-tx); }
.badge-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }

/* Small chips */
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 999px;
    font-size: 12px; background: #f1f5f9; color: #475569;
    text-decoration: none; transition: background 0.15s;
}
.chip:hover { background: #e2e8f0; }
.chip-sm    { padding: 1px 6px; font-size: 11px; }
.chip-more  { background: transparent; color: var(--text-muted); }
.chip-green { background: #d1fae5; color: #065f46; }
.chip-blue  { background: var(--color-info-bg); color: var(--color-info-tx); }
.chip-purple{ background: var(--color-purple-bg); color: var(--color-purple-tx); }


/* ═════════════════════════════════════════════════════════════════
   TABLES
   ═════════════════════════════════════════════════════════════════ */
/* Original data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
    text-align: left; padding: 8px 12px; background: var(--earth-100);
    color: var(--text-secondary); font-weight: 600; border-bottom: 2px solid #ddd;
}
.data-table td { padding: 8px 12px; border-bottom: 1px solid #eee; }
.data-table tr:hover { background: #fafafa; }

/* Facts table (plant detail, etc.) */
.facts-table { width: 100%; font-size: 13px; }
.facts-table td { padding: 6px 0; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.facts-table td:first-child { font-weight: 600; width: 40%; white-space: nowrap; }

/* Admin-style table */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 8px 12px; text-align: left;
    border-bottom: 1px solid #eee; font-size: 14px;
}
.table th {
    font-weight: 600; color: var(--text-secondary);
    font-size: 12px; text-transform: uppercase;
}
.table th a { color: var(--green-800); text-decoration: none; }
.table-hover tr:hover { background: #f8f9f0; }
.row-inactive { opacity: 0.5; }


/* ═════════════════════════════════════════════════════════════════
   DASHBOARD & STAT CARDS
   ═════════════════════════════════════════════════════════════════ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex; align-items: flex-start; gap: 12px;
    box-shadow: var(--shadow);
    border: 1px solid #e8e8e8;
}
.stat-icon {
    font-size: 1.8rem; color: var(--green-600);
    width: 50px; height: 50px; min-width: 50px;
    background: var(--green-100); border-radius: var(--radius-xl);
    display: flex; align-items: center; justify-content: center;
}
.stat-value  { font-size: 1.5rem; font-weight: 700; color: var(--green-800); }
.stat-number { font-size: 1.5rem; font-weight: 700; color: var(--green-900); display: block; }
.stat-label  { font-weight: 600; color: var(--text-secondary); font-size: 14px; }
.stat-sub    { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Mini stats */
.stats-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}
.stat-mini { background: #f8f9f0; padding: 8px 12px; border-radius: var(--radius); font-size: 14px; }
.stat-mini-val { font-weight: 700; color: var(--green-800); font-size: 1.1rem; }


/* ═════════════════════════════════════════════════════════════════
   ALERTS & NOTIFICATIONS
   ═════════════════════════════════════════════════════════════════ */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 14px;
}
.alert-warning { background: var(--color-warning-bg); border: 1px solid #ffe0b2; color: #e65100; }
.alert a { color: inherit; font-weight: 600; }

.notification-item { padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.notification-item:last-child { border-bottom: none; }
.notification-unread { background: #f0f8ff; margin: 0 -20px; padding: 12px 20px; }
.notification-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.notification-body { font-size: 14px; color: var(--text-secondary); margin: 4px 0; }

/* Notification bell */
.nav-bell { position: relative; text-decoration: none; font-size: 1.2rem; }
.nav-bell-count {
    position: absolute; top: -6px; right: -8px;
    background: var(--color-danger); color: #fff;
    font-size: 10px; width: 16px; height: 16px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}


/* ═════════════════════════════════════════════════════════════════
   FILTERS
   ═════════════════════════════════════════════════════════════════ */
.filters-bar,
.filter-bar {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 16px; align-items: center;
}
.filter-form {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.filter-form select,
.filter-form input {
    padding: 6px 10px; border: 1px solid #ddd;
    border-radius: var(--radius); font-size: 14px;
}
.filter-row {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px;
}
.filter-controls { display: flex; gap: 8px; }
.filter-controls select {
    padding: 6px 12px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 14px;
    background: var(--card-bg);
}


/* ═════════════════════════════════════════════════════════════════
   TAB BAR
   ═════════════════════════════════════════════════════════════════ */
.tab-bar {
    display: flex; gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}
.tab {
    padding: 8px 20px; text-decoration: none;
    color: var(--text-muted); font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--green-700); border-bottom-color: var(--green-700); }


/* ═════════════════════════════════════════════════════════════════
   LIST ITEMS
   ═════════════════════════════════════════════════════════════════ */
.list-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #f0f0f0; gap: 12px;
}
.list-item:last-child { border-bottom: none; }


/* ═════════════════════════════════════════════════════════════════
   QUICK LINKS (Admin sidebar)
   ═════════════════════════════════════════════════════════════════ */
.quick-links { display: flex; flex-direction: column; gap: 4px; }
.quick-links a {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; color: var(--green-800);
    text-decoration: none; border-radius: var(--radius);
    transition: background 0.15s;
}
.quick-links a:hover { background: #f0f4e8; }


/* ═════════════════════════════════════════════════════════════════
   ADMIN LAYOUT
   ═════════════════════════════════════════════════════════════════ */
.admin-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.admin-header h1 { margin: 0; }
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-columns {
    display: grid; grid-template-columns: 1fr 360px;
    gap: 20px; margin-top: 16px;
}
.admin-col-main { min-width: 0; }
.admin-col-side { min-width: 0; }


/* ═════════════════════════════════════════════════════════════════
   PAGINATION
   ═════════════════════════════════════════════════════════════════ */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 8px; padding: 12px 0; margin-top: 16px; font-size: 14px;
}
.pagination a { color: var(--green-800); text-decoration: none; font-weight: 600; }


/* ═════════════════════════════════════════════════════════════════
   ERROR DISPLAY
   ═════════════════════════════════════════════════════════════════ */
.error-item { padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.error-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.error-url { font-size: 12px; margin: 2px 0; }
.error-msg { font-size: 14px; color: #c62828; }
.error-trace {
    font-size: 12px; background: #f5f5f5; padding: 8px;
    border-radius: 4px; overflow-x: auto; max-height: 200px; margin-top: 4px;
}


/* ═════════════════════════════════════════════════════════════════
   BACKUPS
   ═════════════════════════════════════════════════════════════════ */
.backup-item { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.backup-item:last-child { border-bottom: none; }


/* ═════════════════════════════════════════════════════════════════
   TEXT HELPERS
   ═════════════════════════════════════════════════════════════════ */
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 13px; color: var(--text-muted); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: #e65100; }


/* ═════════════════════════════════════════════════════════════════
   PRINT STYLES  (single definition — no duplicates)
   ═════════════════════════════════════════════════════════════════ */
@media print {
    .no-print,
    .fab-container,
    .pwa-banner       { display: none !important; }
    #sidebar,
    .sidebar          { display: none !important; }
    #main-content,
    .main-content     { margin-left: 0 !important; padding: 0 !important; }
    .top-bar          { display: none !important; }
    .flash-container  { display: none !important; }
    body              { font-size: 11pt; }
}


/* ═════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═════════════════════════════════════════════════════════════════ */

/* ── Mobile + Tablet (up to 1200px): hamburger slide-out ───────── */
@media (max-width: 1200px) {
    #sidebar {
        width: var(--sidebar-width) !important;
        transform: translateX(-100%) !important;
        transition: transform 0.25s ease;
    }
    #sidebar.collapsed {
        transform: translateX(-100%) !important;
        width: var(--sidebar-width) !important;
    }
    #sidebar.expanded,
    #sidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    #sidebar.expanded .sidebar-title,
    #sidebar.mobile-open .sidebar-title { display: inline; }
    #sidebar.expanded .sidebar-nav a span,
    #sidebar.mobile-open .sidebar-nav a span { display: inline; }
    #sidebar.expanded .sidebar-footer a span,
    #sidebar.mobile-open .sidebar-footer a span { display: inline; }

    #main-content,
    #main-content.sidebar-collapsed { margin-left: 0 !important; }

    .mobile-hamburger {
        display: flex !important;
        background: none; border: none;
        color: var(--green-700); font-size: 22px;
        cursor: pointer; padding: 4px 8px; margin-right: 8px;
    }
    .sidebar-backdrop.active { display: block; }

    .top-bar { padding-left: 16px; }
    .content-area { padding: 16px; }
    .search-bar { max-width: 200px; }
    .user-name { display: none; }

    .two-col,
    .detail-grid,
    .admin-columns { grid-template-columns: 1fr; }

    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Small Mobile (up to 480px) ────────────────────────────────── */
@media (max-width: 480px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .detail-grid    { grid-template-columns: 1fr; }
}

/* ── Desktop (1201px+): persistent collapsible sidebar ─────────── */
@media (min-width: 1201px) {
    .mobile-hamburger  { display: none !important; }
    .sidebar-backdrop  { display: none !important; }

    #sidebar {
        transform: translateX(0) !important;
        transition: width 0.25s ease;
        width: var(--sidebar-width);
        height: 100vh !important;
    }
    #sidebar.collapsed { width: var(--sidebar-collapsed); }
    #sidebar.collapsed .sidebar-title { display: none; }
    #sidebar.collapsed .sidebar-nav a span { display: none; }
    #sidebar.collapsed .sidebar-footer a span { display: none; }
    #sidebar.collapsed .sidebar-divider { margin: 8px; }

    #main-content {
        margin-left: var(--sidebar-width) !important;
        transition: margin-left 0.25s ease;
    }
    #main-content.sidebar-collapsed {
        margin-left: var(--sidebar-collapsed) !important;
    }
}

/* ── Touch & iOS Optimizations ─────────────────────────────────── */
@media (max-width: 768px) {
    input, select, textarea { font-size: 16px; /* prevents iOS zoom */ }
    .btn, button[type="submit"] { min-height: 44px; }
}

/* ── Safe Area (PWA notch handling) ────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
    .sidebar-footer { padding-bottom: env(safe-area-inset-bottom); }
}