:root {
  color-scheme: light;
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
  color: #172a3d;
  background: #edf2f6;
  --surface: #fff;
  --border: #d7e1e9;
  --muted: #506477;
  --accent: #006754;
  --accent-dark: #005342;
  --error: #a13727;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #006fbb; outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.7rem, 3.3vw, 2.2rem); letter-spacing: -.035em; font-weight: 720; }
h2 { font-size: 1.25rem; letter-spacing: -.02em; }
h3 { font-size: 1.05rem; }
a { color: var(--accent-dark); font-weight: 650; text-underline-offset: .2em; overflow-wrap: anywhere; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell { width: min(1320px, calc(100% - 64px)); margin-inline: auto; }
.topbar { background: #142638; color: #fff; }
.topbar-inner { height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.05rem; font-weight: 700; }
.brand-mark { width: 32px; height: 32px; display: flex; align-items: end; justify-content: center; gap: 3px; padding-bottom: 8px; border-radius: 9px; background: #aff0d6; }
.brand-mark i { width: 3px; height: 7px; border-radius: 1px; background: #075646; }
.brand-mark i:nth-child(2) { height: 11px; }
.brand-mark i:nth-child(3) { height: 16px; }
.environment { display: inline-flex; gap: 8px; align-items: center; font-size: .82rem; color: #d0dde9; }
.environment::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #80dbc1; }
main { padding-block: 34px 50px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 24px; }
.workspace { display: grid; grid-template-columns: minmax(290px, .7fr) minmax(0, 1.65fr); align-items: start; gap: 22px; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 2px 6px #19344a09; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 9px; padding: 8px 15px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; text-align: center; }
.primary { color: #fff; background: var(--accent); }
.primary:not(:disabled):hover { background: var(--accent-dark); }
.secondary { color: #2e465d; background: #fff; border-color: #c9d6e0; }
.secondary:not(:disabled):hover { background: #edf3f7; border-color: #9fafbf; }
.plus { font-size: 1.25rem; line-height: 1; font-weight: 400; }

.queue-tools { display: grid; gap: 14px; padding: 16px; }
.queue-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.icon-button { min-width: 36px; min-height: 36px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #38536a; font-size: 1.15rem; line-height: 1; }
.icon-button:not(:disabled):hover { background: #edf3f7; }
.search-field { position: relative; }
.search-icon { position: absolute; top: 13px; left: 13px; width: 12px; height: 12px; border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 5px; height: 1.5px; background: var(--muted); top: 9px; left: 8px; transform: rotate(45deg); }
input[type="search"], textarea { width: 100%; border: 1px solid #aebfcd; border-radius: 8px; background: #fff; color: inherit; }
input[type="search"] { height: 40px; padding: 7px 10px 7px 34px; font-size: .89rem; }
input::placeholder, textarea::placeholder { color: #607387; opacity: 1; }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.filters button { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 34px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; background: #f7f9fb; color: #354e63; font-size: .82rem; font-weight: 600; text-align: left; }
.filters button:hover { border-color: #91a7b6; }
.filters [aria-pressed="true"] { background: #e2f5ee; border-color: #87c6b3; color: #055643; }
.filters span:empty { display: none; }
.filters span { min-width: 20px; padding: 0 3px; border-radius: 5px; background: #e8eef3; color: #41576b; font-size: .72rem; text-align: center; font-variant-numeric: tabular-nums; }
.filters [aria-pressed="true"] span { background: #c7e9dd; color: #055643; }
.queue-list { border-top: 1px solid var(--border); }
.queue-count { padding: 9px 16px 3px; font-size: .78rem; color: var(--muted); }
.queue-status { padding: 16px; color: var(--muted); font-size: .9rem; }
.queue-status:empty { display: none; }
.queue-items { max-height: 510px; overflow-y: auto; overscroll-behavior-y: contain; list-style: none; margin: 0; padding: 6px 9px 9px; }
.queue-items li + li { margin-top: 5px; }
.queue-card { display: grid; gap: 7px; width: 100%; padding: 10px; text-align: left; border: 1px solid #e1e9ef; border-radius: 9px; background: #fff; color: inherit; }
.queue-card:hover { border-color: #a8bdc9; background: #f5f8fa; }
.queue-card[aria-current="true"] { border-color: #85bfaf; background: #eff8f5; box-shadow: inset 3px 0 #087665; }
.queue-card-top, .queue-card-bottom { display: flex; flex-wrap: wrap; gap: 4px 8px; justify-content: space-between; align-items: center; }
.ticket-id { color: #455e72; font: 650 .77rem/1.35 ui-monospace, "Cascadia Mono", monospace; }
.queue-card time, .category { color: var(--muted); font-size: .79rem; }
.queue-snippet { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: .88rem; font-weight: 650; line-height: 1.42; }
.pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border-radius: 999px; padding: 3px 8px; background: #e9eef3; color: #40586c; font-size: .75rem; font-weight: 700; }
.pill::before { content: ""; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; }
.pill.first_line { background: #def4e9; color: #0b654c; }
.pill.specialist { background: #e7effc; color: #254886; }
.pill.manual_review { background: #fff0d6; color: #755013; }

.panel-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.ticket-section { padding: 20px 24px; }
.ticket-section + .ticket-section { border-top: 1px solid var(--border); }
.ticket-section label { display: block; margin-bottom: 7px; font-weight: 650; }
textarea { display: block; min-height: 102px; padding: 11px 12px; resize: vertical; }
.input-footer { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-top: 9px; }
.char-count { flex: 0 0 auto; margin-top: 1px; color: var(--muted); font-size: .79rem; font-variant-numeric: tabular-nums; }
.examples summary { width: fit-content; color: var(--accent-dark); cursor: pointer; font-size: .85rem; font-weight: 630; }
.example-list { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
.example-list .button { min-height: 34px; padding: 5px 9px; font-size: .8rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.message { margin-top: 9px; color: var(--muted); font-size: .88rem; }
.message:empty { display: none; }
.message.error, .queue-status.error { color: var(--error); }
.result { background: #f6f9fa; border-radius: 0 0 14px 14px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.result-facts { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; }
.reason { color: #40596c; margin-top: 8px; }
.result form { margin-top: 15px; }
.source { padding: 10px 12px; border: 1px solid #d6e3e7; border-radius: 8px; background: #f2f7f7; }
.result .source { margin-bottom: 14px; }
.fact-label, .ticket-facts dt { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; }
.source a { font-size: .91rem; }
.back-link { display: none; }
.ticket-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; padding: 0 0 16px; border-bottom: 1px solid #e4ecf1; }
.ticket-facts dd { margin-top: 4px; font-weight: 650; }
.ticket-body { padding-top: 17px; }
.verbatim { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; color: #283e52; }
.saved-decision { border-radius: 0 0 14px 14px; background: #f7fafb; }
.saved-decision .source { margin-top: 16px; }

@media (max-width: 880px) {
  .shell { width: calc(100% - 36px); }
  .workspace { grid-template-columns: minmax(265px, .8fr) minmax(0, 1.2fr); gap: 14px; }
  .panel-heading, .ticket-section { padding-inline: 16px; }
}

@media (max-width: 650px) {
  .shell { width: calc(100% - 26px); }
  .topbar-inner { height: 54px; }
  main { padding-block: 20px 30px; }
  .page-heading { margin-bottom: 16px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace[data-view="queue"] .ticket-panel, .workspace[data-view="ticket"] .queue-panel { display: none; }
  .queue-items { max-height: none; }
  .back-link { display: inline-flex; align-items: center; gap: 6px; padding: 0 0 5px; border: 0; background: transparent; color: var(--accent-dark); font-size: .83rem; font-weight: 650; }
}
