:root {
    --bg: #07111f;
    --panel: rgba(10, 24, 43, .68);
    --panel-strong: rgba(13, 31, 55, .86);
    --field: rgba(255, 255, 255, .08);
    --ink: #eef8ff;
    --muted: #9cb0c4;
    --line: rgba(255, 255, 255, .14);
    --brand: #29f4d0;
    --brand-dark: #71f8e5;
    --accent: #6da8ff;
    --danger: #ff5d78;
    --warn: #ffd166;
    --shadow: 0 22px 70px rgba(0, 0, 0, .34);
    --glass-blur: blur(18px) saturate(145%);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 8%, rgba(41, 244, 208, .18), transparent 30%),
        radial-gradient(circle at 78% 4%, rgba(109, 168, 255, .18), transparent 28%),
        linear-gradient(150deg, #07111f 0%, #0c1728 44%, #04070f 100%),
        var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px clamp(16px, 4vw, 48px);
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(7, 17, 31, .78);
    color: #fff;
    border-bottom: 1px solid var(--line);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(41, 244, 208, .22);
    box-shadow: 0 0 28px rgba(41, 244, 208, .14);
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: var(--muted);
    margin-top: 2px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #dce8f0;
}

.nav a,
.link-button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    padding: 8px 10px;
    border: 1px solid transparent;
}

.nav a:hover,
.link-button:hover {
    background: rgba(255, 255, 255, .08);
    border-color: var(--line);
}

.nav form {
    margin: 0;
}

.link-button {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 34px auto;
}

.footer {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 40px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.center-panel {
    width: min(520px, 100%);
    margin: 48px auto;
    display: grid;
    gap: 20px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(340px, 1.25fr);
    gap: 28px;
    align-items: start;
}

.hero-copy {
    padding: 26px 0;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--brand-dark);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 12px;
}

h1,
h2 {
    margin: 0;
    line-height: 1.1;
}

h1 {
    font-size: clamp(32px, 5vw, 56px);
}

h2 {
    font-size: 22px;
}

.hero-copy p:not(.eyebrow),
.muted {
    color: var(--muted);
    line-height: 1.6;
}

.tracking-link {
    display: inline-flex;
    margin-top: 14px;
    padding: 11px 14px;
    border-radius: 8px;
    background: #102337;
    color: #fff;
    font-weight: 800;
}

form {
    margin: 0;
}

.ticket-form,
.form-grid {
    display: grid;
    gap: 16px;
}

.ticket-form {
    padding: 22px;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 7px;
    color: #d8e8f7;
    font-weight: 700;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--field);
    border-radius: 8px;
    padding: 12px 13px;
    color: var(--ink);
    outline: 0;
}

textarea {
    resize: vertical;
    min-height: 118px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(109, 168, 255, .18);
}

select option {
    color: #0b1625;
}

button,
.primary {
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.primary {
    background: linear-gradient(135deg, #16c7a4, #2d73ff);
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.danger-zone {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 93, 120, .28);
    padding-top: 16px;
}

button.danger {
    border: 1px solid rgba(255, 93, 120, .46);
    background: rgba(255, 93, 120, .14);
    color: #ffd8df;
}

button.danger:hover {
    background: rgba(255, 93, 120, .22);
}

button[disabled] {
    opacity: .66;
    cursor: wait;
}

.hp-field {
    position: absolute;
    left: -9999px;
}

.field-hint {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.password-meter {
    display: block;
    height: 6px;
    background: rgba(255, 255, 255, .12);
    border-radius: 999px;
    overflow: hidden;
}

.password-meter span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--danger);
    transition: width .18s ease, background .18s ease;
}

.flash {
    padding: 13px 15px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    margin-bottom: 18px;
    font-weight: 800;
}

.flash-success {
    border-color: rgba(6, 165, 120, .35);
    color: #08785e;
}

.flash-error {
    border-color: rgba(220, 53, 69, .35);
    color: #b72a38;
}

.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    gap: 10px;
}

.stats span {
    display: grid;
    gap: 2px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
}

.stats strong {
    color: var(--ink);
    font-size: 24px;
}

.toolbar {
    padding: 14px;
    margin-bottom: 16px;
    box-shadow: none;
}

.filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr)) minmax(180px, 1.3fr) auto;
    gap: 12px;
    align-items: end;
}

.ticket-list {
    display: grid;
    gap: 10px;
}

.ticket-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 5px solid var(--accent);
    border-radius: 8px;
    padding: 14px;
}

.ticket-row.priority-urgent {
    border-left-color: var(--danger);
}

.ticket-row.priority-high {
    border-left-color: #ff7a1a;
}

.ticket-row.priority-low {
    border-left-color: #80a2b8;
}

.ticket-row a {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.ticket-id {
    color: #a23b78;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 900;
}

.ticket-row small {
    color: var(--muted);
}

.ticket-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    color: #d8e8f7;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.status-new {
    background: rgba(109, 168, 255, .18);
    color: #b9d6ff;
}

.status-open {
    background: rgba(41, 244, 208, .17);
    color: #93ffec;
}

.status-triage,
.status-pending,
.status-waiting_customer {
    background: rgba(255, 209, 102, .18);
    color: #ffe2a1;
}

.status-in_progress {
    background: rgba(109, 168, 255, .18);
    color: #b9d6ff;
}

.status-escalated {
    background: rgba(255, 93, 120, .2);
    color: #ffbac8;
}

.status-resolved,
.status-closed {
    background: rgba(255, 255, 255, .1);
    color: var(--muted);
}

.severity-critical {
    background: rgba(255, 93, 120, .2);
    color: #ffbac8;
}

.severity-high {
    background: rgba(255, 172, 83, .18);
    color: #ffd2a2;
}

.severity-normal {
    background: rgba(41, 244, 208, .17);
    color: #93ffec;
}

.severity-low {
    background: rgba(255, 255, 255, .1);
    color: var(--muted);
}

.sla-badge.sla-overdue,
.ticket-row.sla-overdue {
    border-color: rgba(220, 53, 69, .55);
}

.sla-badge.sla-overdue {
    background: rgba(255, 93, 120, .2);
    color: #ffbac8;
}

.sla-badge.sla-due_soon {
    background: rgba(255, 209, 102, .18);
    color: #ffe2a1;
}

.sla-badge.sla-on_track,
.sla-badge.sla-met {
    background: rgba(41, 244, 208, .17);
    color: #93ffec;
}

.ticket-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

.ticket-main,
.side-panel {
    padding: 20px;
}

.ticket-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.ticket-head-badges {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ticket-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.ticket-summary span {
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: var(--ink);
    min-width: 0;
    overflow-wrap: anywhere;
}

.ticket-summary strong {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.timeline {
    display: grid;
    gap: 12px;
}

.ticket-context {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.ticket-context h2 {
    font-size: 16px;
    margin-top: 6px;
}

.ticket-context dl {
    margin: 0;
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfe;
}

.ticket-context dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.ticket-context dd {
    margin: 0;
    line-height: 1.55;
}

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

.context-grid span {
    display: grid;
    gap: 2px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    min-width: 0;
    overflow-wrap: anywhere;
}

.context-grid strong {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.attachments {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.attachments h2 {
    font-size: 16px;
}

.attachment-list,
.note-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-list a,
.note-attachments a {
    display: grid;
    gap: 2px;
    max-width: 260px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    overflow-wrap: anywhere;
}

.attachment-list span,
.note-attachments a {
    color: var(--muted);
    font-size: 12px;
}

.note {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: rgba(255, 255, 255, .06);
}

.note-internal {
    background: rgba(255, 209, 102, .11);
    border-color: rgba(255, 209, 102, .32);
}

.note header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    font-size: 13px;
}

.note p {
    margin: 10px 0 0;
    line-height: 1.6;
}

.side-panel {
    display: grid;
    gap: 18px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox input {
    width: auto;
}

.empty {
    padding: 24px;
    color: var(--muted);
    box-shadow: none;
}

.secret-panel,
.project-create {
    display: grid;
    gap: 14px;
    padding: 18px;
    margin-bottom: 16px;
}

.project-list {
    display: grid;
    gap: 10px;
}

@media (max-width: 860px) {
    .topbar,
    .page-heading,
    .ticket-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-grid,
    .ticket-detail,
    .filters,
    .context-grid,
    .ticket-summary {
        grid-template-columns: 1fr;
    }

    .form-grid.two,
    .form-grid.three,
    .stats {
        grid-template-columns: 1fr;
    }

    .ticket-row {
        grid-template-columns: 1fr;
    }

    .ticket-meta {
        flex-wrap: wrap;
    }
}

@media (max-width: 540px) {
    .shell {
        width: min(100% - 20px, 1180px);
        margin-top: 18px;
    }

    .nav {
        width: 100%;
        justify-content: space-between;
    }

    h1 {
        font-size: 32px;
    }

    .ticket-form,
    .ticket-main,
    .side-panel {
        padding: 16px;
    }
}
