/* ═══════════════════════════════════════════
   е-Читалище — Mobile-first CSS
   ═══════════════════════════════════════════ */

:root {
    --c1: #1B5E20;
    --c1-light: #2E7D32;
    --c1-lighter: #4CAF50;
    --c1-bg: #E8F5E9;
    --accent: #F9A825;
    --accent-light: #FFF8E1;
    --ink: #2E2E2E;
    --muted: #777;
    --light: #999;
    --surface: #ffffff;
    --surface2: #f9f9f6;
    --bg: #f5f5f0;
    --border: #e8e5e0;
    --border-light: #f0ede8;
    --danger: #c62828;
    --danger-bg: #FFEBEE;
    --warning: #E65100;
    --warning-bg: #FFF3E0;
    --info: #0277BD;
    --info-bg: #E1F5FE;
    --success: #2E7D32;
    --success-bg: #E8F5E9;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,.06);
    --shadow-lg: 0 4px 20px rgba(0,0,0,.1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg, video, iframe { max-width: 100%; height: auto; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; width: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    padding-bottom: calc(70px + var(--safe-bottom));
    padding-top: 56px;
}
a { color: var(--c1); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Topbar ── */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 56px;
    background: var(--c1);
    color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar-brand {
    display: flex; align-items: center; gap: .5rem;
    color: #fff; text-decoration: none; font-weight: 700; font-size: 1rem;
}
.topbar-icon { font-size: 1.25rem; }
.topbar-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }
.topbar-btn {
    position: relative; color: #fff; padding: .5rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.topbar-btn:hover { background: rgba(255,255,255,.15); text-decoration: none; }
.badge {
    position: absolute; top: 2px; right: 2px;
    background: var(--danger); color: #fff;
    font-size: .65rem; font-weight: 700;
    min-width: 18px; height: 18px;
    border-radius: 9px; display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}

/* ── Bottom Nav (mobile) ── */
.bnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    padding-bottom: var(--safe-bottom);
    height: calc(60px + var(--safe-bottom));
}
.bnav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; color: var(--muted); font-size: .6rem; font-weight: 500;
    text-decoration: none; border: none; background: none; cursor: pointer;
    padding: .5rem 0;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s;
}
.bnav-item svg { width: 22px; height: 22px; }
.bnav-item.active { color: var(--c1); }
.bnav-item:hover { color: var(--c1); text-decoration: none; }

/* ── Mobile slide-up menu ── */
.menu-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,.4);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .2s, visibility .2s;
}
.menu-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }
.menu-sheet {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.22,1,.36,1);
    padding-bottom: calc(80px + var(--safe-bottom));
}
.menu-overlay.show .menu-sheet { transform: translateY(0); }
.menu-handle {
    width: 36px; height: 4px; background: var(--border); border-radius: 2px;
    margin: 10px auto 6px;
}
.menu-user {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border-light);
}
.menu-user strong { display: block; font-size: .95rem; }
.menu-user span { font-size: .8rem; color: var(--muted); }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--c1-bg); color: var(--c1);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
}
.menu-section {
    padding: .75rem 1.25rem .25rem;
    font-size: .7rem; font-weight: 700; text-transform: uppercase;
    color: var(--light); letter-spacing: .04em;
}
.menu-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem 1.25rem;
    color: var(--ink); font-size: .9rem; font-weight: 500;
    text-decoration: none;
    transition: background .15s;
}
.menu-item:hover { background: var(--surface2); text-decoration: none; }
.menu-item.active { color: var(--c1); background: var(--c1-bg); }
.menu-item svg { flex-shrink: 0; opacity: .7; }
.menu-logout { color: var(--danger); }

/* ── Page content ── */
.page { padding: 1rem; max-width: 1100px; margin: 0 auto; }
.page-wide { padding: 1rem; max-width: 1500px; margin: 0 auto; }
.page-title { font-size: 1.35rem; font-weight: 800; margin-bottom: 1rem; }
.page-subtitle { font-size: .85rem; color: var(--muted); margin-top: -.5rem; margin-bottom: 1rem; }

/* ── Cards ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}
.card-header {
    font-size: 1rem; font-weight: 700; margin-bottom: .75rem;
    display: flex; align-items: center; justify-content: space-between;
}

/* ── Stats grid (dashboard) ── */
.stats {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: .75rem; margin-bottom: 1rem;
}
.stat {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--c1); }
.stat-label { font-size: .75rem; color: var(--muted); margin-top: .15rem; }

/* ── Quick actions grid ── */
.actions {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: .75rem; margin-bottom: 1rem;
}
.action-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .4rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem .5rem;
    text-align: center;
    color: var(--ink);
    font-size: .75rem; font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.action-btn svg { color: var(--c1); }
.action-btn:hover { border-color: var(--c1); background: var(--c1-bg); text-decoration: none; }
.action-btn:active { transform: scale(.97); }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block; font-size: .8rem; font-weight: 600;
    margin-bottom: .35rem; color: var(--ink);
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: .7rem .85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: .95rem;
    color: var(--ink);
    transition: border-color .15s;
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--c1);
    box-shadow: 0 0 0 3px rgba(27,94,32,.1);
}
.form-input::placeholder { color: var(--light); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-hint { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .7rem 1.25rem;
    border: none; border-radius: var(--radius-sm);
    font-size: .9rem; font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--c1); color: #fff; }
.btn-primary:hover { background: var(--c1-light); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-accent { background: var(--accent); color: #000; }
.btn-accent:hover { opacity: .9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .4rem .85rem; font-size: .8rem; }
.btn-lg { padding: .85rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .5rem; }

/* ── Flash messages ── */
.flash {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .85rem; font-weight: 500;
}
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-danger { background: var(--danger-bg); color: var(--danger); }
.flash-warning { background: var(--warning-bg); color: var(--warning); }
.flash-info { background: var(--info-bg); color: var(--info); }

/* ── Status badges ── */
.status {
    display: inline-flex; align-items: center;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .7rem; font-weight: 600;
}
.status-success { background: var(--success-bg); color: var(--success); }
.status-danger { background: var(--danger-bg); color: var(--danger); }
.status-warning { background: var(--warning-bg); color: var(--warning); }
.status-info { background: var(--info-bg); color: var(--info); }
.status-secondary { background: #eee; color: #666; }

/* ── List items ── */
.list-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border-light);
}
.list-item:last-child { border-bottom: none; }
.list-item-icon {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--c1-bg); color: var(--c1);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: .9rem; }
.list-item-sub { font-size: .75rem; color: var(--muted); }
.list-item-right { text-align: right; flex-shrink: 0; }

/* ── News feed ── */
.news-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}
.news-card-img { width: 100%; height: 180px; object-fit: cover; }
.news-card-body { padding: 1rem; }
.news-card-title { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; }
.news-card-meta { font-size: .75rem; color: var(--muted); margin-bottom: .5rem; }
.news-card-text { font-size: .85rem; color: #555; line-height: 1.5; }
.news-pinned { border-left: 3px solid var(--accent); }

/* ── Event cards ── */
.event-card {
    display: flex; gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border-light);
}
.event-date-box {
    width: 48px; text-align: center; flex-shrink: 0;
    background: var(--c1-bg); border-radius: var(--radius-sm);
    padding: .4rem .25rem;
}
.event-date-day { font-size: 1.25rem; font-weight: 800; color: var(--c1); line-height: 1; }
.event-date-month { font-size: .65rem; font-weight: 600; color: var(--c1-light); text-transform: uppercase; }
.event-info { flex: 1; }
.event-title { font-weight: 600; font-size: .9rem; }
.event-meta { font-size: .75rem; color: var(--muted); }

/* ── Tables (scrollable on mobile with scroll indicator) ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -1rem; padding: 0 1rem; position: relative; }
.table-wrap::after { content: ''; position: sticky; right: 0; top: 0; bottom: 0; width: 24px; background: linear-gradient(to right, transparent, var(--bg)); pointer-events: none; display: block; float: right; margin-top: -100%; height: 100%; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; padding: .6rem .75rem; border-bottom: 2px solid var(--border); }
td { padding: .65rem .75rem; border-bottom: 1px solid var(--border-light); }
tr:hover td { background: var(--surface2); }

/* ── Empty state ── */
.empty {
    text-align: center; padding: 2.5rem 1rem;
    color: var(--muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .5; }
.empty-title { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; color: var(--ink); }
.empty-text { font-size: .85rem; margin-bottom: 1rem; }

/* ── Footer ── */
.footer {
    text-align: center; padding: 2rem 1rem;
    font-size: .8rem; color: var(--muted);
    margin-bottom: 60px;
}
.footer a { color: var(--c1); }
.footer p { margin-bottom: .25rem; }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,.5);
    display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    width: 100%; max-width: 500px;
    max-height: 90vh; overflow-y: auto;
    padding: 1.5rem;
    animation: slideUp .3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.modal-close { float: right; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; }

/* ── Tabs ── */
.tabs {
    display: flex; gap: 0; flex-wrap: wrap;
    -webkit-overflow-scrolling: touch;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
    scrollbar-width: thin;
}
.tabs::-webkit-scrollbar { height: 4px; }
.tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
@media (max-width: 720px) {
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}
.tab {
    padding: .6rem 1rem;
    font-size: .8rem; font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
}
.tab.active, .tab:hover { color: var(--c1); border-bottom-color: var(--c1); text-decoration: none; }

/* ── Search bar ── */
.search-bar {
    display: flex; gap: .5rem; margin-bottom: 1rem;
}
.search-bar .form-input { flex: 1; }

/* ── Pill badges ── */
.pill {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .25rem .65rem;
    border-radius: 20px; font-size: .7rem; font-weight: 600;
    background: var(--surface2); color: var(--muted);
}
.pill-green { background: var(--success-bg); color: var(--success); }
.pill-yellow { background: var(--accent-light); color: var(--warning); }
.pill-red { background: var(--danger-bg); color: var(--danger); }

/* ── Auth pages (login/register) — no bottom nav ── */
.auth-page { padding-bottom: 2rem; }
.auth-page .bnav { display: none; }
.auth-page body { padding-bottom: 0; }
.auth-card {
    max-width: 420px; margin: 2rem auto;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo-icon { font-size: 2.5rem; }
.auth-logo-text { font-size: 1.2rem; font-weight: 800; color: var(--c1); }
.auth-divider {
    text-align: center; color: var(--muted); font-size: .8rem;
    margin: 1rem 0; position: relative;
}
.auth-divider::before, .auth-divider::after {
    content: ''; position: absolute; top: 50%;
    width: calc(50% - 1rem); height: 1px; background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

/* ── Landing page ── */
.landing-hero {
    background: linear-gradient(135deg, var(--c1) 0%, #0D3B0F 100%);
    color: #fff;
    text-align: center;
    padding: 2.5rem 1.5rem 2rem;
    margin: 0;
}
.landing-hero h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: .75rem; line-height: 1.2; }
.landing-hero p { font-size: 1rem; opacity: .85; margin-bottom: 1.5rem; max-width: 500px; margin-left: auto; margin-right: auto; }
.landing-cta {
    display: inline-flex; align-items: center; gap: .5rem;
    background: var(--accent); color: #000;
    padding: .85rem 2rem; border-radius: var(--radius-sm);
    font-weight: 700; font-size: 1rem;
    text-decoration: none;
    transition: transform .15s;
}
.landing-cta:hover { transform: scale(1.03); text-decoration: none; }

.landing-features {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 1rem; padding: 2rem 1rem;
}
.feature-card {
    text-align: center; padding: 1.25rem .75rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.feature-icon { font-size: 1.75rem; margin-bottom: .5rem; }
.feature-title { font-size: .85rem; font-weight: 700; margin-bottom: .25rem; }
.feature-text { font-size: .75rem; color: var(--muted); }

.landing-section { padding: 2rem 1rem; }
.landing-section-title {
    text-align: center; font-size: 1.35rem; font-weight: 800;
    margin-bottom: 1.5rem;
}

/* ── Pricing cards ── */
.pricing-grid {
    display: grid; grid-template-columns: 1fr;
    gap: 1rem; max-width: 500px; margin: 0 auto;
}
.pricing-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}
.pricing-card.featured { border-color: var(--c1); position: relative; }
.pricing-card.featured::before {
    content: 'Популярен';
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--c1); color: #fff;
    padding: .2rem .75rem; border-radius: 20px;
    font-size: .7rem; font-weight: 700;
}
.pricing-name { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.pricing-price { font-size: 2rem; font-weight: 800; color: var(--c1); }
.pricing-price span { font-size: .85rem; font-weight: 400; color: var(--muted); }
.pricing-features { list-style: none; text-align: left; margin: 1rem 0; font-size: .8rem; }
.pricing-features li { padding: .3rem 0; padding-left: 1.5rem; position: relative; }
.pricing-features li::before { content: '✓'; position: absolute; left: 0; color: var(--c1); font-weight: 700; }
.pricing-features li.disabled { color: var(--light); }
.pricing-features li.disabled::before { content: '—'; color: var(--light); }

/* ── Catalog (public) ── */
.catalog-filters {
    display: flex; gap: .5rem; flex-wrap: wrap;
    margin-bottom: 1rem;
}
.filter-pill {
    padding: .35rem .85rem;
    border-radius: 20px;
    font-size: .8rem; font-weight: 500;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
}
.filter-pill.active, .filter-pill:hover {
    background: var(--c1); color: #fff; border-color: var(--c1); text-decoration: none;
}

.chitalishte-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: .75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    display: flex; align-items: flex-start; gap: .75rem;
}
.chitalishte-card-icon {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    background: var(--c1-bg); color: var(--c1);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; flex-shrink: 0;
}
.chitalishte-card-body { flex: 1; min-width: 0; }
.chitalishte-card-name { font-weight: 700; font-size: .95rem; }
.chitalishte-card-city { font-size: .8rem; color: var(--muted); }
.chitalishte-card-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }

/* ── Utility ── */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .8rem; }
.text-xs { font-size: .7rem; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-sm { gap: .5rem; }
.d-flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ═══════════════════════════════════════════
   Desktop Sidebar
   ═══════════════════════════════════════════ */
.sidebar {
    display: none; /* hidden on mobile */
}

/* ═══════════════════════════════════════════
   Tablet+ (768px)
   ═══════════════════════════════════════════ */
@media (min-width: 768px) {
    body { padding-bottom: 0; }
    .bnav { display: none !important; }
    .menu-overlay { display: none !important; }

    .topbar { display: none; }
    body { padding-top: 0; }

    /* Sidebar */
    .sidebar {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        background: var(--surface);
        border-right: 1px solid var(--border);
        z-index: 101;
    }
    .sidebar-brand-area {
        padding: 1.15rem 1.15rem .75rem;
        border-bottom: 1px solid var(--border-light);
        flex-shrink: 0;
    }
    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: .65rem;
        color: var(--ink);
        text-decoration: none;
    }
    .sidebar-brand:hover { text-decoration: none; color: var(--ink); }
    .sidebar-logo {
        width: 38px; height: 38px;
        background: var(--c1-bg);
        border-radius: 10px;
        display: flex; align-items: center; justify-content: center;
        font-size: 1.2rem;
        flex-shrink: 0;
    }
    .sidebar-brand-text { min-width: 0; }
    .sidebar-brand-name {
        display: block;
        font-weight: 700;
        font-size: .9rem;
        color: var(--ink);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .sidebar-brand-role {
        display: block;
        font-size: .7rem;
        color: var(--muted);
        font-weight: 500;
    }
    .sidebar-nav {
        flex: 1;
        overflow-y: auto;
        padding: .5rem 0;
    }
    .sidebar-divider {
        height: 1px;
        background: var(--border-light);
        margin: .5rem 1rem;
    }
    .sidebar-item {
        display: flex;
        align-items: center;
        gap: .65rem;
        padding: .5rem 1.15rem;
        margin: 1px .5rem;
        color: var(--ink);
        font-size: .84rem;
        font-weight: 500;
        text-decoration: none;
        transition: all .15s;
        border-radius: 8px;
    }
    .sidebar-item:hover {
        background: var(--surface2);
        color: var(--c1);
        text-decoration: none;
    }
    .sidebar-item.active {
        background: var(--c1-bg);
        color: var(--c1);
        font-weight: 600;
    }
    .sidebar-item svg { flex-shrink: 0; width: 18px; height: 18px; opacity: .7; }
    .sidebar-item.active svg { opacity: 1; }
    .sidebar-badge {
        margin-left: auto;
        background: var(--danger);
        color: #fff;
        font-size: .65rem;
        font-weight: 700;
        min-width: 18px;
        height: 18px;
        border-radius: 9px;
        display: flex; align-items: center; justify-content: center;
        padding: 0 5px;
    }
    .sidebar-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .75rem 1.15rem;
        border-top: 1px solid var(--border-light);
        flex-shrink: 0;
    }
    .sidebar-user {
        display: flex;
        align-items: center;
        gap: .6rem;
        text-decoration: none;
        color: var(--ink);
        min-width: 0;
        flex: 1;
    }
    .sidebar-user:hover { text-decoration: none; }
    .sidebar-avatar {
        width: 32px; height: 32px;
        border-radius: 50%;
        background: var(--c1-bg);
        color: var(--c1);
        display: flex; align-items: center; justify-content: center;
        font-weight: 700;
        font-size: .8rem;
        flex-shrink: 0;
    }
    .sidebar-user-name {
        font-size: .82rem;
        font-weight: 500;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .sidebar-logout {
        color: var(--muted);
        padding: .35rem;
        border-radius: 6px;
        display: flex; align-items: center; justify-content: center;
        transition: all .15s;
        flex-shrink: 0;
    }
    .sidebar-logout:hover { background: var(--danger-bg); color: var(--danger); text-decoration: none; }

    /* Push content right of sidebar */
    body:not(.landing) .page,
    body:not(.landing) .page-wide { margin-left: 260px; }
    body:not(.landing) .footer { margin-left: 260px; }

    .page { padding: 1.5rem 2rem; }
    .page-wide { padding: 1.5rem 2rem; }
    .page-title { font-size: 1.5rem; }

    .stats { grid-template-columns: repeat(4, 1fr); }
    .actions { grid-template-columns: repeat(6, 1fr); }
    .form-row { grid-template-columns: 1fr 1fr; }

    .landing-hero { padding: 5rem 2rem 3rem; margin: 0; }
    .landing-hero h1 { font-size: 2.5rem; }
    .landing-features { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; padding: 3rem 2rem; }
    .pricing-grid { grid-template-columns: repeat(3, 1fr); max-width: 900px; }

    .modal-overlay { align-items: center; }
    .modal { border-radius: var(--radius); max-width: 500px; }

    .auth-card { margin-top: 3rem; padding: 2.5rem; }

    /* Dashboard layout — single col until 900px */
    .dash-main { min-width: 0; }
    .dash-side { min-width: 0; }
}
@media (min-width: 900px) {
    .dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; }
}

/* ═══════════════════════════════════════════
   Desktop (1024px+)
   ═══════════════════════════════════════════ */
@media (min-width: 1024px) {
    .landing-hero h1 { font-size: 3rem; }
    .landing-features { grid-template-columns: repeat(3, 1fr); max-width: 900px; margin: 0 auto; }
    .dash-grid { grid-template-columns: 1fr 380px; gap: 1.5rem; }
}

/* ═══════════════════════════════════════════
   Landing page (no auth) — override body padding
   ═══════════════════════════════════════════ */
body.landing { padding-top: 0; padding-bottom: 0; }
body.landing .bnav { display: none; }

/* ── Landing top nav (desktop) ── */
.landing-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1rem;
    background: rgba(0,0,0,.15);
    position: absolute; top: 0; left: 0; right: 0; z-index: 10;
}
.landing-nav-brand {
    font-weight: 800; font-size: 1.1rem; color: #fff;
    display: flex; align-items: center; gap: .4rem;
    text-decoration: none;
}
.landing-nav-links { display: flex; gap: .75rem; align-items: center; }
.landing-nav-links a { color: rgba(255,255,255,.85); font-size: .85rem; font-weight: 500; }
.landing-nav-links a:hover { color: #fff; text-decoration: none; }
.landing-nav-links .btn-sm { background: var(--accent); color: #000; padding: .4rem 1rem; border-radius: var(--radius-sm); font-weight: 700; }

/* ── Landing bottom nav (mobile) ── */
.landing-bnav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--surface, #fff);
    border-top: 1px solid var(--border, #e5e5e5);
    padding: .5rem .25rem calc(.5rem + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: flex-end;
    box-shadow: 0 -4px 20px rgba(0,0,0,.1);
}
.landing-bnav-item {
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    text-decoration: none; color: var(--muted, #737373);
    font-size: .68rem; font-weight: 600;
    padding: .3rem .75rem;
    transition: color .15s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.landing-bnav-item svg { transition: transform .15s; }
.landing-bnav-item.active { color: var(--c1, #1B5E20); }
.landing-bnav-item:hover { color: var(--c1, #1B5E20); text-decoration: none; }
.landing-bnav-item:active svg { transform: scale(.88); }

.landing-bnav-cta {
    color: #fff;
    background: linear-gradient(135deg, var(--c1, #1B5E20) 0%, #2E7D32 100%);
    border-radius: 50%;
    width: 54px; height: 54px;
    margin-top: -1.5rem;
    margin-bottom: .2rem;
    justify-content: center; gap: 0;
    font-size: 0;
    box-shadow: 0 4px 16px rgba(27,94,32,.4);
    transition: transform .15s, box-shadow .15s;
}
.landing-bnav-cta:active { transform: scale(.92); box-shadow: 0 2px 8px rgba(27,94,32,.3); }
.landing-bnav-cta span { display: none; }
.landing-bnav-cta svg { stroke: #fff; }
.landing-bnav-cta:hover { color: #fff; }

/* Mobile: show bottom nav, hide top nav */
@media (max-width: 767px) {
    .landing-nav-desktop { display: none !important; }
    .landing-bnav { display: flex; }
    body.landing { padding-bottom: 5rem; }
    .landing-footer { margin-bottom: 0; padding-bottom: 5.5rem !important; }
    .landing-hero { padding-top: 2rem; }
    .landing-cta { font-size: .9rem; padding: .75rem 1.5rem; }
    .landing-features { gap: .75rem; padding: 1.5rem .75rem; }
    .feature-card { padding: 1rem .5rem; }
    .pricing-grid { gap: .75rem; }
    .landing-section { padding: 1.5rem .75rem; }
}

/* ═══════════════════════════════════════════
   Micro-interactions & Polish
   ═══════════════════════════════════════════ */

/* Button hover lift */
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}
[data-theme="dark"] .btn:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

/* Card hover lift */
.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
[data-theme="dark"] .card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

/* Input focus transition */
.form-input,
.form-textarea,
.form-select {
    transition: border-color .2s ease, box-shadow .2s ease;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--c1);
    box-shadow: 0 0 0 3px rgba(27,94,32,.1);
}
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-textarea:focus,
[data-theme="dark"] .form-select:focus {
    box-shadow: 0 0 0 3px rgba(76,175,80,.15);
}

/* Active sidebar item indicator */
@media (min-width: 768px) {
    .sidebar-item.active {
        border-left: 3px solid var(--c1);
        padding-left: calc(.75rem - 3px);
    }
}

/* Skeleton loading animation */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--surface2) 25%, var(--border-light) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease infinite;
    border-radius: var(--radius-sm);
}

/* Scrollbar — visible, dark thumb (2026-05-19 darkened per Жанета — was too faint) */
* {
    scrollbar-width: auto;
    scrollbar-color: #1f2937 #e5e7eb;
}
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}
::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 7px;
}
::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 7px;
    border: 2px solid #e5e7eb;
}
::-webkit-scrollbar-thumb:hover {
    background: #111827;
}
::-webkit-scrollbar-corner {
    background: #f3f4f6;
}
[data-theme="dark"] * {
    scrollbar-color: #9ca3af #1f2937;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1f2937;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-color: #1f2937;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

/* Selection color */
::selection {
    background: var(--c1-bg, #E8F5E9);
    color: var(--c1);
}
[data-theme="dark"] ::selection {
    background: rgba(76,175,80,.3);
    color: #fff;
}

/* Focus-visible outlines for accessibility */
:focus-visible {
    outline: 2px solid var(--c1);
    outline-offset: 2px;
}
.btn:focus-visible,
.sidebar-item:focus-visible,
.bnav-item:focus-visible {
    outline: 2px solid var(--c1);
    outline-offset: 2px;
}

/* Improved empty state styling */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
}
.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    opacity: .5;
}
.empty-state-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: .35rem;
}
.empty-state-text {
    font-size: .85rem;
    line-height: 1.6;
    max-width: 320px;
    margin: 0 auto;
}

/* Smooth transitions for interactive elements */
.sidebar-item,
.menu-item,
.bnav-item {
    transition: background .15s ease, color .15s ease;
}

/* List item hover */
.list-item {
    transition: background .15s ease;
    border-radius: var(--radius-sm);
}
.list-item:hover {
    background: var(--surface2);
}
[data-theme="dark"] .list-item:hover {
    background: rgba(255,255,255,.03);
}

/* Flash message enter animation */
.flash {
    animation: fadeInUp .3s ease;
}

/* Notification badge pulse */
.badge, .sidebar-badge {
    animation: badge-pulse .3s ease;
}
@keyframes badge-pulse {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ═══════════════════════════════════════════
   Mobile Fixes (<480px)
   ═══════════════════════════════════════════ */
@media (max-width: 480px) {
    /* Enforce minimum readable font sizes */
    .text-sm, .text-xs { font-size: .8rem !important; }
    td, th { font-size: .82rem; padding: .5rem .5rem; }
    .form-select, select { font-size: .85rem !important; min-height: 40px; }

    /* Ensure touch targets are at least 44px */
    .btn, button, .btn-sm { min-height: 40px; min-width: 40px; }
    .btn-sm { padding: .4rem .75rem; font-size: .8rem; }

    /* Stack action buttons */
    .actions, .btn-group { flex-wrap: wrap; gap: .4rem; }

    /* Better modal sizing */
    .modal { max-width: calc(100vw - 24px) !important; margin: 12px auto; }
    .modal-overlay { padding: 12px; }

    /* Reduce card padding on small screens */
    .card { padding: .85rem; }
    .card-header { font-size: .9rem; padding: .75rem .85rem; }

    /* Fix stats grid */
    .stats { gap: .5rem; }
    .stat-card { padding: .65rem; }
    .stat-value { font-size: 1.3rem; }
    .stat-label { font-size: .72rem; }

    /* Better pill/badge sizing */
    .badge, .pill { font-size: .72rem; padding: .2rem .5rem; }
}
