/* =====================================================
   Poti Noleggi - Area Personale
   Mobile-first · Modern · Professional
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Brand */
    --primary:        #2563eb;
    --primary-dark:   #1d4ed8;
    --primary-light:  #eff6ff;
    --primary-glow:   rgba(37,99,235,.18);

    /* Semantic */
    --success:        #10b981;
    --success-light:  #ecfdf5;
    --warning:        #f59e0b;
    --warning-light:  #fffbeb;
    --danger:         #ef4444;
    --danger-light:   #fef2f2;
    --info:           #3b82f6;
    --info-light:     #eff6ff;

    /* Neutrals */
    --gray-50:  #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Surfaces */
    --bg:        #f0f4f8;
    --surface:   #ffffff;
    --surface-2: #f8fafc;

    /* Sidebar */
    --sidebar-bg:    #0f172a;
    --sidebar-hover: rgba(255,255,255,.07);
    --sidebar-active: rgba(37,99,235,.9);
    --sidebar-w:     260px;

    /* Borders */
    --border: #e5e7eb;

    /* Misc */
    --topbar-h:  64px;
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow:    0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.05);

    --transition: .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img, svg { display: block; }

/* ─────────────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform var(--transition);
    overflow: hidden;
}

/* Subtle gradient overlay */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 200px;
    background: linear-gradient(180deg, rgba(37,99,235,.15) 0%, transparent 100%);
    pointer-events: none;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    position: relative;
}

.sidebar-logo {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .85rem; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,.4);
}

.sidebar-brand-name {
    font-size: .875rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -.01em;
}
.sidebar-brand-sub {
    font-size: .7rem;
    color: rgba(255,255,255,.35);
    font-weight: 400;
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.25);
    padding: 18px 8px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.6);
    font-size: .875rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
    margin-bottom: 2px;
    position: relative;
    cursor: pointer;
    border: none;
    width: 100%;
    background: none;
    text-align: left;
}

.nav-link svg,
.nav-link .nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: .7;
    transition: opacity var(--transition);
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: rgba(255,255,255,.9);
    text-decoration: none;
}
.nav-link:hover svg,
.nav-link:hover .nav-icon { opacity: 1; }

.nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.nav-link.active svg,
.nav-link.active .nav-icon { opacity: 1; }

/* Active left bar */
.nav-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}

/* ─────────────────────────────────────────────────────
   TOPBAR
───────────────────────────────────────────────────── */
.topbar {
    position: fixed;
    top: 0; right: 0;
    left: var(--sidebar-w);
    height: var(--topbar-h);
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    z-index: 100;
}

.topbar-title {
    flex: 1;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--gray-800);
    letter-spacing: -.01em;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.btn-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-500);
    transition: all var(--transition);
    position: relative;
    text-decoration: none;
}
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-icon svg { width: 20px; height: 20px; }

.badge {
    position: absolute;
    top: 3px; right: 3px;
    background: var(--danger);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    border-radius: 99px;
    padding: 1px 4px;
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
    border: 2px solid #fff;
}

.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

.user-menu { position: relative; }
.user-menu-btn {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius);
    transition: background var(--transition);
}
.user-menu-btn:hover { background: var(--gray-100); }
.user-name { font-size: .875rem; font-weight: 500; color: var(--gray-700); }

.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 300;
    display: none;
    overflow: hidden;
    animation: dropIn .15s ease;
}
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dropdown.open { display: block; }

.dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}

.dropdown a, .dropdown button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 16px;
    font-size: .875rem; color: var(--gray-700);
    background: none; border: none; cursor: pointer;
    text-align: left; text-decoration: none;
    transition: background var(--transition);
}
.dropdown a:hover, .dropdown button:hover { background: var(--gray-50); color: var(--gray-900); }
.dropdown a svg, .dropdown button svg { width: 16px; height: 16px; color: var(--gray-400); }
.dropdown hr { border: none; border-top: 1px solid var(--gray-100); margin: 4px 0; }

/* ── Hamburger ── */
.hamburger {
    display: none;
    background: none; border: none; cursor: pointer;
    padding: 4px; color: var(--gray-600); border-radius: 6px;
    transition: background var(--transition);
}
.hamburger:hover { background: var(--gray-100); }
.hamburger svg { width: 22px; height: 22px; display: block; }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px);
    z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ─────────────────────────────────────────────────────
   MAIN CONTENT
───────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.main-content {
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    min-height: 100vh;
    flex: 1;
    min-width: 0;
}

.page {
    padding: 28px 24px;
    max-width: 1280px;
}

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

.page-title {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -.025em;
    line-height: 1.2;
}

.page-subtitle {
    font-size: .875rem;
    color: var(--gray-500);
    margin-top: 3px;
    font-weight: 400;
}

/* ─────────────────────────────────────────────────────
   CARDS
───────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid rgba(0,0,0,.06);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

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

.card-title {
    font-size: .9375rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -.01em;
}

.card-body { padding: 20px; }

/* ─────────────────────────────────────────────────────
   STAT CARDS
───────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid rgba(0,0,0,.06);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 50%;
    opacity: .06;
    transform: translate(20px, -20px);
}

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

.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-icon.blue   { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: var(--primary); }
.stat-icon.green  { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: var(--success); }
.stat-icon.yellow { background: linear-gradient(135deg, #fef3c7, #fde68a); color: var(--warning); }
.stat-icon.red    { background: linear-gradient(135deg, #fee2e2, #fecaca); color: var(--danger); }

.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    line-height: 1;
    color: var(--gray-900);
    letter-spacing: -.03em;
}
.stat-label {
    font-size: .8125rem;
    color: var(--gray-500);
    margin-top: 4px;
    font-weight: 500;
}

/* ─────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    letter-spacing: -.01em;
    line-height: 1;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,.12); }
.btn:active { transform: scale(.98); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(37,99,235,.45);
    color: #fff; text-decoration: none;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--gray-700);
    border-color: var(--gray-200);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    text-decoration: none;
    color: var(--gray-800);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16,185,129,.3);
}
.btn-success:hover { box-shadow: 0 4px 12px rgba(16,185,129,.4); color:#fff; text-decoration:none; transform:translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239,68,68,.3);
}
.btn-danger:hover { box-shadow: 0 4px 12px rgba(239,68,68,.4); color:#fff; text-decoration:none; transform:translateY(-1px); }

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245,158,11,.3);
}
.btn-warning:hover { box-shadow: 0 4px 12px rgba(245,158,11,.4); color:#fff; text-decoration:none; transform:translateY(-1px); }

.btn-sm { padding: 6px 12px; font-size: .8125rem; }
.btn-lg { padding: 12px 24px; font-size: .9375rem; }

/* ─────────────────────────────────────────────────────
   FORMS
───────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-700);
    letter-spacing: -.005em;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: .875rem;
    color: var(--gray-800);
    background: var(--surface);
    transition: all var(--transition);
    outline: none;
    font-family: inherit;
    -webkit-appearance: none;
}
.form-control:hover { border-color: var(--gray-300); }
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 88px; }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 36px; }

.form-hint { font-size: .75rem; color: var(--gray-400); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─────────────────────────────────────────────────────
   TABLES
───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: .875rem; }

th {
    text-align: left;
    padding: 11px 16px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--gray-400);
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    color: var(--gray-700);
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--gray-50); }

/* ─────────────────────────────────────────────────────
   PILLS / BADGES
───────────────────────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}

.pill-blue   { background: #dbeafe; color: #1d4ed8; }
.pill-green  { background: #d1fae5; color: #065f46; }
.pill-yellow { background: #fef3c7; color: #92400e; }
.pill-red    { background: #fee2e2; color: #991b1b; }
.pill-gray   { background: var(--gray-100); color: var(--gray-600); }
.pill-purple { background: #ede9fe; color: #5b21b6; }
.pill-indigo { background: #e0e7ff; color: #3730a3; }

/* ─────────────────────────────────────────────────────
   ALERTS
───────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: .875rem;
    margin-bottom: 20px;
    border: 1px solid transparent;
    animation: slideDown .2s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: var(--danger-light);  color: #991b1b; border-color: #fca5a5; }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: #fde68a; }
.alert-info    { background: var(--info-light);    color: #1e40af; border-color: #bfdbfe; }

/* ─────────────────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 52px 20px;
    color: var(--gray-400);
}
.empty-state-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    background: var(--gray-100);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
}
.empty-state-icon svg { width: 28px; height: 28px; }
.empty-state h3 { font-size: .9375rem; font-weight: 700; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p  { font-size: .875rem; max-width: 300px; margin: 0 auto; }

/* ─────────────────────────────────────────────────────
   MODAL
───────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 100%;
    animation: modalIn .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.92) translateY(16px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-100);
}
.modal-title { font-weight: 700; font-size: 1rem; color: var(--gray-900); }
.modal-body  { padding: 22px; }
.modal-footer {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 16px 22px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ─────────────────────────────────────────────────────
   CALENDAR
───────────────────────────────────────────────────── */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cal-header-cell {
    text-align: center;
    font-size: .72rem;
    font-weight: 700;
    color: var(--gray-400);
    padding: 10px 4px;
    letter-spacing: .05em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--gray-100);
}

.cal-cell {
    min-height: 96px;
    border-right: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
    padding: 7px 6px;
}
.cal-cell:nth-child(7n) { border-right: none; }

.cal-day-num {
    font-size: .8125rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gray-400);
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
}
.cal-cell:not(.other-month) .cal-day-num { color: var(--gray-700); }
.cal-cell.today .cal-day-num {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.cal-cell.other-month { background: #fafafa; }

.cal-event {
    display: block;
    font-size: .68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-event.ferie    { background: #dbeafe; color: #1d4ed8; }
.cal-event.permesso { background: #d1fae5; color: #065f46; }
.cal-event.malattia { background: #fee2e2; color: #991b1b; }
.cal-event.altro    { background: #ede9fe; color: #5b21b6; }

.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-month-label {
    font-size: 1rem;
    font-weight: 700;
    min-width: 170px;
    text-align: center;
    color: var(--gray-800);
    letter-spacing: -.01em;
}

/* ─────────────────────────────────────────────────────
   DOCUMENT ITEMS
───────────────────────────────────────────────────── */
.doc-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition);
}
.doc-item:last-child { border-bottom: none; }
.doc-item:hover { background: var(--gray-50); margin: 0 -20px; padding: 14px 20px; border-radius: var(--radius); }

.doc-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.doc-icon.pdf   { background: linear-gradient(135deg, #fee2e2, #fecaca); color: var(--danger); }
.doc-icon.image { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: var(--primary); }
.doc-name       { font-weight: 600; font-size: .875rem; color: var(--gray-800); }
.doc-meta       { font-size: .78rem; color: var(--gray-400); margin-top: 2px; }
.doc-actions    { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; }
.doc-new-badge  {
    font-size: .62rem; font-weight: 800;
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #fff; border-radius: 99px; padding: 2px 7px;
    margin-left: 6px; letter-spacing: .04em;
    box-shadow: 0 2px 6px rgba(239,68,68,.35);
}

/* ─────────────────────────────────────────────────────
   AUTH PAGE
───────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Animated background blobs */
.auth-page::before,
.auth-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .25;
    animation: float 8s ease-in-out infinite;
}
.auth-page::before {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #2563eb, transparent);
    top: -100px; left: -100px;
}
.auth-page::after {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #7c3aed, transparent);
    bottom: -80px; right: -80px;
    animation-delay: -4s;
}
@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50%       { transform: translateY(-20px) scale(1.05); }
}

.auth-card {
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px rgba(0,0,0,.35);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255,255,255,.2);
}

.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo-icon {
    width: 60px; height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
    font-weight: 800; font-size: 1.1rem; color: #fff;
    box-shadow: 0 8px 24px rgba(37,99,235,.4);
}
.auth-logo h1 { font-size: 1.25rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.02em; }
.auth-logo p  { font-size: .875rem; color: var(--gray-500); margin-top: 4px; }

/* ─────────────────────────────────────────────────────
   GRIDS & UTILITIES
───────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

.flex         { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }

.text-muted    { color: var(--gray-400); }
.text-sm       { font-size: .875rem; }
.text-xs       { font-size: .75rem; }
.text-center   { text-align: center; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Divider */
hr.divider { border: none; border-top: 1px solid var(--gray-100); margin: 16px 0; }

/* ─────────────────────────────────────────────────────
   RESPONSIVE — Mobile first
───────────────────────────────────────────────────── */

/* Mobile base (up to 767px) */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .topbar { left: 0; padding: 0 16px; }
    .main-content { margin-left: 0; }
    .hamburger { display: flex; }
    .user-name { display: none; }

    .page { padding: 20px 14px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header .btn { justify-content: center; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-value { font-size: 1.5rem; }

    .form-row { grid-template-columns: 1fr; gap: 0; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }

    .auth-card { padding: 28px 20px; }

    table { font-size: .8125rem; }
    th, td { padding: 10px 12px; }

    .cal-cell { min-height: 60px; padding: 4px 3px; }
    .cal-event { font-size: .6rem; padding: 1px 3px; }
    .cal-day-num { font-size: .7rem; width: 22px; height: 22px; }
    .cal-month-label { min-width: 130px; font-size: .9rem; }
}

/* Tablet (768px – 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    :root { --sidebar-w: 220px; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .page { padding: 24px 20px; }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1280px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Very small screens */
@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 24px 16px; }
    .page-title { font-size: 1.2rem; }
}
