/* TicketApp365 — professional design system */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --app-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --app-primary: #2563eb;
    --app-primary-hover: #1d4ed8;
    --app-primary-soft: #eff6ff;
    --app-accent: #0d9488;
    --app-accent-soft: #ccfbf1;
    --app-sidebar-bg: #0f172a;
    --app-sidebar-bg-hover: #1e293b;
    --app-sidebar-text: #94a3b8;
    --app-sidebar-text-active: #f8fafc;
    --app-sidebar-width: 268px;
    --app-header-height: 58px;
    --app-bg: #f1f5f9;
    --app-surface: #ffffff;
    --app-border: #e2e8f0;
    --app-text: #0f172a;
    --app-text-muted: #64748b;
    --app-radius: 12px;
    --app-radius-sm: 8px;
    --app-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --app-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
    --app-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.06);
    --bs-primary: var(--app-primary);
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-font-family: var(--app-font);
    --bs-body-color: var(--app-text);
    --bs-body-bg: var(--app-bg);
    --bs-border-color: var(--app-border);
    --bs-link-color: var(--app-primary);
    --bs-link-hover-color: var(--app-primary-hover);
}

body {
    font-family: var(--app-font);
    color: var(--app-text);
    background: var(--app-bg);
    -webkit-font-smoothing: antialiased;
}

/* —— Sidebar —— */
.app-sidebar {
    width: var(--app-sidebar-width);
    background: var(--app-sidebar-bg);
    border-right: none;
    padding: 0.35rem 0.6rem 0.6rem;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
    height: 100vh;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-brand {
    color: #f8fafc !important;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
    border-radius: var(--app-radius-sm);
    transition: background 0.15s ease;
}

.sidebar-brand:hover {
    background: var(--app-sidebar-bg-hover);
    color: #f8fafc !important;
}

.sidebar-brand i {
    color: #38bdf8;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    gap: 0.05rem;
    padding-top: 0;
}

.sidebar-section-title {
    color: #64748b;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    margin: 0.5rem 0.7rem 0.2rem;
}

.sidebar-divider {
    height: 1px;
    margin: 0.45rem 0.55rem;
    background: rgba(148, 163, 184, 0.22);
    flex-shrink: 0;
}

.sidebar-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: 0;
    background: transparent;
    color: #94a3b8;
    padding: 0.4rem 0.7rem;
    margin: 0.15rem 0 0.05rem;
    border-radius: var(--app-radius-sm);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-group-toggle:hover {
    background: var(--app-sidebar-bg-hover);
    color: #e2e8f0;
}

.sidebar-group-label {
    display: inline-flex;
    align-items: center;
}

.sidebar-group-chevron {
    font-size: 0.7rem;
    opacity: 0.85;
    transition: transform 0.2s ease;
}

.sidebar-group-toggle:not(.collapsed) .sidebar-group-chevron {
    transform: rotate(180deg);
}

.sidebar-group-collapse {
    overflow: hidden;
}

.sidebar-group-links {
    display: flex;
    flex-direction: column;
    gap: 0.02rem;
    padding: 0.1rem 0 0.15rem 0.35rem;
}

.sidebar-link {
    color: var(--app-sidebar-text);
    padding: 0.42rem 0.7rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--app-radius-sm);
    margin: 0.02rem 0;
    line-height: 1.25;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link-nested {
    padding: 0.36rem 0.65rem 0.36rem 0.85rem;
    font-size: 0.84rem;
}

.sidebar-link i {
    opacity: 0.9;
    width: 1.15rem;
    font-size: 0.95rem;
}

.sidebar-link:hover {
    background: var(--app-sidebar-bg-hover);
    color: #e2e8f0;
}

.sidebar-link.active {
    background: transparent;
    color: var(--app-sidebar-text-active);
    font-weight: 600;
    box-shadow: none;
}

.app-shell.sidebar-collapsed .sidebar-divider,
.app-shell.sidebar-collapsed .sidebar-group-toggle,
.app-shell.sidebar-collapsed .sidebar-group-collapse {
    display: none !important;
}

/* —— Header —— */
.app-header {
    background: var(--app-surface) !important;
    border-bottom: 1px solid var(--app-border) !important;
    box-shadow: var(--app-shadow-sm);
    height: var(--app-header-height);
    min-height: var(--app-header-height);
    max-height: var(--app-header-height);
    flex-shrink: 0;
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    height: 100%;
    min-height: unset;
    padding: 0 1.25rem;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    flex-shrink: 0;
}

.header-datetime-help {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-datetime {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--app-text);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.2;
}

.header-datetime-icon {
    color: #2563eb;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.header-datetime-text {
    letter-spacing: -0.01em;
    color: #334155;
}

.header-center-divider {
    display: inline-block;
    width: 1px;
    height: 1.75rem;
    background: #cbd5e1;
    flex-shrink: 0;
}

.header-help-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border: 1.5px solid #38bdf8;
    border-radius: 50%;
    background: #f0f9ff;
    color: #0284c7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.header-help-btn:hover {
    background: #e0f2fe;
    border-color: #0ea5e9;
    color: #0369a1;
}

.header-user-block {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.header-user-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    line-height: 1.2;
    min-width: 0;
    max-width: 220px;
}

.header-user-meta {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--app-text) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.header-profile-dropdown .dropdown-toggle::after {
    display: none;
}

.header-avatar-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--app-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.header-avatar-btn:hover,
.header-avatar-btn:focus {
    background: var(--app-primary-hover);
    color: #fff;
}

.header-avatar-initial {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

.header-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-profile-menu {
    min-width: 200px;
    padding: 0.35rem 0;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    margin-top: 0.35rem !important;
}

.header-profile-menu .dropdown-item {
    font-size: 0.875rem;
    padding: 0.45rem 1rem;
    display: flex;
    align-items: center;
}

.header-profile-menu .dropdown-item i {
    opacity: 0.85;
}

.header-sign-out-btn {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: #dc3545 !important;
    font-weight: 500;
}

.header-sign-out-btn:hover,
.header-sign-out-btn:focus {
    background: #fde8ea;
    color: #b02a37 !important;
}

.app-header-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--app-text, #0f172a);
    text-decoration: none;
    line-height: 1.2;
    min-width: 0;
}

.app-header-brand:hover {
    color: var(--app-primary, #0d6efd);
}

.app-header-brand i {
    color: var(--app-primary, #0d6efd);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.app-header-brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(280px, 40vw);
}

.app-content {
    background: var(--app-bg) !important;
}

.sidebar-toggle-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    border-radius: var(--app-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.sidebar-toggle-btn:hover {
    background: var(--app-primary-soft);
    border-color: #bfdbfe;
    color: var(--app-primary);
}

.public-header {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-sm);
    height: var(--app-header-height);
    min-height: var(--app-header-height);
}

.public-header-inner {
    height: 100%;
    padding-top: 0;
    padding-bottom: 0;
}

.public-header .fs-5 {
    font-size: 1rem !important;
    margin: 0;
}

.public-header .btn-sm {
    height: 34px;
    padding: 0 0.85rem;
    display: inline-flex;
    align-items: center;
    font-size: 0.8125rem;
}

/* —— Buttons —— */
.btn-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
    font-weight: 600;
    border-radius: var(--app-radius-sm);
    padding: 0.45rem 1rem;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--app-primary-hover);
    border-color: var(--app-primary-hover);
}

.btn-outline-primary {
    color: var(--app-primary);
    border-color: #93c5fd;
    font-weight: 500;
    border-radius: var(--app-radius-sm);
}

.btn-outline-primary:hover {
    background: var(--app-primary-soft);
    border-color: var(--app-primary);
    color: var(--app-primary-hover);
}

.btn {
    border-radius: var(--app-radius-sm);
    font-weight: 500;
}

/* —— Page layout —— */
.page-shell {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.65rem 1.5rem 2rem;
}

.breadcrumb {
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    margin-top: 0;
}

.page-header-title {
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 0.25rem;
    color: var(--app-text);
}

.page-header-subtitle {
    margin: 0;
    color: var(--app-text-muted);
    font-size: 0.9rem;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* —— Cards —— */
.app-card,
.card.app-card,
.stat-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--app-shadow);
}

.stat-card-clickable {
    cursor: pointer;
    user-select: none;
}

.stat-card-clickable:focus-visible {
    outline: 2px solid var(--app-primary, #0d6efd);
    outline-offset: 2px;
}

.stat-card-clickable.stat-card-active {
    box-shadow: var(--app-shadow);
    border-color: var(--app-primary, #0d6efd);
}

.stat-card-clickable.stat-card-active .stat-card-label {
    color: var(--app-primary, #0d6efd);
}

.stat-card .card-body {
    padding: 1.25rem 1.35rem;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--app-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.stat-card-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--app-text-muted);
    margin-bottom: 0.15rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0;
}

.stat-card .progress {
    height: 5px;
    border-radius: 99px;
    background: #f1f5f9;
}

.app-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--app-border);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.app-card .card-body {
    padding: 1.25rem;
}

/* —— Tables —— */
.table-app,
.table {
    --bs-table-bg: transparent;
}

.table-app thead th,
.table thead th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-muted);
    border-bottom-width: 1px;
    padding: 0.75rem 1rem;
    background: #f8fafc;
}

.table-app tbody td,
.table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: var(--app-border);
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

/* —— Forms —— */
.form-control,
.form-select {
    border-radius: var(--app-radius-sm);
    border-color: var(--app-border);
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--app-text-muted);
}

/* —— Alerts —— */
.alert {
    border-radius: var(--app-radius-sm);
    border: none;
    font-size: 0.9rem;
}

.alert-success {
    background: #ecfdf5;
    color: #047857;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
}

/* —— Badges —— */
.badge {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* —— Avatars —— */
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--app-primary-soft);
    color: var(--app-primary);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-circle-sm {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
}

/* —— Insight banner —— */
.app-banner {
    background: linear-gradient(135deg, #1e40af 0%, var(--app-primary) 55%, var(--app-accent) 100%);
    border: none;
    box-shadow: var(--app-shadow);
}

.progress-thin {
    height: 6px;
    border-radius: 99px;
}

/* —— Filter sidebar (tickets) —— */
.filter-sidebar {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
    padding: 1.25rem;
}

@media (min-width: 992px) {
    .filter-sidebar {
        position: sticky;
        top: 1rem;
        max-height: none;
        overflow: visible;
    }
}

/* —— Ticket list rows (reference layout, compact) —— */
.tickets-results-panel {
    width: 100%;
}

.ticket-list-compact {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.ticket-row-card {
    display: flex;
    align-items: center;
    gap: 0.5rem 0.65rem;
    padding: 0.4rem 0.6rem 0.4rem 0.45rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-left: 4px solid #1abc9c;
    border-radius: var(--app-radius-sm);
    box-shadow: var(--app-shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.ticket-row-card:hover {
    box-shadow: var(--app-shadow);
}

.ticket-row-card--clickable {
    cursor: pointer;
}

.ticket-row-card--clickable:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
}

.ticket-row-check {
    padding-top: 0.35rem;
    margin: 0;
}

.ticket-row-check .form-check-input {
    width: 0.9rem;
    height: 0.9rem;
    margin: 0;
}

.ticket-row-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #22d3ee;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.ticket-row-body {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 0.05rem;
}

.ticket-row-title-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
    line-height: 1.25;
}

.ticket-row-title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--app-primary);
    text-decoration: none;
}

.ticket-row-title:hover {
    color: var(--app-primary-hover);
    text-decoration: underline;
}

.ticket-row-id {
    font-size: 0.75rem;
    color: var(--app-text-muted);
    font-weight: 500;
}

.ticket-row-meta-line,
.ticket-row-sla-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    color: var(--app-text-muted);
    line-height: 1.35;
    margin-top: 0.12rem;
}

.ticket-row-sep {
    opacity: 0.45;
}

.ticket-row-sla-line strong {
    font-weight: 600;
    color: var(--app-text);
}

.ticket-row-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    flex: 0 0 auto;
    min-width: 8.5rem;
    max-width: 10.5rem;
    padding-top: 0.05rem;
}

.ticket-row-priority {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.65rem;
    padding: 0.2em 0.55em;
}

.ticket-row-priority .bi-circle-fill {
    font-size: 0.4rem;
}

.ticket-row-side > .badge:last-child {
    font-size: 0.65rem;
    padding: 0.25em 0.55em;
}

.ticket-row-assign {
    width: 100%;
    margin: 0;
}

.ticket-row-assign .ticket-agent-select {
    width: 100%;
    max-width: none;
    font-size: 0.6875rem;
    padding: 0.15rem 1.5rem 0.15rem 0.4rem;
    min-height: 26px;
    background: #f1f5f9;
    border-color: var(--app-border);
}

/* —— Ticket grid card —— */
.ticket-grid-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ticket-grid-card:hover {
    box-shadow: var(--app-shadow);
    transform: translateY(-2px);
}

.ticket-grid-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0;
}

.ticket-grid-card-body {
    padding: 0.65rem 1rem 0.75rem;
    flex: 1;
}

.ticket-grid-title {
    display: block;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--app-text);
    text-decoration: none;
    line-height: 1.35;
    margin-bottom: 0.2rem;
}

.ticket-grid-title:hover {
    color: var(--app-primary);
}

.ticket-grid-id {
    font-size: 0.75rem;
    color: var(--app-text-muted);
    font-weight: 500;
}

.ticket-grid-desc {
    font-size: 0.8125rem;
    color: var(--app-text-muted);
    margin: 0.5rem 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
}

.ticket-grid-card-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--app-border);
    background: #f8fafc;
    font-size: 0.8125rem;
    margin-top: auto;
}

.ticket-grid-assign .form-label {
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
}

.ticket-grid-assign .ticket-agent-select {
    width: 100%;
    max-width: none;
    background: var(--app-surface);
}

.ticket-grid-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.35rem;
    color: var(--app-text-muted);
    margin-bottom: 0.35rem;
}

.ticket-grid-assignee {
    margin-bottom: 0.25rem;
}

.ticket-grid-sla-line {
    margin-top: 0.35rem;
    margin-bottom: 0.15rem;
}

/* —— Status & priority badges —— */
.badge-status-new { background: #f1f5f9; color: #475569; }
.badge-status-open { background: #dcfce7; color: #15803d; }
.badge-status-progress { background: #fbbf24; color: #1f2937; }
.badge-status-pending { background: #e0e7ff; color: #4338ca; }
.badge-status-resolved { background: #cffafe; color: #0e7490; }
.badge-status-closed { background: #e2e8f0; color: #334155; }
.badge-status-hold { background: #f3e8ff; color: #7c3aed; }
.badge-status-default { background: #f1f5f9; color: #64748b; }

.badge-priority-low { background: #ecfdf5; color: #047857; }
.badge-priority-medium { background: #fff7ed; color: #c2410c; }
.badge-priority-high { background: #fef2f2; color: #b91c1c; }
.badge-priority-urgent { background: #dc2626; color: #fff; }
.badge-priority-default { background: #f1f5f9; color: #64748b; }

/* —— Pagination —— */
.ticket-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.85rem 1rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
}

.ticket-pagination .pagination .page-link {
    border-radius: var(--app-radius-sm);
    color: var(--app-text);
    min-width: 2rem;
    text-align: center;
}

.ticket-pagination .page-item.active .page-link {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.ticket-subject {
    color: var(--app-text);
    text-decoration: none;
    font-weight: 600;
}

.ticket-subject:hover {
    color: var(--app-primary-hover);
}

.ticket-id {
    color: var(--app-text-muted);
    font-weight: 500;
}

.ticket-agent-select {
    min-width: 11rem;
    background: #f8fafc;
    border-color: #dbeafe;
}

.ticket-actions {
    min-width: 11rem;
}

/* —— Auth pages —— */
.auth-page {
    width: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 920px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    overflow: hidden;
    box-shadow: var(--app-shadow-lg);
}

.auth-card-aside {
    background: linear-gradient(145deg, #1e3a8a 0%, #2563eb 50%, #0d9488 100%);
    color: #fff;
    padding: 2.5rem 2rem;
}

.auth-card-aside h2 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-card-form {
    padding: 2rem 2.25rem;
    background: var(--app-surface);
}

/* —— Footer —— */
.app-footer {
    font-size: 0.8rem;
    color: var(--app-text-muted);
    border-top: 1px solid var(--app-border) !important;
}

.app-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.app-footer-left {
    text-align: left;
}

.app-footer-right {
    margin-left: auto;
    text-align: right;
    color: var(--app-text-muted);
    font-size: 0.8rem;
}

@media (max-width: 575.98px) {
    .app-footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-footer-right {
        margin-left: 0;
        text-align: left;
    }
}

/* —— Loader (above header/footer z-index 1101; modals hide loader via JS) —— */
#loader-wrapper {
    background: rgba(241, 245, 249, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1200;
}

#nprogress .bar {
    background: var(--app-primary) !important;
    height: 3px !important;
}

/* —— Responsive —— */
@media (max-width: 991.98px) {
    .page-shell {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .btn,
    .page-header-actions form {
        flex: 1 1 auto;
    }

    .app-header-right {
        gap: 0.5rem;
    }

    .header-datetime-help {
        display: none !important;
    }

    .header-user-text {
        display: none !important;
    }

    .app-sidebar {
        width: min(280px, 88vw);
        overflow: hidden;
    }

    .sidebar-link,
    .sidebar-link-nested {
        padding-top: 0.4rem;
        padding-bottom: 0.4rem;
    }
}

@media (max-width: 575.98px) {
    .page-header-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    .auth-card-form {
        padding: 1.5rem 1.25rem;
    }

    .ticket-row-card {
        flex-wrap: wrap;
        padding: 0.5rem 0.6rem;
    }

    .ticket-row-side {
        width: 100%;
        max-width: none;
        min-width: 0;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 0.35rem;
    }

    .ticket-row-assign {
        flex: 1 1 100%;
    }

    .ticket-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .ticket-pagination .pagination {
        justify-content: center;
    }
}

@media (min-width: 1400px) {
    .app-main .container-fluid {
        padding-left: 1.75rem !important;
        padding-right: 1.75rem !important;
    }
}

/* —— Guidance Hub (contextual help panel) —— */
.guidance-hub-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1190;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.guidance-hub-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.guidance-hub-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(400px, 92vw);
    height: 100vh;
    max-height: 100dvh;
    background: #fff;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.15);
    transform: translateX(100%);
    transition: transform 0.28s ease;
    overflow: hidden;
}

.guidance-hub-panel.is-open {
    transform: translateX(0);
}

.guidance-hub-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    background: #2563eb;
    color: #fff;
    flex-shrink: 0;
}

.guidance-hub-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.guidance-hub-title-row i {
    font-size: 1.25rem;
    opacity: 0.95;
}

.guidance-hub-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
}

.guidance-hub-subtitle {
    font-size: 0.8125rem;
    opacity: 0.92;
    margin-top: 0.2rem;
    padding-left: 1.75rem;
}

.guidance-hub-close {
    border: none;
    background: transparent;
    color: #fff;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.35rem;
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
}

.guidance-hub-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.guidance-hub-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.15rem 1.5rem;
}

.guidance-hub-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #2563eb;
    margin: 0 0 0.5rem;
}

.guidance-hub-view-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.65rem;
    line-height: 1.35;
}

.guidance-hub-description {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.55;
    margin: 0;
}

.guidance-hub-divider {
    margin: 1.1rem 0;
    border-color: #e2e8f0;
    opacity: 1;
}

.guidance-hub-capabilities-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #475569;
    margin: 0 0 0.75rem;
}

.guidance-hub-capabilities li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #334155;
    line-height: 1.45;
    margin-bottom: 0.65rem;
}

.guidance-hub-capabilities li:last-child {
    margin-bottom: 0;
}

.guidance-hub-capabilities li i {
    color: #22c55e;
    font-size: 0.95rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

body.guidance-hub-open {
    overflow: hidden;
}

/* Grid tables: row actions in the first column (segmented view / edit / delete) */
th.grid-actions-col,
td.grid-actions-col {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
}

.grid-action-group {
    display: inline-flex;
    flex-wrap: nowrap;
    border: 1px solid #ced4da;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.grid-action-group .grid-action-btn,
.grid-action-group .grid-action-form .grid-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: none;
    border-right: 1px solid #ced4da;
    background: #f8f9fa;
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.grid-action-group > .grid-action-btn:last-child,
.grid-action-group > .grid-action-form:last-child .grid-action-btn,
.grid-action-group > .grid-action-form:last-child {
    border-right: none;
}

.grid-action-form {
    display: inline-flex;
    margin: 0;
}

.grid-action-view {
    color: #17a2b8;
}

.grid-action-view:hover {
    background: #e8f6f8;
    color: #138496;
}

.grid-action-edit {
    color: #0d6efd;
}

.grid-action-edit:hover {
    background: #e7f1ff;
    color: #0a58ca;
}

.grid-action-delete {
    color: #dc3545;
}

.grid-action-delete:hover {
    background: #fde8ea;
    color: #b02a37;
}

/* —— Print: show full scrollable content (not viewport-clipped) —— */
@media print {
    @page {
        margin: 10mm;
    }

    *,
    *::before,
    *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html,
    body {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        background: #fff !important;
    }

    body:has(.app-shell),
    body:has(.public-shell) {
        height: auto !important;
        overflow: visible !important;
    }

    .app-shell,
    .app-main,
    .app-content,
    .app-content-home,
    .app-home-container,
    .public-shell,
    .public-main,
    .public-content,
    .public-home-container,
    .page-shell,
    .container,
    .container-fluid {
        display: block !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        flex: none !important;
    }

    .app-sidebar,
    .sidebar-backdrop,
    .app-header,
    .public-header,
    .app-footer,
    .public-home-footer,
    #loader-wrapper,
    #nprogress,
    .guidance-hub-backdrop,
    .guidance-hub-panel,
    .sidebar-toggle-btn,
    .no-print,
    .print-hide {
        display: none !important;
    }

    .page-header-actions,
    .header-profile,
    .header-datetime-help,
    .breadcrumb {
        display: none !important;
    }

    form.print-hide,
    .card.print-hide,
    .card.app-card:has(form[method="get"]) {
        display: none !important;
    }

    button,
    .btn {
        display: none !important;
    }

    .table-responsive,
    .card,
    .row,
    .col,
    [class*="col-"] {
        overflow: visible !important;
        max-height: none !important;
    }

    .shadow,
    .shadow-sm {
        box-shadow: none !important;
    }

    .report-print-banner {
        display: block !important;
    }

    .report-block {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }

    .report-block-heading {
        border-bottom-color: #000 !important;
    }

    .report-chart-wrap,
    .report-chart-wrap--compact,
    .report-chart-wrap--wide {
        height: auto !important;
        min-height: 160px;
        page-break-inside: avoid;
    }

    .report-chart-wrap canvas {
        width: 100% !important;
        max-height: none !important;
    }

    table {
        width: 100% !important;
    }

    thead {
        display: table-header-group;
    }

    tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
