:root {
    --navy: #10243d;
    --navy-light: #1c3552;
    --blue: #245ac5;
    --blue-dark: #19469f;
    --background: #f3f6fa;
    --surface: #ffffff;
    --text: #172638;
    --muted: #657489;
    --border: #dce3ec;
    --green: #16754a;
    --red: #b42332;
    --amber: #a65b10;
    --radius: 12px;
    --shadow: 0 3px 12px rgba(15, 35, 60, 0.045);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

h1,
h2,
h3,
h4 {
    margin: 0 0 12px;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

h1 {
    font-size: clamp(28px, 4vw, 42px);
}

h2 {
    font-size: 21px;
}

h3 {
    font-size: 17px;
}

p {
    margin: 0 0 16px;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

button {
    cursor: pointer;
}

button:disabled {
    cursor: wait;
    opacity: 0.6;
}

small {
    font-size: 12px;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 13px;
}

.mono {
    font-family: Consolas, "SFMono-Regular", monospace;
    overflow-wrap: anywhere;
}

.prewrap {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.uppercase {
    text-transform: uppercase;
}

/* Shared navigation */

.topbar {
    background: var(--navy);
    color: white;
    border-bottom: 3px solid var(--blue);
}

.topbar-inner {
    max-width: 1540px;
    min-height: 77px;
    margin: auto;
    padding: 12px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.brand-icon {
    width: 43px;
    height: 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue);
    color: white;
    border-radius: 10px;
    font-size: 27px;
    font-weight: 900;
    letter-spacing: -4px;
    padding-right: 4px;
}

.brand-icon span {
    display: inline;
    color: #a9d0ff;
}

.brand strong {
    display: block;
    font-size: 17px;
    letter-spacing: 0.12em;
}

.brand small {
    display: block;
    color: #aebdd0;
    font-size: 11px;
}

.navigation {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.navigation a {
    color: #dfe8f4;
    font-size: 13px;
    font-weight: 600;
}

.navigation form {
    margin: 0;
}

.topbar .button-outline {
    color: #e6eef9;
    background: transparent;
    border-color: #586d87;
}

.station-label {
    font-size: 13px;
    color: #cad7e8;
}

/* Page layouts */

.shell {
    max-width: 1540px;
    margin: auto;
    padding: 32px;
    min-height: calc(100vh - 190px);
}

.page-heading {
    margin-bottom: 25px;
}

.page-heading p,
.section-heading p {
    color: var(--muted);
    margin-bottom: 0;
}

.eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--blue);
    margin-bottom: 10px;
}

.heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    min-width: 0;
}

.footer {
    text-align: center;
    padding: 26px 20px;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
}

.footer p {
    margin: 3px;
}

.three-column {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

/* Buttons */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    padding: 11px 18px;
    border-radius: 7px;
    font-weight: 650;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}

.button:hover {
    text-decoration: none;
    filter: brightness(0.95);
}

.button-primary {
    background: var(--blue);
    color: white;
}

.button-outline {
    color: var(--text);
    background: white;
    border-color: var(--border);
}

.button-success {
    background: var(--green);
    color: white;
}

.button-warning {
    background: #a65b10;
    color: white;
}

.button-danger {
    background: var(--red);
    color: white;
}

.button-large {
    padding: 15px 22px;
    font-size: 17px;
}

.button-small {
    font-size: 12px;
    padding: 7px 12px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.full-width {
    width: 100%;
}

.text-button {
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 12px;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 650;
}

/* Forms */

label {
    display: block;
    margin-bottom: 7px;
    font-weight: 650;
    font-size: 13px;
}

input:not([type="checkbox"]):not([type="hidden"]),
select,
textarea {
    display: block;
    width: 100%;
    color: var(--text);
    background: white;
    border: 1px solid #ccd6e2;
    border-radius: 7px;
    padding: 11px 12px;
    margin-bottom: 17px;
    outline: none;
    min-width: 0;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: 3px solid #92b8f1;
    outline-offset: 2px;
}

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

input::placeholder,
textarea::placeholder {
    color: #8290a2;
}

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

.span-two {
    grid-column: span 2;
}

.form-section {
    padding-bottom: 23px;
    margin-bottom: 23px;
    border-bottom: 1px solid var(--border);
}

.form-section h2 {
    margin-bottom: 20px;
    font-size: 19px;
}

.field-help {
    display: block;
    color: var(--muted);
    margin: -4px 0 16px;
    line-height: 1.5;
}

.checkbox-label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 500;
    margin: 15px 0;
}

.checkbox-label input {
    margin: 4px 0 0;
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

/* Notices */

.notice {
    padding: 15px 18px;
    border: 1px solid var(--border);
    border-left: 4px solid #64748b;
    border-radius: 7px;
    margin: 16px 0 20px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.notice p {
    margin: 4px 0 0;
}

.notice-info {
    background: #eff6ff;
    border-color: #c9dcf6;
    border-left-color: #3471cf;
    color: #214b82;
}

.notice-warning {
    background: #fff7e8;
    border-color: #f0d8b2;
    border-left-color: #d08a25;
    color: #805014;
}

.notice-success {
    background: #eaf8f0;
    border-color: #c3e5d2;
    border-left-color: #269560;
    color: #14643b;
}

.notice-danger {
    background: #fff0f0;
    border-color: #f1c9cf;
    border-left-color: #c83e4b;
    color: #9c2630;
}

/* Homepage */

.hero {
    background: var(--navy);
    border-radius: 16px;
    padding: clamp(32px, 6vw, 80px);
    color: white;
    margin-bottom: 38px;
}

.hero .eyebrow {
    color: #a8caff;
}

.hero h1 {
    font-size: clamp(34px, 6vw, 66px);
    max-width: 920px;
    line-height: 1.1;
    margin-bottom: 22px;
}

.hero p {
    max-width: 640px;
    font-size: 17px;
    color: #bfcde0;
    margin-bottom: 28px;
}

.section-heading {
    margin-bottom: 20px;
}

.feature {
    min-height: 200px;
}

.feature p {
    color: var(--muted);
    margin-bottom: 0;
}

.step-number {
    display: block;
    color: var(--blue);
    font-size: 25px;
    font-weight: 800;
    margin-bottom: 16px;
}

/* Login and check-in */

.auth-panel {
    max-width: 450px;
    margin: 45px auto;
    padding: 32px;
}

.auth-panel form {
    margin-top: 25px;
}

.auth-panel .button {
    margin-top: 5px;
}

.auth-panel .small {
    margin-top: 24px;
}

.kiosk-container {
    max-width: 850px;
    margin: auto;
}

.intake-form {
    padding: clamp(22px, 4vw, 38px);
}

.kiosk-lock {
    text-align: right;
}

.receipt-panel {
    max-width: 680px;
    margin: 20px auto;
    text-align: center;
    padding: 35px;
}

.success-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    color: var(--green);
    background: #e7f6ed;
    font-size: 34px;
    font-weight: 800;
}

.reference-box {
    margin: 20px 0;
    padding: 22px 15px;
    background: #f6f8fc;
    border: 1px dashed #b3c3d8;
    border-radius: 10px;
}

.reference-box small {
    display: block;
    color: var(--muted);
    font-weight: 750;
    letter-spacing: 0.12em;
}

.reference-code {
    display: block;
    margin: 10px 0;
    font-family: Consolas, monospace;
    font-size: clamp(20px, 3vw, 29px);
    color: var(--navy);
    overflow-wrap: anywhere;
}

.reference-box p {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}

.receipt-actions {
    justify-content: center;
    margin-bottom: 16px;
}

/* Staff dashboard */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 20px;
    margin: 0;
    color: var(--text);
    min-height: 120px;
}

.metric:hover {
    text-decoration: none;
}

a.metric:hover {
    border-color: var(--blue);
}

.metric small {
    color: var(--muted);
    font-weight: 650;
    font-size: 13px;
}

.metric strong {
    font-size: 30px;
    font-weight: 750;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.metric span {
    color: var(--blue);
    font-size: 12px;
    margin-top: 7px;
}

.metric-alert strong {
    color: var(--red);
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.sidebar {
    padding: 16px;
}

.sidebar h3 {
    margin: 8px 10px 17px;
    font-size: 14px;
}

.sidebar-link {
    display: block;
    font-size: 13px;
    color: var(--text);
    padding: 11px 12px;
    margin-bottom: 3px;
    border-radius: 6px;
    font-weight: 500;
}

.sidebar-link:hover {
    background: #f1f5fa;
    text-decoration: none;
}

.sidebar-link.selected {
    color: var(--blue);
    background: #e9f0fc;
    font-weight: 700;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 20px 0;
}

.search-form input {
    margin: 0 !important;
}

.table-wrap {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

th {
    padding: 12px 10px;
    color: var(--muted);
    background: #f4f7fb;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

td {
    padding: 15px 10px;
    border-bottom: 1px solid #e8edf3;
    vertical-align: top;
    overflow-wrap: anywhere;
}

tbody tr:hover {
    background: #fafbfd;
}

.ticket-link {
    font-size: 12px;
    font-family: Consolas, monospace;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.table-secondary {
    display: block;
    color: var(--muted);
    margin-top: 5px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--muted);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding-top: 20px;
    font-size: 13px;
    color: var(--muted);
}

/* Ticket statuses and priorities */

.priority,
.status-pill {
    display: inline-block;
    font-size: 11px;
    padding: 5px 9px;
    font-weight: 700;
    border-radius: 5px;
    line-height: 1.5;
    white-space: nowrap;
}

.priority-P1 {
    background: #fce3e5;
    color: #ad2030;
}

.priority-P2 {
    background: #ffead7;
    color: #a24d12;
}

.priority-P3 {
    background: #e5efff;
    color: #2154a7;
}

.priority-P4 {
    background: #e9edf2;
    color: #536174;
}

.status-awaiting_consent {
    color: #87530c;
    background: #fff0cd;
}

.status-open {
    color: #214f99;
    background: #e3edfc;
}

.status-in_progress {
    color: #155b9a;
    background: #dceeff;
}

.status-deferred {
    color: #576174;
    background: #e9edf2;
}

.status-escalated {
    color: #6840a5;
    background: #ede4fc;
}

.status-resolved {
    color: #187345;
    background: #dff4e8;
}

.status-closed,
.status-cancelled {
    color: #626c78;
    background: #e8ebef;
}

.overdue {
    color: var(--red);
    font-weight: 700;
}

/* Technician workspace */

.ticket-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 22px;
    align-items: start;
}

.ticket-controls .panel {
    padding: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.detail-grid small {
    display: block;
    color: var(--muted);
    margin-bottom: 4px;
    font-size: 12px;
}

.detail-grid strong {
    display: block;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.info-list {
    margin: 0;
}

.info-list dt {
    font-size: 12px;
    color: var(--muted);
    padding-top: 12px;
}

.info-list dd {
    margin: 3px 0 0;
    font-weight: 650;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.status-summary h2 {
    margin-top: 18px;
}

.timeline {
    margin-top: 22px;
    padding-left: 19px;
    border-left: 2px solid #dce5f0;
}

.timeline-item {
    position: relative;
    padding-bottom: 22px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -25px;
    top: 7px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue);
    box-shadow: 0 0 0 4px #e9f0fc;
}

.timeline-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
}

.timeline-meta time {
    color: var(--muted);
    font-size: 12px;
}

.activity-label {
    font-size: 10px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.06em;
}

.visibility {
    background: #edf0f4;
    border-radius: 4px;
    font-size: 10px;
    padding: 3px 7px;
    color: #536174;
    font-weight: 700;
}

.public-visibility {
    color: #2154a7;
    background: #e5efff;
}

.internal-note {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.public-note {
    padding: 13px;
    background: #f2f7ff;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 12px;
}

.reset-details {
    margin-top: 10px;
}

.reset-details summary {
    color: var(--blue);
    cursor: pointer;
    font-size: 12px;
}

.reset-details form {
    margin-top: 12px;
    min-width: 160px;
}

/* Public television queue */

.queue-page {
    background: #0b192b;
    color: #f6f8fc;
}

.queue-shell {
    padding: 0;
    min-height: 100vh;
    max-width: 1200px;
}

.queue-display {
    padding: clamp(20px, 4vw, 55px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.queue-header {
    text-align: center;
    padding-bottom: 25px;
    border-bottom: 1px solid #31445d;
    margin-bottom: 28px;
}

.queue-logo {
    width: 64px;
    height: 64px;
    font-size: 42px;
    margin: 0 auto 20px;
}

.queue-header .eyebrow {
    font-size: clamp(11px, 1.5vw, 16px);
    color: #9db5d3;
}

.queue-header h1 {
    font-size: clamp(40px, 7vw, 80px);
    letter-spacing: 0.07em;
    margin-bottom: 2px;
}

.queue-header p {
    color: #91a9c8;
    letter-spacing: 0.2em;
    margin: 0;
}

.queue-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.queue-title h2 {
    font-size: clamp(24px, 4vw, 42px);
    margin: 0;
}

.live-label {
    color: #74b7fa;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.1em;
}

.live-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: #60a5fa;
    border-radius: 50%;
    margin-right: 5px;
}

.queue-tickets {
    display: grid;
    gap: clamp(9px, 1.6vw, 20px);
    flex: 1;
    align-content: start;
}

.queue-ticket {
    background: #192d45;
    border-radius: 12px;
    border-left: 6px solid #60a5fa;
    padding: clamp(15px, 2.5vw, 30px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.queue-ticket small {
    display: block;
    color: #a1b7d1;
    font-size: clamp(10px, 1.2vw, 14px);
    letter-spacing: 0.1em;
}

.queue-ticket strong {
    display: block;
    color: #f8fafc;
    font-size: clamp(22px, 3.8vw, 43px);
    font-family: Consolas, monospace;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.queue-ticket span {
    font-size: clamp(14px, 2vw, 23px);
    color: #8dc7ff;
    font-weight: 650;
}

.queue-open {
    border-left-color: #f5bb58;
}

.queue-open span {
    color: #f5bb58;
}

.queue-escalated {
    border-left-color: #bca7fc;
}

.queue-escalated span {
    color: #c4b5fd;
}

.queue-deferred {
    border-left-color: #94a3b8;
}

.queue-deferred span {
    color: #b3c0d0;
}

.queue-resolved {
    border-left-color: #4ade80;
}

.queue-resolved span {
    color: #75e6a0;
}

.queue-empty {
    padding: 50px 20px;
    text-align: center;
    background: #192d45;
    border-radius: 12px;
}

.queue-footer {
    text-align: center;
    padding-top: 30px;
    margin-top: auto;
    color: #9db5d3;
}

.queue-footer p {
    font-size: clamp(12px, 1.6vw, 17px);
    margin-bottom: 5px;
}

.queue-footer h2 {
    color: white;
    margin-top: 8px;
    font-size: clamp(25px, 4vw, 42px);
}

.queue-footer hr {
    border-color: #31445d;
}

.error-panel {
    max-width: 650px;
    margin: 40px auto;
    text-align: center;
}

.error-number {
    color: var(--blue);
    font-size: 65px;
    font-weight: 800;
}

/* Responsive layouts */

@media (max-width: 1050px) {
    .ticket-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
    }

    .dashboard-layout {
        grid-template-columns: 180px minmax(0, 1fr);
    }

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

@media (max-width: 780px) {
    .shell {
        padding: 20px;
    }

    .queue-shell {
        padding: 0;
    }

    .topbar-inner {
        flex-wrap: wrap;
        padding: 15px 20px;
    }

    .navigation {
        gap: 15px;
    }

    .dashboard-layout,
    .ticket-layout,
    .three-column {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .sidebar h3 {
        width: 100%;
    }

    .sidebar-link {
        margin: 0;
        padding: 8px 10px;
    }

    .panel {
        padding: 20px;
    }

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

    .span-two {
        grid-column: span 1;
    }

    .metric-grid {
        gap: 10px;
    }

    .metric {
        padding: 16px;
        min-height: 100px;
    }

    .metric strong {
        font-size: 24px;
    }

    .auth-panel {
        margin: 20px auto;
    }
}

@media print {

    .topbar,
    .footer,
    .receipt-actions,
    .receipt-panel>.muted {
        display: none !important;
    }

    body {
        background: white;
    }

    .shell {
        padding: 0;
    }

    .receipt-panel {
        margin: 0 auto;
        box-shadow: none;
        border: 0;
    }

    .reference-box {
        break-inside: avoid;
    }
}