:root {
    --bg:           #EDF5FC;
    --text:         #333;
    --muted:        #666;
    --card:         #ffffff;
    --border:       #e5e7eb;
    --primary:      #4a90e2;
    --primary-hover:#357ABD;
    --danger:       #dc3545;
    --danger-hover: #b02a37;
    --input-bg:     #fff;
    --input-border: #ccc;
    --shadow:       0 2px 8px rgba(0,0,0,0.05);

    --header-h:  64px;   /* site-header (логотип + меню) */
    --bar-h:     46px;   /* header-bar (dashboard + logout) */
}

body.dark-mode {
    --bg:           #0f1216;
    --text:         #e6e7e9;
    --muted:        #a0a7b3;
    --card:         #161a1f;
    --border:       #2a2f36;
    --primary:      #8ab4f8;
    --primary-hover:#77a0e2;
    --danger:       #ff4d4d;
    --danger-hover: #ff6666;
    --input-bg:     #1d232b;
    --input-border: #3a414b;
    --shadow:       0 2px 10px rgba(0,0,0,0.25);
}

/* ════════════════════════════════
   RESET / BASE
════════════════════════════════ */
html, body {
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
}

body {
    /* суммарная высота обоих хедеров */
    padding-top: calc(var(--header-h) + var(--bar-h));
    font-size: 14px;
    font-family: 'Segoe UI', sans-serif;
}

h2 {
    text-align: center;
    margin: 28px auto;
    font-weight: 800;
    font-size: 2rem;
    color: var(--primary);
}

/* ════════════════════════════════
   SITE-HEADER  (логотип + кнопки)
   уже стилизован в header_bar.css,
   здесь только позиционирование
════════════════════════════════ */
.site-header {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--header-h);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

/* ════════════════════════════════
   HEADER-BAR  (Dashboard + Logout)
════════════════════════════════ */
.header-bar {
    position: fixed;
    top: var(--header-h);          /* прямо под site-header */
    left: 0;
    right: 0;
    height: var(--bar-h);
    z-index: 990;

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 12px;

    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.85);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.9) inset,
        0 2px 8px rgba(15, 23, 42, 0.06);
}

body.dark-mode .header-bar {
    background: rgba(13, 16, 22, 0.88);
    border-bottom-color: rgba(55, 65, 81, 0.55);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.04) inset,
        0 2px 8px rgba(0, 0, 0, 0.25);
}

.header-bar__left,
.header-bar__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Dashboard button ── */
.hb-dashboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 10px;
    border: 1px solid rgba(65, 0, 147, 0.15);
    background: linear-gradient(135deg,
        rgba(65,0,147,0.07),
        rgba(83,153,231,0.07));
    color: #410093;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: .01em;
    transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
    white-space: nowrap;
}

.hb-dashboard-btn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: linear-gradient(135deg, #410093, #5399E7);
    flex-shrink: 0;
}

.hb-dashboard-btn__icon svg {
    stroke: #fff;
}

.hb-dashboard-btn:hover {
    background: linear-gradient(135deg,
        rgba(65,0,147,0.14),
        rgba(83,153,231,0.14));
    border-color: rgba(65,0,147,0.32);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(65,0,147,0.12);
}

.hb-dashboard-btn:active { transform: translateY(0); box-shadow: none; }

body.dark-mode .hb-dashboard-btn {
    color: #a78bfa;
    border-color: rgba(167,139,250,0.22);
    background: rgba(109,40,217,0.1);
}

body.dark-mode .hb-dashboard-btn:hover {
    background: rgba(109,40,217,0.18);
    border-color: rgba(167,139,250,0.42);
}

/* ── Logout button ── */
.hb-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 10px;
    border: 1px solid rgba(220,38,38,0.18);
    background: rgba(254,242,242,0.8);
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .01em;
    transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
    white-space: nowrap;
}

.hb-logout-btn svg { stroke: #dc2626; flex-shrink: 0; transition: stroke .15s; }

.hb-logout-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(220,38,38,0.25);
}

.hb-logout-btn:hover svg { stroke: #fff; }
.hb-logout-btn:active { transform: translateY(0); box-shadow: none; }

body.dark-mode .hb-logout-btn {
    background: rgba(220,38,38,0.1);
    border-color: rgba(220,38,38,0.22);
    color: #fca5a5;
}

body.dark-mode .hb-logout-btn svg { stroke: #fca5a5; }

body.dark-mode .hb-logout-btn:hover {
    background: #dc2626;
    color: #fff;
}

body.dark-mode .hb-logout-btn:hover svg { stroke: #fff; }

/* ════════════════════════════════
   MAIN CONTENT
════════════════════════════════ */
.page-container {
    display: block;
    min-height: unset;
    padding: 0;
}

.site-main {
    max-width: 1100px;
    margin: 16px auto;
    padding: 0 16px 32px;
}

/* ════════════════════════════════
   INPUTS / BUTTONS (global)
════════════════════════════════ */
input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    margin: 4px 0;
    box-sizing: border-box;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    border-radius: 6px;
    font-size: 14px;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 5px var(--primary-hover);
}

button, input[type="submit"] {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

button:hover, input[type="submit"]:hover {
    background-color: var(--primary-hover);
}

/* ════════════════════════════════
   SITE-HEADER internals
════════════════════════════════ */
.site-header__left  { display: flex; align-items: center; gap: 12px; }
.site-header__right { display: flex; align-items: center; gap: 10px; }

.site-header__logo  { width: 40px; height: 40px; object-fit: contain; }
.site-header__title { margin: 0; font-size: 18px; font-weight: 700; color: #F56F20; }

.site-header__btn {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    cursor: pointer;
}

.site-header__btn:hover { background: var(--bg); }

.site-header__select {
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    padding: 0 10px;
    cursor: pointer;
}

/* ════════════════════════════════
   MISC COMPONENTS
════════════════════════════════ */
.welcome-container {
    background: var(--card);
    padding: 18px 25px;
    border-radius: 10px;
    color: var(--text);
    text-align: center;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s ease-out forwards;
}

.welcome-title {
    font-size: 26px;
    font-weight: 600;
    background: linear-gradient(90deg, #0294DD, #F56F20, #0294DD);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientFlow 4s ease infinite;
    text-align: center;
    margin-bottom: 5px;
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--muted);
    text-align: center;
    font-weight: 400;
}

@keyframes gradientFlow {
    0%   { background-position: 0% center; }
    50%  { background-position: 100% center; }
    100% { background-position: 0% center; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dashboard-wrapper { display: flex; flex-direction: column; align-items: center; gap: 30px; }

.dashboard-grid {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 920px;
    width: 100%;
}

.dashboard-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background-color: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.dashboard-link:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.logout-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background-color: var(--danger);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.logout-link:hover {
    background-color: var(--danger-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.btn-quiet {
    background: #f8fafc;
    color: #374151;
    border: 1px solid #e5e7eb;
    box-shadow: none;
}

.btn-quiet:hover { background: #eef2f7; border-color: #d1d5db; }

.btn-sm {
    padding: .38rem .7rem;
    font-size: .9rem;
    border-radius: .5rem;
    line-height: 1.1;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

/* ════════════════════════════════
   SESSION EXPIRED MODAL
════════════════════════════════ */
.session-expired-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.session-expired-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.session-expired-content {
    position: relative;
    z-index: 1;
    background: #ffffff;
    padding: 22px 26px;
    border-radius: 14px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
    text-align: center;
}

.session-expired-content h3 { margin: 0 0 10px; font-size: 20px; }
.session-expired-content p  { margin: 0 0 18px; font-size: 14px; color: #4b5563; }
.session-expired-content .primary-btn { min-width: 120px; }

/* ════════════════════════════════
   RESPONSIVE
════════════════════════════════ */
@media (max-width: 640px) {
    :root { --bar-h: 40px; }

    .header-bar { padding: 0 12px; }

    .hb-dashboard-btn,
    .hb-logout-btn { padding: 6px 10px; font-size: 12px; }

    .hb-dashboard-btn__icon { width: 18px; height: 18px; }
}