:root {
    --bg: #070b14;
    --bg-2: #0f172a;
    --panel: rgba(15, 23, 42, 0.88);
    --panel-strong: #111827;
    --ink: #f8fafc;
    --muted: #a5b4c9;
    --line: rgba(148, 163, 184, 0.18);
    --primary: #facc15;
    --primary-dark: #f59e0b;
    --primary-soft: rgba(250, 204, 21, 0.18);
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow: 0 18px 45px rgba(2, 6, 23, 0.55);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #111827 0%, var(--bg) 45%, #050a12 100%);
    color: var(--ink);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #fde68a;
    outline-offset: 3px;
}

.skip-link {
    position: absolute;
    z-index: 20;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    background: var(--primary);
    color: #111827;
    font-weight: 800;
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

img {
    max-width: 100%;
}

a {
    color: var(--primary);
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(14px);
    background: rgba(10, 14, 23, 0.8);
    border-bottom: 1px solid rgba(250, 204, 21, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.nav-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fefce8;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.brand-block:hover {
    color: #fff;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.8rem;
    background: linear-gradient(135deg, #facc15, #f59e0b);
    color: #111827;
    box-shadow: 0 10px 22px rgba(250, 204, 21, 0.45);
    font-size: 0.75rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.nav-links a:hover {
    opacity: 0.8;
    color: var(--primary);
}

.nav-logout-form {
    margin: 0;
}

.nav-logout {
    padding: 0;
    border: 0;
    background: transparent;
    color: #fde68a;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.nav-logout:hover {
    color: var(--primary);
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

.page-header,
.panel,
.auth-card,
.mini-panel,
.stat-card {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.9));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.page-header {
    margin-bottom: 1.5rem;
    padding: 1.5rem 1.6rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.eyebrow {
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
}

h1, h2, h3, h4 {
    margin: 0;
    color: var(--ink);
}

h1 {
    font-size: clamp(2rem, 4vw, 2.5rem);
}

h2 {
    font-size: clamp(1.6rem, 2vw, 2rem);
}

h3 {
    font-size: 1.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    border-radius: 1.2rem;
    padding: 1.2rem 1.1rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #111827;
}

.stat-card strong {
    font-size: clamp(2rem, 3vw, 2.5rem);
    line-height: 1;
    color: #111827;
}

.stat-label {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    opacity: 0.92;
    font-weight: 700;
}

.stat-primary { background: linear-gradient(135deg, #facc15, #f59e0b); }
.stat-cyan { background: linear-gradient(135deg, #7dd3fc, #38bdf8); }
.stat-amber { background: linear-gradient(135deg, #fcd34d, #fbbf24); }
.stat-orange { background: linear-gradient(135deg, #fdba74, #fb923c); }
.stat-green { background: linear-gradient(135deg, #6ee7b7, #34d399); }
.stat-red { background: linear-gradient(135deg, #fca5a5, #f87171); }

.mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.mini-panel {
    border-radius: 1.1rem;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mini-panel-label {
    color: var(--muted);
    font-weight: 600;
}

.mini-panel-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--ink);
}

.mini-panel-danger .mini-panel-value,
.sla-overdue {
    color: var(--danger);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0 0 1.5rem;
    color: var(--muted);
}

.notification-unread {
    border-color: rgba(250, 204, 21, 0.55);
}

.article-content {
    line-height: 1.8;
}

.panel {
    border-radius: var(--radius);
    padding: 1.45rem 1.5rem;
    margin-bottom: 1.5rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.table th,
.table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.table th {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.table tbody tr:hover {
    background: rgba(250, 204, 21, 0.05);
}

.ticket-link {
    color: var(--primary);
    font-weight: 700;
}

.ticket-link,
.meta-strip span,
.history-item p,
.ticket-description {
    overflow-wrap: anywhere;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge.new { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.badge.accepted { background: rgba(250, 204, 21, 0.18); color: #fcd34d; }
.badge.in_progress { background: rgba(96, 165, 250, 0.18); color: #bae6fd; }
.badge.pending { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; }
.badge.resolved { background: rgba(52, 211, 153, 0.18); color: #a7f3d0; }
.badge.closed { background: rgba(148, 163, 184, 0.18); color: #e2e8f0; }
.badge.low { background: rgba(96, 165, 250, 0.18); color: #bae6fd; }
.badge.normal { background: rgba(59, 130, 246, 0.18); color: #bfdbfe; }
.badge.high { background: rgba(248, 113, 113, 0.18); color: #fecaca; }
.badge.critical { background: rgba(248, 113, 113, 0.38); color: #fff; }

.auth-card {
    max-width: 520px;
    margin: 3rem auto;
    padding: 2rem;
    border-radius: 1.5rem;
}

.auth-card-wide {
    max-width: 720px;
}

.auth-header {
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--ink);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: rgba(15, 23, 42, 0.85);
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(250, 204, 21, 0.9);
    background: rgba(15, 23, 42, 1);
    box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.18);
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.82rem 1.2rem;
    border: none;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #111827;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(250, 204, 21, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(250, 204, 21, 0.38);
    filter: brightness(1.04);
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.15);
    color: var(--ink);
    box-shadow: none;
}

.btn-nav {
    padding: 0.7rem 1rem;
    border-radius: 0.8rem;
}

.filter-panel {
    padding: 1.35rem;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.col {
    flex: 1 1 180px;
    min-width: 180px;
}

.toolbar {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    padding-top: 0.2rem;
}

.empty-row {
    text-align: center !important;
    color: var(--muted);
    padding: 1.4rem 0.75rem !important;
}

.auth-footer {
    margin-top: 1rem;
    text-align: center;
    color: var(--muted);
}

.form-error {
    margin-top: 0.35rem;
    color: #fca5a5;
    font-size: 0.85rem;
}

.help-text {
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.errorlist {
    margin: 0 0 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 0.75rem;
    background: rgba(248, 113, 113, 0.1);
    color: #fecaca;
    list-style-position: inside;
}

.meta-row,
.meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.meta-strip {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 1rem;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.ticket-description {
    padding: 0.25rem 0;
    color: #e2e8f0;
    line-height: 1.7;
}

.history-item {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1rem 1.1rem;
    margin: 0.9rem 0;
}

.muted {
    color: var(--muted);
}

.alert {
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.alert-success {
    background: rgba(52, 211, 153, 0.12);
    color: #a7f3d0;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.alert-error,
.alert-danger {
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

@media (max-width: 720px) {
    .nav-inner,
    .page-header,
    .ticket-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        width: 100%;
        gap: 0.8rem;
    }

    .container {
        padding-top: 1.2rem;
    }

    .panel,
    .page-header,
    .auth-card {
        padding: 1.15rem;
    }

    .mini-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
