/* ============================================================
   AVISTA Dark Theme — Личный кабинет пользователя
   Brand: ООО «АВИСТА» | avista-corp.ru
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&family=Manrope:wght@400;500;600;700&display=swap');

:root, .theme-dark {
    --primary: #E24C4A;
    --primary-dark: #C0392B;
    --primary-light: rgba(226,76,74,0.12);
    --secondary: #386BB7;
    --secondary-light: rgba(56,107,183,0.12);
    --gradient: linear-gradient(146deg, #E24C4A 0%, #386BB7 100%);
    --gradient-hover: linear-gradient(146deg, #C0392B 0%, #2A5A9E 100%);
    --bg: #1F1F1F;
    --bg-card: #282828;
    --bg-secondary: #222222;
    --bg-input: #2A2A2A;
    --text: #FFFFFF;
    --text-secondary: rgba(255,255,255,0.65);
    --text-tertiary: rgba(255,255,255,0.35);
    --border: rgba(255,255,255,0.08);
    --border-light: rgba(255,255,255,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --sidebar-width: 250px;
    --transition: 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 999px;
}

.theme-light {
    --primary: #E24C4A;
    --primary-dark: #C0392B;
    --primary-light: rgba(226,76,74,0.08);
    --secondary: #386BB7;
    --secondary-light: rgba(56,107,183,0.08);
    --gradient: linear-gradient(146deg, #E24C4A 0%, #386BB7 100%);
    --gradient-hover: linear-gradient(146deg, #C0392B 0%, #2A5A9E 100%);
    --bg: #F2F2F7;
    --bg-card: #FFFFFF;
    --bg-secondary: #F8F9FC;
    --bg-input: #F8F9FC;
    --text: #1C1C1E;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Montserrat', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ================= LOGIN PAGE ================= */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(226,76,74,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(56,107,183,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(226,76,74,0.05) 0%, transparent 50%);
    position: relative;
}
.theme-light .login-page {
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(226,76,74,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(56,107,183,0.04) 0%, transparent 50%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 36px 36px;
    box-shadow: 0 8px 60px rgba(0,0,0,0.5);
    animation: iosSlideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { height: 48px; width: auto; }

.login-card h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-align: center;
    color: var(--text);
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 28px;
    font-size: 13px;
}

.login-card .form-control {
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 15px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    transition: all var(--transition);
}
.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(226,76,74,0.12);
}
.login-card .form-group label {
    font-size: 11px;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.login-card .btn-block {
    border-radius: var(--radius);
    padding: 14px 20px;
    font-size: 13px;
}
.login-card .checkbox-label {
    font-size: 11px;
    line-height: 1.5;
}

.login-theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    transition: all var(--transition);
    z-index: 10;
}
.login-theme-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text);
    transform: scale(1.05);
}

/* ================= SEARCH BAR ================= */
.search-bar {
    position: relative;
    max-width: 500px;
}
.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
    background: var(--bg-secondary);
    color: var(--text);
    outline: none;
    transition: all var(--transition);
    font-family: inherit;
}
.search-bar input:focus {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(226,76,74,0.08);
}
.search-bar input::placeholder { color: var(--text-tertiary); }
.search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--text-tertiary);
    pointer-events: none;
}
.search-bar .search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}
.search-bar .search-results.show { display: block; }
.search-bar .search-results a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text);
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
    gap: 8px;
}
.search-bar .search-results a:last-child { border-bottom: none; }
.search-bar .search-results a:hover { background: var(--primary-light); text-decoration: none; }
.search-bar .search-results .result-module {
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.search-bar .search-results .result-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
}
.search-bar .search-results .result-loading {
    padding: 16px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* ================= EXPIRING FILTER ================= */
.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.filter-pill {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.filter-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}
.filter-pill.active {
    background: var(--gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 12px rgba(226,76,74,0.3);
}
.filter-pill.expiring {
    border-color: #F39C12;
    color: #F39C12;
}
.filter-pill.expiring.active {
    background: #F39C12;
    border-color: #F39C12;
    color: #fff;
}

/* ================= LAYOUT ================= */
.layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px 40px;
}

.footer {
    margin-left: var(--sidebar-width);
    padding: 16px 40px 20px;
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg);
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

/* ================= SIDEBAR ================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 28px 20px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-link { display: block; margin-bottom: 10px; }
.logo { height: 32px; width: auto; }

.sidebar-header .user-info {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-secondary);
    transition: all var(--transition);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin: 2px 0;
}

.sidebar-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--gradient);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(226,76,74,0.3);
}

.sidebar-nav a .icon {
    margin-right: 10px;
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav a .icon-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapse-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 13px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    margin-top: 6px;
    width: 100%;
    text-align: center;
    font-family: inherit;
}
.sidebar-collapse-btn:hover {
    color: var(--text);
    background: var(--bg-secondary);
}

.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-header { padding: 18px 8px 14px; }
.sidebar.collapsed .logo { height: 28px; }
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .sidebar-nav a .icon-text,
.sidebar.collapsed .sidebar-collapse-btn span,
.sidebar.collapsed .theme-toggle .label { display: none; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .sidebar-nav a .icon { margin-right: 0; }
.sidebar.collapsed ~ .main-content,
.sidebar.collapsed ~ .footer { margin-left: 60px; }

.sidebar.collapsed .sidebar-nav { padding: 12px 4px; }

.sidebar-footer {
    padding: 14px 20px 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.sidebar-footer a {
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
    margin: 2px 6px;
    transition: color var(--transition);
    letter-spacing: 0.3px;
}
.sidebar-footer a:hover { color: var(--primary); text-decoration: none; }

/* ================= PAGE HEADER ================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.6px;
    color: var(--text);
}

/* ================= CARDS ================= */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-body { padding: 22px 24px; }
.card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
    letter-spacing: -0.2px;
}

/* ================= STATS ================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stats-grid .card { min-width: 0; }
.stats-grid .card table { word-break: break-word; }
.stats-grid .card table td:first-child { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-grid .card table td:first-child a { overflow: hidden; text-overflow: ellipsis; display: block; }

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-top: 3px solid var(--border);
    transition: all var(--transition);
}

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

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card.stat-blue { border-top-color: var(--secondary); }
.stat-card.stat-blue .stat-value { color: var(--secondary); }
.stat-card.stat-green { border-top-color: #2ECC71; }
.stat-card.stat-green .stat-value { color: #2ECC71; }
.stat-card.stat-orange { border-top-color: #F39C12; }
.stat-card.stat-orange .stat-value { color: #F39C12; }
.stat-card.stat-red { border-top-color: var(--primary); }
.stat-card.stat-red .stat-value { color: var(--primary); }
.stat-card.stat-purple { border-top-color: #9B59B6; }
.stat-card.stat-purple .stat-value { color: #9B59B6; }

/* ================= TABLES ================= */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

table th, table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

table tbody tr:last-child td { border-bottom: none; }
table tbody tr { transition: background var(--transition); }
table tbody tr:hover { background: var(--primary-light); }

table .actions { white-space: nowrap; gap: 6px; display: flex; }

table .actions a,
table .actions button {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

table .actions a:hover,
table .actions button:hover {
    background: var(--gradient);
    color: #fff;
}

/* ================= BADGES ================= */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.6;
    text-transform: uppercase;
}

.badge-success { background: rgba(46,204,113,0.15); color: #2ECC71; }
.badge-danger  { background: rgba(226,76,74,0.15); color: #E24C4A; }
.badge-warning { background: rgba(243,156,18,0.15); color: #F39C12; }
.badge-info    { background: rgba(56,107,183,0.15); color: #5A8FD4; }
.badge-primary { background: rgba(155,89,182,0.15); color: #9B59B6; }
.badge-secondary { background: rgba(255,255,255,0.05); color: var(--text-secondary); }

/* ================= BUTTONS ================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    gap: 6px;
    line-height: 1.4;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }

.btn-primary {
    background: var(--gradient);
    color: #fff;
    border-color: transparent;
}
.btn-primary:hover {
    background: var(--gradient-hover);
    box-shadow: 0 6px 24px rgba(226,76,74,0.3);
    color: #fff;
}
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 30%;
    height: 300%;
    transition: 0.3s;
    background: linear-gradient(174deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.1) 100%);
    animation: blick 3s linear infinite;
    transform: rotate(45deg) translateY(-50%);
}
@keyframes blick {
    0% { left: -80%; }
    100% { left: 160%; }
}

.btn-success {
    background: rgba(46,204,113,0.15);
    color: #2ECC71;
    border-color: rgba(46,204,113,0.3);
}
.btn-success:hover { background: #2ECC71; color: #fff; box-shadow: 0 6px 24px rgba(46,204,113,0.3); }

.btn-danger {
    background: rgba(226,76,74,0.15);
    color: var(--primary);
    border-color: rgba(226,76,74,0.3);
}
.btn-danger:hover { background: var(--primary); color: #fff; box-shadow: 0 6px 24px rgba(226,76,74,0.3); }

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-card); color: var(--text); }

.btn-sm { padding: 5px 14px; font-size: 10px; border-radius: 7px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ================= FORMS ================= */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition);
    background: var(--bg-input);
    color: var(--text);
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
}

.form-control:focus {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(226,76,74,0.1);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

select.form-control { cursor: pointer; padding-right: 32px; }
textarea.form-control { min-height: 90px; resize: vertical; line-height: 1.5; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.form-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    letter-spacing: -0.2px;
}

.checkbox-group { margin-bottom: 20px; }

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
    border-radius: 4px;
}

.checkbox-label a { color: var(--primary); font-weight: 500; }

/* ================= ALERTS ================= */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success { background: rgba(46,204,113,0.1); color: #2ECC71; border-color: rgba(46,204,113,0.2); }
.alert-danger  { background: rgba(226,76,74,0.1); color: #E24C4A; border-color: rgba(226,76,74,0.2); }
.alert-info    { background: rgba(56,107,183,0.1); color: #5A8FD4; border-color: rgba(56,107,183,0.2); }
.alert-warning { background: rgba(243,156,18,0.1); color: #F39C12; border-color: rgba(243,156,18,0.2); }
.flash-warning { background: rgba(243,156,18,0.1); color: #F39C12; border-color: rgba(243,156,18,0.2); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 12px; font-weight: 500; }

/* ================= TABS ================= */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
}
.tab {
    padding: 10px 18px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tab:hover { color: var(--primary); text-decoration: none; }
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ================= PAGINATION ================= */
.pagination {
    display: flex;
    list-style: none;
    gap: 6px;
    margin-top: 20px;
    justify-content: center;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    transition: all var(--transition);
    background: var(--bg-card);
}

.page-item .page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.page-item.active .page-link {
    background: var(--gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(226,76,74,0.3);
}

/* ================= TICKET MESSAGES ================= */
.ticket-messages {
    max-height: 450px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 8px;
}

.message {
    padding: 14px 18px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    max-width: 82%;
    line-height: 1.5;
    font-size: 13px;
    animation: fadeIn 0.3s ease;
}

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

.message-user {
    background: rgba(56,107,183,0.12);
    margin-right: auto;
    border-bottom-left-radius: 5px;
    border: 1px solid rgba(56,107,183,0.15);
}

.message-admin {
    background: rgba(226,76,74,0.12);
    margin-left: auto;
    border-bottom-right-radius: 5px;
    border: 1px solid rgba(226,76,74,0.15);
}

.message-meta {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 8px;
    font-weight: 500;
}

/* ================= PROFILE ================= */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 28px;
    background: var(--bg-card);
    padding: 24px 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(226,76,74,0.3);
}

/* ================= THEME TOGGLE ================= */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    width: 100%;
    text-align: center;
    font-family: inherit;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.theme-toggle:hover {
    color: var(--text);
    background: var(--bg-secondary);
}
.theme-toggle .icon { font-size: 14px; }

/* ================= EMPTY STATE ================= */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* ================= FILE HELPERS ================= */
small { font-size: 11px; color: var(--text-tertiary); }
small a { color: var(--primary); font-weight: 500; }

/* ================= ANNOUNCEMENTS ================= */
.announcement {
    padding: 18px 20px 14px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    transition: all var(--transition);
}
.announcement:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.announcement-critical {
    border-left-color: var(--primary);
    background: rgba(226,76,74,0.05);
}
.announcement-important {
    border-left-color: #F39C12;
    background: rgba(243,156,18,0.05);
}
.announcement-normal {
    border-left-color: #2ECC71;
    background: rgba(46,204,113,0.05);
}

.announcement .actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.announcement .priority-badge {
    font-size: 9px;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 700;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.announcement-critical .priority-badge { background: var(--primary); color: #fff; }
.announcement-important .priority-badge { background: #F39C12; color: #fff; }
.announcement-normal .priority-badge { background: #2ECC71; color: #fff; }

/* ================= RESPONSIVE ================= */

/* Mobile header — hidden on desktop */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(40,40,40,0.95);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 200;
}
.hamburger {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 8px 10px;
    color: var(--text);
    border-radius: 8px;
    transition: background 0.2s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hamburger:hover { background: var(--bg-secondary); }
.mobile-logo { height: 28px; width: auto; }
.mobile-notif { position: relative; font-size: 20px; padding: 6px; text-decoration: none; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.mobile-notif .badge { position: absolute; top: 2px; right: 0; }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.show { display: block; opacity: 1; }

/* ---------- Tablet (≤1024px) ---------- */
@media (max-width: 1024px) {
    .main-content { padding: 24px 28px; }
    .card-body { padding: 18px 20px; }
    .form-card { padding: 22px 24px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
    .page-header h1 { font-size: 24px; }
}

/* ---------- Mobile (≤768px) ---------- */
@media (max-width: 768px) {
    .mobile-header { display: flex; }
    body { padding-top: 52px; }

    .layout { min-height: calc(100vh - 52px); }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
        width: 280px;
        box-shadow: 4px 0 40px rgba(0,0,0,0.3);
        -webkit-overflow-scrolling: touch;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-nav a { padding: 12px 14px; min-height: 44px; font-size: 14px; }

    .main-content { margin-left: 0; padding: 16px; min-height: 0; }
    .footer { margin-left: 0; padding: 12px 16px; }

    .page-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .page-header h1 { font-size: 22px; }
    .page-header .btn { width: 100%; justify-content: center; }

    .card-body { padding: 16px; }
    .form-card { padding: 18px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px 16px; }
    .stat-card .stat-value { font-size: 22px; }

    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
    table { font-size: 12px; min-width: 600px; }
    table th, table td { padding: 8px 10px; white-space: nowrap; }
    table .actions { flex-direction: column; gap: 4px; }
    table .actions a { font-size: 11px; padding: 6px 8px; text-align: center; min-height: 32px; }

    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-control { font-size: 16px; padding: 12px 14px; }

    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; gap: 0; }
    .tab { padding: 10px 14px; font-size: 11px; flex-shrink: 0; }

    .message { max-width: 95%; font-size: 13px; padding: 12px 14px; }
    .ticket-messages { max-height: 350px; }

    .login-container { padding: 12px; }
    .login-card { padding: 28px 24px; border-radius: 20px; }

    .btn { padding: 12px 18px; font-size: 13px; min-height: 44px; }
    .btn-sm { padding: 7px 12px; font-size: 11px; min-height: 36px; }

    .profile-header { flex-direction: column; text-align: center; gap: 14px; padding: 20px; }
    .profile-avatar { width: 60px; height: 60px; font-size: 22px; }

    .pagination { flex-wrap: wrap; gap: 4px; }
    .page-item .page-link { min-width: 36px; height: 36px; font-size: 12px; }

    .announcement { padding: 14px 16px 12px; }
    .announcement .actions .btn { flex: 1; min-width: 0; }

    .form-card h3 { font-size: 14px; }

    .card-title { font-size: 14px; }

    .stats-grid + .card { margin-top: 0; }

    .empty-state { padding: 32px 16px; }

    select.form-control { font-size: 16px; }

    .page-header div:first-child { display: flex; flex-wrap: wrap; gap: 6px; }
    .page-header div:first-child .btn { flex: 1; min-width: 0; white-space: nowrap; font-size: 11px; padding: 8px 10px; }

    .form-group label { font-size: 13px; }
    textarea.form-control { font-size: 16px; }

    .sidebar-footer a { min-height: 36px; line-height: 36px; }
}

/* ---------- Phone (≤480px) ---------- */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; gap: 8px; }
    .main-content { padding: 12px; }
    .card-body { padding: 12px; }
    .form-card { padding: 14px; }
    .sidebar { width: 260px; }

    .page-header { gap: 8px; }
    .page-header h1 { font-size: 20px; }

    table { font-size: 11px; min-width: 500px; }
    table th, table td { padding: 5px 7px; }

    .stat-card { padding: 12px 14px; }
    .stat-card .stat-value { font-size: 20px; }
    .stat-card .stat-label { font-size: 11px; }

    .profile-header { padding: 16px; gap: 10px; }
    .profile-avatar { width: 52px; height: 52px; font-size: 20px; }

    .login-card { padding: 24px 16px; }
    .login-card h1 { font-size: 22px; }

    .btn { padding: 10px 14px; font-size: 12px; }
    .btn-sm { padding: 6px 10px; font-size: 10px; min-height: 32px; }

    .form-card { padding: 12px; }
    .form-card h3 { font-size: 13px; }

    .page-header { gap: 6px; }

    .announcement { padding: 12px 14px; }

    .pagination { gap: 3px; }
    .page-item .page-link { min-width: 32px; height: 32px; font-size: 11px; }

    .message { max-width: 100%; font-size: 12px; padding: 10px 12px; }
    .ticket-messages { max-height: 280px; padding: 4px; }

    .stats-grid { gap: 8px; }
    .stat-card .stat-value { font-size: 18px; }
}

/* ---------- Quill alignment (rendered outside .ql-editor) ---------- */
.ql-align-center { text-align: center; }
.ql-align-right { text-align: right; }
.ql-align-justify { text-align: justify; }
.ql-align-left { text-align: left; }

/* ---------- Print ---------- */
@media print {
    .sidebar, .footer, .btn, .mobile-header, .sidebar-overlay { display: none; }
    .main-content { margin-left: 0; padding: 0; }
    body { padding-top: 0; }
    .card { box-shadow: none; border: 1px solid rgba(255,255,255,0.1); break-inside: avoid; }
}
