:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --ink: #1f2937;
    --muted: #667085;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --nav: #111827;
    --nav-soft: #1f2937;
    --danger: #c2410c;
    --warning: #b45309;
    --success: #047857;
    --info: #0369a1;
    --shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink);
    background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: 0; color: #111827; }
h1 { font-size: 24px; line-height: 1.2; font-weight: 700; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 700; }
p { color: var(--muted); line-height: 1.5; }
small { color: var(--muted); }
.icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
h1 .icon { width: 22px; height: 22px; vertical-align: -4px; color: var(--primary); }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 20px 16px;
    color: #fff;
    background: var(--nav);
    border-right: 1px solid rgba(255, 255, 255, .08);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 4px; }
.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #e5edff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 800;
}
.brand-mark .icon { width: 21px; height: 21px; }
.brand strong { display: block; font-size: 15px; font-weight: 700; }
.brand small { display: block; color: #9ca3af; margin-top: 2px; text-transform: capitalize; }
nav { display: grid; gap: 4px; }
nav a, .logout {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d1d5db;
    padding: 10px 11px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
}
nav a .icon, .logout .icon { width: 17px; height: 17px; color: #93c5fd; }
nav a.active .icon { color: #bfdbfe; }
nav a:hover, .logout:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}
nav a.active {
    background: var(--nav-soft);
    color: #fff;
    border-color: rgba(255, 255, 255, .08);
    box-shadow: inset 3px 0 0 var(--primary);
}
.logout { margin-top: auto; }

.shell { margin-left: 248px; padding: 22px; min-height: 100vh; }
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #111827, #1e3a8a);
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow {
    color: #93c5fd;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.page-head, .ticket-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.page-head p, .ticket-header p { margin: 6px 0 0; max-width: 760px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: #1f2937;
    border-radius: 8px;
    padding: 8px 13px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.button .icon { width: 16px; height: 16px; }
.button:hover { background: #f8fafc; border-color: #94a3b8; }
.button.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.button.full { width: 100%; }

.card, .table-wrap, .metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.card { padding: 18px; }
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.metric {
    min-height: 94px;
    padding: 15px;
    border-top: 3px solid #bfdbfe;
}
.metric:nth-child(4) { border-top-color: #fed7aa; }
.metric:nth-child(5) { border-top-color: #fecaca; }
.metric:nth-child(6) { border-top-color: #bbf7d0; }
.metric-head {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}
.metric-head .icon {
    width: 17px;
    height: 17px;
    color: #2563eb;
    background: #eff6ff;
    border-radius: 6px;
    padding: 2px;
}
.metric:nth-child(4) .metric-head .icon,
.metric:nth-child(5) .metric-head .icon { color: #b91c1c; background: #fef2f2; }
.metric:nth-child(6) .metric-head .icon,
.metric:nth-child(7) .metric-head .icon { color: #047857; background: #ecfdf5; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong {
    display: block;
    margin-top: 8px;
    color: #111827;
    font-size: 24px;
    line-height: 1;
    font-weight: 750;
}
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.quick-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    padding: 14px;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.quick-card .quick-icon {
    grid-row: span 2;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
}
.quick-card.danger .quick-icon { background: #fef2f2; color: #b91c1c; }
.quick-card.warning .quick-icon { background: #fffbeb; color: #b45309; }
.quick-card.info .quick-icon { background: #ecfeff; color: #0e7490; }
.quick-icon .icon { width: 18px; height: 18px; }
.quick-card strong { font-size: 15px; }
.quick-card span { color: var(--muted); font-size: 13px; }
.quick-card.danger { border-left-color: #ef4444; }
.quick-card.warning { border-left-color: #f59e0b; }
.quick-card.info { border-left-color: #0ea5e9; }
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px 0;
}

table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th {
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    background: #f8fafc;
}
td { font-size: 13px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fafc; }
.empty { text-align: center; color: var(--muted); }
.row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    gap: 5px;
}
.row-action .icon { width: 13px; height: 13px; }

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    background: #e0f2fe;
    color: var(--info);
    border: 1px solid rgba(3, 105, 161, .12);
}
.badge.danger { color: #991b1b; background: #fee2e2; border-color: #fecaca; }
.badge.warning { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.badge.success { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.badge.info { color: #155e75; background: #cffafe; border-color: #a5f3fc; }
.badge.muted { color: #475569; background: #e2e8f0; border-color: #cbd5e1; }
.overdue { color: var(--danger); font-weight: 800; }

.form { display: grid; gap: 13px; }
.form.wide { max-width: 1080px; }
.form-section {
    display: grid;
    gap: 13px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}
.form-section-head { display: flex; align-items: center; gap: 9px; }
.form-section-head span {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #e0ecff;
    color: #1d4ed8;
}
.form-section-head span .icon { width: 16px; height: 16px; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
label { display: grid; gap: 6px; color: #334155; font-size: 13px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 9px 11px;
    font: inherit;
    font-size: 13px;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .18);
}
textarea { resize: vertical; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 9px;
    margin-bottom: 14px;
}
.guide-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.guide-strip article {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 13px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.guide-strip .icon {
    width: 30px;
    height: 30px;
    padding: 6px;
    color: #1d4ed8;
    background: #eff6ff;
    border-radius: 8px;
}
.guide-strip article:nth-child(2) .icon { color: #0f766e; background: #f0fdfa; }
.guide-strip article:nth-child(3) .icon { color: #b45309; background: #fffbeb; }
.guide-strip strong { display: block; font-size: 13px; color: #111827; }
.guide-strip span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.status-strip {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.status-strip a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}
.status-strip .icon { width: 14px; height: 14px; }
.status-strip a.active,
.status-strip a:hover {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .7fr);
    gap: 16px;
    align-items: start;
}

.login-panel {
    width: min(960px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 370px;
    gap: 32px;
    align-items: center;
    color: #fff;
}
.login-panel h1 {
    margin: 8px 0 12px;
    color: #fff;
    font-size: 34px;
    line-height: 1.15;
    font-weight: 700;
}
.login-panel p { color: #cbd5e1; font-size: 15px; }
.login-panel .card { color: var(--ink); }
.preline { white-space: pre-line; color: var(--ink); }
.details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 18px 0;
}
.details div {
    padding: 11px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}
dt { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 700; }
dd { margin: 4px 0 0; font-weight: 400; font-size: 13px; color: #1f2937; }
.workflow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; }
.ticket-badges { display: flex; gap: 7px; flex-wrap: wrap; }
.timeline { margin-top: 18px; }
.timeline h2 { margin-bottom: 9px; }
.comment {
    margin: 10px 0;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid #93c5fd;
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.comment.internal { border-left-color: #f59e0b; background: #fffbeb; }
.comment header { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; }
.alert {
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    background: #ecfdf5;
    color: var(--success);
    border: 1px solid #bbf7d0;
}
.alert.danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
}
.kb-list { display: grid; gap: 12px; margin-top: 16px; }
.kb-card { border-top: 3px solid #bfdbfe; }
.kb-card h3 {
    margin: 14px 0 4px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}
.survey { margin: 16px 0; border-top: 3px solid #bbf7d0; }
.compact-event p { margin-bottom: 0; }
.attachment-list {
    display: grid;
    gap: 9px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
}
.attachment-item .icon {
    width: 28px;
    height: 28px;
    padding: 6px;
    border-radius: 8px;
    color: #1d4ed8;
    background: #eff6ff;
}
.attachment-item strong {
    display: block;
    font-weight: 500;
}
.attachment-item small { display: block; }

@media (max-width: 900px) {
    .sidebar { position: static; width: auto; }
    .shell { margin-left: 0; padding: 15px; }
    .metrics, .grid-3, .split, .login-panel { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr; }
    .workflow { grid-template-columns: 1fr; }
    .page-head, .ticket-header, .topbar { flex-direction: column; align-items: stretch; }
    .head-actions, .form-actions { justify-content: stretch; }
    .head-actions .button, .form-actions .button { text-align: center; flex: 1; }
    .table-wrap { overflow-x: auto; }
    .login-panel h1 { font-size: 29px; }
}
