:root {
    --primary: #7D1515;
    --primary-dark: #6B1212;
    --primary-light: #9A2020;
    --gray: #707070;
    --gray-light: #E8E4E4;
    --dark: #222222;
    --bg-light: #F8F6F6;
    --white: #FFFFFF;
    --shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 6px 30px rgba(125, 21, 21, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --header-height: 60px;
    --sidebar-width: 260px;
    --bottom-nav-height: 60px;
}

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

body {
    margin: 0 0 0 var(--sidebar-w);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', sans-serif;
    color: var(--dark);
    min-height: 100vh;
    font-size: 16px;
    overflow: hidden;
}

/* ========== LOGIN ========== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.login-card {
    background: var(--white);
    border: 1px solid #eee8e8;
    border-radius: 18px;
    box-shadow: 0 18px 55px rgba(45, 22, 22, 0.09);
    padding: 38px 34px 34px;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.login-header .logo {
    width: 40px;
    height: 40px;
}

.login-header h1 {
    font-size: 26px;
    color: var(--primary);
    font-weight: 700;
}

.login-page {
    position: relative;
    padding: 28px 16px;
    background:
        radial-gradient(ellipse at 12% 15%, rgba(125, 21, 21, 0.07), transparent 35%),
        radial-gradient(ellipse at 88% 84%, rgba(125, 21, 21, 0.055), transparent 32%),
        #f8f6f6;
}

.login-container {
    position: relative;
    z-index: 1;
    transform: translateY(-28px);
}

.login-header .logo {
    border-radius: 10px;
}

.login-header h1 {
    letter-spacing: -0.45px;
}

.login-footer {
    padding-top: 17px;
    border-top: 1px solid #f0ebeb;
}

.login-page .login-card {
    border: 2px solid #8f2929;
    border-top-width: 4px;
}

.login-header p {
    color: var(--gray);
    font-size: 16px;
    margin-top: 6px;
}

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

.form-group label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.2s ease;
    outline: none;
    background: var(--white);
    color: var(--dark);
}

.form-group input::placeholder {
    color: #b0b0b0;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.form-group input.error {
    border-color: #dc2626;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
}

.btn-submit:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-hover);
}

.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.forgot-link {
    color: var(--gray);
    font-size: 15px;
    text-decoration: none;
    transition: color 0.15s ease;
}

.forgot-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.alert-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-success {
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.alert-success strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.input-error {
    font-size: 13px;
    color: #dc2626;
    margin-top: 4px;
    display: none;
}

.input-error.visible {
    display: block;
}

/* ========== HEADER ========== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 32px;
    height: 32px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    font-size: 15px;
    color: var(--gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.header-logout {
    font-size: 15px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.header-logout:hover {
    background: var(--primary);
    color: var(--white);
}

/* ========== LAYOUT ========== */

.layout {
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* ========== COLLAPSIBLE SIDEBAR ========== */

:root {
    --sidebar-collapsed: 64px;
}

.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    width: var(--sidebar-collapsed);
    background: var(--white);
    border-right: 1px solid var(--gray-light);
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: width 0.25s ease;
    overflow: hidden;
}

.sidebar:hover {
    width: var(--sidebar-width);
    z-index: 100;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    margin: 2px 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--dark);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item .nav-icon {
    flex-shrink: 0;
    width: 44px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: var(--radius);
    transition: background 0.15s ease;
}

.nav-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.nav-item .nav-text {
    opacity: 0;
    transition: opacity 0.15s ease;
    font-size: 15px;
}

.sidebar:hover .nav-text {
    opacity: 1;
}

.nav-item:hover .nav-icon {
    background: rgba(125, 21, 21, 0.06);
}

.nav-item:hover {
    background: transparent;
    color: var(--primary);
}

.nav-item.active .nav-icon {
    background: rgba(125, 21, 21, 0.08);
    color: var(--primary);
}

.nav-item.active {
    color: var(--primary);
    font-weight: 600;
}

.sidebar-divider {
    height: 1px;
    background: var(--gray-light);
    margin: 8px 14px;
}

/* ========== ORG SWITCHER ========== */

.org-switcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    min-height: 40px;
}

.org-current {
    display: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.sidebar:hover .org-current {
    display: block;
}

.btn-org-switch {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: var(--gray);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-org-switch:hover {
    background: rgba(125, 21, 21, 0.06);
    color: var(--primary);
}

.sidebar:hover .btn-org-switch {
    width: 28px;
    height: 28px;
    font-size: 13px;
    border: 1.5px solid var(--gray-light);
}

.org-dropdown {
    display: none;
    position: absolute;
    left: 14px;
    right: 14px;
    top: 100%;
    margin-top: 4px;
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 60;
}

.org-dropdown.open {
    display: block;
}

.org-option {
    display: block;
    padding: 12px 16px;
    font-size: 15px;
    color: var(--dark);
    text-decoration: none;
    transition: background 0.1s ease;
    border-bottom: 1px solid var(--gray-light);
}

.org-option:last-child {
    border-bottom: none;
}

.org-option:hover {
    background: var(--bg-light);
}

.org-option.active {
    color: var(--primary);
    font-weight: 600;
    background: rgba(125, 21, 21, 0.04);
}

/* ========== CONTENT ========== */

.content {
    margin-left: var(--sidebar-collapsed);
    flex: 1;
    padding: 24px 28px;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    overflow-x: hidden;
}

/* ========== CARDS ========== */

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 18px 26px;
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 22px 26px;
}

/* ========== BADGE ========== */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--primary);
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    border-radius: 12px;
}

/* ========== PROFILE GRID ========== */

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-value {
    font-size: 18px;
    color: var(--dark);
    font-weight: 500;
}

.profile-value.debt {
    color: var(--primary);
    font-weight: 700;
}

/* ========== TABLE ========== */

.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.table thead {
    background: var(--bg-light);
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-light);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-light);
    color: var(--dark);
}

.table tbody tr:hover {
    background: rgba(125, 21, 21, 0.02);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .price {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.table .center {
    text-align: center;
}

/* ========== EMPTY STATE ========== */

.empty-state {
    text-align: center;
    padding: 40px 0;
    color: var(--gray);
    font-size: 16px;
}

/* ========== PHONE INLINE EDIT ========== */

.profile-value-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.phone-input {
    padding: 8px 12px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 16px;
    outline: none;
    width: 220px;
    transition: border-color 0.2s ease;
}

.phone-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    background: var(--white);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
    color: var(--gray);
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-save {
    color: #16a34a;
    border-color: #16a34a;
}

.btn-save:hover {
    background: #16a34a;
    color: var(--white);
}

.btn-cancel {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-cancel:hover {
    background: #dc2626;
    color: var(--white);
}

/* ========== PROFILE PHONE LIST ========== */

.profile-phones {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.profile-phone-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 420px;
}

.profile-phone-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 15px;
}

.profile-phone-number {
    flex: 1;
    font-weight: 600;
    color: var(--dark);
}

.profile-phone-empty {
    text-align: center;
    padding: 16px 0;
    color: var(--gray);
    font-size: 14px;
}

.phone-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
}


.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-hover);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

/* ========== TOGGLE SWITCH ========== */

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--dark);
}

.toggle-hint {
    font-size: 14px;
    color: var(--gray);
    margin-top: 6px;
    line-height: 1.4;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 26px;
    transition: 0.25s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: 0.25s;
}

.toggle input:checked+.toggle-slider {
    background: var(--primary);
}

.toggle input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* ========== HINT TEXT ========== */

.hint-text {
    font-size: 13px;
    color: var(--gray);
    margin-top: -8px;
    margin-bottom: 16px;
    line-height: 1.4;
}

/* ========== EMPLOYEES ========== */

.employee-table {
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.employee-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-light);
    background: var(--white);
}

.employee-row:last-child {
    border-bottom: none;
}

.employee-info {
    flex: 1;
    min-width: 0;
}

.employee-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2px;
}

.employee-contact {
    font-size: 13px;
    color: var(--gray);
}

.employee-contact span+span::before {
    content: ' · ';
}

.employee-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: 16px;
}

.employee-toggle-label {
    font-size: 13px;
    color: var(--gray);
    white-space: nowrap;
}

/* ========== TOAST ========== */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--white);
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #16a34a;
}

.toast-error {
    background: #dc2626;
}

/* ========== ACTION CARD ========== */

.action-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.action-divider {
    height: 1px;
    background: var(--gray-light);
    margin: 0;
}

/* ========== PASSWORD CHANGE ========== */

.password-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.password-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease;
    background: var(--white);
    color: var(--dark);
}

.password-input::placeholder {
    color: #b0b0b0;
}

.password-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

/* ========== TICKETS 3-COL LAYOUT ========== */

.tickets-layout {
    display: flex;
    gap: 0;
    align-items: flex-start;
    height: calc(100vh - var(--header-height) - 48px);
}

/* === LEFT COL: FILTERS === */

.tickets-filters-col {
    width: 180px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-right: 16px;
}

.filter-tabs-vertical {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-tab-v {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--dark);
    background: transparent;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.filter-tab-v:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.filter-tab-v.active {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
}

.filter-actions-v {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.btn-action-v {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.btn-action-v:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.btn-action-v:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-action-v-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-action-v-outline:hover {
    background: var(--bg-light);
    color: var(--primary);
}

/* === CENTER COL: LIST === */

.tickets-list-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.search-bar-c {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid rgba(125, 21, 21, 0.07);
    padding: 16px 18px 18px;
    margin-bottom: 12px;
}

.search-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.search-field,
.filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.search-field {
    flex: 1;
}

.search-label {
    color: var(--gray);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.035em;
}

.search-field .search-label {
    color: var(--dark);
    font-size: 13px;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.search-input-c {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
    background: var(--white);
    color: var(--dark);
}

.search-input-c:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.search-select-c {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    background: var(--white);
    color: var(--dark);
    cursor: pointer;
    min-width: 100px;
}

.search-select-c:focus {
    border-color: var(--primary);
}

.ticket-saved-views {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0 2px;
}

.ticket-saved-views .filter-field {
    min-width: 220px;
    flex: 1 1 260px;
}

.ticket-filter-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 13px;
    padding-top: 11px;
    border-top: 1px solid var(--gray-light);
}

.ticket-filter-summary-text {
    min-width: 0;
    color: var(--gray);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.ticket-clear-filters {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid rgba(125, 21, 21, 0.22);
    border-radius: 999px;
    background: rgba(125, 21, 21, 0.045);
    color: var(--primary);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ticket-clear-filters:hover:not(:disabled) {
    background: rgba(125, 21, 21, 0.1);
    border-color: var(--primary);
}

.ticket-clear-filters:disabled {
    opacity: 0.55;
    cursor: default;
}

.tickets-count {
    font-size: 15px;
    color: var(--gray);
    margin-bottom: 8px;
    padding: 0 4px;
}

.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.ticket-empty-state {
    display: flex;
    min-height: 210px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px;
    border: 1px dashed rgba(125, 21, 21, 0.22);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, var(--white), #fbf8f8);
    color: var(--dark);
    text-align: center;
}

.ticket-empty-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    margin-bottom: 12px;
    border-radius: 50%;
    background: rgba(125, 21, 21, 0.08);
    color: var(--primary);
    font-size: 24px;
}

.ticket-empty-state strong {
    font-size: 16px;
}

.ticket-empty-state p {
    max-width: 320px;
    margin-top: 5px;
    color: var(--gray);
    font-size: 14px;
    line-height: 1.5;
}

.ticket-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.ticket-item:hover {
    box-shadow: var(--shadow-hover);
    border-left-color: var(--primary);
}

.ticket-item:focus-visible {
    outline: 3px solid rgba(125, 21, 21, 0.35);
    outline-offset: 2px;
}

.ticket-item.ticket-active {
    border-left-color: var(--primary);
    background: rgba(125, 21, 21, 0.04);
    box-shadow: var(--shadow-hover);
}

.ticket-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}

.ticket-title mark {
    background: rgba(125, 21, 21, 0.12);
    color: var(--primary);
    padding: 0 2px;
    border-radius: 2px;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.ticket-header-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.ticket-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
    margin-left: 12px;
}

.ticket-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    margin-top: 1px;
}

.ticket-status {
    padding: 3px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    text-align: center;
}

.status-0 {
    background: #F5F0F0;
    color: #7D1515;
}

.status-1 {
    background: #EDE8E8;
    color: #5A5A5A;
}

.status-2 {
    background: #F0EDED;
    color: #7D1515;
}

.status-3 {
    background: #F5E8E8;
    color: #8B3C3C;
}

.status-4 {
    background: #F0EBEB;
    color: #7D1515;
}

.status-5 {
    background: #EDE8E8;
    color: #5A5A5A;
}

.status-6 {
    background: #F0EDED;
    color: #444444;
}

.status-7 {
    background: #F0EBEB;
    color: #7D1515;
}

.status-8 {
    background: #EDE8E8;
    color: #5A5A5A;
}

.status-9 {
    background: #F5F0F0;
    color: #6B1212;
}

.ticket-date {
    color: var(--gray);
}

.ticket-preview {
    font-size: 14px;
    color: var(--gray);
    line-height: 1.4;
}

.ticket-preview mark {
    background: rgba(125, 21, 21, 0.12);
    color: var(--primary);
    padding: 0 2px;
    border-radius: 2px;
}

.ticket-match {
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
    margin-top: 4px;
    padding: 3px 10px;
    background: rgba(125, 21, 21, 0.04);
    border-radius: 4px;
}

.ticket-imp {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 4px;
}

.ticket-imp.imp-Высокая {
    background: #F5E8E8;
    color: #8B3C3C;
}

.ticket-imp.imp-Средняя {
    background: #EDE8E8;
    color: #5A5A5A;
}

.ticket-imp.imp-Низкая {
    background: #F0EDED;
    color: #7D1515;
}

/* === RESIZE HANDLE === */

.resize-handle {
    display: none;
    width: 6px;
    flex-shrink: 0;
    cursor: col-resize;
    position: relative;
    background: transparent;
    z-index: 10;
    margin: 0 5px;
    align-self: stretch;
}

.resize-handle::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: calc(100% - 16px);
    background: var(--gray-light);
    border-radius: 2px;
    transition: background 0.15s ease;
}

.resize-handle:hover::after,
.resize-handle.active::after {
    background: var(--primary);
}

.resize-handle.active {
    background: rgba(125, 21, 21, 0.04);
}

/* === DETAILS BACK BUTTON (shown on narrow screens) === */

.details-back-btn {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 8px;
    flex-shrink: 0;
    white-space: nowrap;
    font-family: inherit;
}

.details-back-btn:hover {
    background: rgba(125, 21, 21, 0.06);
}

/* === RESPONSIVE: screens < 1100px === */

@media (max-width: 1099px) {

    .tickets-layout {
        flex-direction: column;
    }

    .tickets-layout.ticket-details-open .tickets-list-col {
        display: none !important;
    }

    .tickets-filters-col {
        width: 100% !important;
        margin-right: 0;
        flex-shrink: 0;
    }

    .filter-tabs-vertical {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .filter-tab-v {
        flex: 1 1 0px;
        text-align: center;
        padding: 10px 12px;
        font-size: 14px;
        min-width: 0;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .filter-actions-v {
        flex-direction: row;
    }

    .btn-action-v {
        flex: 1 1 0px;
        padding: 10px 12px;
        font-size: 15px;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .ticket-details-col {
        position: fixed !important;
        top: calc(var(--header-height) + 12px);
        left: calc(var(--sidebar-collapsed) + 12px);
        right: 12px;
        bottom: 12px;
        width: auto !important;
        flex: none !important;
        z-index: 80;
        display: none;
        max-height: none;
        overflow-y: auto;
        background: var(--white);
        border: 1px solid rgba(125, 21, 21, 0.12);
        border-radius: var(--radius-lg);
        box-shadow: 0 12px 36px rgba(34, 34, 34, 0.2);
    }

    .ticket-details-col.details-visible {
        display: block !important;
    }

    .tickets-list-col {
        width: 100% !important;
        flex: 1 !important;
        height: auto !important;
        min-height: 0;
        order: -1 !important;
    }

    .resize-handle {
        display: none !important;
    }

    .details-back-btn {
        display: inline-flex !important;
    }
}

@media (max-width: 599px) {

    .header-user {
        display: none;
    }

    .btn-action-v {
        padding: 9px 11px;
        font-size: clamp(13px, calc(6.78px + 1.37vw), 15px);
    }

    .filter-tab-v {
        padding: 8px 10px;
        font-size: clamp(12px, calc(5.78px + 1.37vw), 14px);
    }

    .search-bar-c {
        padding: 14px;
    }

    .filter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 8px;
    }

    .search-select-c {
        font-size: 14px;
        padding: 10px;
    }

    .ticket-details-col {
        top: calc(var(--header-height) + 8px);
        left: calc(var(--sidebar-collapsed) + 8px);
        right: 8px;
        bottom: 8px;
        border-radius: 12px;
    }

    .ticket-details-col .d-header {
        position: sticky;
        top: 0;
        z-index: 2;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
    }

    .ticket-details-col .d-header>span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .create-ticket-page>.card>.card-body {
        padding: 18px;
    }
}

@media (max-width: 454px) {

    .btn-action-v {
        padding: 8px 10px;
    }

    .filter-tab-v {
        padding: 7px 8px;
    }

    .filter-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .create-ticket-page>.card>.card-header {
        padding: 16px 18px;
        font-size: 18px;
    }

    .create-ticket-page>.card>.card-body {
        padding: 14px;
    }

    .create-ticket-page .create-ticket-actions {
        flex-direction: column;
    }

    .create-ticket-page .create-ticket-actions .btn-action-v {
        width: 100%;
        flex: none !important;
    }
}

/* === RIGHT COL: DETAILS === */

.ticket-details-col {
    width: 400px;
    flex-shrink: 0;
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height) - 48px);
}

.details-placeholder {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px 20px;
    text-align: center;
    color: var(--gray);
}

.details-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 10px;
}

.details-placeholder p {
    font-size: 16px;
}

.details-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.d-header {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    border-bottom: 1px solid var(--gray-light);
    background: var(--bg-light);
}

.d-block {
    padding: 8px 16px;
    border-bottom: 1px solid var(--gray-light);
}

.d-block:last-child {
    border-bottom: none;
}

.d-block-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.d-field {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 6px;
}

.d-field:last-child {
    margin-bottom: 0;
}

.d-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.d-value {
    font-size: 15px;
    color: var(--dark);
    word-break: break-word;
}

.d-scroll {
    max-height: 300px;
    overflow-y: auto;
    font-size: 15px;
    color: var(--dark);
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 6px 10px;
    border: 1px solid var(--gray-light);
}

/* ========== ACTION BUTTONS IN DETAILS ========== */

.d-actions {
    border-top: 1px solid var(--gray-light);
    background: var(--bg-light);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.d-actions .action-buttons {
    padding: 2px;
}

.btn-action-sm {
    padding: 4px 8px;
    font-size: 15px;
    font-weight: 600;
    background: var(--white);
    color: var(--dark);
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-action-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.btn-action-sm-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-action-sm-primary:hover {
    background: var(--primary-light);
    color: var(--white);
    border-color: var(--primary-light);
}

.btn-action-sm-warn {
    background: #d97706;
    color: var(--white);
    border-color: #d97706;
}

.btn-action-sm-warn:hover {
    background: #b45309;
    color: var(--white);
    border-color: #b45309;
}



/* ========== MODAL ========== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
}

.modal-overlay.open {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 520px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    flex-direction: column;
    overflow: hidden;
}

.modal-wide {
    width: 700px;
}

.modal-full {
    width: calc(100vw - 80px);
    height: calc(100vh - 80px);
}

.modal.open {
    display: flex;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-light);
    background: var(--bg-light);
}

.modal-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--dark);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 22px;
    color: var(--gray);
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: rgba(125, 21, 21, 0.06);
    color: var(--primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray);
    margin-bottom: 8px;
}

.modal-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease;
    line-height: 1.5;
}

.modal-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.modal-textarea-lg {
    min-height: 200px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* ========== CHAT ========== */

#chatModal .modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.chat-scroll-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    padding: 20px 20px 0;
}

.chat-scroll-btn {
    display: none;
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border: 1px solid var(--gray-light);
    border-radius: 50%;
    background: var(--white);
    box-shadow: var(--shadow);
    font-size: 18px;
    cursor: pointer;
    z-index: 5;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    color: var(--gray);
}

.chat-scroll-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.chat-empty {
    text-align: center;
    color: var(--gray);
    font-size: 15px;
    padding: 30px 0;
}

.chat-loading-state {
    color: var(--gray);
}

.chat-load-error,
.chat-refresh-error {
    color: #8f1d18;
    background: #fff5f4;
    border: 1px solid rgba(143, 29, 24, 0.2);
    border-radius: var(--radius);
    padding: 12px 14px;
    text-align: center;
}

.chat-retry-btn {
    margin-left: 8px;
    color: var(--primary);
    background: transparent;
    border: 0;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.chat-input-help,
.chat-action-feedback {
    color: var(--gray);
    font-size: 12px;
    padding: 0 20px 8px;
}

.chat-action-feedback:empty {
    display: none;
}

.chat-action-feedback[role="status"] {
    color: var(--primary);
}

.chat-msg {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 10px 14px;
    max-width: 85%;
    align-self: flex-start;
}

.chat-msg-mine {
    background: rgba(125, 21, 21, 0.06);
    align-self: flex-end;
}

.chat-msg-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}


.chat-msg-text {
    font-size: 15px;
    color: var(--dark);
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.chat-msg-date {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 12px 20px 20px;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    resize: none;
    transition: border-color 0.2s ease;
    line-height: 1.4;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.btn-chat-file {
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    background: var(--white);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.btn-chat-file:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-chat-send {
    padding: 10px 20px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-chat-send:hover {
    background: var(--primary-light);
}

.btn-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== LIFECYCLE ========== */

.lifecycle-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lc-loading {
    text-align: center;
    color: var(--gray);
    font-size: 14px;
    padding: 20px 0;
}

.lc-event {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 12px 16px;
    border-left: 3px solid var(--primary);
}

.lc-event-date {
    font-size: 13px;
    color: var(--gray);
    font-weight: 600;
    margin-bottom: 4px;
}

.lc-event-type {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.lc-event-detail {
    font-size: 14px;
    color: var(--dark);
    line-height: 1.4;
}

.lc-event-author {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
    margin-top: 4px;
}

.lc-event-label {
    font-size: 13px;
    color: var(--dark);
    margin-bottom: 3px;
    line-height: 1.4;
}

.lc-event-value {
    color: var(--dark);
    font-weight: 500;
}

.lc-event-chat {
    border-left-color: #9A2020;
    background: #fffafa;
}

.lc-event-created {
    border-left-color: #777;
}

.lc-event-description {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.lc-event-meta {
    color: var(--gray);
    font-size: 12px;
    margin-top: 6px;
}

/* ========== CLASSIFY PREDICTIONS ON CHIPS ========== */

.classify-label {
    font-size: 12px;
    font-weight: 400;
    color: var(--gray);
}

.t-chip.pred-high {
    background: rgba(125, 21, 21, 0.08);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
    position: relative;
}

.t-chip.pred-high::after {
    content: attr(data-conf);
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.8;
}

.t-chip.pred-med {
    background: rgba(125, 21, 21, 0.04);
    border-color: var(--primary);
    color: var(--primary);
    position: relative;
}

.t-chip.pred-med::after {
    content: attr(data-conf);
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.6;
}

.t-chip.pred-low {
    border-color: var(--gray-light);
    color: var(--gray);
    position: relative;
}

.t-chip.pred-low::after {
    content: attr(data-conf);
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.5;
}

/* ========== STATUS MODAL ========== */

#statusActions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#statusActions .btn-action-v {
    width: 100%;
}

.rating-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-rating {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    background: var(--white);
    color: var(--dark);
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-rating:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.btn-rating[data-rating="Хорошо"]:hover {
    border-color: #16a34a;
    color: #16a34a;
}

.btn-rating[data-rating="Удовлетворительно"]:hover {
    border-color: #f59e0b;
    color: #f59e0b;
}

.btn-rating[data-rating="Плохо"]:hover {
    border-color: #dc2626;
    color: #dc2626;
}

.btn-rating-skip {
    background: var(--bg-light);
    color: var(--gray);
}

.btn-rating-skip:hover {
    border-color: var(--gray);
    color: var(--dark);
}

/* ========== NOTIFICATIONS ========== */

.notif-bell-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.notif-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.notif-bell:hover {
    background: rgba(125, 21, 21, 0.06);
}

.notif-bell-flash .notif-bell {
    animation: bellFlash 1s ease-in-out infinite;
}

@keyframes bellFlash {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(125, 21, 21, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(125, 21, 21, 0);
    }
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #dc2626;
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

.notif-dropdown {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    height: 380px;
    background: var(--white);
    border: none;
    border-bottom: 1px solid var(--gray-light);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    overflow-y: auto;
    margin-top: 0;
}

.notif-dropdown.open {
    display: block;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-light);
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    background: var(--bg-light);
    position: sticky;
    top: 0;
}

.notif-header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.notif-markall {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background 0.1s ease;
}

.notif-markall:hover {
    background: rgba(125, 21, 21, 0.06);
}

.notif-clear {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background 0.1s ease;
}

.notif-clear:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--dark);
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-light);
    cursor: pointer;
    transition: background 0.1s ease;
    align-items: flex-start;
}

.notif-item-del {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--gray);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.1s ease;
    margin-top: 4px;
}

.notif-item:hover .notif-item-del {
    opacity: 0.6;
}

.notif-item-del:hover {
    opacity: 1 !important;
    background: rgba(0, 0, 0, 0.06);
    color: #dc2626;
}

.notif-footer {
    padding: 10px 16px;
    text-align: center;
    border-top: 1px solid var(--gray-light);
}

.notif-center-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary, #7D1515);
    font-size: 12px;
    font-weight: 600;
    padding: 8px 10px;
    text-decoration: none;
    border-top: 1px solid var(--border, #eadede);
}

.notif-center-link:hover {
    text-decoration: underline;
}

.notif-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--gray);
    font-size: 14px;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: rgba(125, 21, 21, 0.03);
}

.notif-unread {
    background: rgba(125, 21, 21, 0.04);
    border-left: 3px solid var(--primary);
}

.notif-item-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--bg-light);
    border-radius: 50%;
}

.notif-unread .notif-item-icon {
    background: rgba(125, 21, 21, 0.08);
}

.notif-item-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-text {
    font-size: 14px;
    color: var(--dark);
    line-height: 1.4;
    word-break: break-word;
}

.notif-unread .notif-item-text {
    font-weight: 600;
}

.notif-item-date {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

/* ========== CONFIRM TICKETS ========== */

.confirm-page {
    max-width: 100%;
}

.confirm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 22px 26px;
    border: 1px solid rgba(125, 21, 21, 0.08);
    border-radius: 18px;
    background: linear-gradient(112deg, #fff 0%, #fff 66%, #fbf3f2 100%);
    box-shadow: 0 8px 26px rgba(45, 22, 22, 0.045);
}

.confirm-title {
    font-size: clamp(25px, 2.2vw, 32px);
    font-weight: 750;
    color: var(--dark);
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.65px;
}

.confirm-count {
    background: var(--primary);
    color: var(--white);
    font-size: 13px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}

.confirm-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.confirm-empty {
    text-align: center;
    color: var(--gray);
    font-size: 16px;
    padding: 40px 0;
}

.confirm-card {
    background: var(--white);
    border: 1px solid #eee8e8;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(45, 22, 22, 0.045);
    overflow: hidden;
}

.confirm-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-light);
    background: var(--bg-light);
}

.confirm-card-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--dark);
    flex: 1;
}

.confirm-card-org {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366F1;
    margin-right: 8px;
    white-space: nowrap;
}

.confirm-card-imp {
    font-size: 13px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.confirm-card-imp.imp-high {
    background: rgba(220, 38, 38, 0.1);
    color: #DC2626;
}

.confirm-card-imp.imp-mid {
    background: rgba(217, 119, 6, 0.1);
    color: #D97706;
}

.confirm-card-imp.imp-low {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
}

.confirm-card-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.confirm-card-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.confirm-card-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.confirm-card-value {
    font-size: 15px;
    color: var(--dark);
    line-height: 1.5;
}

.confirm-card-content {
    background: var(--bg-light);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.confirm-card-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-light);
}

.confirm-comment-wrap {
    margin-bottom: 12px;
}

.confirm-comment-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    margin-bottom: 6px;
}

.confirm-comment {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease;
    line-height: 1.5;
    box-sizing: border-box;
}

.confirm-comment:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.confirm-btn-row {
    display: flex;
    gap: 10px;
}

.btn-action-v-danger {
    color: #DC2626 !important;
    border-color: #DC2626 !important;
}

.btn-action-v-danger:hover {
    background: #DC2626 !important;
    color: var(--white) !important;
}

.loading-state {
    text-align: center;
    color: var(--gray);
    padding: 40px 0;
    font-size: 14px;
}

/* ========== CREATE TICKET MODAL ========== */

.create-ticket-page>.card {
    margin: 0 auto 24px;
    border: 1px solid rgba(125, 21, 21, 0.1);
    border-radius: 16px;
    box-shadow: 0 7px 24px rgba(45, 22, 22, 0.05);
}

.create-ticket-page>.card>.card-header {
    border-left: 0;
    background: #fff;
    font-size: 17px;
}

.create-ticket-heading {
    margin: 0 auto 18px;
    padding: 22px 26px;
    border: 1px solid rgba(125, 21, 21, 0.08);
    border-radius: 18px;
    background: linear-gradient(112deg, #fff 0%, #fff 66%, #fbf3f2 100%);
    box-shadow: 0 8px 26px rgba(45, 22, 22, 0.045);
}

.create-ticket-heading h1,
.profile-page-header h1,
.help-page-header h1 {
    color: var(--dark);
    font-size: clamp(25px, 2.2vw, 32px);
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.65px;
}

.create-ticket-heading>div>p:last-child,
.profile-page-header>div>p:last-child {
    margin: 6px 0 0;
    color: #747070;
    font-size: 14px;
    line-height: 1.5;
}

.guide-suggestion-panel {
    margin: 0 auto 16px;
    padding: 14px 18px;
    border: 1px solid rgba(125, 21, 21, 0.14);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    background: #fffdfd;
}

.guide-suggestion-panel[hidden] {
    display: none;
}

.guide-suggestion-panel h2 {
    margin: 0 0 8px;
    color: var(--dark);
    font-size: 14px;
}

.guide-suggestion-list,
.assistant-guide-suggestions>div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.guide-suggestion-list a,
.assistant-guide-suggestions a {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
}

.guide-suggestion-list a:hover,
.assistant-guide-suggestions a:hover {
    text-decoration: underline;
}

.create-ticket-page>.card>.card-header {
    padding: 20px 26px;
    border-bottom-color: rgba(125, 21, 21, 0.12);
    border-left: 4px solid var(--primary);
    background: linear-gradient(110deg, #fbf7f7, var(--white) 72%);
    font-size: 20px;
}

.create-ticket-page>.card>.card-body {
    padding: 26px;
}

.create-ticket-page .form-group {
    margin-bottom: 22px;
}

.create-ticket-page .form-group>label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.create-ticket-page .modal-textarea,
.create-ticket-page .search-select-c {
    border-color: #ddd5d5;
    background-color: var(--white);
}

.create-ticket-page input.modal-textarea {
    min-height: 46px;
    resize: none;
}

.create-ticket-page .editor-wrapper {
    border-color: #ddd5d5;
    background: var(--white);
}

.create-ticket-page .editor-content {
    min-height: 220px;
    padding: 15px 16px;
    font-size: 15px;
}

.create-ticket-page .editor-hint {
    line-height: 1.5;
}

.create-ticket-page .create-ticket-actions {
    padding-top: 4px;
}

.create-ticket-page .create-ticket-actions .btn-action-v {
    min-height: 48px;
}

.tickets-layout button:focus-visible,
.tickets-layout a:focus-visible,
.tickets-layout input:focus-visible,
.tickets-layout select:focus-visible,
.tickets-layout textarea:focus-visible,
.tickets-layout [role="button"]:focus-visible,
.create-ticket-page button:focus-visible,
.create-ticket-page a:focus-visible,
.create-ticket-page input:focus-visible,
.create-ticket-page select:focus-visible,
.create-ticket-page textarea:focus-visible,
.create-ticket-page [contenteditable="true"]:focus-visible {
    outline: 3px solid rgba(125, 21, 21, 0.38);
    outline-offset: 2px;
}

.create-ticket-page .file-upload-area {
    width: 100%;
    color: var(--dark);
    font-family: inherit;
    text-align: left;
}

.create-ticket-page .file-upload-area:hover {
    box-shadow: inset 0 0 0 1px rgba(125, 21, 21, 0.08);
}

.editor-wrapper {
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    transition: border-color 0.2s ease;
    overflow: hidden;
}

.editor-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.editor-content {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    word-break: break-word;
}

.editor-content:empty::before {
    content: attr(placeholder);
    color: #b0b0b0;
    pointer-events: none;
}

.editor-content img.editor-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 6px 0;
    cursor: grab;
    display: block;
}

.editor-content img.editor-image:active {
    cursor: grabbing;
}

.editor-dragover {
    border-color: var(--primary);
    background: rgba(125, 21, 21, 0.04);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.editor-hint {
    font-size: 12px;
    color: var(--gray);
    margin-top: 6px;
}

/* ========== CONFIG CHIPS ========== */

.config-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.config-chip {
    display: inline-flex;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray);
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
    user-select: none;
}

.config-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.config-chip.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.config-display {
    font-size: 13px;
    color: var(--gray);
    padding: 4px 0;
}

/* ========== TEMPLATES ========== */

.template-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.t-chip {
    display: inline-flex;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray);
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
    user-select: none;
}

.t-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.t-chip.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.template-fields {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 14px;
}

.template-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.template-fg {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.template-fg label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.template-input {
    padding: 7px 10px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
    background: var(--bg-light);
}

.template-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
    background: var(--white);
}

.template-textarea {
    resize: vertical;
    max-height: 7.5em;
    overflow-y: auto;
    line-height: 1.4;
}

.template-select {
    cursor: pointer;
    appearance: auto;
    background: var(--bg-light);
}

.btn-transfer {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-transfer::before {
    content: '\21E9';
    font-size: 14px;
}

.template-content-block {
    background: var(--bg-light);
    border-left: 3px solid var(--primary);
    padding: 10px 14px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.6;
}

.tcb-title {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ========== DOCUMENTS PAGE ========== */

.doc-page {
    max-width: 100%;
}

.doc-eyebrow,
.ratings-eyebrow,
.confirm-eyebrow,
.create-ticket-eyebrow,
.help-eyebrow,
.profile-eyebrow,
.notification-center-eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.1px;
}

.doc-description,
.ratings-description,
.confirm-description {
    margin: 6px 0 0;
    color: #747070;
    font-size: 14px;
    line-height: 1.5;
}

.doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 22px 26px;
    border: 1px solid rgba(125, 21, 21, 0.08);
    border-radius: 18px;
    background: linear-gradient(112deg, #fff 0%, #fff 66%, #fbf3f2 100%);
    box-shadow: 0 8px 26px rgba(45, 22, 22, 0.045);
}

.doc-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

.doc-order-act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.doc-order-act-btn img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

@media (max-width: 640px) {
    .doc-header-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .doc-order-act-btn {
        width: 100%;
    }
}

.doc-title {
    font-size: clamp(25px, 2.2vw, 32px);
    font-weight: 750;
    color: var(--dark);
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.65px;
}

.doc-filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 13px;
    align-items: end;
}

.doc-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}

.doc-filter-btn-group {
    min-width: auto;
}

.doc-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.doc-filter-feedback {
    color: var(--gray);
    font-size: 13px;
    margin-top: 14px;
}

.doc-filter-feedback-error {
    color: #b42318;
    font-weight: 600;
}

.doc-filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray);
    letter-spacing: 0.15px;
}

.doc-input,
.doc-select {
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #e4dddd;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--white);
    color: var(--dark);
    transition: border-color 0.2s ease;
}

.doc-input:focus,
.doc-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.doc-results {
    margin-top: 20px;
}

.doc-action-cell {
    text-align: right;
    white-space: nowrap;
}

.btn-doc-download {
    font-size: 13px;
    padding: 6px 12px;
}

/* ========== EDITOR OVERRIDES FOR PLAIN TEXT ========== */

.editor-content {
    white-space: pre-wrap;
}

/* ========== RATINGS PAGE ========== */

.ratings-page {
    max-width: 100%;
}

.ratings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 22px 26px;
    border: 1px solid rgba(125, 21, 21, 0.08);
    border-radius: 18px;
    background: linear-gradient(112deg, #fff 0%, #fff 66%, #fbf3f2 100%);
    box-shadow: 0 8px 26px rgba(45, 22, 22, 0.045);
}

.ratings-title {
    font-size: clamp(25px, 2.2vw, 32px);
    font-weight: 750;
    color: var(--dark);
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.65px;
}

.ratings-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 12px;
    align-items: end;
    background: var(--white);
    border: 1px solid #ebe5e5;
    border-radius: 15px;
    box-shadow: 0 6px 20px rgba(45, 22, 22, 0.05);
    padding: 15px 17px;
    margin-bottom: 16px;
}

.ratings-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ratings-filter-btn-group {
    min-width: auto;
}

.ratings-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ratings-filter-summary {
    margin: -4px 0 12px;
    color: var(--gray);
    font-size: 13px;
    line-height: 1.5;
}

.ratings-overview-status {
    margin: 0 0 12px;
    color: var(--gray);
    font-size: 14px;
    line-height: 1.5;
}

.ratings-filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray);
    letter-spacing: 0.15px;
}

.ratings-input,
.ratings-select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #e4dddd;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--white);
    color: var(--dark);
    transition: border-color 0.2s ease;
}

.ratings-input:focus,
.ratings-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

.ratings-table-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: auto;
}

.ratings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.ratings-table thead {
    background: var(--bg-light);
}

.ratings-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-light);
}

.ratings-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-light);
    color: var(--dark);
}

.ratings-table tbody tr:hover {
    background: rgba(125, 21, 21, 0.02);
}

.ratings-table tbody tr:last-child td {
    border-bottom: none;
}

.ratings-cell-uidoc code {
    font-size: 12px;
    color: var(--gray);
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: 4px;
}

.rating-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.rating-badge-good {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

.rating-badge-ok {
    background: rgba(234, 179, 8, 0.1);
    color: #a16207;
}

.rating-badge-bad {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.rating-badge-none {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.ratings-empty {
    text-align: center;
    padding: 40px 0;
    color: var(--gray);
    font-size: 16px;
}

.ratings-loading {
    text-align: center;
    padding: 40px 0;
    color: var(--gray);
    font-size: 16px;
}

.ratings-error {
    text-align: center;
    color: #dc2626;
    padding: 20px;
}

/* ========== API CHECK ========== */

.api-check-refresh {
    margin-bottom: 16px;
}

.api-check-overall-card {
    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 20px;
    color: var(--white);
    font-weight: 700;
}

.api-check-overall-card.api-status-ok {
    background: #7D1515;
}

.api-check-overall-card.api-status-warn {
    background: #888888;
}

.api-check-overall-card.api-status-err {
    background: #4a0000;
}

.api-check-overall-status {
    font-size: 24px;
    margin-bottom: 4px;
}

.api-check-overall-count {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 600;
}

.api-check-table-wrap {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: auto;
}

.api-check-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.api-check-table thead {
    background: var(--bg-light);
}

.api-check-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--gray-light);
}

.api-check-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-light);
    color: var(--dark);
}

.api-check-table tbody tr:hover {
    background: rgba(125, 21, 21, 0.02);
}

.api-check-table tbody tr:last-child td {
    border-bottom: none;
}

.api-check-table td code {
    background: var(--bg-light);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--primary);
}

.api-ep-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.api-ep-badge.api-ep-ok {
    background: rgba(125, 21, 21, 0.1);
    color: #7D1515;
}

.api-ep-badge.api-ep-err {
    background: rgba(180, 60, 60, 0.1);
    color: #8B3C3C;
}

.api-ep-error {
    font-size: 12px;
    color: #dc2626;
    margin-top: 4px;
    word-break: break-all;
}

/* ========== TICKET STATS METRICS ========== */

.ticket-stats-page .stats-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.ticket-stats-page .stat-metric {
    justify-items: center;
    background: var(--white);
    border: 1px solid #eee8e8;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(45, 22, 22, 0.04);
    padding: 16px 14px;
    text-align: center;
    transition: box-shadow 0.2s;
}

.ticket-stats-breakdown {
    background: var(--white);
    border: 1px solid #eee8e8;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(45, 22, 22, 0.045);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.ticket-stats-timeline {
    background: var(--white);
    border: 1px solid #eee8e8;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(45, 22, 22, 0.045);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.ticket-stats-sla {
    background: var(--white);
    border: 1px solid #eee8e8;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(45, 22, 22, 0.045);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.ticket-stats-sla-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.ticket-stats-sla-card {
    display: grid;
    gap: 5px;
    padding: 13px;
    min-width: 0;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius);
    background: #fffdfd;
}

.ticket-stats-sla-card strong {
    color: var(--primary);
    font-size: 18px;
}

.ticket-stats-sla-card span {
    color: var(--dark);
    font-size: 13px;
    font-weight: 600;
}

.ticket-stats-sla-card small {
    color: var(--gray);
    font-size: 11px;
    line-height: 1.45;
}

.ticket-stats-breakdown-title {
    color: var(--dark);
    font-size: 16px;
    margin: 0 0 14px;
}

.ticket-stats-breakdown-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 24px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ticket-stats-breakdown-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--dark);
    font-size: 13px;
    margin-bottom: 5px;
}

.ticket-stats-breakdown-label strong {
    color: var(--primary);
}

.ticket-stats-breakdown-action {
    display: block;
    width: 100%;
    padding: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.ticket-stats-breakdown-action:hover,
.ticket-stats-breakdown-action[aria-pressed="true"] {
    background: rgba(125, 21, 21, 0.06);
    border-color: rgba(125, 21, 21, 0.18);
}

.ticket-stats-breakdown-action:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.ticket-stats-focus-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.ticket-stats-focus-controls p {
    margin: 0;
    color: var(--gray);
    font-size: 13px;
}

.ticket-stats-breakdown-track {
    height: 7px;
    background: var(--bg-light);
    border-radius: 999px;
    overflow: hidden;
}

.ticket-stats-breakdown-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.ticket-stats-breakdown-empty {
    color: var(--gray);
    margin: 0;
}

.ticket-stats-timeline-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 24px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ticket-stats-timeline-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--dark);
    font-size: 13px;
    margin-bottom: 5px;
}

.ticket-stats-timeline-label strong {
    color: var(--primary);
}

.ticket-stats-timeline-track {
    height: 7px;
    background: var(--bg-light);
    border-radius: 999px;
    overflow: hidden;
}

.ticket-stats-timeline-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.ticket-stats-timeline-note {
    margin: 12px 0 0;
    color: var(--gray);
    font-size: 12px;
}

@media (max-width: 640px) {
    .admin-page-header,
    .ticket-stats-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 19px 18px;
    }

    .admin-page-badge {
        align-self: flex-start;
    }

    .admin-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-tab {
        padding: 10px 9px;
        font-size: 13px;
    }

    .stats-grid-cards {
        grid-template-columns: 1fr;
    }

    .admin-activity-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-stats-filters {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-stats-filters .admin-filter-group {
        min-width: 0;
    }

    .ticket-stats-filters {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 13px;
    }

    .ticket-stats-filter-group:nth-child(1),
    .ticket-stats-filter-group:nth-child(2),
    .ticket-stats-filter-group:nth-child(3) {
        grid-column: span 2;
    }

    .ticket-stats-filter-actions {
        flex-direction: column;
    }

    .ticket-stats-filter-actions .btn-action-v {
        width: 100%;
    }

    .ticket-stats-header .context-help-link {
        align-self: flex-start;
    }

    .ticket-stats-breakdown-items {
        grid-template-columns: 1fr;
    }

    .ticket-stats-timeline-items {
        grid-template-columns: 1fr;
    }
}

.ticket-stats-page .stat-metric:hover {
    box-shadow: var(--shadow-hover);
}

.ticket-stats-page .stat-metric-icon {
    font-size: 26px;
    margin-bottom: 6px;
}

.ticket-stats-page .stat-metric-icon-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}

.ticket-stats-page .stat-metric-value {
    font-size: clamp(22px, 2vw, 27px);
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 2px;
    line-height: 1.2;
}

.ticket-stats-page .stat-metric-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ticket-stats-page .stat-metric {
    background: linear-gradient(155deg, #ffffff 0%, #fbf8f7 100%);
    align-items: flex-start;
    padding: 18px;
}

.ticket-stats-page .stat-metric-value {
    font-size: clamp(25px, 2.4vw, 34px);
    font-variant-numeric: tabular-nums;
}

.ticket-stats-page .ticket-stats-filters,
.ticket-stats-page .ticket-stats-comparison,
.ticket-stats-page .ticket-stats-breakdown,
.ticket-stats-page .ticket-stats-timeline,
.ticket-stats-page .ticket-stats-sla {
    border: 1px solid #eee7e5;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 6px 24px rgba(45, 22, 22, 0.045);
    padding: 22px;
    margin: 0 0 18px;
}

.ticket-stats-page .ticket-stats-breakdown-title {
    font-size: 19px;
    letter-spacing: -0.25px;
}

.admin-user-row {
    cursor: pointer;
}

.admin-user-row:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.admin-user-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.admin-user-detail-item {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid #eee7e5;
    border-radius: 12px;
    background: #fbfaf9;
}

.admin-user-detail-item span,
.admin-user-detail-item strong {
    display: block;
    overflow-wrap: anywhere;
}

.admin-user-detail-item span {
    margin-bottom: 5px;
    color: var(--gray);
    font-size: 12px;
}

.admin-user-detail-actions {
    flex-wrap: wrap;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .admin-user-detail-grid { grid-template-columns: 1fr; }
}

/* ========== RATINGS STATS ========== */

.stats-cards {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.stat-card {
    flex: 1;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 12px;
}

.stat-card-bar {
    height: 6px;
    background: var(--gray-light);
    border-radius: 3px;
    overflow: hidden;
}

.stat-card-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.fill-good {
    background: #16a34a;
}

.fill-ok {
    background: #eab308;
}

.fill-bad {
    background: #dc2626;
}

/* ========== ADMIN PANEL ========== */

.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 22px;
    padding: 22px 26px;
    border: 1px solid rgba(125, 21, 21, 0.08);
    border-radius: 18px;
    background: linear-gradient(112deg, #fff 0%, #fff 66%, #fbf3f2 100%);
    box-shadow: 0 8px 26px rgba(45, 22, 22, 0.045);
}

.admin-results-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.admin-results-heading .admin-users-summary {
    margin-bottom: 8px;
}

.admin-results-hint {
    flex-shrink: 0;
    margin-bottom: 8px;
    color: #8a8383;
    font-size: 11px;
}

.admin-page-eyebrow,
.ticket-stats-eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.15px;
}

.admin-page-title {
    color: var(--dark);
    font-size: clamp(25px, 2.2vw, 32px);
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.65px;
}

.admin-page-description,
.ticket-stats-description {
    margin: 6px 0 0;
    color: #747070;
    font-size: 14px;
    line-height: 1.5;
}

.admin-page-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
    padding: 9px 13px;
    border: 1px solid #ebdddd;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: #625858;
    font-size: 12px;
    font-weight: 650;
}

.admin-page-badge span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4b8f69;
    box-shadow: 0 0 0 3px rgba(75, 143, 105, 0.12);
}

.admin-page .admin-toolbar > .btn-action-v {
    flex-shrink: 0;
}

.admin-page {
    max-width: 100%;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 22px;
    background: #f0eded;
    border: 1px solid #ebe7e7;
    border-radius: 14px;
    box-shadow: none;
    padding: 5px;
}

.admin-page > .admin-tab-content {
    min-width: 0;
}

.admin-tab {
    flex: 0 0 auto;
    padding: 10px 17px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    background: transparent;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.admin-tab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.admin-tab:hover {
    color: var(--dark);
    background: var(--bg-light);
}

.admin-tab.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(32, 20, 20, 0.09);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.admin-page {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.admin-page .admin-tabs {
    flex-shrink: 0;
}

#tabUsers.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.admin-filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.admin-users-summary {
    margin: -4px 0 12px;
    color: var(--gray);
    font-size: 13px;
    line-height: 1.5;
}

.admin-page-header + .admin-tabs + .admin-tab-content .admin-users-summary {
    min-height: 20px;
}

.admin-activity-card {
    margin-top: 17px;
}

.admin-activity-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 15px;
}

.admin-activity-heading .admin-card-title {
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: 17px;
}

.admin-activity-heading p {
    margin: 5px 0 0;
    color: var(--gray);
    font-size: 13px;
}

.admin-activity-count {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f5eeee;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.admin-activity-table-wrap {
    overflow: auto;
    border: 1px solid #eee9e9;
    border-radius: 12px;
}

.admin-activity-table th,
.admin-activity-table td {
    padding: 12px 14px;
}

.admin-activity-table td:nth-child(n+3) {
    font-variant-numeric: tabular-nums;
}

.admin-stats-filters {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin: 14px 0 10px;
}

.admin-stats-filters .admin-filter-group {
    min-width: min(320px, 100%);
}

.admin-empty-cell {
    padding: 24px !important;
    color: var(--gray) !important;
    text-align: center;
}

.admin-filters>.btn-action-v {
    min-height: 40px;
}

.admin-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-section-title {
    font-size: 21px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.admin-table-wrap {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid #eee9e9;
    box-shadow: 0 5px 18px rgba(45, 22, 22, 0.045);
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #c0c0c0 var(--bg-light);
}

#tabUsers.active .admin-table-wrap {
    flex: 1;
    min-height: 0;
}

.admin-table-wrap::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.admin-table-wrap::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.admin-table-wrap::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

.admin-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

.admin-table thead {
    background: #f7f5f5;
}

.admin-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-light);
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f7f5f5;
}

.admin-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    text-align: left;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.admin-sort-button::after {
    content: '↕';
    color: var(--gray);
    font-size: 12px;
    opacity: 0.6;
}

.admin-table th[aria-sort="ascending"] .admin-sort-button::after {
    content: '↑';
    color: var(--primary);
    opacity: 1;
}

.admin-table th[aria-sort="descending"] .admin-sort-button::after {
    content: '↓';
    color: var(--primary);
    opacity: 1;
}

.admin-sort-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 2px;
}

.admin-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--gray-light);
    color: var(--dark);
}

.admin-table tbody tr:hover {
    background: #fcf8f8;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* Compact user table */
.admin-table-users th,
.admin-table-users td {
    padding: 6px 8px;
    font-size: 14px;
    white-space: nowrap;
}

#tabUsers.active .admin-table-users th,
#tabUsers.active .admin-table-users td {
    padding: 9px 10px;
}

.admin-cell-date {
    color: var(--gray);
    font-size: 14px;
    white-space: nowrap;
}

.admin-cell-actions {
    white-space: nowrap;
}

/* Pending tickets table column styles */
.admin-table td.pending-cell-author {
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-table td.pending-cell-title {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 300px;
    min-width: 120px;
}

.admin-table td.pending-cell-desc {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 400px;
}

.admin-table td.pending-cell-imp {
    white-space: nowrap;
}

.admin-table td.pending-cell-files {
    text-align: center;
    color: var(--gray);
    font-size: 14px;
}

.btn-action-sm-danger {
    color: #dc2626 !important;
    border-color: #dc2626 !important;
}

.btn-action-sm-danger:hover {
    background: #dc2626 !important;
    color: var(--white) !important;
}

.admin-empty {
    text-align: center;
    padding: 40px 0;
    color: var(--gray);
    font-size: 16px;
}

.admin-loading {
    text-align: center;
    padding: 40px 0;
    color: var(--gray);
    font-size: 16px;
}

.admin-error {
    text-align: center;
    color: #dc2626;
    padding: 20px;
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.role-admin {
    background: rgba(125, 21, 21, 0.1);
    color: #7D1515;
}

.role-super {
    background: rgba(80, 80, 80, 0.1);
    color: #505050;
}

.role-user {
    background: rgba(120, 120, 120, 0.08);
    color: #787878;
}

/* === ADMIN FORM === */

.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.admin-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-form-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.admin-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    background: var(--white);
    color: var(--dark);
    transition: border-color 0.2s ease;
}

.admin-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

/* === STATS === */

.stats-grid-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.stats-grid-card {
    position: relative;
    display: grid;
    grid-template-columns: 42px 1fr;
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 14px;
    min-height: 120px;
    background: var(--white);
    border: 1px solid #eee8e8;
    border-radius: 16px;
    box-shadow: 0 5px 18px rgba(45, 22, 22, 0.045);
    padding: 20px 22px;
    text-align: left;
    overflow: hidden;
}

.stats-grid-card::after {
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    content: '';
    background: var(--primary);
}

.stats-grid-card-online::after {
    background: #4b8f69;
}

.stats-grid-icon {
    grid-column: 1;
    grid-row: 1 / span 3;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: #f7eded;
    color: var(--primary);
    font-size: 22px;
}

.stats-grid-card-online .stats-grid-icon {
    background: #edf6f0;
    color: #4b8f69;
    font-size: 13px;
}

.stats-grid-cards .sgc-value {
    grid-column: 2;
    font-size: 31px;
    font-weight: 760;
    line-height: 1.05;
    color: var(--dark);
    font-variant-numeric: tabular-nums;
}

.stats-grid-cards .sgc-label {
    grid-column: 2;
    margin-top: 4px;
    color: #494343;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.sgc-value {
    grid-column: 2;
    font-size: 31px;
    font-weight: 760;
    line-height: 1.05;
    color: var(--dark);
    font-variant-numeric: tabular-nums;
}

.sgc-label {
    grid-column: 2;
    margin-top: 4px;
    color: #494343;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.stats-grid-caption {
    grid-column: 2;
    margin-top: 4px;
    color: #858080;
    font-size: 12px;
}

.admin-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
}

.admin-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-roles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-role-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: var(--radius);
}

.stat-role-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.stat-role-count {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
}

/* ========== TICKET STATS PAGE ========== */

.ticket-stats-page {
    max-width: 100%;
    padding-bottom: 24px;
}

.ticket-stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding: 22px 26px;
    border: 1px solid rgba(125, 21, 21, 0.08);
    border-radius: 18px;
    background: linear-gradient(112deg, #fff 0%, #fff 66%, #fbf3f2 100%);
    box-shadow: 0 8px 26px rgba(45, 22, 22, 0.045);
}

.ticket-stats-title {
    font-size: clamp(25px, 2.2vw, 32px);
    font-weight: 750;
    color: var(--dark);
    line-height: 1.15;
    letter-spacing: -0.65px;
}

.ticket-stats-metrics {
    margin-bottom: 16px;
}

.ticket-stats-header + .ticket-stats-metrics .stats-metrics {
    margin-bottom: 0;
}

.ticket-stats-page .stats-metrics {
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 11px;
    margin-bottom: 0;
}

.ticket-stats-page .stat-metric {
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #eee8e8;
    border-top: 3px solid var(--primary) !important;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(45, 22, 22, 0.04);
    padding: 14px 12px;
}

.ticket-stats-page .stat-metric-icon {
    min-height: 34px;
    margin-bottom: 7px;
    color: var(--primary);
}

.ticket-stats-page .stat-metric-icon-img {
    width: 28px;
    height: 28px;
}

.ticket-stats-page .stat-metric-label {
    margin-top: 5px;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.35;
}

.ticket-stats-header .context-help-link {
    flex-shrink: 0;
}

.ticket-stats-comparison {
    margin-bottom: 16px;
    padding: 17px 20px;
    border: 1px solid #eee8e8;
    border-radius: 14px;
    background: var(--white);
    box-shadow: 0 5px 18px rgba(45, 22, 22, 0.045);
}

.ticket-stats-comparison .ticket-stats-breakdown-title {
    margin-bottom: 10px;
}

.ticket-stats-comparison-grid {
    gap: 10px;
}

.ticket-stats-comparison-card {
    border: 1px solid #eee6e6;
    border-radius: 11px;
    background: #fffdfd;
    padding: 13px 14px;
}

.ticket-stats-page .ticket-stats-breakdown-title {
    font-size: 15px;
    font-weight: 750;
}

.ticket-stats-filters {
    position: sticky;
    top: 8px;
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(6, minmax(125px, 1fr));
    gap: 12px;
    align-items: end;
    background: var(--white);
    border: 1px solid #ebe5e5;
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(45, 22, 22, 0.075);
    padding: 15px 17px;
    margin-bottom: 10px;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.96);
}

.ticket-stats-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ticket-stats-filter-group .multi-select-wrap {
    min-width: 0;
}

.ticket-stats-filter-group:nth-child(1) {
    grid-column: span 2;
}

.ticket-stats-filter-group:nth-child(2) {
    grid-column: span 2;
}

.ticket-stats-filter-group:nth-child(3) {
    grid-column: span 2;
}

.ticket-stats-filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-stats-filter-summary {
    display: flex;
    align-items: center;
    min-height: 34px;
    color: #686161;
    font-size: 13px;
    margin: 0 0 10px;
    padding: 7px 12px;
    border-left: 3px solid #b88484;
    border-radius: 0 8px 8px 0;
    background: #f8f5f5;
}

.ticket-stats-filter-btn-group {
    min-width: auto;
}

.ticket-stats-filter-label {
    font-size: 11px;
    font-weight: 600;
    color: #716a6a;
    letter-spacing: 0.15px;
}

.ticket-stats-input,
.ticket-stats-select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #e4dddd;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--white);
    color: var(--dark);
    transition: border-color 0.2s ease;
}

.ticket-stats-input:focus,
.ticket-stats-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 21, 21, 0.1);
}

/* Multi-select */
.multi-select-wrap {
    position: relative;
    min-width: 200px;
}

.multi-select-btn {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #e4dddd;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    color: var(--dark);
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: border-color 0.2s ease;
}

.multi-select-btn:hover,
.multi-select-btn:focus {
    border-color: var(--primary);
}

.multi-select-arrow {
    font-size: 10px;
    color: var(--gray);
    transition: transform 0.2s ease;
}

.multi-select-dropdown.open+.multi-select-btn .multi-select-arrow,
.multi-select-btn:focus+.multi-select-dropdown .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--white);
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    max-height: 260px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
}

.multi-select-dropdown.open {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.multi-select-option:hover {
    background: var(--bg-light);
}

.multi-select-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Ticket stats table */
.ticket-stats-table-wrapper {
    background: var(--white);
    border: 1px solid #eee8e8;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(45, 22, 22, 0.045);
    overflow: auto;
}

.ticket-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.ticket-stats-table thead {
    background: #f7f5f5;
    position: sticky;
    top: 0;
    z-index: 2;
}

.ticket-stats-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    color: #716a6a;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-light);
}

.ticket-stats-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-light);
    color: var(--dark);
}

.ticket-stats-table tbody tr:hover {
    background: #fcf8f8;
}

.ticket-stats-table tbody tr:nth-child(even) {
    background: #fcfafa;
}

.ticket-stats-table tbody tr:nth-child(even):hover {
    background: #fcf8f8;
}

.ticket-stats-table tbody tr:last-child td {
    border-bottom: none;
}

.ticket-stats-cell-num {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-stats-cell-name {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-stats-cell-labor {
    font-weight: 600;
    text-align: center;
}

.btn-action-xs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius);
    background: var(--white);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-action-xs:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* States */
.ticket-stats-empty {
    text-align: center;
    padding: 40px 0;
    color: var(--gray);
    font-size: 16px;
}

.ticket-stats-loading {
    text-align: center;
    padding: 40px 0;
    color: var(--gray);
    font-size: 16px;
}

.ticket-stats-error {
    text-align: center;
    color: #dc2626;
    padding: 20px;
}

/* ========== HELP / GUIDE PAGE ========== */

.context-help-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
    margin: 0 0 12px;
}

.context-help-link-inline {
    margin: 0 0 0 12px;
    vertical-align: middle;
}

.context-help-link-compact {
    float: right;
    font-size: 12px;
}

.assistant-context-help {
    margin: 0;
    color: var(--white);
}

.notification-help-link {
    margin: 0 6px 0 0;
}

.context-help-link>.context-help-popover {
    display: none !important;
}

.context-help-icon {
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
}

.context-help-portal {
    position: fixed;
    z-index: 12000;
    width: max-content;
    max-width: min(280px, calc(100vw - 24px));
    max-height: min(180px, calc(100vh - 24px));
    overflow: auto;
    padding: 9px 11px;
    border-radius: 8px;
    background: var(--dark);
    color: var(--white);
    box-shadow: var(--shadow);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
    pointer-events: none;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    opacity: 1;
    visibility: visible;
    transform: none;
}

.context-help-portal[hidden] {
    display: none;
}

.context-help-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

@media (max-width: 600px) {
    .context-help-link-inline {
        margin: 8px 0 0;
    }

    .context-help-link-compact {
        float: none;
        margin-left: 8px;
    }
}

.help-title {
    font-size: clamp(25px, 2.2vw, 32px);
    font-weight: 750;
    color: var(--dark);
    margin: 0 0 4px 0;
}

.help-subtitle {
    color: var(--gray);
    font-size: 16px;
    margin: 0 0 28px 0;
}

.help-page-header {
    margin-bottom: 20px;
    padding: 22px 26px;
    border: 1px solid rgba(125, 21, 21, 0.08);
    border-radius: 18px;
    background: linear-gradient(112deg, #fff 0%, #fff 66%, #fbf3f2 100%);
    box-shadow: 0 8px 26px rgba(45, 22, 22, 0.045);
}

.help-page-header .help-title,
.help-page-header .help-subtitle {
    margin-bottom: 0;
}

.help-page-header {
    position: relative;
}

.help-page-header::after {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #f7eded;
    color: var(--primary);
    content: '?';
    font-size: 23px;
    font-weight: 750;
}

.help-page-header .help-subtitle {
    margin-top: 6px;
    font-size: 14px;
}

.help-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
    scroll-margin-top: 80px;
}

.help-section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 12px 0;
}

.help-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 6px;
    margin-bottom: 12px;
}

.help-role-user {
    background: rgba(120, 120, 120, 0.08);
    color: #787878;
}

.help-role-super {
    background: rgba(80, 80, 80, 0.1);
    color: #505050;
}

.help-role-admin {
    background: rgba(125, 21, 21, 0.1);
    color: #7D1515;
}

.help-section-body {
    font-size: 15px;
    line-height: 1.6;
    color: var(--dark);
}

.help-section-body p {
    margin: 0 0 12px 0;
}

.help-section-body ul {
    margin: 0;
    padding-left: 20px;
}

.help-section-body li {
    margin-bottom: 6px;
}

.help-search {
    min-width: 0;
}

.help-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: end;
    margin-bottom: 20px;
}

.help-search label {
    display: block;
    color: var(--gray);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

.help-filter-empty {
    color: var(--gray);
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius-lg);
}

.help-search input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-lg);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--white);
    box-shadow: var(--shadow);
}

.help-search input:focus {
    border-color: var(--primary);
}

.admin-form-group-full {
    grid-column: 1 / -1;
}

.admin-form-static {
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 6px;
    font-size: 15px;
    color: var(--dark);
    line-height: 1.4;
    word-break: break-word;
}

.admin-form-divider {
    border-top: 1px solid var(--gray-light);
    margin: 12px 0;
}

.admin-orgs-section {
    padding: 0 0 12px 0;
}

.admin-orgs-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.admin-org-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-light);
    border-radius: var(--radius);
    font-size: 13px;
}

.admin-org-row-name {
    flex: 1;
    color: var(--dark);
}

.admin-org-row-uid {
    color: var(--gray);
    font-size: 12px;
}

.admin-orgs-add-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-textarea {
    width: 100%;
    min-height: 200px;
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.guide-roles-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0;
}

.guide-role-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.guide-role-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #7D1515;
}

.help-toc {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.help-toc h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

.help-toc ol {
    margin: 0;
    padding-left: 20px;
}

.help-toc li {
    list-style-type: none;
    margin-bottom: 6px;
    font-size: 14px;
}

.help-toc a {
    color: var(--primary);
    text-decoration: none;
}

.help-toc a:hover {
    text-decoration: underline;
}

.help-toc a.active {
    display: inline-block;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.help-section-body h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    margin: 20px 0 10px 0;
}

.help-section-body h4:first-child {
    margin-top: 0;
}

.help-section-body h5 {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    margin: 16px 0 8px 0;
}

.help-section-body ol {
    margin: 0 0 12px 0;
    padding-left: 20px;
}

.help-section-body ol li {
    margin-bottom: 6px;
}

.help-tip {
    background: #fff8e6;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 13px;
    color: #92400e;
    margin: 12px 0 0 0;
}

.help-scroll-top {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 1100;
    display: none;
    width: 44px;
    height: 44px;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(125, 21, 21, 0.35);
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
}

.help-scroll-top:hover {
    background: var(--primary-light);
    box-shadow: 0 6px 20px rgba(125, 21, 21, 0.5);
    transform: translateY(-2px);
}

.help-scroll-top.visible {
    display: flex;
}


/* ========== SYSTEM MODE CONTROL ========== */

.alert-warning {
    background: #fff8e6;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.system-mode-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.system-mode-option {
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-lg);
    padding: 4px;
    transition: border-color 0.2s;
}

.system-mode-option:has(input:checked) {
    border-color: var(--primary);
    background: rgba(125, 21, 21, 0.03);
}

.system-mode-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
}

.system-mode-label input[type="radio"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #7D1515;
}

.system-mode-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.system-mode-info strong {
    font-size: 15px;
    color: var(--dark);
}

.system-mode-desc {
    font-size: 13px;
    color: var(--gray);
}

.system-message-group {
    margin-bottom: 12px;
}

.system-save-msg {
    font-size: 13px;
    color: var(--gray);
    animation: fadeInOut 3s ease;
}

.system-current {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.system-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.system-status-normal {
    background: rgba(80, 80, 80, 0.1);
    color: #505050;
}

.system-status-maintenance {
    background: rgba(120, 120, 120, 0.08);
    color: #787878;
}

.system-status-api_issues {
    background: rgba(125, 21, 21, 0.1);
    color: #7D1515;
}

#systemModeBar {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* ========== FILE UPLOAD ========== */

.file-upload-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border: 2px dashed var(--gray-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-light);
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: rgba(125, 21, 21, 0.03);
}

.file-upload-icon {
    font-size: 24px;
}

.file-upload-text {
    color: var(--gray);
    font-size: 14px;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-light);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 13px;
}

.file-item-name {
    color: var(--dark);
    word-break: break-all;
}

.file-item-remove {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
}

.file-item-remove:hover {
    color: #b91c1c;
}

/* ========== FILE DISPLAY IN DETAILS ========== */

.d-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.d-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-light);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 13px;
}

.d-file-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

.d-file-link:hover {
    text-decoration: underline;
}

.d-file-size {
    color: var(--gray);
    font-size: 12px;
    white-space: nowrap;
}

.d-file-empty {
    color: var(--gray);
    font-size: 13px;
    padding: 4px 0;
}

/* ========== INLINE IMAGE THUMBNAILS ========== */

.d-scroll-html {
    line-height: 1.6;
    white-space: pre-wrap;
}

.d-scroll-html p {
    margin: 4px 0;
}

.img-thumb-wrap {
    display: inline-block;
    margin: 4px 2px;
    vertical-align: middle;
    line-height: 0;
}

.img-thumb {
    max-width: 200px;
    max-height: 150px;
    border-radius: 6px;
    border: 1px solid var(--gray-light);
    cursor: pointer;
    transition: opacity 0.15s ease;
    object-fit: cover;
}

.img-thumb:hover {
    opacity: 0.8;
}

/* ========== IMAGE PREVIEW LIGHTBOX ========== */

.image-preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.image-preview-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: calc(100vw - 60px);
    max-height: calc(100vh - 60px);
}

.image-preview-container img {
    max-width: 100%;
    max-height: calc(100vh - 60px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.image-preview-toolbar {
    position: absolute;
    top: -44px;
    right: 0;
    display: flex;
    gap: 8px;
}

.image-preview-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    color: #fff;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    text-decoration: none;
}

.image-preview-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== ASSISTANT ========== */

.assistant-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(125, 21, 21, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.assistant-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(125, 21, 21, 0.45);
}

.assistant-btn:active {
    transform: scale(0.95);
}

.assistant-btn-active {
    box-shadow: 0 4px 20px rgba(125, 21, 21, 0.25);
}

.assistant-btn .assistant-btn-icon {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.assistant-btn .assistant-btn-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.assistant-btn-active .assistant-btn-icon {
    opacity: 0;
    transform: rotate(90deg);
}

.assistant-btn-active .assistant-btn-close {
    opacity: 1;
    transform: rotate(0deg);
}

.assistant-panel {
    position: fixed;
    bottom: 92px;
    left: 24px;
    z-index: 998;
    width: min(440px, calc(100vw - 48px));
    max-height: min(680px, calc(100vh - 120px));
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.assistant-panel-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--gray-light);
    flex-shrink: 0;
}

.assistant-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
}

.assistant-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.assistant-close-btn:hover {
    background: var(--gray-light);
    color: var(--dark);
}

.assistant-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    min-height: 120px;
}

.assistant-greeting {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 20px 20px;
    gap: 10px;
}

.assistant-greeting-icon {
    font-size: 40px;
    line-height: 1;
}

.assistant-greeting-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.assistant-greeting-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.4;
}

.assistant-greeting-sub {
    font-size: 13px;
    font-weight: 400;
    color: var(--gray);
    display: block;
    margin-top: 4px;
}

.assistant-group {
    margin-bottom: 4px;
}

.assistant-group-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
    padding: 8px 12px 4px;
}

.assistant-suggestions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px;
}

.assistant-guide-suggestions {
    margin: 8px 16px 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(125, 21, 21, 0.045);
}

.assistant-guide-suggestions[hidden] {
    display: none;
}

.assistant-guide-suggestions strong {
    display: block;
    margin-bottom: 7px;
    color: var(--dark);
    font-size: 12px;
}

.assistant-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s ease;
}

.assistant-context-action {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}

.assistant-context-action:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.assistant-suggestion:hover {
    background: var(--bg-light);
}

.assistant-suggestion:active {
    background: #eee;
}

.assistant-suggestion-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.assistant-suggestion-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.assistant-suggestion-content {
    flex: 1;
    min-width: 0;
}

.assistant-suggestion-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.3;
}

.assistant-suggestion-hint {
    display: block;
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assistant-suggestion-arrow {
    font-size: 14px;
    color: var(--gray);
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.assistant-suggestion:hover .assistant-suggestion-arrow {
    opacity: 1;
    transform: translateX(2px);
}

.assistant-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 20px;
    color: var(--gray);
    font-size: 14px;
    gap: 8px;
}

.assistant-no-results-icon {
    font-size: 32px;
}

.assistant-footer {
    flex-shrink: 0;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--gray-light);
}

.assistant-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-light);
    border-radius: 12px;
    padding: 4px;
}

.assistant-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--dark);
    outline: none;
    font-family: inherit;
}

.assistant-input::placeholder {
    color: #aaa;
}

.assistant-input-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.assistant-input-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.assistant-input-btn:not(:disabled):hover {
    opacity: 0.9;
}

@media (max-width: 480px) {

    .assistant-panel,
    .assistant-panel-sidebar {
        top: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100%;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        overflow-x: hidden;
    }

    .assistant-body {
        overflow-x: hidden;
        word-break: break-word;
    }

    .assistant-btn {
        bottom: 16px;
        left: 16px;
        width: 52px;
        height: 52px;
    }
}

/* Assistant button inside sidebar */
.sidebar .assistant-btn-sidebar {
    position: static;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    background: transparent;
    color: var(--dark);
    box-shadow: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
}

.sidebar .assistant-btn-sidebar:hover {
    color: var(--primary);
    background: transparent;
}

.sidebar .assistant-btn-sidebar:active {
    transform: none;
}

.sidebar .assistant-btn-sidebar .nav-icon {
    font-size: 20px;
    line-height: 1;
}

/* Assistant panel when button is in sidebar */
.assistant-panel-sidebar {
    right: auto;
    left: calc(var(--sidebar-collapsed) + 12px);
    bottom: 24px;
    transform-origin: bottom left;
}

/* ========== ASSISTANT CONVERSATION ========== */

.assistant-conversation {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
    flex: 1;
    overflow-y: auto;
}

.conv-message {
    display: flex;
    animation: convFadeIn 0.2s ease;
}

@keyframes convFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.conv-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.conv-bot-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.conv-bot-avatar-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.conv-message-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.conv-message-text {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.conv-message-bot .conv-message-text {
    background: var(--bg-light);
    color: var(--dark);
    border-bottom-left-radius: 4px;
}

.conv-message-user .conv-message-text {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.conv-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.conv-option-selected {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    padding: 4px 0;
}

.conv-option {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.conv-option:hover {
    background: var(--primary);
    color: #fff;
}

.conv-option-primary {
    background: var(--primary);
    color: #fff;
}

.conv-option-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.conv-option-danger {
    border-color: #c0392b;
    color: #c0392b;
}

.conv-option-danger:hover {
    background: #c0392b;
    color: #fff;
}

.conv-preview {
    background: #fff;
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    padding: 12px;
    margin-top: 4px;
}

.conv-preview-row {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--bg-light);
}

.conv-preview-row:last-child {
    border-bottom: none;
}

.conv-preview-label {
    font-weight: 600;
    color: var(--gray);
    min-width: 120px;
    flex-shrink: 0;
}

.conv-preview-value {
    color: var(--dark);
    word-break: break-word;
    white-space: pre-wrap;
}

.conv-ticket-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.conv-ticket-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.12s ease;
    text-align: left;
    font-family: inherit;
    width: 100%;
}

.conv-ticket-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(125, 21, 21, 0.08);
}

.conv-ticket-item-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    min-width: 70px;
}

.conv-ticket-item-name {
    flex: 1;
    font-size: 13px;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-ticket-item-status {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: break-spaces;
}

.conv-ticket-card {
    background: #fff;
    border: 1px solid var(--gray-light);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 4px;
}

.conv-ticket-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--gray-light);
}

.conv-ticket-card-num {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.conv-ticket-card-status {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
}

.conv-ticket-card-name {
    padding: 10px 14px 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.conv-ticket-card-details {
    padding: 2px 14px 8px;
}

.conv-ticket-card-row {
    font-size: 13px;
    color: var(--dark);
    padding: 2px 0;
}

.conv-ticket-card-label {
    font-weight: 600;
    color: var(--gray);
    margin-right: 6px;
}

.conv-ticket-card-content {
    padding: 8px 14px 10px;
    font-size: 13px;
    color: var(--gray);
    border-top: 1px solid var(--gray-light);
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
}

.conv-loading-dots {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-items: center;
}

.conv-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray);
    animation: convBounce 1.2s ease-in-out infinite;
}

.conv-loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.conv-loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes convBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.assistant-suggestion-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(125, 21, 21, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

.assistant-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.assistant-header-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.assistant-header-btn:hover {
    background: var(--gray-light);
    color: var(--dark);
}

/* ========== TEXT WRAP & EXPAND ========== */

.text-wrap {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.btn-expand-text {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: none;
    border: 1px solid var(--primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s ease;
    font-family: inherit;
    line-height: 1.6;
}

.btn-expand-text:hover {
    background: var(--primary);
    color: #fff;
}

/* ========== TEXT PREVIEW MODAL ========== */

.text-preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.text-preview-overlay.open {
    display: flex;
}

.text-preview-modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 640px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.text-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-light);
    background: var(--bg-light);
    flex-shrink: 0;
}

.text-preview-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
}

.text-preview-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 22px;
    color: var(--gray);
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.text-preview-close:hover {
    background: rgba(125, 21, 21, 0.06);
    color: var(--primary);
}

.text-preview-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ========== ASSISTANT DEBT ========== */

.conv-debt-card {
    text-align: center;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--gray-light);
}

.conv-debt-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.conv-debt-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.conv-debt-label {
    font-size: 14px;
    color: var(--gray);
    margin-top: 4px;
}

/* ========== ASSISTANT PHONE MANAGEMENT ========== */

.conv-phone-section {
    margin-top: 4px;
}

.conv-phone-empty {
    text-align: center;
    padding: 16px;
    color: var(--gray);
    font-size: 14px;
}

.conv-phone-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conv-phone-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 14px;
}

.conv-phone-number {
    flex: 1;
    font-weight: 600;
    color: var(--dark);
}

.conv-phone-action {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.12s ease;
    font-family: inherit;
}

.conv-phone-action-edit {
    background: rgba(125, 21, 21, 0.08);
    color: var(--primary);
}

.conv-phone-action-edit:hover {
    background: var(--primary);
    color: #fff;
}

.conv-phone-action-del {
    background: rgba(192, 57, 43, 0.08);
    color: #c0392b;
}

.conv-phone-action-del:hover {
    background: #c0392b;
    color: #fff;
}

/* ========== ASSISTANT ACT ORDER ========== */

.conv-act-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.conv-act-label {
    font-size: 14px;
    color: var(--dark);
    font-weight: 600;
}

.conv-act-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.conv-act-quick-btn {
    font-size: 12px !important;
    padding: 6px 12px !important;
}

.conv-act-custom {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 10px;
    border: 1px solid var(--gray-light);
}

.conv-act-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-act-date-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    min-width: 24px;
}

.conv-act-date-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--dark);
    background: var(--white);
    outline: none;
}

.conv-act-date-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(125, 21, 21, 0.1);
}

.conv-act-submit {
    margin-top: 4px;
    width: 100%;
    text-align: center;
}

.conv-act-success {
    text-align: center;
    padding: 16px;
}

.conv-act-success-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.conv-act-success-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 6px;
}

.conv-act-success-details {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 4px;
}

.conv-act-success-note {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

/* ========== ASSISTANT DOC SEARCH ========== */

.conv-doc-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.conv-doc-label {
    font-size: 13px;
    color: var(--dark);
    font-weight: 600;
}

.conv-doc-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.conv-doc-quick-btn {
    font-size: 12px !important;
    padding: 6px 12px !important;
}

.conv-doc-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-doc-date-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
    min-width: 24px;
}

.conv-doc-date-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--dark);
    background: var(--white);
    outline: none;
}

.conv-doc-date-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(125, 21, 21, 0.1);
}

.conv-doc-type-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-doc-type-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
    white-space: nowrap;
}

.conv-doc-type-select {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--dark);
    background: var(--white);
    outline: none;
}

.conv-doc-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conv-doc-type-section {
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    overflow: hidden;
}

.conv-doc-type-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
    padding: 10px 12px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-doc-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    background: var(--white);
    border-radius: 10px;
    padding: 1px 8px;
}

.conv-doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--bg-light);
    gap: 8px;
}

.conv-doc-item:last-child {
    border-bottom: none;
}

.conv-doc-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.conv-doc-item-number {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
}

.conv-doc-item-date {
    font-size: 12px;
    color: var(--gray);
}

.conv-doc-item-dl {
    flex-shrink: 0;
    font-size: 12px;
    padding: 5px 10px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease, color 0.12s ease;
    white-space: nowrap;
}

.conv-doc-item-dl:hover {
    background: var(--primary);
    color: #fff;
}

/* ========== ASSISTANT ORG SWITCH ========== */

.conv-org-section {
    margin: 4px 0;
}

/* ========== ASSISTANT TELEGRAM CODE ========== */

.conv-tg-section {
    text-align: center;
    padding: 16px;
}

.conv-tg-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.conv-tg-label {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 8px;
}

.conv-tg-code {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 4px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
    font-family: monospace;
}

.conv-tg-hint {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 12px;
}

/* ========== ASSISTANT TICKET CARD SECTION ========== */

.conv-ticket-card-section {
    border-top: 1px solid var(--gray-light);
    padding: 0;
}

.conv-ticket-card-section-title {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray);
    text-transform: uppercase;
    padding: 8px 14px 2px;
    letter-spacing: 0.5px;
}

/* ========== PROFILE QUESTIONS ========== */

.profile-question-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-light);
}

.profile-question-item:last-child {
    border-bottom: none;
}

.profile-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.profile-question-status {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-q-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.profile-q-answered {
    background: #7D1515;
}

.profile-q-pending {
    background: #A0A0A0;
}

.profile-question-status-text {
    margin-left: 0;
}

.profile-question-date {
    font-size: 12px;
    color: var(--gray);
}

.profile-question-text {
    font-size: 14px;
    color: var(--dark);
    margin-bottom: 6px;
    line-height: 1.4;
    word-break: break-word;
}

.profile-question-answer {
    font-size: 13px;
    color: var(--dark);
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-top: 4px;
    line-height: 1.4;
    word-break: break-word;
}

.profile-question-answer-label {
    font-weight: 600;
    color: var(--primary);
}

.profile-questions-pages {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding-top: 10px;
}

.btn-page {
    background: none;
    border: 1px solid var(--gray-light);
    min-width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--gray);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-page:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-page-active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.btn-page-active:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
}

/* ========== ASSISTANT SITE MODE ========== */

.conv-mode-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.conv-mode-current {
    font-size: 14px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
}

.conv-mode-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conv-mode-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1.5px solid var(--gray-light);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.12s ease;
    font-size: 13px;
}

.conv-mode-option:hover {
    border-color: var(--primary);
}

.conv-mode-option input[type="radio"] {
    margin-right: 6px;
}

.conv-mode-desc {
    font-size: 12px;
    color: var(--gray);
    margin-left: 22px;
}

.conv-mode-message-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conv-mode-message-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
}

.conv-mode-message-input {
    padding: 8px 10px;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--dark);
    background: var(--white);
    outline: none;
}

.conv-mode-message-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(125, 21, 21, 0.1);
}

/* ========== ASSISTANT ONLINE USERS ========== */

.conv-online-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.conv-online-count {
    font-size: 15px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    text-align: center;
}

.conv-online-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conv-online-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 13px;
}

.conv-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #27ae60;
    flex-shrink: 0;
}

.conv-online-name {
    font-weight: 600;
    color: var(--dark);
    flex: 1;
}

.conv-online-login {
    color: var(--gray);
    font-size: 12px;
}

.conv-online-empty {
    text-align: center;
    padding: 16px;
    color: var(--gray);
    font-size: 13px;
}

/* ========== ASSISTANT STATS ========== */

.conv-stats-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.conv-stats-label {
    font-size: 14px;
}

.conv-stats-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.conv-stats-quick-btn {
    font-size: 12px !important;
    padding: 6px 12px !important;
}

.conv-stats-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-stats-date-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
    min-width: 24px;
}

.conv-stats-date-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--dark);
    background: var(--white);
    outline: none;
}

.conv-stats-date-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(125, 21, 21, 0.1);
}

.conv-stats-statuses {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conv-stats-statuses-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
}

.conv-stats-statuses-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 8px;
    background: var(--bg-light);
    border-radius: 8px;
}

.conv-stats-status-check {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.conv-stats-status-check input[type="checkbox"] {
    margin: 0;
}

.conv-stats-result {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.conv-stats-result-title {
    font-size: 14px;
    text-align: center;
}

.conv-stats-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.conv-stats-result-card {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-light);
    border-radius: 10px;
    border: 1px solid var(--gray-light);
}

.conv-stats-result-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.conv-stats-result-label {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
}

.conv-stats-status-breakdown {
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
}

.conv-stats-status-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.conv-stats-status-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 2px 0;
}

.conv-stats-status-name {
    color: var(--gray);
}

.impersonation-banner {
    background: #fff3cd;
    border-bottom: 2px solid #ffc107;
    padding: 10px 20px;
    text-align: center;
    font-size: 14px;
    color: #856404;
}

.impersonation-banner a {
    color: #856404;
    font-weight: 600;
    text-decoration: underline;
    margin-left: 8px;
}

.impersonation-banner a:hover {
    color: #533f03;
}

/* ========== PROFILE PAGE NAV ========== */

.profile-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 24px;
    padding: 6px;
    border: 1px solid #ebe5e5;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 13px;
    box-shadow: 0 6px 18px rgba(45, 22, 22, 0.05);
    backdrop-filter: blur(10px);
}

.profile-nav-link {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.profile-nav-link:hover {
    color: var(--primary);
    background: rgba(125, 21, 21, 0.06);
}

.profile-nav-link.active {
    color: var(--primary);
    background: #f5ebeb;
    box-shadow: inset 0 0 0 1px rgba(125, 21, 21, 0.08);
    font-weight: 600;
}

.profile-page-header {
    margin-bottom: 18px;
    padding: 22px 26px;
    border: 1px solid rgba(125, 21, 21, 0.08);
    border-radius: 18px;
    background: linear-gradient(112deg, #fff 0%, #fff 66%, #fbf3f2 100%);
    box-shadow: 0 8px 26px rgba(45, 22, 22, 0.045);
}

.content {
    scroll-behavior: smooth;
}

/* === DISABLED MODE (api_issues, maintenance) === */

.mode-api-issues .nav-item,
.mode-api-issues .notif-bell-wrapper,
.mode-api-issues .header-user,
.mode-api-issues .assistant-btn {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}

.mode-api-issues .nav-item:hover,
.mode-api-issues .nav-item.active,
.mode-api-issues .assistant-btn:hover {
    color: var(--dark);
    background: transparent;
}

.mode-api-issues .nav-item.active .nav-icon {
    background: rgba(125, 21, 21, 0.08);
    color: var(--dark);
}

.mode-api-issues .notif-bell:hover,
.mode-api-issues .assistant-btn:hover {
    background: transparent;
}

/* Shared keyboard focus across the existing frontend */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
[contenteditable="true"]:focus-visible {
    outline: 3px solid var(--primary) !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(125, 21, 21, 0.14);
    position: relative;
    z-index: 2;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 640px) {
    .help-controls {
        grid-template-columns: minmax(0, 1fr);
    }

    .profile-nav {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-nav-link {
        white-space: normal;
        text-align: center;
        padding: 10px 8px;
    }

    .modal-full {
        width: calc(100vw - 20px);
        height: calc(100dvh - 20px);
        max-height: calc(100vh - 20px);
    }

    .chat-scroll-wrap {
        padding: 12px 12px 0;
    }

    .chat-input-area {
        flex-wrap: wrap;
        align-items: stretch;
        padding: 10px 12px 12px;
    }

    .chat-input {
        flex: 1 0 100%;
        min-height: 100px;
    }

    .chat-input-help,
    .chat-action-feedback {
        padding-left: 12px;
        padding-right: 12px;
    }

    .doc-filter-actions>* {
        flex: 1 1 auto;
    }

    .confirm-header {
        padding: 18px;
    }

    .confirm-card-header,
    .confirm-card-body,
    .confirm-card-actions {
        padding-left: 16px;
        padding-right: 16px;
    }
}

.doc-results-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    padding: 12px 16px;
    background: var(--white, #fff);
    border-radius: var(--radius, 10px);
    box-shadow: var(--shadow, 0 2px 10px rgba(30, 0, 0, .06));
}

.doc-results-toolbar label {
    color: var(--dark, #333);
    font-size: 13px;
    font-weight: 600;
}

.doc-results-toolbar input {
    flex: 1 1 220px;
    max-width: 420px;
}

.doc-results-toolbar select {
    min-width: 190px;
}

.doc-results-toolbar span {
    color: var(--gray, #777);
    font-size: 13px;
    margin-left: auto;
}

.notification-center-page {
    max-width: 1050px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.notification-center-page .header-user {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.notification-center-back {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--primary, #7D1515);
    text-decoration: none;
}

.notification-center-back:hover {
    text-decoration: underline;
}

.notification-center-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    padding: 22px 26px;
    border: 1px solid rgba(125, 21, 21, 0.08);
    border-radius: 18px;
    background: linear-gradient(112deg, #fff 0%, #fff 66%, #fbf3f2 100%);
    box-shadow: 0 8px 26px rgba(45, 22, 22, 0.045);
}

.notification-center-heading h1 {
    margin: 0;
    color: var(--dark, #333);
    font-size: clamp(25px, 2.2vw, 32px);
    line-height: 1.15;
    letter-spacing: -0.65px;
}

.notification-center-heading p {
    margin: 6px 0 0;
    color: var(--gray, #777);
    font-size: 14px;
}

.notification-center-toolbar {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto minmax(140px, 190px);
    align-items: center;
    gap: 10px 12px;
    padding: 15px 17px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #ebe5e5;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(45, 22, 22, 0.05);
}

.notification-center-toolbar label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark, #333);
}

.notification-center-toolbar input,
.notification-center-toolbar select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #e4dddd;
    border-radius: 9px;
    color: var(--dark);
    font: inherit;
}

.notification-center-toolbar input:focus,
.notification-center-toolbar select:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(125, 21, 21, 0.1);
}

.notification-center-toolbar input {
    flex: 1 1 260px;
}

.notification-center-toolbar select {
    min-width: 160px;
}

.notification-center-list {
    display: grid;
    gap: 10px;
}

.notification-center-item {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid #eee8e8;
    border-left: 4px solid transparent;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(45, 22, 22, 0.04);
}

.notification-center-unread {
    border-left-color: var(--primary, #7D1515);
    background: linear-gradient(100deg, #fffafa, #fff 65%);
}

.notification-center-item-top {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: baseline;
}

.notification-center-item-top strong {
    color: var(--primary, #7D1515);
}

.notification-center-item-top time,
.notification-center-state {
    color: var(--gray, #777);
    font-size: 12px;
}

.notification-center-item p {
    margin: 8px 0;
    color: var(--dark, #333);
}

.notification-center-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.notification-center-actions button {
    white-space: nowrap;
}

.notification-center-empty {
    padding: 34px;
    text-align: center;
    color: var(--gray, #777);
    background: #fff;
    border: 1px solid #eee8e8;
    border-radius: 14px;
}

.notification-center-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 18px;
}

@media (max-width: 700px) {
    .doc-header,
    .ratings-header,
    .confirm-header,
    .create-ticket-heading,
    .profile-page-header,
    .help-page-header,
    .notification-center-heading {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .doc-header .context-help-link,
    .ratings-header .context-help-link {
        align-self: flex-start;
    }

    .doc-filter-row,
    .ratings-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .doc-filter-group,
    .ratings-filter-group {
        min-width: 0;
    }

    .doc-filter-actions,
    .ratings-filter-actions {
        flex-direction: column;
    }

    .doc-filter-actions > *,
    .ratings-filter-actions > * {
        width: 100%;
    }

    .notification-center-toolbar {
        grid-template-columns: minmax(0, 1fr);
    }

    .notification-center-toolbar input,
    .notification-center-toolbar select {
        min-width: 0;
        width: 100%;
    }

    .notification-center-heading .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 440px) {
    .doc-filter-row,
    .ratings-filters {
        grid-template-columns: minmax(0, 1fr);
    }

    .notification-center-item {
        flex-direction: column;
        padding: 14px;
    }

    .notification-center-actions {
        flex-wrap: wrap;
    }

    .notification-center-pagination {
        gap: 10px;
    }
}

.ticket-stats-comparison {
    background: var(--white, #fff);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin: 16px 0 20px;
}

.ticket-stats-comparison-period {
    margin: 0 0 14px;
    color: var(--dark, #333);
    font-weight: 600;
}

.ticket-stats-comparison-period span {
    display: block;
    margin-top: 4px;
    color: var(--gray, #777);
    font-size: 12px;
    font-weight: 400;
}

.ticket-stats-comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.ticket-stats-comparison-card {
    display: grid;
    gap: 5px;
    padding: 13px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 10px);
    background: #fffdfd;
}

.ticket-stats-comparison-card>span {
    color: var(--gray, #777);
    font-size: 12px;
}

.ticket-stats-comparison-card strong {
    color: var(--primary, #7D1515);
    font-size: 19px;
}

.ticket-stats-comparison-card small {
    color: var(--gray, #777);
    font-size: 11px;
}

.ticket-stats-comparison-card .ticket-stats-comparison-change {
    color: var(--dark, #333);
    font-weight: 600;
}

@media (max-width: 640px) {
    .notification-center-page {
        padding: 18px 14px 40px;
    }

    .notification-center-heading,
    .notification-center-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .notification-center-actions {
        justify-content: flex-start;
    }
}

/* Final Hemi refinements: keep them after the shared component rules. */
#assistantContainer {
    position: relative;
    z-index: 1200;
}

#assistantBtn {
    left: 24px;
    right: auto;
    bottom: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #9b2727, #671010);
    box-shadow: 0 12px 30px rgba(103, 16, 16, .28), 0 2px 6px rgba(40, 10, 10, .12);
}

#assistantBtn::after {
    content: "Хэми";
    position: absolute;
    left: calc(100% + 10px);
    padding: 7px 11px;
    border: 1px solid rgba(103, 16, 16, .08);
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    color: #6f1717;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 5px 18px rgba(28, 20, 20, .12);
}

#assistantBtn.assistant-btn-active::after { content: "Закрыть"; }

#assistantPanel {
    width: min(490px, calc(100vw - 40px));
    max-height: min(740px, calc(100vh - 112px));
    border: 1px solid rgba(101, 27, 27, .1);
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(45, 20, 20, .22), 0 4px 14px rgba(45, 20, 20, .08);
}

#assistantPanel .assistant-header {
    min-height: 74px;
    padding: 14px 17px;
    background: linear-gradient(120deg, #fff 0%, #fff 64%, #fff5f2 100%);
    border-bottom-color: #f0e6e3;
}

#assistantPanel .assistant-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
#assistantPanel .assistant-header-avatar { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; overflow: hidden; border: 1px solid rgba(125, 21, 21, .08); border-radius: 13px; background: linear-gradient(145deg, #fff8f5, #f6e6e1); }
#assistantPanel .assistant-header-avatar img { width: 30px; height: 30px; object-fit: contain; }
#assistantPanel .assistant-identity-copy { display: grid; gap: 2px; }
#assistantPanel .assistant-title { color: #481414; font-size: 15px; line-height: 1.2; letter-spacing: -.02em; }
#assistantPanel .assistant-presence { display: flex; align-items: center; gap: 6px; color: #766767; font-size: 10px; line-height: 1.3; }
#assistantPanel .assistant-presence i { width: 6px; height: 6px; border-radius: 50%; background: #3c9a69; box-shadow: 0 0 0 3px rgba(60, 154, 105, .1); }
#assistantPanel .assistant-body { padding: 12px 0 16px; background: linear-gradient(180deg, #fff, #fdfbfa); }

#assistantPanel .assistant-greeting {
    align-items: flex-start;
    text-align: left;
    margin: 8px 14px 12px;
    padding: 17px 18px;
    gap: 8px;
    border: 1px solid #f1e5e1;
    border-radius: 17px;
    background: radial-gradient(circle at top right, rgba(247, 224, 215, .58), transparent 48%), #fff;
}

#assistantPanel .assistant-greeting-icon img { width: 44px; height: 44px; }
#assistantPanel .assistant-greeting-text { color: #321b1b; font-size: 16px; letter-spacing: -.02em; }
#assistantPanel .assistant-greeting-sub { color: #766767; font-size: 12px; line-height: 1.5; }
#assistantPanel .assistant-context-heading { margin: 2px 16px 8px; color: #766767; font-size: 10px; font-weight: 700; letter-spacing: .045em; }
#assistantPanel .assistant-context-heading[hidden] { display: none; }
#assistantPanel .assistant-suggestions { gap: 7px; padding: 0 14px; }

#assistantPanel .assistant-suggestion {
    min-height: 60px;
    padding: 11px 12px;
    border: 1px solid #f0e9e7;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(39, 20, 20, .025);
    transition: border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}

#assistantPanel .assistant-suggestion:hover {
    transform: translateY(-1px);
    border-color: #e3c8c1;
    background: #fffdfc;
    box-shadow: 0 7px 18px rgba(58, 26, 26, .07);
}

#assistantPanel .assistant-suggestion-icon { width: 36px; height: 36px; border-radius: 12px; background: #fbf0ed; color: #811d1d; }
#assistantPanel .assistant-suggestion-label { color: #302222; font-size: 13px; }
#assistantPanel .assistant-suggestion-hint { color: #817171; font-size: 11px; line-height: 1.4; }
#assistantPanel .assistant-suggestion-arrow { color: #a56b65; }
#assistantPanel .assistant-footer { padding: 12px 14px 14px; border-top: 1px solid #f0e7e4; background: rgba(255, 255, 255, .97); }

#assistantPanel .assistant-input-wrapper {
    padding: 5px 6px 5px 14px;
    border: 1px solid #e7d8d4;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(52, 25, 25, .05);
}

#assistantPanel .assistant-input-wrapper:focus-within { border-color: #b56760; box-shadow: 0 0 0 3px rgba(150, 39, 39, .1); }
#assistantPanel .assistant-input { min-height: 40px; color: #302222; }
#assistantPanel .assistant-input-btn { width: 38px; height: 38px; border-radius: 12px; background: #821d1d; }
#assistantPanel .conv-message-content { max-width: 86%; }
#assistantPanel .conv-message-text { border-radius: 15px; line-height: 1.55; }
#assistantPanel .conv-message-bot .conv-message-text { border: 1px solid #f0e7e4; box-shadow: 0 3px 10px rgba(39, 20, 20, .04); }
#assistantPanel .conv-option { border-radius: 12px; border-color: #eadbd7; }

.notification-center-header-back {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 9px;
    padding: 0 15px;
    border: 1px solid rgba(125, 21, 21, .13);
    border-radius: 12px;
    background: #fff;
    color: #721919;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(45, 22, 22, .06);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.notification-center-header-back:hover { transform: translateY(-1px); border-color: rgba(125, 21, 21, .3); box-shadow: 0 7px 20px rgba(45, 22, 22, .1); }
.notification-center-header-back span { font-size: 19px; line-height: 1; }

@media (max-width: 520px) {
    #assistantBtn { left: 16px; right: auto; bottom: 16px; }
    #assistantPanel { left: 12px; bottom: 88px; width: calc(100vw - 24px); max-height: calc(100dvh - 104px); }
}

/* Statistics page: compact, scannable analytics layout inspired by the OpenDesign prototype. */
.ticket-stats-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
        "head head"
        "filters filters"
        "summary summary"
        "kpis kpis"
        "supplemental supplemental"
        "status trend"
        "clients clients"
        "table-title table-title"
        "table table"
        "empty empty"
        "loading loading";
    gap: 0 16px;
    width: 100%;
    max-width: 1512px;
    margin: 0 auto;
    padding: 0 0 36px;
}

.ticket-stats-header { grid-area: head; align-items: flex-end; margin: 0 0 18px; }
.ticket-stats-header .ticket-stats-title { font-size: clamp(25px, 2.4vw, 32px); letter-spacing: -.04em; }
.ticket-stats-header .ticket-stats-description { margin-top: 6px; color: #777174; font-size: 13px; }
.ticket-stats-header .ticket-stats-eyebrow { margin-bottom: 6px; color: #777174; font-size: 11px; letter-spacing: .08em; }
.ticket-stats-filters { grid-area: filters; position: relative; top: auto; z-index: 12; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; margin: 0 0 4px; padding: 16px; border: 1px solid #e8e3e3; border-radius: 12px; box-shadow: 0 3px 12px rgba(35, 25, 25, .035); background: #fff; backdrop-filter: none; }
.ticket-stats-filter-group:nth-child(-n+6) { grid-column: span 2; }
.ticket-stats-filter-group:nth-child(5),
.ticket-stats-filter-group:nth-child(6) { grid-column: span 2; }
.ticket-stats-filter-btn-group { grid-column: span 4; }
.ticket-stats-filter-label { color: #706b6c; font-size: 11px; font-weight: 600; }
.ticket-stats-filter-summary { grid-area: summary; min-height: 0; margin: 8px 0 15px; padding: 0; border: 0; background: none; color: #777174; font-size: 11px; line-height: 1.5; }
.ticket-stats-filter-summary:empty { display: none; }
.ticket-stats-request-error { margin: 0 0 12px; padding: 9px 12px; border: 1px solid #efcaca; border-radius: 8px; background: #fff7f7; color: #8b2424; font-size: 12px; line-height: 1.45; }
.ticket-stats-metrics { grid-area: kpis; margin: 0 0 18px; }
.ticket-stats-page .stats-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ticket-stats-page .stat-metric { min-height: 108px; align-items: flex-start; justify-content: center; padding: 14px 15px; border: 1px solid #e9e4e4; border-top: 2px solid var(--primary) !important; border-radius: 10px; background: #fff; box-shadow: 0 2px 10px rgba(35, 25, 25, .035); text-align: left; }
.ticket-stats-page .stat-metric-icon { display: none; }
.ticket-stats-page .stat-metric-value { margin: 5px 0 0; color: #2f292a; font-size: 24px; font-weight: 720; line-height: 1.15; letter-spacing: -.04em; }
.ticket-stats-page .stat-metric-label { margin-top: 5px; color: #716b6d; font-size: 11px; line-height: 1.35; text-align: left; }
.ticket-stats-comparison { grid-area: comparison; margin: 0 0 12px; padding: 16px; border: 1px solid #e8e3e3; border-radius: 12px; box-shadow: 0 2px 10px rgba(35, 25, 25, .03); }
.ticket-stats-comparison-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.ticket-stats-comparison-card { min-width: 0; padding: 12px; border-radius: 8px; background: #fcfbfb; }
.ticket-stats-comparison-card strong { font-size: 18px; }
.ticket-stats-sla { grid-area: supplemental; margin: 0 0 14px; padding: 14px 16px; border: 1px solid #e8e3e3; border-radius: 12px; background: #fff; box-shadow: 0 2px 10px rgba(35, 25, 25, .03); }
.ticket-stats-sla .ticket-stats-breakdown-title { margin-bottom: 10px; }
.ticket-stats-sla-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.ticket-stats-sla-card { padding: 12px 14px; border: 1px solid #eee9e9; border-radius: 8px; background: #fcfbfb; }
.ticket-stats-breakdown { grid-area: status; align-self: stretch; margin: 0 0 16px; padding: 16px; border: 1px solid #e8e3e3; border-radius: 12px; background: #fff; box-shadow: 0 2px 10px rgba(35, 25, 25, .03); }
.ticket-stats-timeline { grid-area: trend; align-self: stretch; margin: 0 0 16px; padding: 16px; border: 1px solid #e8e3e3; border-radius: 12px; background: #fff; box-shadow: 0 2px 10px rgba(35, 25, 25, .03); }
.ticket-stats-clients { grid-area: clients; min-width: 0; max-height: 580px; overflow: hidden; margin: 0 0 16px; padding: 14px 16px; border: 1px solid #e8e3e3; border-radius: 12px; background: #fff; box-shadow: 0 2px 10px rgba(35, 25, 25, .03); }
.ticket-stats-clients-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.ticket-stats-clients-header .ticket-stats-breakdown-title { margin: 0 0 4px; }
.ticket-stats-clients-note { margin: 0; color: #777172; font-size: 12px; }
.ticket-stats-clients-granularity { display: flex; align-items: center; gap: 8px; color: #706b6c; font-size: 12px; white-space: nowrap; }
.ticket-stats-clients-granularity .ticket-stats-select { min-width: 190px; }
.ticket-stats-client-org-list { max-height: 460px; overflow: auto; border: 1px solid #eee9e9; border-radius: 9px; }
.ticket-stats-client-org { border-bottom: 1px solid #eee9e9; background: #fff; }
.ticket-stats-client-org:last-child { border-bottom: 0; }
.ticket-stats-client-org > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 54px; padding: 9px 13px; cursor: pointer; list-style: none; }
.ticket-stats-client-org > summary::-webkit-details-marker { display: none; }
.ticket-stats-client-org > summary::before { content: '›'; color: #8b7778; font-size: 20px; transition: transform .15s ease; }
.ticket-stats-client-org[open] > summary::before { transform: rotate(90deg); }
.ticket-stats-client-org-name { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.ticket-stats-client-org-name strong { overflow: hidden; color: #342e2f; font-size: 12px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.ticket-stats-client-org-name small { color: #898183; font-size: 10px; }
.ticket-stats-client-org-count { min-width: 64px; color: #7d1515; font-size: 18px; font-weight: 720; text-align: right; }
.ticket-stats-client-org-count small { display: block; color: #898183; font-size: 9px; font-weight: 500; }
.ticket-stats-client-org-content { padding: 0 12px 12px 34px; }
.ticket-stats-client-periods { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 10px; }
.ticket-stats-client-period { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 6px 9px; border: 1px solid #eee9e9; border-radius: 7px; background: #fcfbfb; color: #716b6d; font-size: 10px; }
.ticket-stats-client-period strong { color: #342e2f; font-size: 11px; }
.ticket-stats-client-users { overflow-x: auto; border: 1px solid #f0eded; border-radius: 7px; }
.ticket-stats-client-user-row { display: grid; grid-template-columns: 240px repeat(var(--client-period-count, 1), 76px); width: max-content; min-width: 100%; }
.ticket-stats-client-user-row > span { padding: 7px 9px; border-bottom: 1px solid #f2eeee; color: #5e5859; font-size: 10px; text-align: right; }
.ticket-stats-client-user-row > span:first-child { min-width: 0; text-align: left; }
.ticket-stats-client-user-head > span { background: #faf9f9; color: #777172; font-weight: 650; }
.ticket-stats-client-user-row:last-child > span { border-bottom: 0; }
.ticket-stats-page .ticket-stats-breakdown-title { margin-bottom: 10px; color: #342e2f; font-size: 13px; font-weight: 680; }
.ticket-stats-breakdown-items,
.ticket-stats-timeline-items { grid-template-columns: 1fr; gap: 8px; }
.ticket-stats-breakdown-action { padding: 7px; border-radius: 7px; }
.ticket-stats-breakdown-track,
.ticket-stats-timeline-track { height: 6px; background: #f0eeee; }
.ticket-stats-breakdown-label,
.ticket-stats-timeline-label { margin-bottom: 4px; font-size: 11px; }
.ticket-stats-timeline-note { margin-top: 10px; font-size: 11px; line-height: 1.45; }
.ticket-stats-table-title { grid-area: table-title; margin: 4px 0 10px; color: #342e2f; font-size: 15px; font-weight: 700; }
.ticket-stats-table-wrapper { grid-area: table; overflow-x: auto; border: 1px solid #e8e3e3; border-radius: 10px; background: #fff; box-shadow: 0 2px 10px rgba(35, 25, 25, .03); }
.ticket-stats-table { min-width: 900px; }
.ticket-stats-table thead { background: #faf9f9; }
.ticket-stats-table th { padding: 11px 12px; color: #706b6c; font-size: 10px; letter-spacing: .02em; }
.ticket-stats-table td { padding: 11px 12px; font-size: 11px; }
.ticket-stats-table tbody tr:hover { background: #fcf9f9; }
.ticket-stats-page .ticket-stats-empty { grid-area: empty; margin-top: 10px; }
.ticket-stats-page .ticket-stats-loading { grid-area: loading; padding: 16px; color: #777174; font-size: 12px; }

@media (max-width: 1100px) {
    .ticket-stats-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ticket-stats-filter-group:nth-child(-n+6) { grid-column: span 1; }
    .ticket-stats-filter-btn-group { grid-column: span 2; }
    .ticket-stats-page .stats-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ticket-stats-comparison-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
.ticket-stats-page { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "filters" "summary" "kpis" "supplemental" "status" "trend" "clients" "table-title" "table" "empty" "loading"; padding-bottom: 28px; }
    .ticket-stats-header { align-items: flex-start; flex-direction: row; gap: 12px; margin-bottom: 14px; }
    .ticket-stats-header .ticket-stats-title { font-size: 23px; }
    .ticket-stats-header .context-help-label { display: none; }
    .ticket-stats-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 13px; }
    .ticket-stats-filter-group:nth-child(1), .ticket-stats-filter-group:nth-child(4) { grid-column: span 2; }
    .ticket-stats-filter-group:nth-child(2), .ticket-stats-filter-group:nth-child(3),
    .ticket-stats-filter-group:nth-child(5), .ticket-stats-filter-group:nth-child(6) { grid-column: span 1; }
    .ticket-stats-filter-btn-group { grid-column: span 2; }
    .ticket-stats-filter-actions { display: grid; grid-template-columns: 1fr auto; }
    .ticket-stats-page .stats-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .ticket-stats-page .stat-metric { min-height: 96px; padding: 12px; }
    .ticket-stats-page .stat-metric-value { font-size: 21px; }
    .ticket-stats-comparison-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ticket-stats-sla-grid { grid-template-columns: 1fr; }
    .ticket-stats-clients-header { align-items: flex-start; flex-direction: column; }
    .ticket-stats-clients-granularity { width: 100%; justify-content: space-between; }
    .ticket-stats-clients-granularity .ticket-stats-select { min-width: 0; max-width: 68%; }
    .ticket-stats-client-org-content { padding-left: 12px; }
    .ticket-stats-breakdown-items { grid-template-columns: 1fr; }
    .ticket-stats-table-title { margin-top: 0; }
}

@media (max-width: 390px) {
    .ticket-stats-header .ticket-stats-title { font-size: 21px; }
    .ticket-stats-page .stat-metric-value { font-size: 19px; }
    .ticket-stats-filter-actions .btn-action-v { min-height: 39px; padding: 8px 10px; }
}

.ticket-stats-page .stat-metric-hint { margin-top: 5px; color: #8a8284; font-size: 10px; line-height: 1.4; }
.ticket-stats-recent-events { grid-column: 1 / -1; margin-top: 4px; padding-top: 14px; border-top: 1px solid #eee9e9; }
.ticket-stats-recent-events h3 { margin: 0 0 8px; font-size: 12px; }
.ticket-stats-recent-events ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ticket-stats-recent-events li { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; color: #4b4547; font-size: 11px; }
.ticket-stats-recent-events time, .ticket-stats-recent-events small { color: #827a7c; }
@media (max-width: 680px) { .ticket-stats-recent-events li { grid-template-columns: 1fr; gap: 2px; } }
.ticket-stats-compare-form { display: grid; gap: 16px; }
.ticket-stats-compare-form > p { margin: 0; color: #62595b; line-height: 1.5; }
.ticket-stats-compare-current { padding: 12px 14px; border-radius: 10px; background: #f8f5f5; color: #4b2024; font-weight: 650; }
.ticket-stats-compare-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ticket-stats-compare-dates label { display: grid; gap: 7px; color: #51494b; font-size: 13px; font-weight: 600; }
.ticket-stats-compare-error { color: #a3212c !important; font-size: 13px; }
.ticket-stats-compare-form .ticket-stats-filter-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ticket-stats-modal-comparison { padding-top: 14px; border-top: 1px solid #eee9e9; }
.ticket-stats-modal-comparison h2 { margin: 0 0 10px; color: #342e2f; font-size: 15px; }
.ticket-stats-modal-comparison .ticket-stats-comparison-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .ticket-stats-compare-dates { grid-template-columns: 1fr; } }
.admin-checkbox-row { display: flex; align-items: center; gap: 9px; margin: 14px 0; color: #4b4547; font-size: 13px; }
