﻿/* ================================================================
   LMS — Main Stylesheet (Dark Theme by default + Light Theme)
   ================================================================ */


/* === Fixel Display Font Family === */
/* 
@font-face {
  font-family: 'Fixel Display';
  src: url('/font/FixelDisplay-Regular.woff2') format('woff2'),
       url('/font/FixelDisplay-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Fixel Display';
  src: url('/font/FixelDisplay-RegularItalic.woff2') format('woff2'),
       url('/font/FixelDisplay-RegularItalic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
}

@font-face {
  font-family: 'Fixel Display';
  src: url('/font/FixelDisplay-Medium.woff2') format('woff2'),
       url('/font/FixelDisplay-Medium.otf') format('opentype');
  font-weight: 500;
}

@font-face {
  font-family: 'Fixel Display';
  src: url('/font/FixelDisplay-Bold.woff2') format('woff2'),
       url('/font/FixelDisplay-Bold.otf') format('opentype');
  font-weight: 700;
}

@font-face {
  font-family: 'Fixel Display';
  src: url('/font/FixelDisplay-ExtraBold.woff2') format('woff2'),
       url('/font/FixelDisplay-ExtraBold.otf') format('opentype');
  font-weight: 800;
}

@font-face {
  font-family: 'Fixel Display';
  src: url('/font/FixelDisplay-Light.woff2') format('woff2'),
       url('/font/FixelDisplay-Light.otf') format('opentype');
  font-weight: 300;
}

@font-face {
  font-family: 'Fixel Display';
  src: url('/font/FixelDisplay-ExtraLight.woff2') format('woff2'),
       url('/font/FixelDisplay-ExtraLight.otf') format('opentype');
  font-weight: 200;
}

@font-face {
  font-family: 'Fixel Display';
  src: url('/font/FixelDisplay-Black.woff2') format('woff2'),
       url('/font/FixelDisplay-Black.otf') format('opentype');
  font-weight: 900;
}

@font-face {
  font-family: 'Fixel Display';
  src: url('/font/FixelDisplay-Regular.woff2') format('woff2'),
       url('/font/FixelDisplay-Regular.otf') format('opentype');
  font-weight: 400;
} */

/* ── CSS Variables (Dark Theme – by default) ───────────────────────── */
:root {
    /* Colors – Dark */
    --bg-base:       #0A0A12;
    --bg-surface:    #12121E;
    --bg-raised:     #1A1A2E;
    --bg-hover:      #22223A;
    --border:        #2A2A45;
    --border-light:  #35355A;

    --primary:       #2A5EE8;
    --primary-dark:  #1E4BB8;
    --primary-glow:  rgba(42,94,232,0.25);
    --secondary:     #60A5FA;
    --accent:        #06B6D4;
    --success:       #10B981;
    --warning:       #F59E0B;
    --danger:        #EF4444;
    --info:          #3B82F6;

    --text-primary:  #E2E8F0;
    --text-secondary:#94A3B8;
    --text-muted:    #64748B;
    --text-inverse:  #0A0A12;

    /* Sidebar */
    --sidebar-w:     235px;
    --sidebar-w-col: 70px;

    /* Spacing */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-full:9999px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg:  0 10px 40px rgba(0,0,0,0.6);
    --shadow-glow:0 0 30px var(--primary-glow);

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.35s ease;
}

/* ── LIGHT THEME (Gold accent on white) ───────────────────────────── */
.light-theme {
    /* Colors – Light (Gold #fcb316 as primary, #263473 as secondary) */
    --bg-base:       #F8FAFC;
    --bg-surface:    #FFFFFF;
    --bg-raised:     #F1F5F9;
    --bg-hover:      #E2E8F0;
    --border:        #E2E8F0;
    --border-light:  #CBD5E1;

    --primary:       #2A5EE8;
    --primary-dark:  #1E4BB8;
    --primary-glow:  rgba(42,94,232,0.2);
    --secondary:     #0369A1;      /* темно-синій – другорядний */
    --accent:        #06B6D4;
    --success:       #10B981;
    --warning:       #F59E0B;
    --danger:        #EF4444;
    --info:          #3B82F6;

    --text-primary:  #374151;
    --text-secondary:#4B5563;
    --text-muted:    #6B7280;
    --text-inverse:  #FFFFFF;

    /* Shadows – lighter */
    --shadow-sm:  0 1px 2px rgba(0,0,0,0.03), 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
    --shadow-glow:0 0 20px rgba(252,179,22,0.25);
}

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: background var(--transition), color var(--transition);
}

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

img { max-width: 100%; display: block; }

/* ── Utility ────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

/* ── Typography ─────────────────────────────────────────────────── */
h1 { font-size: 1.875rem; font-weight: 700; }
h2 { font-size: 1.5rem;   font-weight: 600; }
h3 { font-size: 1.25rem;  font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 500; }

.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.875rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary-color { color: var(--primary); }
.font-bold  { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    font-family: 'Inter', sans-serif;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) {
    background: #173A8E;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
    transform: translateY(0);
}
.btn-primary:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
    opacity: 1;
}

.btn-secondary {
    background: var(--bg-raised);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-login {
    width: 100%;
    background: linear-gradient(160deg, #F5D66A 0%, #C9A227 40%, #A07C10 100%);
    border: none;
    border-top: 1px solid rgba(255,255,255,0.45);
    border-radius: 0.7rem;
    padding: 1.05rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: transform .25s ease, box-shadow .3s ease;
    box-shadow:
        0 6px 24px rgba(201, 162, 39, 0.5),
        inset 0 1px 0 rgba(255,255,255,0.5),
        inset 0 -2px 6px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    margin-top: 0;
}
.btn-login::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.22), rgba(255,255,255,0));
    border-radius: 0.7rem 0.7rem 0 0;
    pointer-events: none;
}

.btn-login:hover {
    transform: scale(1.02);
    box-shadow:
        0 12px 36px rgba(201, 162, 39, 0.6),
        inset 0 1px 0 rgba(255,255,255,0.55),
        inset 0 -2px 6px rgba(0,0,0,0.2);
}

.btn-login:active {
    transform: scale(0.975);
}

.btn-login:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.btn-login-arrow { font-size: 1.2rem; }

.light-theme .btn-login {
    box-shadow: 0 6px 20px rgba(201, 162, 39, 0.35);
}

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }
.btn-warning { background: var(--warning); color: #000; }
.btn-ghost   { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 0.55rem 0.8rem; font-size: 0.8rem; }

/* ── Back button — canonical style for every "Назад" page-navigation button ──
   Use this everywhere instead of a page-local class or inline style. */
.btn-back {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: 10px;
    border: 1.5px solid var(--border); background: var(--bg-surface);
    color: var(--text-secondary); font-size: .83rem; font-weight: 600;
    cursor: pointer; transition: all .15s; font-family: inherit; text-decoration: none;
    white-space: nowrap;
}
.btn-back:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-hover); }
.btn-back i { font-size: .75rem; }
/* Icon-only variant (compact headers with no room for a label) */
.btn-back-icon { width: 34px; height: 34px; padding: 0; justify-content: center; gap: 0; }

/* "Modern" pill buttons — style established by the create-user form (admin.js).
   Use for headline primary/secondary actions (modal footers, page-level create/save),
   not for small inline icon buttons inside tables/cards. */
.btn-primary-modern, .btn-secondary-modern {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 48px;
    font-weight: 600;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    white-space: nowrap;
}
.btn-primary-modern:disabled, .btn-secondary-modern:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary-modern {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary-modern:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.02);
    box-shadow: 0 8px 18px var(--primary-glow);
}

.btn-secondary-modern {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-secondary-modern:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-primary-modern.btn-sm, .btn-secondary-modern.btn-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn-tab { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 0.55rem 1rem; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); cursor: pointer; white-space: nowrap; transition: all var(--transition); }
.btn-tab:hover { color: var(--text-primary); background: none; transform: none; box-shadow: none; }
.btn-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-md); }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ── Row-style form (admin user create / edit) ───────────── */
.uf-form {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
}
.uf-row {
    display: grid;
    grid-template-columns: 128px 1fr;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
    min-height: 36px;
}
.uf-form .uf-row:last-child { border-bottom: none; }
.uf-lbl {
    padding: 0 .7rem;
    font-size: .775rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
    background: var(--bg-raised);
    display: flex;
    align-items: center;
    white-space: nowrap;
    user-select: none;
    line-height: 1.2;
}
.uf-lbl .req { color: var(--danger); margin-left: 2px; }
.uf-row > input,
.uf-row > select {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: .25rem .65rem !important;
    min-height: 36px;
    box-shadow: none !important;
    font-size: .875rem;
    width: 100%;
}
.uf-row > input:focus,
.uf-row > select:focus {
    background: var(--primary-glow) !important;
    box-shadow: none !important;
}
.uf-row > input[readonly] { opacity: .6; cursor: default; }
/* SearchSelect / CreatableSelect inside uf-row */
.uf-row .ss-wrap,
.uf-row .cs-wrap { display: block; }
.uf-row .ss-wrap .ss-input,
.uf-row .cs-wrap .cs-input {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    min-height: 36px;
    padding: .25rem .65rem !important;
}
.uf-row .ss-wrap .ss-input:focus,
.uf-row .cs-wrap .cs-input:focus {
    background: var(--primary-glow) !important;
    box-shadow: none !important;
}
/* Section header inside uf-form */
.uf-section {
    padding: .3rem .75rem;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
}

/* ── Gender picker ──────────────────────────────────────────── */
.gender-picker {
    display: flex;
    gap: .4rem;
    align-items: center;
    padding: .3rem .5rem;
    flex-wrap: wrap;
}
.gender-btn {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: .8rem;
    cursor: pointer;
    transition: all .15s;
    line-height: 1;
}
.gender-btn:hover { border-color: var(--primary); color: var(--primary); }
.gender-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.gender-btn .gender-icon { font-size: 1rem; line-height: 1; }

/* ── MultiSelect ─────────────────────────────────────────────── */
.ms-wrap { position: relative; min-width: 0; }
.ms-control {
    display: flex; align-items: center; flex-wrap: wrap; gap: .25rem;
    min-height: 32px; padding: .25rem .5rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-raised); cursor: pointer;
    transition: border-color .15s;
}
.ms-control:hover { border-color: var(--primary); }
.ms-control.open  { border-color: var(--primary); }
.ms-chips { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .2rem; flex: 0 1 auto; min-width: 0; }
.ms-chip {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .1rem .45rem; border-radius: 999px;
    background: var(--primary); color: #fff;
    font-size: .72rem; font-weight: 500; white-space: nowrap;
    line-height: 1.4;
}
.ms-chip-x {
    cursor: pointer; opacity: .8; font-size: .7rem; line-height: 1;
    padding: 0 .1rem;
}
.ms-chip-x:hover { opacity: 1; }
.ms-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.ms-chip-more { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); cursor: default; }
.ms-search {
    border: none; outline: none; background: transparent;
    font-size: .8rem; color: var(--text-primary);
    min-width: 60px; flex: 1; padding: 0;
}
.ms-search::placeholder { color: var(--text-muted); }
.ms-actions { display: flex; align-items: center; gap: .2rem; flex-shrink: 0; margin-left: auto; }
.ms-clear-btn {
    display: none; background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: .85rem; padding: 0 .15rem;
    line-height: 1;
}
.ms-clear-btn:hover { color: var(--text-primary); }
.ms-arrow {
    font-size: .65rem; color: var(--text-muted);
    transition: transform .15s; flex-shrink: 0;
}
.ms-wrap.open .ms-arrow { transform: rotate(180deg); }
.ms-wrap.open .ms-clear-btn[data-visible="1"] { display: inline; }

.ms-dropdown {
    display: none;
    position: fixed;
    max-width: 380px;
    z-index: 9999;
    background: var(--bg-raised); border: 1px solid var(--border-light);
    border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.45);
    overflow: hidden;
}
.ms-wrap.open .ms-dropdown { display: block; }
.ms-search-wrap {
    padding: .35rem .5rem; border-bottom: 1px solid var(--border);
    background: var(--bg-raised);
}
.ms-search-inner {
    width: 100%; box-sizing: border-box; outline: none;
    background: var(--bg-surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: .8rem; color: var(--text-primary);
    padding: .25rem .5rem;
}
.ms-search-inner::placeholder { color: var(--text-muted); }
.ms-list { max-height: 220px; overflow-y: auto; background: var(--bg-raised); }
.ms-option {
    display: flex; align-items: center; gap: .5rem;
    padding: .3rem .65rem; cursor: pointer; font-size: .75rem;
    color: var(--text-primary); transition: background .1s;
}
.ms-option:hover, .ms-option.ms-focused { background: var(--bg-hover); }
.ms-option.ms-selected { color: var(--primary); }
.ms-check {
    width: 14px; height: 14px; flex-shrink: 0;
    border: 1.5px solid var(--border-light); border-radius: 3px;
    background: var(--bg-surface);
    display: inline-flex; align-items: center; justify-content: center;
    transition: all .12s;
}
.ms-check.ms-check-on {
    background: var(--primary); border-color: var(--primary);
}
.ms-check.ms-check-on::after {
    content: ''; display: block;
    width: 4px; height: 7px;
    border: 1.5px solid #fff; border-top: none; border-left: none;
    transform: rotate(45deg) translateY(-1px);
}
.ms-opt-label { flex: 1; min-width: 0; white-space: normal; word-break: break-word; }
.ms-empty { padding: .75rem; text-align: center; font-size: .78rem; color: var(--text-muted); background: var(--bg-raised); }

/* MultiSelect in table filter row */
.ms-filter-label {
    display: flex; align-items: center; gap: .3rem;
    font-size: .78rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-secondary);
    margin-bottom: .3rem; padding: 0 .1rem;
    cursor: pointer; user-select: none; white-space: nowrap;
}
.ms-filter-label:hover { color: var(--text-primary); }
.sort-btns { display: inline-flex; flex-direction: column; gap: 0; flex-shrink: 0; }
.sort-arrow {
    display: block; background: none; border: none; padding: 0;
    font-size: .65rem; line-height: 1.1; cursor: pointer;
    color: var(--border-light); transition: color .15s;
}
.sort-arrow:hover { color: var(--text-secondary); }
.sort-arrow.active { color: var(--primary); }

/* ── Page size switcher ── */
.page-size-btn {
    font-size: .8rem; cursor: pointer; color: var(--text-muted);
    padding: .1rem .25rem; border-radius: 3px;
    transition: color .15s;
}
.page-size-btn:hover  { color: var(--text-primary); }
.page-size-btn.active { color: var(--primary); font-weight: 700; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: .3rem; justify-content: center; }
.pg-btn {
    min-width: 30px; height: 30px; padding: 0 .4rem;
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-secondary);
    font-size: .8rem; cursor: pointer; transition: all .15s;
}
.pg-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pg-btn:disabled { opacity: .35; cursor: default; }
.pg-gap { font-size: .8rem; color: var(--text-muted); padding: 0 .2rem; }

/* ── Reset filters button ── */
.btn-reset-filters {
    background: none; border: 2px solid var(--border);
    border-radius: var(--radius-sm); padding: .2rem .4rem;
    transition: all .15s; line-height: 1;
    width: 40px;
    cursor: pointer;
}
.btn-reset-filters:hover { border-color: var(--primary); color: var(--primary); }
th .ms-wrap { display: block; }
th .ms-wrap .ms-control {
    height: 28px; min-height: unset; padding: .25rem .35rem;
    flex-direction: row; align-items: center; gap: .25rem; overflow: hidden;
}
th .ms-wrap .ms-chips {
    display: flex; flex-direction: row; flex-wrap: nowrap;
    align-items: center; gap: .25rem; flex: 1; min-width: 0; overflow: hidden;
}
th .ms-wrap .ms-chip:first-child { flex: 1; min-width: 0; overflow: hidden; max-width: 100%; }
th .ms-wrap .ms-chip        { font-size: .7rem; flex-shrink: 0; }
th .ms-wrap .ms-chip:first-child { flex-shrink: 1; }
th .ms-wrap .ms-actions     { flex-shrink: 0; }
th .ms-wrap .ms-search      { display: none; }
th .ms-wrap .ms-search-inner { font-size: .78rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="date"],
textarea,
select {
    width: 100%;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 0.9rem 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input::placeholder,
textarea::placeholder { color: var(--text-muted); }

textarea { resize: vertical; min-height: 100px; }
#bd-bl-title, #bd-bl-tov, #rf-inp-title, #rf-inp-tov { min-height: unset; height: 50px; }

select option { background: var(--bg-raised); }

.input-with-icon {
    position: relative;
}
.input-with-icon input { padding-right: 2.5rem; }
.input-with-icon .toggle-pwd {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-primary);
    opacity: 0.6;
    transition: opacity var(--transition);
}
.input-with-icon .toggle-pwd:hover { opacity: 1; }

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 0.3rem; }

/* ── Searchable Select ──────────────────────────────────────────── */
.ss-wrap { position: relative; }
.ss-input { cursor: text; }
.ss-list {
    position: absolute;
    top: calc(100% + 3px);
    left: 0; right: 0;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 210px;
    overflow-y: auto;
    z-index: 300;
    box-shadow: var(--shadow-lg);
}
.ss-opt {
    padding: 0.5rem 0.9rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ss-opt:first-child { color: var(--text-muted); }
.ss-opt:hover { background: var(--bg-hover); }

/* ── Ukrainian date-time picker (UaDateTime) ──────────────────────── */
.uadt-wrap { position: relative; width: 260px; max-width: 100%; }
.uadt-trigger {
    width: 100%; display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; background: var(--bg-raised); border: 1.5px solid var(--border);
    border-radius: 12px; font-size: .9rem; color: var(--text-primary); font-family: inherit;
    cursor: pointer; outline: none; transition: border-color .15s, box-shadow .15s; box-sizing: border-box;
}
.uadt-trigger:hover, .uadt-trigger:focus { border-color: var(--primary); }
.uadt-trigger-ico { color: var(--primary); font-size: .85rem; flex-shrink: 0; }
.uadt-txt { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uadt-trigger-chev { font-size: .65rem; color: var(--text-muted); flex-shrink: 0; }
.uadt-pop {
    position: absolute; z-index: 950; width: 280px; padding: 14px;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-lg); animation: fadeIn .12s ease;
}
.uadt-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.uadt-nav-lbl { font-size: .85rem; font-weight: 700; color: var(--text-primary); }
.uadt-nav-btn {
    width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-raised); color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: .7rem; transition: all .15s;
}
.uadt-nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.uadt-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.uadt-dow span { text-align: center; font-size: .68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.uadt-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 12px; }
.uadt-cell {
    aspect-ratio: 1; border: none; background: transparent; border-radius: 8px;
    font-size: .8rem; color: var(--text-primary); cursor: pointer; transition: background .15s;
}
.uadt-cell:hover { background: var(--bg-hover); }
.uadt-cell.sel { background: var(--primary); color: #fff; font-weight: 700; }
.uadt-cell-empty { cursor: default; }
.uadt-time { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .85rem; }
.uadt-time-inp {
    width: 48px; padding: 5px 6px; text-align: center; border: 1.5px solid var(--border);
    border-radius: 8px; background: var(--bg-raised); color: var(--text-primary); font-family: inherit;
    font-size: .85rem; outline: none;
}
.uadt-time-inp:focus { border-color: var(--primary); }
.uadt-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.uadt-btn { padding: 7px 14px; border-radius: 9px; font-size: .78rem; font-weight: 600; cursor: pointer; border: 1.5px solid transparent; }
.uadt-btn-ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.uadt-btn-ghost:hover { border-color: var(--danger); color: var(--danger); }
.uadt-btn-primary { background: var(--primary); color: #fff; }
.uadt-btn-primary:hover { background: var(--primary-dark); }

/* ── Creatable Select ───────────────────────────────────────────── */
.cs-wrap { position: relative; }
.cs-list {
    position: absolute;
    top: calc(100% + 3px);
    left: 0; right: 0;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 220px;
    overflow-y: auto;
    z-index: 300;
    box-shadow: var(--shadow-lg);
}
.cs-opt {
    padding: 0.5rem 0.9rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-opt-empty { color: var(--text-muted); }
.cs-opt:hover { background: var(--bg-hover); }
.cs-add-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-top: 1px solid var(--border);
    background: var(--bg-raised);
}
.cs-add-label {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cs-add-label strong { color: var(--primary); font-weight: 600; }
.cs-add-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.15rem 0.25rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    flex-shrink: 0;
}
.cs-add-btn:hover { background: var(--bg-hover); }
.cs-add-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── CreatableMultiSelect ─────────────────────────────────────────── */
.cms-wrap { position: relative; }
.cms-field {
    display: flex; flex-wrap: wrap; align-items: center; gap: .3rem;
    min-height: 44px; padding: 6px 12px;
    background: var(--bg-raised); border: 1.5px solid var(--border);
    border-radius: 16px; cursor: text; transition: border-color .15s;
}
.cms-wrap:focus-within .cms-field { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.cms-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.cms-input {
    border: none; outline: none; background: transparent;
    font-size: .9rem; color: var(--text-primary);
    font-family: inherit; min-width: 120px; flex: 1;
}
.cms-input::placeholder { color: var(--text-muted); }
.cms-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    z-index: 999; background: var(--bg-raised);
    border: 1px solid var(--border-light); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.35); overflow: hidden;
}
.cms-list { max-height: 200px; overflow-y: auto; }
.cms-add-row { border-top: 1px solid var(--border); }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.875rem;
}
.checkbox-item input[type="checkbox"] { width: auto; }

/* ── Card ───────────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-body { padding: 1.5rem; }
.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-raised);
}

/* ── Badge ──────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    
}
.badge-primary { background: rgba(42,94,232,0.15); color: var(--primary); }
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-info    { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-muted   { background: var(--bg-raised);      color: var(--text-muted); border: 1px solid var(--border); }
.badge-admin   { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.25); width: fit-content; }
.light-theme .badge-admin { background: rgba(5,150,105,0.12); color: #059669; border-color: rgba(5,150,105,0.25); }
.badge-manager { background: rgba(99,155,255,0.15); color: #60A5FA; border: 1px solid rgba(99,155,255,0.25); }
.light-theme .badge-manager { background: rgba(124,58,237,0.12); color: #7c3aed; border-color: rgba(124,58,237,0.25); }
.badge-ceo { background: rgba(167,139,250,.18); color: #a78bfa; border: 1px solid rgba(167,139,250,.35); }
.light-theme .badge-ceo { background: rgba(124,58,237,.12); color: #7c3aed; border-color: rgba(124,58,237,.3); }

/* Світла тема – коригуємо прозорість бейджів для кращого контрасту */
.light-theme .badge-primary { background: rgba(252,179,22,0.15); color: #b87c00; }
.light-theme .badge-success { background: rgba(16,185,129,0.1); }
.light-theme .badge-danger  { background: rgba(239,68,68,0.1); }
.light-theme .badge-warning { background: rgba(245,158,11,0.1); }

/* ── Table ──────────────────────────────────────────────────────── */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.filter-row th { position: relative; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: fixed;
}
thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-raised);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-raised); }
tbody td { padding: 0.875rem 1rem; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tbody td:nth-child(3) { white-space: normal; word-break: break-word; }

/* ── Bulk selection bar ─────────────────────────────────────────── */
.bulk-bar {
    position: sticky;
    bottom: 0;
    z-index: 40;
    background: var(--bg-raised);
    border-top: 2px solid var(--primary);
    padding: .6rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    box-shadow: 0 -4px 24px rgba(0,0,0,.18);
    animation: bulkSlideUp .15s ease;
    margin-top: 2px;
}
@keyframes bulkSlideUp {
    from { transform: translateY(6px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}
.bulk-bar .bulk-info {
    font-size: .875rem;
    font-weight: 600;
    color: var(--primary);
    margin-right: .25rem;
    white-space: nowrap;
}
.bulk-bar .bulk-sep {
    width: 1px; height: 20px;
    background: var(--border);
    flex-shrink: 0;
}
/* Row checkboxes */
.user-cb-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
}
input.user-cb,
input#uf-select-all {
    width: 15px !important;
    height: 15px !important;
    min-height: unset !important;
    cursor: pointer;
    accent-color: var(--primary);
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* ── User filter panel ──────────────────────────────────────────── */
.uf-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-raised);
    margin-bottom: .6rem;
    overflow: hidden;
}
.uf-panel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}
.uf-field {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.uf-field:nth-child(4n) { border-right: none; }
.uf-field:nth-last-child(-n+4) { border-bottom: none; }
.uf-field label {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    padding: .3rem .65rem .15rem;
    user-select: none;
}
.uf-field input,
.uf-field select {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: .2rem .65rem .35rem !important;
    font-size: .85rem !important;
    height: auto !important;
    min-height: unset !important;
    width: 100%;
}
.uf-field input:focus,
.uf-field select:focus {
    background: var(--primary-glow) !important;
    outline: none !important;
    box-shadow: none !important;
}
.uf-field input::placeholder { color: var(--text-muted); }
@media (max-width: 900px) {
    .uf-panel-grid { grid-template-columns: repeat(2, 1fr); }
    .uf-field:nth-child(2n) { border-right: none; }
    .uf-field:nth-child(4n) { border-right: 1px solid var(--border); }
    .uf-field:nth-last-child(-n+4) { border-bottom: 1px solid var(--border); }
    .uf-field:nth-last-child(-n+2) { border-bottom: none; }
}

/* ── Table filter row ───────────────────────────────────────────── */
.filter-row th {
    padding: .4rem .5rem !important;
    background: var(--bg-raised);
    border-bottom: 2px solid var(--primary);
    z-index: 11;
}
.filter-row input,
.filter-row select {
    width: 100%;
    padding: .3rem .55rem !important;
    font-size: .78rem !important;
    font-weight: 500;
    height: auto !important;
    min-height: unset !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border) !important;
    background: var(--bg-surface) !important;
    box-shadow: none !important;
    color: var(--text-primary) !important;
}
.filter-row input:focus,
.filter-row select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-glow) !important;
    background: var(--bg-raised) !important;
}
.filter-row input::placeholder {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.filter-row select option { font-weight: normal; text-transform: none; }
.filter-row .filter-empty { padding: .4rem 0; }
.filter-active-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .35rem .75rem;
    margin-bottom: .5rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: .8rem;
    color: var(--text-secondary);
}
.filter-active-bar .filter-count { font-weight: 600; color: var(--text-primary); }
.filter-active-bar .filter-badge {
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: var(--radius-full);
    padding: .1rem .55rem;
    font-size: .72rem;
    font-weight: 600;
}

/* ── Progress bar ───────────────────────────────────────────────── */
.progress-bar {
    height: 6px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.6s ease;
}
.progress-fill.success { background: linear-gradient(90deg, var(--success), #34D399); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #FCD34D); }

/* ── Auth Screen ────────────────────────────────────────────────── */
/* ── Auth Screen ────────────────────────────────────────────────── */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
}
.auth-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/BG.png') center center / cover no-repeat;
    z-index: 0;
}
.auth-bg {
    position: absolute;
    inset: 0;
    
    z-index: 1;
}

/* Sparkles */
.auth-sparkles-left,
.auth-sparkles-right {
    position: absolute;
    top: 0; bottom: 0;
    width: 140px;
    z-index: 2;
    pointer-events: none;
}
.auth-sparkles-left { left: 0; }
.auth-sparkles-right { right: 0; }

.sp {
    position: absolute;
    display: block;
}
.sp::before, .sp::after {
    content: '';
    position: absolute;
    background: #C9A227;
    border-radius: 2px;
    box-shadow: 0 0 8px 2px rgba(201,162,39,0.55);
}
.sp::before { width: 2px; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); }
.sp::after  { height: 2px; left: 0; right: 0; top: 50%; transform: translateY(-50%); }

.auth-sparkles-left .sp1 { width: 30px; height: 30px; top: 28%; left: 55px; }
.auth-sparkles-left .sp2 { width: 14px; height: 14px; top: 45%; left: 20px; opacity: .65; }
.auth-sparkles-left .sp3 { width: 20px; height: 20px; top: 62%; left: 65px; opacity: .8; }
.auth-sparkles-left .sp4 { width: 10px; height: 10px; top: 18%; left: 18px; opacity: .5; }
.auth-sparkles-left .sp5 { width: 8px;  height: 8px;  top: 76%; left: 40px; opacity: .55; }

.auth-sparkles-right .sp1 { width: 28px; height: 28px; top: 32%; right: 50px; }
.auth-sparkles-right .sp2 { width: 16px; height: 16px; top: 50%; right: 18px; opacity: .65; }
.auth-sparkles-right .sp3 { width: 22px; height: 22px; top: 65%; right: 60px; opacity: .8; }
.auth-sparkles-right .sp4 { width: 10px; height: 10px; top: 20%; right: 22px; opacity: .5; }
.auth-sparkles-right .sp5 { width: 8px;  height: 8px;  top: 72%; right: 35px; opacity: .55; }

.auth-blob { display: none; }

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.05); }
}

.auth-card {
    background: rgba(11, 23, 51, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(201, 162, 39, 0.35);
    border-radius: 18px;
    padding: 2.5rem;
    width: 100%;
    position: relative;
    z-index: 3;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65), 0 0 20px rgba(201,162,39,0.08);
    animation: slideUp 0.4s ease;
}

/* Two-column layout */
.auth-layout {
    display: flex;
    align-items: center;
    gap: 12rem;
    width: 100%;
    max-width: 100%;
    padding: 2rem 0 2rem 5rem;
    position: relative;
    z-index: 3;
}
.auth-left {
    flex: 0 0 525px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.auth-right {
    flex: 1;
    min-width: 0;
    align-self: flex-start;
    
    margin-left: auto;
    transform: translateX(100px);
}

/* Brand logo */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.auth-brand-icon { display: flex; align-items: center; }
.auth-brand-text { display: flex; flex-direction: column; gap: 3px; }
.auth-brand-name {
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    line-height: 1;
    background: linear-gradient(135deg, #FFF0A0 0%, #F5D66A 25%, #C9A227 55%, #E8C547 80%, #FFF0A0 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 8px rgba(201,162,39,0.5));
    animation: brand-shimmer 3s linear infinite;
}
.auth-brand-sub {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.45em;
    color: rgba(201,162,39,0.7);
    text-transform: uppercase;
}
@keyframes brand-shimmer {
    0%   { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* Promo right column */
.auth-promo-title {
    
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    
    margin: 0 0 0.6rem 0;
}
.auth-promo-accent { color: #C9A227; }
.auth-promo-sub {
    color: rgba(255,255,255,0.5);
    font-size: 0.95rem;
    margin: 0 0 2rem 0;
}

/* Feature list */
.auth-features { display: flex; flex-direction: column; gap: 1rem; }
.auth-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.4rem 0;
}
.auth-feature-icon {
    width: 44px;
    height: 44px;
    background: rgba(201,162,39,0.12);
    border: 1px solid rgba(201,162,39,0.35);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(201,162,39,0.3), inset 0 0 8px rgba(201,162,39,0.08);
}
.auth-feature-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.2rem;
}
.auth-feature-desc {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.45);
    line-height: 1.45;
}

/* Responsive */
@media (max-width: 1200px) {
    .auth-layout { gap: 6rem; }
}
@media (max-width: 900px) {
    .auth-layout { flex-direction: column; gap: 2rem; padding: 1.5rem; justify-content: center; align-items: center; }
    .auth-left { flex: none; width: 100%; max-width: 440px; }
    .auth-right { width: 100%; max-width: 440px; transform: none; margin-left: 0; align-self: auto; padding-right: 0; padding-top: 0; }
}
@media (max-width: 500px) {
    .auth-layout { gap: 1.5rem; }
    .auth-left, .auth-right { max-width: 100%; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Auth header */
.auth-header { margin-bottom: 1.75rem; }
.auth-system-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #C9A227;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}
.auth-title {
    font-size: 2.1rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 0.35rem 0;
    line-height: 1.15;
}
.auth-subtitle-text {
    color: rgba(255,255,255,0.5);
    font-size: 0.875rem;
    margin: 0;
}

.auth-card label {
    color: rgba(255,255,255,0.75);
    font-size: 0.875rem;
    font-weight: 500;
    display: block;
    margin-bottom: 0.45rem;
}

/* Auth inputs */
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-input-icon {
    position: absolute;
    left: 14px;
    color: rgba(255,255,255,0.38);
    display: flex;
    align-items: center;
    pointer-events: none;
    z-index: 1;
}
.auth-card input[type="text"],
.auth-card input[type="password"] {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.11);
    color: #fff;
    padding-left: 42px;
    border-radius: 10px;
}
.auth-card input[type="text"]::placeholder,
.auth-card input[type="password"]::placeholder { color: rgba(255,255,255,0.28); }
.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #131f3a inset;
    -webkit-text-fill-color: #fff;
    border-color: rgba(255,255,255,0.11);
    caret-color: #fff;
    transition: background-color 99999s ease-in-out 0s;
}
.auth-card input[type="text"]:focus,
.auth-card input[type="password"]:focus {
    background: rgba(255,255,255,0.09);
    border-color: rgba(201,162,39,0.5);
    box-shadow: 0 0 0 3px rgba(201,162,39,0.1);
}

.auth-input-wrap .toggle-pwd {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.38);
    display: flex;
    align-items: center;
    padding: 0;
    transition: color 0.2s;
}
.auth-input-wrap .toggle-pwd:hover { color: rgba(255,255,255,0.8); }

/* Remember row */
.auth-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1rem 0 1.25rem;
}
.auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: rgba(255,255,255,0.65);
    font-size: 0.875rem;
    user-select: none;
}
.auth-checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: #C9A227;
    cursor: pointer;
    padding: 0;
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 3px;
}
.auth-forgot {
    color: #C9A227;
    font-size: 0.875rem;
    text-decoration: none;
    transition: opacity 0.2s;
}
.auth-forgot:hover { opacity: 0.75; }

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    
    margin: 1.25rem 0;
    color: rgba(255,255,255,0.3);
    font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1); }

/* Security box */
.auth-security-box {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 0.875rem 1rem;
}
.auth-security-icon-wrap {
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.07);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.65);
    flex-shrink: 0;
}
.auth-security-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.2rem;
}
.auth-security-desc {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    line-height: 1.4;
}

.auth-switch { text-align: center; font-size: 0.875rem; color: var(--text-secondary); margin-top: 1rem; }

/* ── App Shell ──────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: #0B1733;
    border-right: 1px solid rgba(201,162,39,0.2);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 64px;
    left: 0;
    height: calc(100vh - 64px);
    z-index: 200;
    transition: transform var(--transition-slow), width var(--transition-slow);
    overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-w-col); }
.sidebar.collapsed ~ .main-wrapper .logo { display: none; }
.top-bar .logo {
    overflow: visible;
    display: flex;
    align-items: center;
    gap: 0;
}
.logo-icon-extra {
    display: none;
    align-items: center;
    flex-shrink: 0;
}
.logo-icon-extra img {
    height: 60px;
    width: auto;
    display: block;
    flex-shrink: 0;
    margin-right: 30px;
}
body.light-theme .logo-icon-extra {
    display: flex;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    border-bottom: none;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    overflow: hidden;
    flex-shrink: 0;
}

.login-icon{
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    
}

.logo-icon { display:block; line-height:0; }
.logo-icon img { display: block; max-width: none; height: 50px; width: auto; }
.logo-icon .logo-light { display: none; }
.logo-icon .logo-dark  { display: block; }
body.light-theme .logo-icon .logo-light { display: block; }
body.light-theme .logo-icon .logo-dark  { display: none; }
.logo-text {
    font-size: 1.125rem;
    font-weight: 800;
    background: linear-gradient(135deg, #F5D66A, #C9A227);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    transition: opacity var(--transition);
}
.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color var(--transition), background var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    padding: 1rem 0.5rem 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sidebar.collapsed .sidebar-nav {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* AI Assistant в сайдбарі */
@keyframes sa-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(99,102,241,.55), 0 4px 20px rgba(99,102,241,.35); }
    70%  { box-shadow: 0 0 0 10px rgba(99,102,241,0), 0 4px 20px rgba(99,102,241,.2); }
    100% { box-shadow: 0 0 0 0 rgba(99,102,241,0), 0 4px 20px rgba(99,102,241,.35); }
}
@keyframes sa-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}
.sidebar-assistant {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    position: fixed;
    bottom: 43px;
    right: 334px;
    width: 76px;
    height: 90px;
    border-radius: 18px;
    background: none;
    border: none;
    box-shadow: none;
    cursor: pointer;
    transition: transform .2s ease;
    z-index: 201;
    animation: none;
    padding: 0;
    outline: none;
    user-select: none;
}
.sidebar-assistant:hover {
    transform: translateY(-2px) scale(1.05);
}
.sidebar-assistant.active {
    transform: scale(.95);
}
.sa-icon {
    width: 72px; height: 72px; object-fit: contain;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,.4));
    transition: transform .2s;
    display: block;
}
.sidebar-assistant:hover .sa-icon { transform: scale(1.06) rotate(-3deg); }
.sa-label {
    display: inline-block; font-size: .62rem; font-weight: 800;
    color: #1e3a5f; text-align: center;
    margin-top: 3px; white-space: nowrap; letter-spacing: .03em;
    background: rgba(186,224,255,.82);
    padding: 2px 6px; border-radius: 6px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(147,197,253,.3);
}
.sa-close-icon { font-size: 1.2rem; color: #fff; }
.sidebar.collapsed .sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-section {
    margin-bottom: 1.25rem;
}
.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 0.75rem;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    transition: opacity var(--transition);
    background: linear-gradient(90deg, #C9A227, #2A5EE8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.sidebar.collapsed .nav-section-title { opacity: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,.7);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.35s cubic-bezier(.4,0,.2,1),
                color 0.35s cubic-bezier(.4,0,.2,1),
                border-radius 0.35s cubic-bezier(.4,0,.2,1),
                padding 0.35s cubic-bezier(.4,0,.2,1),
                margin 0.35s cubic-bezier(.4,0,.2,1),
                box-shadow 0.35s cubic-bezier(.4,0,.2,1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}
.nav-item:hover { background: rgba(201,162,39,.1); color: #fff; }
.nav-item.active {
    background: rgba(201,162,39,.18);
    color: #fff;
    font-weight: 600;
    text-shadow: 0 0 12px rgba(201,162,39,.4);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    margin-right: -0.5rem;
    padding-right: 1.35rem;
}
.nav-item::before {
    content: '';
    position: absolute;
    right: 0;
    left: auto;
    top: 10%;
    bottom: 10%;
    width: 3px;
    background: linear-gradient(180deg, #F5D66A, #C9A227);
    border-radius: 2px 0 0 2px;
    box-shadow: 0 0 8px rgba(201,162,39,.7);
    opacity: 0;
    transform: scaleY(0.4);
    transition: opacity 0.35s cubic-bezier(.4,0,.2,1),
                transform 0.35s cubic-bezier(.4,0,.2,1),
                top 0.35s cubic-bezier(.4,0,.2,1),
                bottom 0.35s cubic-bezier(.4,0,.2,1);
}
.nav-item.active::before {
    opacity: 1;
    transform: scaleY(1);
    top: 0;
    bottom: 0;
}
.nav-icon {
    font-size: 1rem; flex-shrink: 0;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.07);
    position: relative;
    transition: background var(--transition), box-shadow var(--transition);
}
.nav-item:hover .nav-icon {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.15);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* Заблоковані пункти (недовірена мережа) */
.nav-item-blocked {
    opacity: .45;
    cursor: not-allowed;
}
.nav-item-blocked:hover {
    background: transparent;
    color: inherit;
}
.nav-item-blocked:hover .nav-icon {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}
.nav-blocked-icon {
    position: absolute;
    bottom: -3px;
    right: -3px;
    font-size: .62rem;
    color: #ef4444;
    background: var(--bg-surface);
    border-radius: 50%;
    line-height: 1;
    pointer-events: none;
}
.light-theme .nav-item-blocked { opacity: .4; }
.nav-item.active .nav-icon {
    background: rgba(201,162,39,.25);
    border-color: rgba(201,162,39,.4);
    box-shadow: 0 2px 10px rgba(201,162,39,.35);
}
.light-theme .nav-item.active .nav-icon {
    background: rgba(201,162,39,.25);
    border-color: rgba(201,162,39,.4);
    box-shadow: 0 2px 10px rgba(201,162,39,.35);
}
.light-theme .nav-item {
    color: #374151;
}
.light-theme .nav-item:hover { color: #111827; }
.light-theme .nav-item.active { color: #111827; }
.light-theme .nav-icon {
    background: rgba(55,65,81,.07);
    border-color: rgba(55,65,81,.1);
    color: #374151;
}
.light-theme .nav-item:hover .nav-icon {
    background: rgba(55,65,81,.13);
    border-color: rgba(55,65,81,.18);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.nav-label { font-size: 0.875rem; flex: 1; transition: opacity var(--transition); }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .nav-item { justify-content: center; position: relative; }
.sidebar.collapsed .nav-item:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-tooltip, #1e293b);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: .75rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* Bookmark star button (resources, news, collections) */
.res-star-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: .9rem;
    cursor: pointer;
    transition: all .15s;
    flex-shrink: 0;
}
.res-star-btn:hover { border-color: #f59e0b; color: #f59e0b; background: rgba(245,158,11,.1); }
.res-star-btn.active { border-color: #f59e0b; color: #f59e0b; background: rgba(245,158,11,.12); }

@keyframes doc-ack-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16,185,129,0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16,185,129,0);
        transform: scale(1.04);
    }
}
.doc-ack-pulse {
    animation: doc-ack-pulse 1.4s ease-in-out infinite;
}

.resource-item.bookmarked {
    border-left: 3px solid #C9A227;
    background: rgba(201,162,39,0.06);
}
.resource-item.bookmarked .resource-title {
    color: #C9A227;
}

/* Docs acknowledgment status */
.resource-item.doc-needs-ack {
    border-left: 3px solid #ef4444;
    background: rgba(239,68,68,0.06);
    box-shadow: 0 0 12px rgba(239,68,68,0.15);
}
.resource-item.doc-needs-ack .resource-title {
    color: #f87171;
}
.resource-item.doc-acked {
    border-left: 3px solid #10b981;
    background: rgba(16,185,129,0.06);
    box-shadow: 0 0 12px rgba(16,185,129,0.12);
}
.resource-item.doc-acked .resource-title {
    color: #34d399;
}

.nav-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 0.4rem 0.15rem;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}
.nav-badge-dot {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    padding: 0 3px 2px;
    font-size: .72rem;
    line-height: 14px;
    text-align: center;
    border-radius: 99px;
    border: 2px solid transparent;
    box-sizing: border-box;
}
@keyframes nav-bolt-glow { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.7); } 50% { box-shadow: 0 0 0 6px rgba(245,158,11,0); } }
@keyframes nav-bolt-bounce { 0%,100% { transform: scale(1); } 40% { transform: scale(1.15); } 70% { transform: scale(.97); } }
.nav-imp-bolt {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .5rem;
    color: #fff;
    border: 2px solid rgba(245,158,11,.35);
    animation: nav-bolt-glow 3s ease-in-out infinite, nav-bolt-bounce 3s ease-in-out infinite;
}
#nav-ntf-badge {
    background: var(--danger);
}
#nav-doc-badge {
    background: #f59e0b;
    color: #fff;
}
#nav-ntf-badge:not(.hidden) {
    animation: nav-ntf-scale 3s ease-in-out infinite, nav-ntf-ring 3s ease-in-out infinite;
}
#nav-doc-badge:not(.hidden) {
    animation: nav-ntf-scale 3s ease-in-out infinite, nav-doc-ring 3s ease-in-out infinite;
}
@keyframes nav-ntf-scale {
    0%, 100% { transform: scale(1); }
    40%       { transform: scale(1.15); }
    70%       { transform: scale(.97); }
}
@keyframes nav-ntf-ring {
    0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.6); }
    50%  { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
@keyframes nav-doc-ring {
    0%   { box-shadow: 0 0 0 0 rgba(245,158,11,.6); }
    50%  { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
    100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}


.su-popup {
    background: #0f1f42;
    border: 1px solid rgba(201,162,39,.25);
    border-radius: var(--radius-md);
    padding: .35rem;
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: none;
    z-index: 500;
}
.su-popup.open { opacity: 1; pointer-events: all; }
.su-popup.hidden { display: none; }

.su-popup-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .55rem .75rem;
    border: none;
    background: none;
    color: rgba(255,255,255,.75);
    font-size: .82rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-align: left;
}
.su-popup-item i { width: 14px; text-align: center; font-size: .8rem; color: rgba(255,255,255,.45); }
.su-popup-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.su-popup-item:hover i { color: rgba(255,255,255,.75); }
.su-popup-danger { color: rgba(239,68,68,.85) !important; }
.su-popup-danger i { color: rgba(239,68,68,.6) !important; }
.su-popup-danger:hover { background: rgba(239,68,68,.1) !important; color: #ef4444 !important; }
.su-popup-danger:hover i { color: #ef4444 !important; }

.su-popup-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: .3rem .5rem;
}

.light-theme .su-popup {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.light-theme .su-popup-item { color: #334155; }
.light-theme .su-popup-item i { color: #64748b; }
.light-theme .su-popup-item:hover { background: #f1f5f9; color: #1e293b; }
.light-theme .su-popup-item:hover i { color: #334155; }
.light-theme .su-popup-divider { background: #e2e8f0; }
.light-theme .su-popup-danger { color: #ef4444 !important; }
.light-theme .su-popup-danger i { color: #ef4444 !important; }
.light-theme .su-popup-danger:hover { background: rgba(239,68,68,.08) !important; }

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
}
.btn-logout:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); color: var(--danger); }

/* ── Theme Toggle Button ────────────────────────────────────────── */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: all var(--transition);
    color: var(--text-muted);
}
.theme-toggle-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

/* В sidebar — широка кнопка як logout */
.sidebar-theme-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.85rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    gap: 0.5rem;
}
.sidebar-theme-btn::after {
    content: attr(title);
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    transition: color var(--transition);
}
.sidebar-theme-btn:hover::after { color: var(--text-primary); }

/* На екрані входу — плаваюча кнопка у верхньому куті */
.auth-theme-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.08);
}

/* ── Main Wrapper ───────────────────────────────────────────────── */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-w);
    margin-top: 64px;
    min-height: calc(100vh - 64px);
    transition: margin-left var(--transition-slow);
}
.sidebar.collapsed ~ .main-wrapper { margin-left: var(--sidebar-w-col); }

/* ── Top bar ────────────────────────────────────────────────────── */
.top-bar {
    height: 64px;
    background: #0B1733;
    border-bottom: 1px solid rgba(201,162,39,0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    flex-shrink: 0;
}

.top-bar-left { display: flex; align-items: center; gap: 1rem; }
.top-bar-right { display: flex; align-items: center; gap: .5rem; }

/* sidebar-bottom — при >1300px в потоці top-bar, при ≤1300px fixed знизу */
.sidebar-bottom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sb-icons-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
}

/* >1300px: нормальний потік у top-bar-right, ніяких fixed/z-index */
@media (min-width: 1301px) {
    .sidebar-bottom {
        flex-direction: row;
        background: transparent;
        border: none;
        padding: 0;
        height: 64px;
    }
    .sidebar-bottom .sb-icons-row {
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
    }
}

/* ≤1300px: fixed знизу сайдбару */
@media (max-width: 1300px) {
    .sidebar-bottom {
        position: fixed;
        z-index: 250;
        left: 0;
        bottom: 0;
        width: var(--sidebar-w);
        flex-direction: column;
        align-items: stretch;
        padding: 0.4rem 0.6rem;
        gap: 0.25rem;
        background: #0B1733;
        border-top: 1px solid rgba(201,162,39,0.15);
        transition: width var(--transition-slow);
    }
    .light-theme .sidebar-bottom {
        background: #ffffff;
        border-top: 1px solid #e2e8f0;
    }
    .sidebar-bottom .tb-user-wrap { width: 100%; }
    .sidebar-bottom .tb-user { width: 100%; box-sizing: border-box; }

    body.sidebar-collapsed .sidebar-bottom {
        width: var(--sidebar-w-col);
        flex-direction: column;
        align-items: center;
        padding: 0.4rem 0;
        gap: 0.25rem;
    }
    body.sidebar-collapsed .sidebar-bottom .sb-icons-row {
        flex-direction: column;
        gap: 0.25rem;
    }
    body.sidebar-collapsed .sidebar-bottom .tb-user-wrap { width: auto; flex: none; }
    body.sidebar-collapsed .sidebar-bottom .tb-user {
        width: 36px; min-width: 36px; max-width: 36px;
        padding: 0; border: none; background: none;
        justify-content: center;
    }
    body.sidebar-collapsed .sidebar-bottom .tb-user-info,
    body.sidebar-collapsed .sidebar-bottom .tb-user-chevron { display: none; }

    /* sidebar-nav відступ знизу щоб не перекривався */
    .sidebar-nav { padding-bottom: 90px; }
    .sidebar.collapsed ~ #sidebar .sidebar-nav { padding-bottom: 100px; }
}

/* Topbar user button */
.tb-user-wrap { position: relative; }
.tb-user {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem .6rem .3rem .3rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
    border: 1px solid rgba(255,255,255,.08);
    max-width: 340px;
}
.tb-user:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
.tb-user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg,#C9A227,#F5D66A);
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700; color: #fff;
    flex-shrink: 0; overflow: hidden;
    border: 1.5px solid rgba(201,162,39,.45);
}
.tb-user-info { overflow: hidden; flex: 1; min-width: 0; }
.tb-user-name { font-size: .8rem; font-weight: 600; color: rgba(255,255,255,.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.tb-user-sub { font-size: .68rem; color: rgba(255,255,255,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; display: flex; align-items: center; gap: .25rem; }
.tb-user-chevron { font-size: .58rem; color: rgba(255,255,255,.3); transition: transform .2s ease; flex-shrink: 0; }
.tb-user-chevron.su-rotated { transform: rotate(180deg); }

/* Move popup to topbar — drops down */
.tb-user-wrap .su-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    bottom: auto;
    width: 200px;
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.tb-user-wrap .su-popup.open { transform: translateY(0); }

@media (max-width: 1300px) {
@media (max-width: 1300px) {
    .sidebar-bottom .tb-user-wrap .su-popup {
        top: auto;
        bottom: calc(100% + 8px);
        right: auto;
        left: 0;
        transform: translateY(6px);
    }
    .sidebar-bottom .tb-user-wrap .su-popup.open { transform: translateY(0); }
}
}

/* Light theme – clean white sidebar + top-bar */
.light-theme .sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 12px rgba(0,0,0,.04);
}
.light-theme .top-bar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 8px rgba(0,0,0,.04);
}
.light-theme .sidebar-header { border-bottom: none; }
.light-theme .logo-text {
    background: linear-gradient(135deg, #2A5EE8, #60A5FA);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.light-theme .sidebar-toggle { color: #94a3b8; }
.light-theme .sidebar-toggle:hover { color: #334155; background: #f1f5f9; }
.light-theme .nav-item { color: #334155; }
.light-theme .nav-item:hover { background: #f1f5f9; color: #0f172a; }
.light-theme .nav-item.active { background: rgba(42,94,232,.09); color: #2A5EE8; font-weight: 600; text-shadow: none; }
.light-theme .nav-item.active::before { background: #2A5EE8; box-shadow: none; }
.light-theme .nav-section-title { background: linear-gradient(90deg, #C9A227, #2A5EE8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.light-theme .nav-icon { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.1); filter: none; color: #1e293b; }
.light-theme .nav-item:hover .nav-icon { background: rgba(42,94,232,.08); border-color: rgba(42,94,232,.18); box-shadow: none; color: #2A5EE8; }
.light-theme .nav-item.active .nav-icon { background: rgba(42,94,232,.14); border-color: rgba(42,94,232,.3); box-shadow: 0 2px 8px rgba(42,94,232,.18); color: #2A5EE8; }
.light-theme .nav-icon i {
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
}
.light-theme .sidebar-user .user-name { color: #1e293b; }
.light-theme .sidebar-user .user-role { color: #64748b; }
.light-theme .sidebar-theme-btn,
.light-theme .btn-logout { color: #94a3b8; }
.light-theme .sidebar-theme-btn:hover,
.light-theme .btn-logout:hover { color: #334155; background: #f1f5f9; }
.light-theme .tb-user { border-color: #e2e8f0; }
.light-theme .tb-user:hover { background: #f8fafc; border-color: #cbd5e1; }
.light-theme .tb-user-name { color: #0f172a; }
.light-theme .tb-user-sub { color: #64748b; }
.light-theme .tb-user-chevron { color: #94a3b8; }
.light-theme .tb-user-avatar { background: linear-gradient(135deg, #2A5EE8, #60A5FA); border-color: rgba(42,94,232,.35); }
.light-theme .ntf-bell-btn { background: #f8fafc; border-color: #e2e8f0; color: #64748b; }
.light-theme .ntf-bell-btn:hover { background: rgba(42,94,232,.07); border-color: rgba(42,94,232,.3); color: #2A5EE8; }
.light-theme .news-bell-btn:hover { background: rgba(245,158,11,.07); border-color: rgba(245,158,11,.4); color: #d97706; }
.news-bell-btn:hover { color: #f59e0b; border-color: #f59e0b; }
.news-bell-badge { background: #f59e0b !important; }
.light-theme .top-bar-left .btn-ghost,
.light-theme .top-bar-left button { color: #64748b; }
.light-theme .breadcrumb-item { color: #64748b; }
.light-theme .breadcrumb-item.active { color: #0f172a; }

.ntf-bell-btn {
    position: relative;
    width: 40px; height: 40px;
    min-width: 40px;
    border: none; border-radius: 50%;
    background: var(--bg-raised);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.ntf-bell-btn:hover { background: var(--bg-hover); color: var(--primary); border-color: var(--primary); }
.ntf-bell-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    background: var(--danger);
    color: #fff;
    border-radius: 40px;
    font-size: .65rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-surface);
    animation: ntf-pop .3s cubic-bezier(.34,1.56,.64,1);
    z-index: 1;
}
.ntf-bell-badge:not(.hidden) {
    animation: ntf-pop .3s cubic-bezier(.34,1.56,.64,1),
               ntf-badge-pulse 2.4s ease-in-out 1s infinite;
}
@keyframes ntf-pop { from{transform:scale(0)} to{transform:scale(1)} }
@keyframes ntf-badge-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.2); }
}

/* Wave rings around bell when there are unread notifications */
.ntf-bell-btn.has-unread::before,
.ntf-bell-btn.has-unread::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--danger);
    opacity: 0;
    animation: ntf-wave 2.2s ease-out infinite;
    pointer-events: none;
}
.ntf-bell-btn.has-unread::after {
    animation-delay: 1.1s;
}
/* Wave rings for news button */
.news-bell-btn.has-unread::before,
.news-bell-btn.has-unread::after {
    border-color: #f59e0b;
}
@keyframes ntf-wave {
    0%   { opacity: .6; transform: scale(1); }
    100% { opacity: 0;  transform: scale(1.9); }
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.breadcrumb span { color: var(--text-muted); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.4rem 0.9rem;
    transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--primary); }
.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 200px;
    padding: 0;
}
.search-icon { color: var(--text-muted); font-size: 0.875rem; }

.header-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-full);
    transition: background var(--transition);
}
.header-user:hover { background: var(--bg-hover); }
.header-user .avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
}

/*  */
input:focus, select:focus {
    border-color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.05) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}
.light-theme input:focus,
.light-theme select:focus {
    background: rgba(252,179,22,0.02) !important;
    box-shadow: 0 0 0 3px rgba(252,179,22,0.2) !important;
}

select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* Кастомный скроллбар для select */
select {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-hover);
}

/* ── Page Content ───────────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 1rem 1rem 4px 1rem;
    width: 100%;
}
.page-content.no-scroll {
    overflow: hidden;
    max-height: calc(100vh - 64px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Admin section nav links ────────────────────────────────────── */
.admin-section-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition), border-color var(--transition);
    max-width: 480px;
}
.admin-section-link:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}
.admin-section-icon { font-size: 1.75rem; flex-shrink: 0; }
.admin-section-title { font-size: 1rem; font-weight: 600; margin-bottom: .2rem; }
.admin-section-desc { font-size: .8rem; color: var(--text-muted); }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-title h1 { font-size: 1.75rem; font-weight: 700; }
.page-title p  { color: var(--text-muted); margin-top: 0.25rem; font-size: 0.875rem; }
.page-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ── Stat Cards ─────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-color, var(--primary));
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-light); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    background: var(--bg-raised);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.3rem;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.stat-delta {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ── Course Cards ───────────────────────────────────────────────── */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.course-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); }

.course-thumbnail {
    height: 160px;
    background: linear-gradient(135deg, var(--bg-raised), var(--bg-hover));
    position: relative;
    overflow: hidden;
}
.course-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.course-thumbnail .thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, rgba(42,94,232,0.1), rgba(99,155,255,0.1));
}
.course-level-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
}

.course-body { padding: 1.25rem; }
.course-title { font-weight: 600; margin-bottom: 0.5rem; line-height: 1.4; }
.course-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.course-progress-section { margin-top: 0.75rem; }
.course-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

/* ── Lesson List ────────────────────────────────────────────────── */
.lesson-list { display: flex; flex-direction: column; gap: 0.5rem; }

.lesson-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}
.lesson-item:hover { border-color: var(--primary); background: var(--bg-hover); }
.lesson-item.completed { border-color: rgba(16,185,129,0.3); }
.lesson-item.active { border-color: var(--primary); background: var(--primary-glow); }

.lesson-num {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    color: var(--text-muted);
}
.lesson-item.completed .lesson-num { background: rgba(16,185,129,0.15); color: var(--success); }
.lesson-item.active .lesson-num { background: var(--primary-glow); color: var(--primary); }

.lesson-info { flex: 1; min-width: 0; }
.lesson-title { font-weight: 500; font-size: 0.9rem; }
.lesson-meta-row { font-size: 0.78rem; color: var(--text-muted); }
.lesson-duration { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }

/* ── Test & Quiz UI ─────────────────────────────────────────────── */
.test-container { max-width: 720px; margin: 0 auto; }

.test-progress-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}
.test-progress-bar .progress-bar { flex: 1; height: 8px; }
.test-progress-text { font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }

.question-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    animation: slideUp 0.3s ease;
}

.question-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.question-num {
    background: var(--primary-glow);
    color: var(--primary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}
.question-text { font-size: 1.05rem; font-weight: 500; line-height: 1.6; }
.question-points { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

.answer-options { display: flex; flex-direction: column; gap: 0.75rem; }

.answer-option {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-raised);
}
.answer-option:hover { border-color: var(--primary); background: var(--primary-glow); }
.answer-option.selected { border-color: var(--primary); background: var(--primary-glow); }
.answer-option.correct  { border-color: var(--success); background: rgba(16,185,129,0.1); }
.answer-option.wrong    { border-color: var(--danger);  background: rgba(239,68,68,0.1); }

.answer-marker {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    border: 2px solid var(--border-light);
    flex-shrink: 0;
    margin-top: 0.1rem;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}
.answer-option.selected .answer-marker { background: var(--primary); border-color: var(--primary); }
.answer-option.correct .answer-marker  { background: var(--success); border-color: var(--success); }
.answer-option.wrong   .answer-marker  { background: var(--danger);  border-color: var(--danger); }

.answer-text { font-size: 0.9rem; line-height: 1.5; }

/* Test Result */
.test-result {
    text-align: center;
    padding: 3rem 2rem;
}
.result-score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 4px solid;
}
.result-score-circle.passed { border-color: var(--success); background: rgba(16,185,129,0.08); }
.result-score-circle.failed { border-color: var(--danger);  background: rgba(239,68,68,0.08); }
.result-pct { font-size: 2.5rem; font-weight: 800; }
.result-label { font-size: 0.78rem; color: var(--text-muted); }

/* ── Analytics ──────────────────────────────────────────────────── */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.chart-card h3 { margin-bottom: 1rem; font-size: 0.95rem; color: var(--text-secondary); }
.chart-wrapper { position: relative; height: 220px; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 900;
    backdrop-filter: blur(3px);
    animation: fadeIn2 0.25s ease;
}
@keyframes fadeIn2 { from { opacity: 0; } to { opacity: 1; } }

.modal-container {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 901;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    pointer-events: none;
}

.modal-box {
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
    width: 800px;
    max-width: 100vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0,0,0,0.18);
    pointer-events: auto;
    animation: drawerIn 0.28s cubic-bezier(0.22,1,0.36,1);
}
@keyframes drawerIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.modal-box.modal-sm  { width: 420px; }
.modal-box.modal-lg  { width: 960px; }
.modal-box.modal-xl  { width: 1100px; }

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1;
}
.modal-close:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* ── Toast ──────────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
    border-left: 4px solid var(--border);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast.removing { animation: toastOut 0.25s ease forwards; }
@keyframes toastOut {
    to { opacity: 0; transform: translateX(100%); }
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info    { border-left-color: var(--info); }

.toast-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 0.1rem; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.875rem; }
.toast-msg   { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ── Loading Overlay ────────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,18,0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.light-theme .loading-overlay {
    background: rgba(248,250,252,0.85);
}
.loading-box {
    text-align: center;
    color: var(--text-secondary);
}
.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SCORM Player ───────────────────────────────────────────────── */
.scorm-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    z-index: 800;
    display: flex;
    flex-direction: column;
}

.scorm-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.scorm-title { font-weight: 600; font-size: 0.95rem; }
.scorm-controls { display: flex; align-items: center; gap: 1rem; }
.scorm-status-badge { font-size: 0.78rem; padding: 0.25rem 0.6rem; border-radius: var(--radius-full); background: var(--bg-raised); }

.scorm-frame {
    flex: 1;
    border: none;
    width: 100%;
    background: #fff;
}

/* ── File Upload ────────────────────────────────────────────────── */
.file-upload-frame { width: 180px;padding: 2px; border-radius: 16px; background: var(--border-light, #CBD5E1); }
.file-upload-area {
    border: none;
    border-radius: 14px;
    padding: 13px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: linear-gradient(145deg, rgba(42,94,232,.05), rgba(99,155,255,.05));
    transition: background .2s;
    position: relative;
    overflow: hidden;
    
    width: 180px;
    height: 150px;
}
.file-upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 90% 70% at 50% 110%, rgba(42,94,232,.1), transparent 60%),
                radial-gradient(ellipse 35% 35% at 8% 8%, rgba(99,155,255,.08), transparent);
    pointer-events: none;
}
.file-upload-area:hover,
.file-upload-area.drag-over {
    background: linear-gradient(145deg, rgba(42,94,232,.09), rgba(99,155,255,.09));
}
.file-upload-icon {
    width: 64px; height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(42,94,232,.15), rgba(99,155,255,.18));
    border: 1.5px solid rgba(42,94,232,.28);
    display: flex; align-items: center; justify-content: center;
    transition: transform .25s, box-shadow .25s;
    box-shadow: 0 4px 18px rgba(42,94,232,.12);
    flex-shrink: 0;
}
.file-upload-icon i { font-size: 1.6rem; color: #2A5EE8; }
.file-upload-area:hover .file-upload-icon,
.file-upload-area.drag-over .file-upload-icon {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 24px rgba(42,94,232,.22);
}
.file-upload-label { font-weight: 700; font-size: .9rem; color: var(--text-primary); text-align: center; }
.file-upload-hint {
    display: flex; align-items: center; gap: 8px;
    font-size: .73rem; color: var(--text-muted);
}
.file-upload-hint::before, .file-upload-hint::after {
    content: ''; flex: 1; height: 1px; background: var(--border); max-width: 36px;
}

/* ── Sidebar Overlay (Mobile) ───────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    backdrop-filter: blur(2px);
}
.light-theme .sidebar-overlay {
    background: rgba(0,0,0,0.3);
}

/* ── Tabs ───────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}
.tab {
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}
.empty-state .empty-icon { font-size: 4rem; opacity: 0.4; margin-bottom: 1rem; }
.empty-state h3 { margin-bottom: 0.5rem; color: var(--text-secondary); }
.empty-state p  { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }

/* ── News Card ──────────────────────────────────────────────────── */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(430px, 100%), 1fr));
    gap: .75rem;
    max-width: 1450px;
}
.news-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
}
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-light); }
.news-thumb {
    height: 170px;
    background: var(--bg-raised);
    overflow: hidden;
    flex-shrink: 0;
}
.news-thumb img { width: 100%; height: 100%; object-fit: fill; display: block; transition: transform 0.4s ease; }
.news-card:hover .news-thumb img { transform: scale(1.05); }
.news-body { padding: 1.25rem; flex: 1; }
.news-category { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary); margin-bottom: 0.5rem; }
.news-title { font-weight: 600; line-height: 1.4; margin-bottom: 0.5rem; }
.news-excerpt { font-size: 0.875rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem; padding: 0.6rem 1.25rem; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--text-muted); }
.news-card-actions { position: absolute; top: .5rem; right: .5rem; z-index: 3; display: flex; gap: .3rem; opacity: 0; transition: opacity var(--transition); }
.news-card:hover .news-card-actions { opacity: 1; }
.nv-react-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1.1rem; border-radius: 2rem; border: 1.5px solid var(--border); background: var(--bg-raised); cursor: pointer; font-size: .92rem; transition: all var(--transition); font-family: inherit; color: var(--text-primary); }
.nv-react-btn:hover { border-color: var(--primary); background: rgba(42,94,232,.08); color: var(--primary); }
.nv-react-btn.active-up { border-color: #22c55e; background: rgba(34,197,94,.1); color: #16a34a; }
.nv-react-btn.active-down { border-color: #f97316; background: rgba(249,115,22,.1); color: #ea580c; }
.nv-react-count { font-weight: 700; font-size: .95rem; min-width: 1.2ch; text-align: center; }
.nv-emoji-btn { display: inline-flex; align-items: center; justify-content: center; gap: .15rem; padding: .18rem .32rem; min-width: 1.9rem; border-radius: 2rem; border: 1.5px solid var(--border); background: var(--bg-raised); cursor: pointer; font-size: .82rem; font-family: inherit; transition: transform .18s cubic-bezier(.34,1.56,.64,1), border-color .15s, background .15s; color: var(--text-primary); line-height: 1; }
.nv-emoji-btn:hover { border-color: var(--primary); background: rgba(99,102,241,.1); transform: scale(1.15); }
.nv-emoji-btn.active { border-color: var(--primary); background: rgba(99,102,241,.18); }
.nv-emoji-btn .nv-react-count { font-size: .72rem; font-weight: 600; min-width: 1ch; text-align: left; }
.nv-emoji-hero { background: rgba(0,0,0,.35); border-color: rgba(255,255,255,.25); color: #fff; backdrop-filter: blur(6px); }
.nv-emoji-hero:hover { background: rgba(0,0,0,.5); border-color: rgba(255,255,255,.5); }
.nv-emoji-hero.active { background: rgba(99,102,241,.55); border-color: var(--primary); }

/* ── News Article Content ───────────────────────────────────────── */
.news-content-body {
    line-height: 1.9;
    color: var(--text-primary);
    font-size: 1.05rem;
    word-break: break-word;
    
}
.news-content-body h1,
.news-content-body h2,
.news-content-body h3,
.news-content-body h4,
.news-content-body h5 {
    margin: 2.25rem 0 .85rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.01em;
}
.news-content-body h1 { font-size: 1.9rem; }
.news-content-body h2 { font-size: 1.45rem; padding-bottom: .5rem; border-bottom: 2px solid var(--border); }
.news-content-body h3 { font-size: 1.2rem; color: var(--primary); }
.news-content-body p  { margin: 0 0 1.2rem; }
.news-content-body a  {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(42,94,232,.35);
    transition: border-color var(--transition), color var(--transition);
}
.news-content-body a:hover { color: var(--secondary); border-bottom-color: var(--secondary); }
.news-content-body strong { font-weight: 700; }
.news-content-body em     { font-style: italic; color: var(--text-secondary); }
.news-content-body ul { list-style: none; padding-left: 0; margin: 0 0 1.2rem; }
.news-content-body ul li { padding: .2rem 0 .2rem 1.5rem; position: relative; margin-bottom: .3rem; }
.news-content-body ul li::before {
    content: '';
    position: absolute;
    left: 0; top: .65em;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--primary);
    opacity: .7;
}
.news-content-body ol { padding-left: 1.5rem; margin: 0 0 1.2rem; }
.news-content-body li { margin-bottom: .35rem; }
.news-content-body blockquote {
    margin: 1.75rem 0;
    padding: 1rem 1.5rem 1rem 2rem;
    border-left: 4px solid var(--primary);
    background: rgba(42,94,232,.05);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 1.05rem;
    position: relative;
}
.news-content-body blockquote::before {
    content: '\201C';
    position: absolute;
    top: -.25rem; left: .6rem;
    font-size: 3.5rem;
    color: var(--primary);
    opacity: .2;
    line-height: 1;
    font-style: normal;
}
.news-content-body pre,
.news-content-body code {
    font-family: 'Courier New', monospace;
    font-size: .875rem;
    background: var(--bg-raised);
    border-radius: var(--radius-sm);
}
.news-content-body pre  { padding: 1.1rem 1.4rem; overflow-x: auto; margin: 1.25rem 0; border: 1px solid var(--border); border-radius: var(--radius-md); }
.news-content-body code { padding: .15rem .45rem; }
.news-content-body pre code { background: none; padding: 0; }
.news-content-body img {
    max-width: 100%;
    border-radius: var(--radius-lg);
    margin: 1.25rem 0;
    box-shadow: 0 4px 24px rgba(0,0,0,.1);
    display: block;
}
.news-content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: .92rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--border);
}
.news-content-body th,
.news-content-body td { padding: .7rem 1.1rem; border-bottom: 1px solid var(--border); text-align: left; }
.news-content-body th {
    background: var(--bg-raised);
    font-weight: 700;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}
.news-content-body tbody tr:last-child td { border-bottom: none; }
.news-content-body tr:hover td { background: var(--bg-hover); }
.news-content-body hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, var(--primary), transparent);
    margin: 2.5rem 0;
    border-radius: 1px;
    opacity: .3;
}

/* ── Resource List ──────────────────────────────────────────────── */
.resource-list { display: flex; flex-direction: column; gap: 0.5rem; }
.resource-list-docs { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
@media (max-width: 700px) { .resource-list-docs { grid-template-columns: 1fr; } }
.resource-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}
.resource-item:hover { border-color: var(--primary); background: var(--bg-raised); box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.resource-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.resource-icon.pdf     { background: linear-gradient(135deg,rgba(239,68,68,.18),rgba(239,68,68,.06));   color: #ef4444;  border-left-color: #ef4444; }
.resource-icon.video   { background: linear-gradient(135deg,rgba(42,94,232,.18),rgba(42,94,232,.06));   color: #2A5EE8;  }
.resource-icon.scorm   { background: linear-gradient(135deg,rgba(245,158,11,.18),rgba(245,158,11,.06)); color: #f59e0b;  }
.resource-icon.link    { background: linear-gradient(135deg,rgba(6,182,212,.18),rgba(6,182,212,.06));   color: #06b6d4;  }
.resource-icon.file    { background: linear-gradient(135deg,rgba(99,102,241,.18),rgba(99,102,241,.06)); color: #6366f1;  }
.resource-icon.document{ background: linear-gradient(135deg,rgba(16,185,129,.18),rgba(16,185,129,.06)); color: #10b981;  }
.resource-icon.image   { background: linear-gradient(135deg,rgba(236,72,153,.18),rgba(236,72,153,.06)); color: #ec4899;  }
.resource-item .resource-icon.pdf    { --ri-color: #ef4444; }
.resource-item .resource-icon.video  { --ri-color: #2A5EE8; }
.resource-item .resource-icon.scorm  { --ri-color: #f59e0b; }
.resource-item .resource-icon.link   { --ri-color: #06b6d4; }
.resource-item .resource-icon.file   { --ri-color: #6366f1; }
.resource-item .resource-icon.document { --ri-color: #10b981; }
.resource-item .resource-icon.image  { --ri-color: #ec4899; }
.resource-item:hover { border-left-color: var(--ri-color, var(--primary)); }
.resource-info { flex: 1; min-width: 0; }
.resource-title { font-size: .9rem; font-weight: 700; color: var(--text-primary); line-height: 1.35; }
.resource-meta  { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.resource-meta-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 20px; border: 1px solid transparent; }

/* ── Mobile bottom nav ──────────────────────────────────────────── */
.mob-nav {
    display: none;
}
@media (max-width: 768px) {
    .mob-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 300;
        background: #0B1733;
        border-top: 1px solid rgba(201,162,39,0.2);
        height: 60px;
        align-items: stretch;
    }
    .light-theme .mob-nav {
        background: #ffffff;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    }
    .mob-nav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 0.62rem;
        font-weight: 600;
        cursor: pointer;
        position: relative;
        transition: color var(--transition);
        padding: 0;
        letter-spacing: 0.02em;
    }
    .mob-nav-btn i { font-size: 1.15rem; }
    .mob-nav-btn.active { color: var(--primary); }
    .mob-nav-btn-blocked { opacity: .35; cursor: not-allowed; }
    .mob-blocked-icon {
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(6px);
        font-size: .55rem;
        color: #ef4444;
        background: var(--bg-surface, #0B1733);
        border-radius: 50%;
        line-height: 1;
        pointer-events: none;
    }
    .mob-nav-btn .ntf-bell-badge {
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(4px);
    }
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        top: 64px;
        height: calc(100vh - 64px);
        transition: transform var(--transition-slow);
        z-index: 200;
    }
    .sidebar.open { transform: translateX(0); }
    /* overlay: JS управляє через style.display — тут лише позиція */
    .sidebar-overlay { top: 64px; display: none; }
    .main-wrapper { margin-left: 0 !important; }
    .mobile-menu-btn { display: block; }
    .search-box input { width: 140px; }
    /* sidebar-bottom прячем — на мобиле он в top-bar, не нужен */
    .sidebar-bottom { display: none; }
}

@media (max-width: 768px) {
    .page-content { padding: 1rem; padding-bottom: 72px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .courses-grid { grid-template-columns: 1fr; }
    .analytics-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .page-actions { width: 100%; }
    .page-actions input[type="text"] { width: 100% !important; box-sizing: border-box; }
    .form-row { grid-template-columns: 1fr; }
    .search-box { display: none; }
    .modal-box { width: 100% !important; border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important; }
    /* top-bar на мобиле */
    .logo-icon-extra { display: none; }
    .top-bar { padding: 0 0.75rem; }

    /* News mobile */
    .news-grid { gap: .5rem; }
    .news-thumb { height: 130px; }
    .news-body { padding: .85rem; }
    .news-title { font-size: .9rem; }
    .news-excerpt { font-size: .8rem; -webkit-line-clamp: 2; line-clamp: 2; }
    .news-footer { padding: .5rem .85rem; gap: .3rem; flex-wrap: wrap; }
    .nv-emoji-btn { font-size: .8rem; padding: .15rem .25rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 1.5rem; margin: 1rem; }
}

/* ── Quill Editor override ──────────────────────────────────────── */
.ql-toolbar { background: var(--bg-raised) !important; border-color: var(--border) !important; border-radius: var(--radius-md) var(--radius-md) 0 0; }
.ql-container { border-color: var(--border) !important; border-radius: 0 0 var(--radius-md) var(--radius-md); background: var(--bg-raised) !important; color: var(--text-primary) !important; }
.ql-editor { min-height: 150px; }
.ql-toolbar .ql-stroke { stroke: var(--text-secondary) !important; }
.ql-toolbar .ql-fill   { fill: var(--text-secondary) !important; }
.ql-toolbar button:hover .ql-stroke { stroke: var(--primary) !important; }
.ql-snow .ql-picker.ql-expanded .ql-picker-options { z-index: 9999 !important; }
.ql-editor.drag-active { outline: 2px dashed var(--primary) !important; background: rgba(42,94,232,.04) !important; }
/* Image resize/align toolbar */
.ql-img-toolbar { position:absolute;display:none;z-index:6;background:rgba(15,23,42,.82);border:1.5px solid rgba(255,255,255,.15);border-radius:10px;padding:4px 5px;gap:3px;box-shadow:0 4px 18px rgba(0,0,0,.4);backdrop-filter:blur(6px) }
.ql-img-toolbar button { width:36px;height:36px;border:none;border-radius:7px;background:transparent;cursor:pointer;font-size:1rem;color:rgba(255,255,255,.75);transition:all .12s;display:flex;align-items:center;justify-content:center }
.ql-img-toolbar button:hover { background:rgba(255,255,255,.12);color:#fff }
.ql-img-toolbar button.on { background:var(--primary,#2A5EE8);color:#fff }

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Selection ──────────────────────────────────────────────────── */
::selection { background: var(--primary-glow); color: var(--text-primary); }

/* ── Drag items ─────────────────────────────────────────────────── */
.dragging { opacity: 0.5; }
.drag-over-top    { border-top: 2px solid var(--primary); }
.drag-over-bottom { border-bottom: 2px solid var(--primary); }
.btn .fa-angle-left { position:relative; top:1.5px; }

/* ── HelpTip ────────────────────────────────────────────────────── */
@keyframes ht-in{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes ht-ack{0%{transform:scale(1)}40%{transform:scale(1.06)}100%{transform:scale(1)}}
@keyframes ht-check-pop{0%{transform:scale(0) rotate(-20deg);opacity:0}70%{transform:scale(1.2) rotate(5deg);opacity:1}100%{transform:scale(1) rotate(0);opacity:1}}
@keyframes ht-pulse{0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.4)}60%{box-shadow:0 0 0 6px rgba(239,68,68,0)}}

/* ── HelpTip wrapper ─────────────────────────── */
.ht-wrap{display:inline-flex;flex-direction:column;align-items:flex-start;margin-bottom:0;position:relative}

/* ── HELP button ─────────────────────────────── */
.ht-btn{width:50px;height:50px;border-radius:14px;background:linear-gradient(135deg,#ef4444,#dc2626);border:none;color:#fff;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;box-shadow:0 3px 14px rgba(239,68,68,.45);transition:transform .15s,box-shadow .15s;flex-shrink:0;font-family:inherit}
.ht-wrap:not(.ht-done) .ht-btn{animation:ht-pulse 2.4s ease-in-out infinite}
.ht-btn:hover{transform:scale(1.08);box-shadow:0 5px 20px rgba(239,68,68,.6)}
.ht-btn-label{font-size:.62rem;font-weight:800;letter-spacing:.08em;line-height:1}
.ht-btn-dot{font-size:.55rem;color:rgba(255,255,255,.75);font-weight:600;line-height:1}
.ht-btn-done{background:linear-gradient(135deg,#10b981,#059669);box-shadow:0 3px 14px rgba(16,185,129,.4);animation:none !important}
.ht-btn-done i{font-size:1.3rem}

/* ── expandable panel ────────────────────────── */
.ht-panel{position:absolute;top:calc(100% + 8px);right:0;z-index:50;width:max-content;max-width:calc(100vw - 120px);border-radius:var(--radius-lg);overflow:hidden;box-shadow:0 8px 32px rgba(0,0,0,.22);pointer-events:none;opacity:0;transform:translateY(-6px) scale(.97);transform-origin:top right;transition:opacity .22s ease,transform .22s ease}
.ht-wrap.ht-open .ht-panel{pointer-events:auto;opacity:1;transform:translateY(0) scale(1)}

.ht-panel-head{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.6rem 1rem}
.ht-panel-head-left{display:flex;align-items:center;gap:.6rem}
.ht-banner-ico{width:32px;height:32px;border-radius:10px;background:rgba(255,255,255,.18);border:1.5px solid rgba(255,255,255,.28);display:flex;align-items:center;justify-content:center;font-size:1rem;color:#fff;flex-shrink:0}
.ht-banner-label{font-size:.58rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:rgba(255,255,255,.55)}
.ht-banner-title{font-size:.82rem;font-weight:700;color:#fff;line-height:1.25}
.ht-progress-wrap{display:flex;flex-direction:column;align-items:flex-end;gap:.15rem}
.ht-progress-bar{width:60px;height:4px;background:rgba(255,255,255,.22);border-radius:3px;overflow:hidden}
.ht-progress-fill{height:100%;background:#fff;border-radius:3px;transition:width .4s ease}
.ht-progress-label{font-size:.6rem;color:rgba(255,255,255,.75);font-weight:600}
.ht-done-badge{display:flex;align-items:center;gap:.3rem;background:rgba(255,255,255,.18);border:1px solid rgba(255,255,255,.3);border-radius:2rem;padding:.2rem .65rem;font-size:.7rem;font-weight:700;color:#fff}
.ht-toggle{width:28px;height:28px;border-radius:50%;border:1.5px solid rgba(255,255,255,.28);background:rgba(255,255,255,.1);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,transform .15s;flex-shrink:0;font-size:.85rem}
.ht-toggle:hover{background:rgba(255,255,255,.25);transform:scale(1.1)}

.ht-scroll{display:flex;flex-wrap:wrap;gap:.6rem;padding:.75rem;background:var(--bg-surface)}
@media(max-width:1300px){.ht-panel{width:calc(185px * 2 + .6rem + 1.5rem) !important;max-width:calc(100vw - 120px)}}

.ht-card{min-width:185px;max-width:185px;background:var(--bg-raised);border:1.5px solid var(--border);border-radius:var(--radius-md);padding:.7rem;display:flex;flex-direction:column;gap:.5rem;flex-shrink:0;scroll-snap-align:start;transition:border-color .2s,box-shadow .2s,opacity .3s,transform .3s}
.ht-wrap.ht-open .ht-card{animation:ht-in .3s ease both}
.ht-card:hover{border-color:var(--primary);box-shadow:0 3px 12px rgba(42,94,232,.12);transform:translateY(-2px)}
.ht-card-done{opacity:.5;border-style:dashed}
.ht-card-done:hover{transform:none;box-shadow:none}
.ht-card-acking{animation:ht-ack .35s ease}
.ht-card-top{display:flex;align-items:flex-start;justify-content:space-between}
.ht-card-ico{width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:.85rem;flex-shrink:0}
.ht-card-check{width:20px;height:20px;border-radius:50%;background:#10b981;display:flex;align-items:center;justify-content:center;font-size:.6rem;color:#fff;animation:ht-check-pop .4s ease both}
.ht-card-text{font-size:.75rem;color:var(--text-secondary);line-height:1.45;flex:1}
.ht-card-ack{margin-top:auto;width:100%;padding:.28rem;border-radius:var(--radius-sm);border:1.5px solid var(--primary);background:transparent;color:var(--primary);font-size:.7rem;font-weight:600;cursor:pointer;transition:background .15s,color .15s;display:flex;align-items:center;justify-content:center;gap:.3rem;font-family:inherit}
.ht-card-ack:hover{background:var(--primary);color:#fff}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — Multi-resolution support
   1920×1080 · 1440×900 · 1280×1024 · mobile 2400×1080
   ══════════════════════════════════════════════════════════════════ */

/* ── 1920×1080: більший padding ── */
@media (min-width: 1600px) {
    .page-content {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* ── 1440×900 ── */
@media (max-width: 1440px) and (min-width: 1281px) {
    :root { --sidebar-w: 220px; }
    .page-content { padding: .85rem; }
}

/* ── 1280×1024: стискаємо сайдбар ── */
@media (max-width: 1280px) and (min-width: 1025px) {
    :root { --sidebar-w: 200px; }
    .page-content { padding: .75rem; }
    .top-bar { padding: 0 1rem; }
    .tb-user-name { max-width: 130px; }
}

/* ── Загальний планшет 1024px ── */
@media (max-width: 1024px) {
    :root { --sidebar-w: 235px; }

    .page-content { padding: .75rem; }

    /* Таблиці — горизонтальний скрол замість overflow */
    .table-wrap, .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Картки в гриді — 2 колонки */
    .course-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ══ MOBILE ≤768px ══ */
@media (max-width: 768px) {

    /* Сайдбар — drawer поверх контенту */
    .sidebar { transform: translateX(-100%); z-index: 300; top: 56px; height: calc(100vh - 56px); transition: transform .25s ease; }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.4); }
    .main-wrapper { margin-left: 0 !important; }

    /* Топбар */
    .top-bar { padding: 0 .75rem; height: 56px; }
    .main-wrapper { margin-top: 56px; }
    .top-bar-left { gap: .35rem; }
    .tb-user-info { display: none; }
    .tb-user { padding: .25rem; border: none; background: none !important; }

    /* Контент */
    .page-content { padding: .6rem .65rem; }

    /* Page headers */
    .page-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .page-actions { width: 100%; flex-wrap: wrap; }
    .page-actions .btn { flex: 1; justify-content: center; }

    /* Таблиці → карткова розкладка */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 600px; }

    /* Картки — 1 колонка */
    .course-grid,
    .stats-grid { grid-template-columns: 1fr !important; }

    /* Модалки — повний екран */
    .modal { width: 100vw !important; max-width: 100vw !important;
             margin: 0 !important; border-radius: 0 !important;
             max-height: 100dvh; }

    /* Приховати breadcrumb на дуже малих */
    .breadcrumb { display: none; }

    /* Форми */
    .form-row { flex-direction: column; }
    input, select, textarea { font-size: 16px !important; } /* запобігає zoom на iOS */
}

/* ══ MOBILE ≤480px (2400×1080 portrait / small phones) ══ */
@media (max-width: 480px) {
    .page-content { padding: .5rem; }
    .top-bar { height: 52px; padding: 0 .5rem; }
    .main-wrapper { margin-top: 52px; }
    h1 { font-size: 1.25rem !important; }
    h2 { font-size: 1.1rem !important; }
    .btn { padding: .35rem .65rem; font-size: .78rem; }
    .card { border-radius: var(--radius-md); }
    .badge { font-size: .6rem; }

    /* Мобільний nav вище */
    .mob-nav { padding-bottom: env(safe-area-inset-bottom, 0); }
}

/* ══ Landscape mobile (2400×1080) ══ */
@media (max-width: 768px) and (orientation: landscape) {
    .top-bar { height: 48px; }
    .main-wrapper { margin-top: 48px; }
    .page-content { padding: .4rem .6rem; }
    .mob-nav { display: none; } /* ховаємо нижній nav в landscape */
}




/* ── PDF Drawer ─────────────────────────────────────────────────── */
.pdf-drawer-backdrop {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(0,0,0,0);
    transition: background 0.3s ease;
}
.pdf-drawer-backdrop--open { background: rgba(0,0,0,0.5); }

.pdf-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1101;
    width: min(1020px, 92vw);
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 40px rgba(0,0,0,0.35);
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.pdf-drawer--open { transform: translateX(0); }

.pdf-drawer-header {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.pdf-drawer-title {
    flex: 1; font-weight: 600; font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 0.5rem;
    min-width: 0;
}
.pdf-drawer-meta {
    display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
}
.pdf-drawer-ack {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.75rem; font-weight: 500;
    padding: 3px 10px; border-radius: var(--radius-full);
    white-space: nowrap;
}
.pdf-drawer-ack--done {
    background: rgba(16,185,129,0.12); color: #10b981;
}
.pdf-drawer-ack--pending {
    background: var(--bg-raised); color: var(--text-muted);
    border: 1px solid var(--border);
}
.pdf-drawer-bm {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-muted); border-radius: var(--radius-md);
    width: 32px; height: 32px; display: flex; align-items: center;
    justify-content: center; cursor: pointer; flex-shrink: 0;
    transition: all var(--transition); font-size: 0.875rem;
}
.pdf-drawer-bm:hover { background: var(--bg-hover); color: var(--text-primary); }
.pdf-drawer-bm.active { color: var(--primary); border-color: var(--primary); background: var(--primary-glow); }
.pdf-drawer-close {
    background: var(--bg-raised); border: 1px solid var(--border);
    color: var(--text-secondary); border-radius: var(--radius-md);
    width: 32px; height: 32px; display: flex; align-items: center;
    justify-content: center; cursor: pointer; flex-shrink: 0;
    transition: all var(--transition);
}
.pdf-drawer-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.pdf-drawer-body { flex: 1; overflow: hidden; }

@media (max-width: 600px) {
    .pdf-drawer { width: 100vw; }
}
