:root {
    color-scheme: light;
    --canvas: #f4f6fa;
    --surface: #fff;
    --text: #162239;
    --muted: #526079;
    --line: #dbe2eb;
    --dark: #121d32;
    --accent: #0754ac;
    font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); }
a { color: var(--accent); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #2679d7; outline-offset: 3px; }
.skip { position: fixed; z-index: 3; left: 1rem; top: 1rem; background: white; padding: .7rem 1rem; transform: translateY(-200%); }
.skip:focus { transform: translateY(0); }
h1, h2, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); letter-spacing: -.045em; line-height: 1.13; }
h2 { font-size: 1.17rem; letter-spacing: -.018em; }
.muted, .date { color: var(--muted); }
.shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar { color: #e2eaf7; background: var(--dark); display: flex; flex-direction: column; padding: 1.7rem 1.2rem 1.25rem; gap: 1.6rem; }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: #fff; font-weight: 750; font-size: 1.3rem; text-decoration: none; line-height: 1.1; width: max-content; }
.brand small { display: block; margin-top: .25rem; color: #a5bad6; font-size: .61rem; font-weight: 650; letter-spacing: .16em; }
.brand-mark { width: 2.35rem; height: 2.35rem; display: flex; align-items: end; justify-content: center; gap: 3px; padding: .55rem; background: #1456ad; border: 1px solid #5f98da; border-radius: 9px; }
.brand-mark i { width: 4px; height: 47%; background: #eaf5ff; border-radius: 2px; transform: skew(-12deg); }
.brand-mark i:nth-child(2) { height: 72%; }
.brand-mark i:nth-child(3) { height: 100%; }
.workspace { display: flex; align-items: center; gap: .65rem; padding: .75rem .65rem; border: 1px solid #36435b; border-radius: 8px; font-size: .86rem; overflow-wrap: anywhere; }
.workspace-icon { display: grid; place-items: center; background: #263b5d; color: #e4eeff; width: 2rem; height: 2rem; flex: 0 0 auto; border-radius: 6px; font-weight: 700; }
.workspace small { display: block; color: #b3c3da; }
.sidebar nav { display: grid; gap: .35rem; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; color: #c5d5ed; padding: .62rem .7rem; text-decoration: none; border-radius: 6px; font-size: .89rem; font-weight: 600; }
.sidebar nav a:hover, .sidebar nav a[aria-current] { background: #243959; color: #fff; }
.account { margin-top: auto; border-top: 1px solid #36435b; padding-top: .9rem; display: flex; align-items: center; gap: .5rem; justify-content: space-between; font-size: .83rem; }
.account > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout { border: 0; min-height: 40px; background: transparent; color: #b9d9ff; text-decoration: underline; padding: .15rem .35rem; }
.main { width: 100%; max-width: 1450px; margin-inline: auto; padding: clamp(1rem, 3.8vw, 3.4rem); }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.65rem; }
.page-header p { color: var(--muted); margin-top: .42rem; }
.page-header .button { flex-shrink: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .25rem; min-height: 42px; padding: .54rem .9rem; border-radius: 7px; background: var(--surface); color: var(--text); border: 1px solid #bdcadd; text-decoration: none; font-size: .88rem; font-weight: 650; text-align: center; }
.button:hover { background: #edf3fb; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { background: #073e83; border-color: #073e83; }
.card { border: 1px solid var(--line); background: var(--surface); border-radius: 11px; box-shadow: 0 2px 4px #17274808; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.metric { padding: 1rem 1.15rem; }
.metric > span { display: flex; gap: .5rem; align-items: center; color: var(--muted); font-weight: 600; font-size: .86rem; }
.metric strong { display: block; font-size: 1.85rem; font-weight: 680; padding-top: .25rem; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; flex: 0 0 .5rem; height: .5rem; border-radius: 50%; }
.dot-active { background: #236ec4; }
.dot-urgent { background: #bd492a; }
.dot-resolved { background: #268158; }
.tickets { min-width: 0; }
.tickets h2 { padding: 1.15rem 1.15rem .65rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; padding: .2rem 1.15rem 1.05rem; }
.filters label { flex: 1 1 7.4rem; min-width: 0; }
.filters .search { flex: 2 1 11rem; }
label { display: grid; gap: .35rem; font-weight: 600; font-size: .86rem; }
input:not([type="hidden"]), select, textarea { width: 100%; min-height: 42px; padding: .55rem .68rem; border: 1px solid #bfccdc; border-radius: 7px; color: var(--text); background: var(--surface); font-weight: 400; }
input::placeholder, textarea::placeholder { color: #68768a; }
textarea { resize: vertical; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .875rem; }
th { background: #f2f5fa; color: #485872; font-size: .78rem; padding: .65rem .65rem; font-weight: 650; }
td { border-bottom: 1px solid var(--line); padding: .92rem .65rem; }
tr:last-child td { border-bottom: 0; }
td:first-child, th:first-child { padding-left: 1.15rem; }
td:last-child, th:last-child { padding-right: 1.15rem; }
.ticket-link { color: var(--text); font-weight: 650; overflow-wrap: anywhere; text-decoration-thickness: 1px; }
.ticket-ref { display: block; margin-top: .15rem; white-space: nowrap; color: var(--muted); font-size: .72rem; }
.date { white-space: nowrap; font-size: .78rem; }
.pill { display: inline-block; padding: .18rem .55rem; border-radius: 5px; font-weight: 650; font-size: .75rem; white-space: nowrap; background: #ebeff5; color: #43536e; }
.pill-critical { background: #fde8e6; color: #912528; }
.pill-high, .pill-waiting { background: #fff0d7; color: #785000; }
.pill-improvement { background: #eee8fa; color: #65408c; }
.pill-open { background: #e4efff; color: #19579d; }
.pill-working { background: #e2eff1; color: #235c64; }
.pill-resolved { background: #e5f4e9; color: #20623f; }
.empty { padding: 2rem 1.15rem; border-top: 1px solid var(--line); color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: end; gap: .65rem; padding: .65rem 1.15rem; border-top: 1px solid var(--line); font-size: .84rem; }
.back { display: inline-block; margin-bottom: .65rem; font-size: .88rem; font-weight: 650; }
.reference { margin-bottom: .3rem; }
.form-card, .conversation, .details-card { padding: clamp(1rem, 2.5vw, 1.6rem); }
.form-card { max-width: 760px; }
.form-card h2, .conversation h2, .details-card h2 { margin-bottom: .85rem; }
.stack { display: grid; gap: .85rem; }
.stack small { margin-top: -.55rem; }
.form-actions { display: flex; gap: .6rem; margin-top: .25rem; }
.alert { background: #e5f4e9; border: 1px solid #b3d9c0; color: #1b5537; padding: .7rem .9rem; border-radius: 6px; margin-bottom: .9rem; }
.alert.error { background: #fdeceb; border-color: #ecc0bd; color: #852627; }
.detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(215px, 1fr); align-items: start; gap: 1rem; }
.message { padding: .86rem .94rem; margin-bottom: .75rem; background: #f4f6fa; border: 1px solid #dee6f0; border-radius: 8px; }
.message.staff-message { background: #eff6ff; border-color: #cfdef2; }
.message header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .35rem .75rem; }
.message small, .timeline-change small { color: var(--muted); }
.message p, .timeline-change span { white-space: pre-wrap; overflow-wrap: anywhere; }
.message p { margin-top: .45rem; }
.file-link { display: inline-block; margin: .55rem .55rem 0 0; overflow-wrap: anywhere; font-size: .86rem; }
.timeline-change { padding: .35rem .6rem; margin-bottom: .65rem; font-size: .85rem; color: #465872; }
.timeline-change small { display: block; }
.reply { margin-top: 1rem; }
.details-card dl { margin: 0; }
.details-card dt { font-size: .86rem; font-weight: 600; }
.details-card dd { margin: .35rem 0 .8rem; }
.auth-layout { min-height: 100vh; padding: 2.2rem 1rem; display: grid; gap: 1.5rem; align-content: center; justify-items: center; background: linear-gradient(160deg, #ecf3ff, #f7f8fa 72%); }
.auth-card { padding: clamp(1.25rem, 4vw, 2.45rem); width: min(100%, 440px); }
.auth-card h1 { font-size: 2rem; }
.auth-card p.muted { margin: .65rem 0 1.1rem; }
.auth-card p.footnote { margin: 1rem 0 0; font-size: .85rem; }
.eyebrow { color: var(--accent); font-size: .76rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.public-brand { color: var(--text); }
.public-brand small { color: var(--muted); }

@media (max-width: 850px) {
    .shell { grid-template-columns: 185px minmax(0, 1fr); }
    .sidebar { padding-inline: .85rem; }
    .detail { grid-template-columns: minmax(0, 1fr); }
    .details-card { grid-row: 1; }
}

@media (max-width: 620px) {
    .shell { display: block; }
    .sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem .75rem; padding: .85rem 1rem .65rem; }
    .sidebar nav { display: flex; flex-wrap: wrap; grid-column: 1 / -1; grid-row: 2; }
    .sidebar nav a { padding: .42rem .6rem; }
    .workspace { display: none; }
    .account { border: 0; padding: 0; margin: 0; justify-content: end; }
    .page-header { flex-wrap: wrap; }
    .metric { padding: .6rem .55rem; }
    .metrics { gap: .4rem; }
    .metric > span { font-size: .73rem; }
    .metric strong { font-size: 1.5rem; }
    .table-scroll:focus-within { outline: 1px solid var(--accent); }
}
