/* Файл: app/static/style.css - Общие стили */

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f8fafc;
    color: #0f172a;
    margin: 0;
    padding: 0;
}


.modal-dialog.modal-dialog--wide {
    width: min(960px, 95vw);
}

.filters-card.compact {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.year-filter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.year-filter label {
    font-weight: 600;
    color: #0f172a;
}

.year-filter select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #d0d5dd;
    background: #f9fafb;
    font-family: inherit;
}

.classification-select {
    width: 160px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d0d5dd;
    background: #fff;
    font-family: inherit;
}

.classification-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.ticket-description {
    margin-bottom: 8px;
}

.requalify-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #f97316;
    background: #fff7ed;
    color: #c2410c;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

.requalify-btn:hover:not(:disabled) {
    background: #ffedd5;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

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

.secondary-button {
    background: #f1f5f9;
    color: #1f2933;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

.secondary-button:hover {
    background: #e2e8f0;
    box-shadow: 0 6px 16px rgba(148, 163, 184, 0.35);
}

.classification-actions button {
    padding: 6px 12px;
}

.table-search {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.table-search label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    color: #475467;
    gap: 4px;
}

.table-search input {
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    font-family: inherit;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.pagination-controls button {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.pagination-info {
    color: #475467;
    font-weight: 600;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #10b981;
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    font-weight: 600;
    z-index: 1001;
}

.modal-backdrop[hidden] {
    display: none !important;
}

.analytics-body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f7fb;
    color: #1f2933;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.analytics-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 36px 12px;
    border-bottom: 1px solid #e4e7ec;
    background: #ffffff;
}

.analytics-header h1 {
    margin: 0;
    color: #0f172a;
    font-size: 1.0rem;
}

.analytics-header p {
    margin: 4px 0 0;
    color: #64748b;
}

.analytics-header nav a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.analytics-container {
    padding: 28px 48px 60px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.filters-card {
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.filters-card h2 {
    margin-top: 0;
    color: #0f172a;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filter-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    color: #475467;
}

.filter-grid input,
.filter-grid select {
    background: #f9fafb;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    color: #1f2933;
    padding: 10px;
    font-family: inherit;
}

.filter-grid select {
    min-height: 90px;
}

.filter-grid .full-width {
    grid-column: 1 / -1;
}

.filter-pair {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.filter-pair input[type="text"] {
    border-radius: 6px;
    padding: 8px 10px;
    border: 1px solid #d0d5dd;
    margin-bottom: 6px;
    background: #fff;
    font-size: 0.9rem;
}

.filter-actions {
    display: flex;
    gap: 12px;
}

.analytics-container button {
    background: #2563eb;
    border: 1px solid #1d4ed8;
    color: #ffffff;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.analytics-container button:hover {
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

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

.summary-card {
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    padding: 18px;
    min-height: 120px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.summary-label {
    margin: 0 0 6px;
    font-size: 0.85rem;
    color: #64748b;
}

.summary-value {
    margin: 0;
    font-size: 2rem;
    color: #0f172a;
}

.summary-value.small {
    font-size: 1rem;
    word-break: break-word;
}

.summary-sub {
    margin: 8px 0 0;
    color: #10b981;
}

.comparison-card {
    border-color: #c7d2fe;
}

.analytics-module {
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.analytics-module header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.analytics-module h2 {
    margin: 0 0 4px;
    color: #0f172a;
}

.analytics-module p {
    margin: 0;
    color: #64748b;
}

.module-content.split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.table-wrapper,
.chart-wrapper {
    background: #f8fafc;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 12px;
    overflow-x: auto;
}

.table-wrapper.scrollable {
    max-height: 480px;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table thead {
    background: #f1f5f9;
}

table th,
table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e4e7ec;
    text-align: left;
}

.pivot-table thead th,
.pivot-table tbody td {
    white-space: nowrap;
}

.pivot-table thead th {
    position: sticky;
    top: 0;
    background: #f1f5f9;
}

.pivot-table tfoot td {
    font-weight: 600;
    background: #eef2ff;
}

table tbody tr:hover {
    background: #eff6ff;
}

.analytics-module.muted {
    border: 1px dashed #d0d5dd;
    color: #94a3b8;
    background: #fdfdfd;
}

#heatmap-module .heatmap-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: #475467;
}

.legend-scale {
    display: flex;
    gap: 4px;
}

.legend-swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: #e2e8f0;
}

.legend-swatch[data-level="0"] { background: #e2e8f0; }
.legend-swatch[data-level="1"] { background: #c6f6d5; }
.legend-swatch[data-level="2"] { background: #9ae6b4; }
.legend-swatch[data-level="3"] { background: #68d391; }
.legend-swatch[data-level="4"] { background: #38a169; }
.legend-swatch[data-level="5"] { background: #047857; }

.heatmap-container {
    overflow-x: auto;
}

.heatmap-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 640px;
}

.heatmap-months {
    display: grid;
    gap: 4px;
    font-size: 0.75rem;
    color: #475467;
    font-weight: 600;
    margin-left: 56px;
}

.heatmap-body {
    display: flex;
    gap: 12px;
}

.heatmap-weekday-labels {
    display: grid;
    grid-template-rows: repeat(7, 24px);
    gap: 4px;
    font-size: 0.8rem;
    color: #475467;
    text-align: right;
    min-width: 48px;
}

.heatmap-week-columns {
    display: grid;
    gap: 4px;
    grid-auto-flow: column;
}

.heatmap-week-column {
    display: grid;
    grid-template-rows: repeat(7, 24px);
    gap: 4px;
}

.heatmap-cell {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #e2e8f0;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.heatmap-cell.empty {
    opacity: 0.15;
}

.heatmap-cell[data-level="1"] { background: #c6f6d5; }
.heatmap-cell[data-level="2"] { background: #9ae6b4; }
.heatmap-cell[data-level="3"] { background: #68d391; }
.heatmap-cell[data-level="4"] { background: #38a169; }
.heatmap-cell[data-level="5"] { background: #047857; }

.heatmap-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.4);
}

.heatmap-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 999;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.4);
    white-space: nowrap;
}

.heatmap-placeholder {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 16px;
    width: min(640px, 90vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid #e4e7ec;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.modal-dialog header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px 10px;
    border-bottom: 1px solid #e4e7ec;
}

.modal-dialog header h3 {
    margin: 0;
}

.modal-dialog header p {
    margin: 4px 0 0;
    color: #64748b;
}

#modal-close {
    border: none;
    background: transparent;
    font-size: 1.4rem;
    cursor: pointer;
    color: #475467;
}

.modal-body {
    padding: 16px 24px 24px;
    overflow-y: auto;
}

.analytics-footer {
    text-align: center;
    padding: 26px 48px 40px;
    border-top: 1px solid #e4e7ec;
    background: #ffffff;
}

h1 {
    text-align: center;
    color: #0f172a;
    text-shadow: none;
    margin-bottom: 30px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

/* Убираем task-grid, используем обертку */
.rows-wrapper {
    max-width: 1200px;
    margin: 20px auto;
}

.task-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.task-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.task-card h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem; 
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 5px;
}

.task-card button {
    width: 100%;
    padding: 10px 15px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #4f46e5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.task-card button:hover {
    background-color: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.task-card button:disabled {
    background-color: #94a3b8;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.6;
}

.status {
    margin-top: 15px;
    font-size: 0.85rem;
    color: #64748b;
}
.status p {
    margin: 4px 0;
}
.status .last-stats {
    font-style: normal;
    color: #0f172a;
    font-weight: 500;
}

/* Статусы */
.task-card.status-success {
    border-left: 4px solid #10b981;
}
.task-card.status-failed {
    border-left: 4px solid #ef4444;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.1);
}
.task-card.status-running {
    border-left: 4px solid #f59e0b;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.1);
}

.task-card .last-status {
    font-weight: 600;
    text-transform: uppercase;
}
.task-card.status-success .last-status {
    color: #10b981;
}
.task-card.status-failed .last-status {
    color: #ef4444;
}
.task-card.status-running .last-status {
    color: #f59e0b;
}

/* Футер */
.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #64748b;
}
.footer a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}
.footer a:hover {
    text-decoration: underline;
    color: #4338ca;
}

/* Дашборды проблемных объектов */
.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #475467;
    font-size: 0.875rem;
    border-bottom: 2px solid #e4e7ec;
}

.dashboard-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.dashboard-table tbody tr:hover {
    background: #f8fafc;
}

.dashboard-table a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.dashboard-table a:hover {
    text-decoration: underline;
}

.category-dashboard {
    margin-bottom: 32px;
}

.category-dashboard:last-child {
    margin-bottom: 0;
}

.category-dashboard h3 {
    margin: 0 0 16px;
    color: #0f172a;
    font-size: 1.125rem;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #e4e7ec;
}

#dashboard-category-container,
#dashboard-problem-type-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    padding: 20px;
}

@media (min-width: 1400px) {
    #dashboard-category-container,
    #dashboard-problem-type-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Страница "Заявки" --- */

.app-nav__link--active {
    color: #1d4ed8;
    font-weight: 600;
}

.btn--ghost {
    background: transparent;
    border-color: #d0d5dd;
    color: #475467;
    padding: 10px 18px;
}

.btn--ghost:hover {
    background: #f8fafc;
}


.tickets-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 40px 64px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tickets-shell__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 22px 28px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.tickets-shell__title h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
}

.tickets-shell__title p {
    margin: 6px 0 0;
    color: #64748b;
}

.tickets-shell__meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    color: #0f172a;
}

.tickets-shell__count {
    font-size: 2.2rem;
    font-weight: 700;
}

.tickets-shell__count-caption {
    font-size: 0.9rem;
    color: #64748b;
}

.tickets-toolbar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px 28px 28px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.06);
}

.tickets-filter-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tickets-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.tickets-filter-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 120px;
}

.tickets-filter-card--period {
    grid-column: span 2;
    min-width: 320px;
}

.tickets-filter-card__title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475467;
}

.tickets-filter-card__content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tickets-filter-card__content input[type="text"],
.tickets-filter-card__content input[type="date"],
.tickets-filter-card__content select {
    border: 1px solid #cbd5f5;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.95rem;
    background: #ffffff;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}

.tickets-filter-card__content input[type="text"]:focus,
.tickets-filter-card__content input[type="date"]:focus,
.tickets-filter-card__content select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    outline: none;
}

.tickets-filter-card__content select[multiple] {
    min-height: 150px;
    resize: vertical;
}

.tickets-filter-card__content small {
    color: #94a3b8;
    font-size: 0.75rem;
}

.tickets-period {
    display: flex;
    gap: 10px;
}

.tickets-period input {
    flex: 1;
}

.tickets-period-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tickets-period-presets button {
    background: #eef2ff;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4338ca;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tickets-period-presets button:hover {
    background: #e0e7ff;
}

.tickets-period-presets button.is-active {
    background: #4338ca;
    color: #fff;
    border-color: #312e81;
}

.tickets-filter-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #fff;
    border-top: 1px dashed #e2e8f0;
    padding-top: 16px;
}

.tickets-filter-actions__hint {
    font-size: 0.85rem;
    color: #64748b;
}

.tickets-filter-actions__buttons {
    display: inline-flex;
    gap: 10px;
}

.tickets-table {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px 24px 28px;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.07);
}

.tickets-table__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.tickets-table__title h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
}

.tickets-table__title p {
    margin: 4px 0 0;
    color: #6b7280;
}

.tickets-table__controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #475467;
}

.tickets-table__controls select {
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.9rem;
}

.tickets-table__wrapper {
    overflow-x: auto;
    border-radius: 12px;
}

.tickets-table__wrapper table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.92rem;
}

.tickets-table__wrapper thead th {
    position: sticky;
    top: 0;
    background: #f1f5f9;
    padding: 14px 16px;
    font-weight: 600;
    color: #475467;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.tickets-col__trigger {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: none;
    background: transparent;
    color: #0f172a;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    transition: background 0.15s ease, color 0.15s ease;
}

.tickets-col__trigger::after {
    content: "▾";
    font-size: 0.9rem;
    color: #64748b;
    transition: transform 0.15s ease;
}

.tickets-col__trigger:hover,
.tickets-col__trigger:focus-visible {
    background: rgba(99, 102, 241, 0.12);
    color: #312e81;
    outline: none;
}

.tickets-col__trigger:focus-visible::after {
    transform: translateY(2px);
}

.tickets-col__badge {
    background: rgba(79, 70, 229, 0.18);
    color: #3730a3;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px 3px;
    border-radius: 999px;
}

.tickets-table__wrapper tbody tr {
    background: #fff;
    transition: background 0.15s ease;
}

.tickets-table__wrapper tbody tr:nth-child(even) {
    background: #f8fafc;
}

.tickets-table__wrapper tbody tr:hover {
    background: #eef2ff;
}

.tickets-table__wrapper td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
    color: #1e293b;
}

.tickets-col--meta {
    width: 180px;
}

.tickets-col--subject {
    width: 32%;
}

.tickets-col--status {
    width: 140px;
}

.tickets-cell-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tickets-cell-meta__date {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #64748b;
}

.tickets-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 0;
    color: #2563eb;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.tickets-link:hover {
    text-decoration: underline;
}

.tickets-link::before {
    content: '#';
    color: #cbd5f5;
    font-weight: 400;
}

.tickets-cell-subject {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tickets-subject__title {
    font-weight: 600;
    color: #0f172a;
}

.tickets-subject__description {
    color: #475467;
    font-size: 0.85rem;
    line-height: 1.4;
    max-height: calc(1.4em * 2);
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.tickets-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tickets-status-badge--inprogress {
    background: #fef3c7;
    color: #92400e;
}

.tickets-status-badge--resolved,
.tickets-status-badge--closed,
.tickets-status-badge--done {
    background: #dcfce7;
    color: #166534;
}

.tickets-status-badge--registered,
.tickets-status-badge--new {
    background: #e0f2fe;
    color: #0c4a6e;
}

.tickets-status-badge--overdue,
.tickets-status-badge--sla {
    background: #fee2e2;
    color: #991b1b;
}

.tickets-status-badge--default {
    background: #e2e8f0;
    color: #475569;
}

.sidebar__top {
    position: relative;
}

.sidebar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    color: #475569;
    background: #ffffff;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar__toggle:hover {
    background: #f1f5f9;
    color: #1d4ed8;
    border-color: #cbd5f5;
}

.sidebar[data-collapsed="true"] .sidebar__toggle-icon {
    transform: rotate(0deg);
}

.sidebar[data-collapsed="true"] .sidebar__top {
    justify-content: center;
}

.sidebar[data-collapsed="true"] .sidebar__logo {
    display: none;
}

.sidebar__toggle-floating {
    position: fixed;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.9);
    color: #f8fafc;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 55;
    display: none;
}

.sidebar__toggle-floating::before {
    content: '☰';
    font-size: 18px;
    font-weight: 600;
}

@media (min-width: 768px) {
    .sidebar__toggle-floating {
        display: none !important;
    }
}

.tickets-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
}

.tickets-pagination__summary {
    color: #475467;
    font-size: 0.9rem;
}

.tickets-pagination__controls {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.tickets-filter-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1010;
}

.tickets-filter-modal[hidden] {
    display: none;
}

.tickets-filter-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
}

.tickets-filter-modal__dialog {
    position: relative;
    width: min(520px, 94vw);
    max-height: 88vh;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tickets-filter-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 28px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.18), rgba(129, 140, 248, 0.22));
}

.tickets-filter-modal__header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.tickets-filter-modal__close {
    border: none;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.tickets-filter-modal__close:hover {
    background: rgba(15, 23, 42, 0.16);
    transform: rotate(8deg);
}

.tickets-filter-modal__body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tickets-filter-modal__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

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

.tickets-filter-label {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6366f1;
    font-weight: 700;
}

.tickets-filter-input,
.tickets-filter-modal__body input[type="date"] {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}

.tickets-filter-input:focus,
.tickets-filter-modal__body input[type="date"]:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    outline: none;
}

.tickets-filter-dates {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.tickets-filter-dates__dash {
    color: #94a3b8;
    font-weight: 600;
}

.tickets-filter-presets {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tickets-filter-presets button {
    border: none;
    background: #e0e7ff;
    color: #3730a3;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.tickets-filter-presets button.is-active,
.tickets-filter-presets button:hover {
    background: #4f46e5;
    color: #eef2ff;
}

.tickets-filter-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.tickets-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.04);
}

.tickets-filter-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.tickets-filter-option span {
    font-size: 0.9rem;
    color: #1f2937;
}

.tickets-filter-empty {
    padding: 24px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

.tickets-pagination__controls button {
    border: 1px solid #d0d5dd;
    padding: 8px 14px;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tickets-pagination__controls button:hover:not(:disabled) {
    background: #f1f5f9;
}


.tickets-pagination__controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#tickets-pagination-info {
    font-weight: 600;
    color: #0f172a;
}

body.modal-open {
    overflow: hidden;
}

.ticket-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.ticket-modal[hidden] {
    display: none;
}

.ticket-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.ticket-modal__dialog {
    position: relative;
    width: min(1100px, 95vw);
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
}

.ticket-modal__surface {
    position: relative;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.25);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ticket-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #475467;
    z-index: 5;
}

.ticket-modal__close:hover {
    color: #1d4ed8;
}

.ticket-modal__header {
    padding: 24px 32px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #e4e7ec;
}

.ticket-modal__header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #0f172a;
}

.ticket-modal__external {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

.ticket-modal__external:hover {
    text-decoration: underline;
}

.ticket-modal__loader {
    padding: 48px 32px;
    text-align: center;
    font-size: 0.95rem;
    color: #475467;
}

.ticket-modal__body {
    display: none;
}

.ticket-modal__body.is-visible {
    display: block;
}

.ticket-modal__info dl {
    margin: 0 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px 24px;
}

.ticket-modal__info dt {
    font-weight: 600;
    color: #475467;
}

.ticket-modal__info dd {
    margin: 4px 0 0;
    color: #0f172a;
}

.ticket-modal__description {
    background: #f8fafc;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    padding: 16px;
    font-size: 0.95rem;
    color: #334155;
    max-height: 260px;
    overflow-y: auto;
}

.ticket-modal__gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ticket-modal__image-area {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 12px;
}

.ticket-modal__nav {
    border: none;
    background: #1d4ed8;
    color: #ffffff;
    border-radius: 999px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
}

.ticket-modal__nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ticket-modal__nav:hover:not(:disabled) {
    background: #2563eb;
}

.ticket-modal__image-frame {
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #0f172a;
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ticket-modal__image-frame img {
    max-width: 100%;
    max-height: 360px;
    object-fit: contain;
    display: none;
    cursor: zoom-in;
}

.ticket-modal__image-frame img.is-visible {
    display: block;
}

.ticket-modal__image-placeholder {
    color: #e2e8f0;
    font-size: 0.95rem;
}

.ticket-modal__thumbnails {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-modal__thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: pointer;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticket-modal__thumb.is-active {
    border-color: #1d4ed8;
}

.ticket-modal__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ticket-manager-contact__link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.ticket-manager-contact__link:hover {
    text-decoration: underline;
}

.ticket-manager-contact__divider {
    color: #94a3b8;
}

#ticket-modal-prev-ticket,
#ticket-modal-next-ticket {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.82);
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.35);
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 80;
}

#ticket-modal-prev-ticket {
    left: 24px;
}

#ticket-modal-next-ticket {
    right: 24px;
}

#ticket-modal-prev-ticket:hover,
#ticket-modal-next-ticket:hover {
    background: rgba(37, 99, 235, 0.92);
}

@media (max-width: 1024px) {
    #ticket-modal-prev-ticket,
    #ticket-modal-next-ticket {
        width: 44px;
        height: 44px;
        left: 16px;
        right: 16px;
    }
}

@media (max-width: 640px) {
    #ticket-modal-prev-ticket,
    #ticket-modal-next-ticket {
        top: auto;
        bottom: 96px;
        transform: translateY(0);
        background: rgba(15, 23, 42, 0.95);
    }
    #ticket-modal-prev-ticket {
        left: 12px;
    }
    #ticket-modal-next-ticket {
        right: 12px;
    }
}

.ticket-modal__zoom {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.ticket-modal__zoom[hidden] {
    display: none;
}

.ticket-modal__zoom-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
}

.ticket-modal__zoom-dialog {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ticket-modal__zoom-dialog img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
    cursor: zoom-out;
}

.ticket-modal__zoom-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(15, 23, 42, 0.6);
    color: #f1f5f9;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    font-size: 1.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.ticket-modal__zoom-close:hover {
    background: rgba(15, 23, 42, 0.8);
    transform: scale(1.05);
}

@media (max-width: 960px) {
    .ticket-modal__dialog {
        width: 100vw;
        padding: 0;
    }

    .ticket-modal__surface {
        border-radius: 0;
        max-height: 100vh;
    }
}

@media (max-width: 768px) {
    .tickets-shell {
        padding: 20px 16px 56px;
        gap: 20px;
    }

    .tickets-shell__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .tickets-filter-grid {
        grid-template-columns: 1fr;
    }

    .tickets-filter-card {
        min-height: auto;
    }

    .tickets-filter-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .tickets-filter-actions__buttons {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .tickets-table__wrapper table {
        font-size: 0.85rem;
    }

    .tickets-col--meta,
    .tickets-col--status {
        width: auto;
    }

    .tickets-pagination {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .ticket-modal__surface {
        max-height: 100vh;
    }

    .ticket-modal__image-area {
        grid-template-columns: 32px 1fr 32px;
    }

    .ticket-modal__image-frame {
        min-height: 200px;
    }
}

@media (max-width: 560px) {
    .tickets-table__wrapper thead {
        display: none;
    }

    .tickets-table__wrapper table,
    .tickets-table__wrapper tbody,
    .tickets-table__wrapper tr,
    .tickets-table__wrapper td {
        display: block;
        width: 100%;
    }

    .tickets-table__wrapper tbody tr {
        margin-bottom: 16px;
        border-radius: 12px;
        box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
        overflow: hidden;
    }

    .tickets-table__wrapper td {
        border: none;
        border-bottom: 1px solid #e2e8f0;
        padding: 12px 16px;
    }

    .tickets-table__wrapper td:last-child {
        border-bottom: none;
    }

    .tickets-col--subject {
        width: 100%;
    }
}