/* === ADMIN.CSS ===
   assets/css/admin.css
   НАЗНАЧЕНИЕ: Базовi стилi адмiн-панелi Dormeza (змiннi, layout, форми, кнопки, утилiти)
   СВЯЗИ: admin/index.php, views/admin/login.php, admin-pages.css
   РАЗМЕР: ~450 строк
*/

/* ------ CSS Variables ------ */
:root {
    /* === ФОНЫ === */
    --bg-primary: hsl(0, 0%, 4%);
    --bg-secondary: hsl(0, 0%, 6%);
    --bg-tertiary: hsl(0, 0%, 8%);

    /* === ТЕКСТ === */
    --text-primary: hsl(0, 0%, 98%);
    --text-secondary: hsl(0, 0%, 75%);
    --text-muted: hsl(0, 0%, 55%);

    /* === ОСНОВНЫЕ ЦВЕТА (Ночная палитра) === */
    --color-primary: hsl(235, 85%, 65%);
    --color-secondary: hsl(270, 70%, 68%);
    --color-accent: hsl(160, 75%, 55%);

    /* === AI ЦВЕТА === */
    --ai-dark: #0a0a0a;
    --ai-gray: #1a1a1a;
    --ai-indigo: hsl(235, 85%, 65%);
    --ai-lavender: hsl(270, 70%, 68%);
    --ai-mint: hsl(160, 75%, 55%);
    --ai-blue: hsl(210, 90%, 60%);
    --ai-green: #10b981;
    --ai-purple: hsl(270, 70%, 68%);

    /* === КАРТОЧКИ И ГРАНИЦЫ === */
    --card-bg: hsl(0, 0%, 7%);
    --border-color: hsl(0, 0%, 15%);

    /* === СОСТОЯНИЯ === */
    --color-success: hsl(160, 75%, 55%);
    --color-warning: hsl(45, 95%, 60%);
    --color-danger: hsl(0, 85%, 62%);

    /* === ГРАДИЕНТЫ === */
    --gradient-primary: linear-gradient(135deg, var(--ai-indigo), var(--ai-lavender));
    --gradient-card: linear-gradient(135deg, var(--card-bg) 0%, hsla(235, 85%, 65%, 0.06) 100%);

    /* === ТИПОГРАФИКА === */
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* === LAYOUT === */
    --sidebar-width: 200px;
    --header-height: 48px;

    /* === ГЕОМЕТРИЯ === */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* === ТЕНИ === */
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);
    --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-dramatic: 0 4px 6px rgba(0, 0, 0, 0.1), 0 10px 20px hsla(235, 85%, 65%, 0.18), 0 20px 40px hsla(235, 85%, 65%, 0.1);

    /* === TRANSITIONS === */
    --transition: 0.2s ease;
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* === ДОПОЛНИТЕЛЬНО === */
    --text-on-accent: #fff;
}

/* ------ Reset & Base ------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: hsl(210, 85%, 65%); }
::selection { background: hsla(210, 80%, 55%, 0.3); color: var(--text-primary); }

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

/* ------ Login Page ------ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 50%, hsla(210, 80%, 55%, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, hsla(270, 55%, 60%, 0.05) 0%, transparent 60%),
        var(--bg-primary);
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-elevated);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-form .form-group { margin-bottom: 20px; }
.error-message {
    background: hsla(0, 75%, 55%, 0.12);
    border: 1px solid hsla(0, 75%, 55%, 0.25);
    color: var(--color-danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}
.login-footer {
    text-align: center;
    margin-top: 20px;
}
.forgot-password {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: color var(--transition);
}
.forgot-password:hover {
    color: var(--color-primary);
}

/* ------ Form Elements ------ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px hsla(210, 80%, 55%, 0.15);
}
textarea { resize: vertical; min-height: 100px; }
select { cursor: pointer; }

/* ------ Buttons ------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.5;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--gradient-primary); color: var(--text-on-accent); border: none; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 6px 20px hsla(235, 85%, 65%, 0.4); }
.btn-success { background: var(--color-success); color: hsl(0, 0%, 4%); font-weight: 600; }
.btn-success:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-2px); box-shadow: 0 6px 20px hsla(160, 75%, 55%, 0.4); }
.btn-danger { background: var(--color-danger); color: #fff; font-weight: 600; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-2px); box-shadow: 0 6px 20px hsla(0, 85%, 62%, 0.4); }
.btn-warning { background: var(--color-warning); color: hsl(0, 0%, 4%); font-weight: 600; }
.btn-warning:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 6px 20px hsla(45, 95%, 60%, 0.4); }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-outline:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); transform: translateY(-2px); box-shadow: 0 4px 16px hsla(235, 85%, 65%, 0.2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ------ Admin Layout ------ */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-logo {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--header-height);
}
.sidebar-logo h2 {
    font-size: 16px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.sidebar-logo .logo-subtitle { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
}
.nav-link:hover { color: var(--text-primary); background: hsla(210, 80%, 55%, 0.05); }
.nav-link.active {
    color: var(--color-primary);
    background: hsla(210, 80%, 55%, 0.08);
    border-left-color: var(--color-primary);
}
.nav-link .nav-icon { width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
    margin-left: auto;
    background: var(--color-danger);
    color: var(--text-on-accent);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}
.sidebar-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
}

/* Header */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: hsla(220, 20%, 8%, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 90;
}
.header-left { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.header-title { font-size: 14px; font-weight: 600; line-height: 1.4; }
.header-back {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
    flex-shrink: 0;
}
.header-back:hover { color: var(--text-primary); }
.header-patient-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.header-patient-meta {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.header-left .btn-sm { padding: 3px 8px; font-size: 11px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.notification-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    transition: color var(--transition);
}
.notification-btn:hover { color: var(--text-primary); }
.notification-badge {
    position: absolute;
    top: 0; right: 0;
    width: 16px; height: 16px;
    background: var(--color-danger);
    color: var(--text-on-accent);
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
}

/* Main content */
.main-content { flex: 1; padding: 14px 16px; }

/* ------ Card ------ */
.card {
    background: var(--gradient-card, var(--card-bg));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}
.card:hover { border-color: var(--color-primary); transform: translateY(-4px); box-shadow: 0 12px 32px hsla(235, 85%, 65%, 0.18); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.card-title { font-size: 15px; font-weight: 600; line-height: 1.4; }

/* ------ Table ------ */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.filters-bar .form-control,
.filters-bar select,
.filters-bar input { width: auto; min-width: 160px; padding: 8px 12px; font-size: 13px; }
.search-input { position: relative; }
.search-input input { padding-left: 34px; }
.search-input .search-icon {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); max-height: 65vh; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--bg-tertiary); }
th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid hsla(220, 15%, 22%, 0.5);
    vertical-align: middle;
    line-height: 1.6;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: hsla(210, 80%, 55%, 0.04); }
tbody tr:last-child td { border-bottom: none; }
.clickable-row { cursor: pointer; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 16px; }
.pagination button {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
}
.pagination button:hover { border-color: var(--color-primary); color: var(--color-primary); }
.pagination button.active { background: var(--color-primary); color: var(--text-on-accent); border-color: var(--color-primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ------ Badges ------ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    line-height: 1.4;
}
.badge-active    { background: hsla(160, 70%, 42%, 0.15); color: var(--color-success); }
.badge-paused    { background: hsla(45, 90%, 52%, 0.15);  color: var(--color-warning); }
.badge-completed { background: hsla(210, 80%, 55%, 0.15); color: var(--color-primary); }
.badge-dropped   { background: hsla(0, 75%, 55%, 0.12);   color: var(--color-danger); }
.badge-pending   { background: hsla(270, 55%, 60%, 0.15); color: var(--color-accent); }
.badge-paid      { background: hsla(160, 70%, 42%, 0.15); color: var(--color-success); }
.badge-unpaid    { background: hsla(0, 75%, 55%, 0.12);   color: var(--color-danger); }
.badge-success   { background: hsla(160, 70%, 42%, 0.15); color: var(--color-success); }
.badge-info      { background: hsla(210, 80%, 55%, 0.15); color: var(--color-primary); }
.badge-warning   { background: hsla(45, 90%, 52%, 0.15);  color: var(--color-warning); }
.badge-danger    { background: hsla(0, 75%, 55%, 0.15);   color: var(--color-danger); }
.badge-muted     { background: hsla(215, 15%, 50%, 0.15); color: var(--text-muted); }
.text-center { text-align: center; }

/* ------ Alerts ------ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 12px;
    border: 1px solid;
}
.alert-success { background: hsla(160, 70%, 42%, 0.1); border-color: hsla(160, 70%, 42%, 0.25); color: var(--color-success); }
.alert-danger  { background: hsla(0, 75%, 55%, 0.1);   border-color: hsla(0, 75%, 55%, 0.25);   color: var(--color-danger); }
.alert-warning { background: hsla(45, 90%, 52%, 0.1);  border-color: hsla(45, 90%, 52%, 0.25);  color: var(--color-warning); }
.alert-info    { background: hsla(210, 80%, 55%, 0.1); border-color: hsla(210, 80%, 55%, 0.25); color: var(--color-primary); }

/* ------ Modal ------ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-elevated);
    transform: translateY(12px);
    transition: transform 0.25s ease;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-dialog {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-elevated);
    transform: translateY(12px);
    transition: transform 0.25s ease;
}
.modal-overlay.active .modal-dialog { transform: translateY(0); }
.modal-dialog .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-dialog .modal-body {
    padding: 20px 24px;
}
.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 2px 6px;
    transition: color var(--transition);
    line-height: 1;
}
.modal-close-btn:hover { color: var(--text-primary); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 2px;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* ------ Loading Spinner ------ */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    gap: 10px;
    font-size: 14px;
}
.loading-spinner::before {
    content: '';
    width: 22px; height: 22px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ------ Animations ------ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Staggered reveals */
.stagger-item { animation: fadeIn 0.5s ease-out forwards; opacity: 0; }
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }

/* ------ Sticky Table Header ------ */
.table-wrapper thead th,
.table-responsive thead th {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    z-index: 10;
    box-shadow: 0 1px 0 var(--border-color);
}

/* ------ Gradient Mesh Background ------ */
.admin-body {
    position: relative;
    background: var(--bg-primary);
}

.admin-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 15% 50%, hsla(235, 85%, 65%, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 20%, hsla(270, 70%, 68%, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, hsla(160, 75%, 55%, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ------ Sortable Table Headers ------ */
.sortable-th { cursor: pointer; user-select: none; }
.sortable-th:hover { color: var(--color-primary); }
.sort-indicator { font-size: 10px; margin-left: 4px; opacity: 0.4; }
.sort-indicator.sort-active { opacity: 1; color: var(--color-primary); }

/* ------ Page Help Block ------ */
.page-help {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 14px; margin-bottom: 14px;
    background: hsla(210, 80%, 55%, 0.06);
    border: 1px solid hsla(210, 80%, 55%, 0.12);
    border-radius: var(--radius-sm);
    font-size: 13px; color: var(--text-secondary); line-height: 1.5;
}
.page-help .help-icon { flex-shrink: 0; color: var(--color-primary); margin-top: 1px; }
.page-help-dismiss {
    margin-left: auto; background: none; border: none;
    color: var(--text-muted); cursor: pointer; padding: 2px; font-size: 16px; flex-shrink: 0;
}
.page-help-dismiss:hover { color: var(--text-primary); }

/* ------ Empty State ------ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 320px; margin: 0 auto; }

/* ------ Utility ------ */
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-primary { color: var(--color-primary); }
.text-muted   { color: var(--text-muted); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.fw-600 { font-weight: 600; }
.hidden { display: none !important; }

/* ------ Responsive (base layout) ------ */
@media (max-width: 1024px) {
    .main-content { padding: 14px; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5); }
    .main-wrapper { margin-left: 0; }
    .hamburger { display: block; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .filters-bar .form-control,
    .filters-bar select,
    .filters-bar input { width: 100%; min-width: 0; }
    .modal { width: 95%; padding: 20px; }
    .header { padding: 0 14px; }
    .main-content { padding: 14px; }
}
@media (max-width: 640px) {
    .header-user .user-name { display: none; }
    .card { padding: 12px; }
    .main-content { padding: 12px; }
    .page-help { font-size: 12px; padding: 8px 12px; }
}
@media (max-width: 480px) {
    .login-card { padding: 28px 20px; }
    .btn { padding: 8px 14px; font-size: 13px; }
}

/* ------ Toast notifications ------ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-elevated);
    min-width: 250px;
    max-width: 400px;
    color: var(--text-primary);
    font-size: 14px;
    white-space: pre-line;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateX(0);
}
.toast-success { border-left: 3px solid var(--color-success); }
.toast-error { border-left: 3px solid var(--color-danger); }
.toast-info { border-left: 3px solid var(--color-primary); }
.toast-warning { border-left: 3px solid var(--color-warning); }
.toast-fade {
    opacity: 0;
    transform: translateX(20px);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}
@media (max-width: 768px) {
    .sidebar-overlay.active { display: block; }
}

/* ------ CodeMirror Prompt Editor ------ */
#promptEditorWrap .CodeMirror {
    height: 100%;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13.5px;
    line-height: 1.65;
    border-radius: 8px;
}
#promptEditorWrap .CodeMirror-gutters {
    background: hsl(0, 0%, 8%);
    border-right: 1px solid hsl(0, 0%, 15%);
}
#promptEditorWrap .CodeMirror-linenumber {
    color: hsl(0, 0%, 35%);
    font-size: 11px;
}
/* Markdown-заголовки — бiльш контрастнi */
#promptEditorWrap .cm-header-1 { font-size: 1.25em; color: hsl(210, 90%, 72%); font-weight: 700; }
#promptEditorWrap .cm-header-2 { font-size: 1.15em; color: hsl(210, 80%, 68%); font-weight: 600; }
#promptEditorWrap .cm-header-3 { font-size: 1.05em; color: hsl(210, 70%, 64%); font-weight: 600; }
#promptEditorWrap .cm-header-4 { color: hsl(210, 60%, 60%); font-weight: 600; }
/* Активний рядок */
#promptEditorWrap .CodeMirror-activeline-background {
    background: hsla(235, 85%, 65%, 0.06);
}
/* Виділення */
#promptEditorWrap .CodeMirror-selected {
    background: hsla(235, 85%, 65%, 0.2) !important;
}
/* Пошук (Ctrl+F) */
#promptEditorWrap .CodeMirror-dialog {
    background: hsl(0, 0%, 10%);
    border-bottom: 1px solid hsl(0, 0%, 20%);
    color: var(--text-primary);
    padding: 6px 12px;
    font-size: 13px;
}
#promptEditorWrap .CodeMirror-dialog input {
    background: hsl(0, 0%, 14%);
    color: var(--text-primary);
    border: 1px solid hsl(0, 0%, 22%);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 13px;
}
/* Скролбар */
#promptEditorWrap .CodeMirror-vscrollbar::-webkit-scrollbar {
    width: 8px;
}
#promptEditorWrap .CodeMirror-vscrollbar::-webkit-scrollbar-track {
    background: transparent;
}
#promptEditorWrap .CodeMirror-vscrollbar::-webkit-scrollbar-thumb {
    background: hsl(0, 0%, 25%);
    border-radius: 4px;
}
#promptEditorWrap .CodeMirror-vscrollbar::-webkit-scrollbar-thumb:hover {
    background: hsl(0, 0%, 35%);
}
