/* Enfusion Support — interface styles
   Brand: navy #1c4278 → cerulean #007ab3 (from the Enfusion "E").
   Signature: the E's stacked bars with angled ends, reused as the ticket lifecycle track. */

:root {
  --ink: #10233f;
  --navy: #1c4278;
  --navy-deep: #12305a;
  --cerulean: #007ab3;
  --steel: #5d6f86;
  --line: #d8e0eb;
  --line-soft: #e7edf4;
  --mist: #eef2f7;
  --paper: #ffffff;

  --decide: #9a5a00;   --decide-bg: #fff1d9;
  --working: #00679a;  --working-bg: #e2f1f9;
  --waiting: #4f4a86;  --waiting-bg: #ecebf7;
  --alert: #a63a29;    --alert-bg: #fbe8e4;
  --done: #276c4c;     --done-bg: #e2f3ea;
  --info: #1c4278;     --info-bg: #e7edf6;
  --muted: #5d6f86;    --muted-bg: #edf0f4;

  --display: 'Saira', 'Segoe UI', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible Next', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;

  --radius: 8px;
  --side-w: 232px;
  --cut: 9px; /* the angled end of a bar */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 15px/1.55 var(--body);
  color: var(--ink);
  background: var(--mist);
}
img { max-width: 100%; }
a { color: var(--cerulean); }
a:hover { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--cerulean) 55%, transparent); outline-offset: 2px; }
code { font-family: var(--mono); font-size: 0.88em; }
pre { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: #f4f7fb; border: 1px solid var(--line-soft); border-radius: 6px; padding: 10px 12px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
h1, h2, h3, h4, h5, h6 { font-family: var(--display); font-stretch: 112%; color: var(--ink); line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14.5px; font-weight: 650; }
.muted { color: var(--steel); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */

.shell { min-height: 100vh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 26px 18px 20px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
}
.side-logo img { display: block; width: 150px; height: auto; }
.side-app { margin: 10px 0 30px; font: 500 13px/1 var(--display); font-stretch: 112%; color: rgba(255, 255, 255, 0.66); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px 9px 16px; border-radius: 6px;
  color: rgba(255, 255, 255, 0.78); text-decoration: none; font-weight: 500;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.nav-link.is-active { color: #fff; background: rgba(255, 255, 255, 0.11); }
.nav-link.is-active::before {
  content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 8px;
  background: var(--cerulean);
  clip-path: polygon(0 0, 100% 0, 40% 100%, 0 100%);
}
.nav-badge { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #fff; color: var(--navy); font-size: 12px; font-weight: 700; text-align: center; }
.side-user { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.14); font-size: 13px; }
.side-user-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { color: rgba(255, 255, 255, 0.6); text-transform: capitalize; margin-bottom: 6px; }
.btn-link-light { background: none; border: 0; padding: 0; color: rgba(255, 255, 255, 0.8); text-decoration: underline; cursor: pointer; }
.topbar { display: none; }
.main { min-width: 0; outline: none; }
.page { max-width: 1320px; margin: 0 auto; padding: 32px 36px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.lede { font-size: 16.5px; color: var(--steel); margin: 6px 0 22px; max-width: 72ch; }
.lede-link { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--cerulean) 55%, transparent); text-underline-offset: 3px; cursor: pointer; }
.lede-link:hover { color: var(--cerulean); }
.stack { display: grid; gap: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #b9c6d8; color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn[data-busy] { cursor: progress; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); border-color: var(--navy-deep); color: #fff; }
.btn-danger { background: var(--alert); border-color: var(--alert); color: #fff; }
.btn-danger:hover { color: #fff; filter: brightness(0.93); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--steel); }
.btn-quiet:hover { color: var(--ink); border-color: transparent; background: var(--muted-bg); }
.btn-light { background: #fff; border-color: #fff; color: var(--navy); }
.btn-light:hover { background: #eaf2fb; color: var(--navy); border-color: #eaf2fb; }
.btn-strong { padding-inline: 20px; }
.btn-ghost-light { background: transparent; border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.btn-ghost-light:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, 0.08); }
.btn-small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }

input[type='text'], input[type='email'], input[type='search'], input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cerulean); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cerulean) 18%, transparent); }
.search { max-width: 380px; }
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field-label { font-weight: 600; font-size: 13.5px; }
.field-hint { font-size: 12.5px; color: var(--steel); }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.check input { margin-top: 4px; }
.radio-group { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.radio-group legend { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.radio-group label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.form-error { color: var(--alert); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 0; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--steel); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--navy); border-bottom-color: var(--navy); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.chip-small { font-size: 11.5px; padding: 0 8px; }
.tone-decide { color: var(--decide); background: var(--decide-bg); }
.tone-working { color: var(--working); background: var(--working-bg); }
.tone-waiting { color: var(--waiting); background: var(--waiting-bg); }
.tone-alert { color: var(--alert); background: var(--alert-bg); }
.tone-done { color: var(--done); background: var(--done-bg); }
.tone-info { color: var(--info); background: var(--info-bg); }
.tone-muted { color: var(--muted); background: var(--muted-bg); }
.tag { display: inline-block; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; font-size: 11.5px; font-weight: 600; color: var(--steel); background: #fff; text-transform: capitalize; }
.tag-auto { color: var(--working); border-color: #b8dcef; background: var(--working-bg); }
.tag-manual { color: var(--waiting); border-color: #d2cff0; background: var(--waiting-bg); }
.tag-prod { color: var(--alert); border-color: #f0c7bf; background: var(--alert-bg); }
.tag-kind { color: var(--navy); border-color: #c9d6ea; background: var(--info-bg); }
.base-id { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--mist); color: var(--navy); }

.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cerulean); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.35; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.empty { padding: 36px 20px; text-align: center; color: var(--steel); }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 16px; }
.empty p { margin: 0 auto; max-width: 52ch; }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--steel); font-size: 13px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table select { width: auto; padding: 4px 8px; }
.is-inactive { opacity: 0.55; }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.kv-list { margin: 0 0 14px; padding-left: 18px; display: grid; gap: 4px; }

/* ---------- queue ---------- */

.ticket-list { background: var(--paper); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.ticket-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px 230px; gap: 18px; align-items: start;
  padding: 15px 20px; border-top: 1px solid var(--line-soft);
  color: inherit; text-decoration: none; position: relative;
}
.ticket-row:first-child { border-top: 0; }
.ticket-row:hover { background: #f7f9fc; color: inherit; }
.ticket-row.is-unread::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; background: var(--cerulean); border-radius: 0 3px 3px 0; }
.tr-ref { font: 600 12.5px/1.2 var(--display); font-stretch: 112%; color: var(--cerulean); display: flex; align-items: center; gap: 6px; }
.tr-title { font-weight: 600; font-size: 15.5px; margin-top: 3px; }
.tr-summary { color: var(--steel); font-size: 13.5px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tr-meta { display: grid; gap: 2px; font-size: 13.5px; min-width: 0; }
.tr-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-state { display: flex; flex-wrap: wrap; gap: 6px 8px; justify-content: flex-end; align-items: center; }
.tr-time { flex-basis: 100%; text-align: right; font-size: 12.5px; color: var(--steel); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cerulean); display: inline-block; }
.working-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--working); }

/* ---------- ticket ---------- */

.back { display: inline-block; margin-bottom: 14px; font-size: 13.5px; color: var(--steel); text-decoration: none; }
.back::before { content: '‹ '; }
.ticket-ref { font: 600 13px/1 var(--display); font-stretch: 112%; color: var(--cerulean); margin-bottom: 6px; }
.ticket-title { font-size: 28px; max-width: 34ch; }
.ticket-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 10px; font-size: 14px; }
.quiet-link { color: var(--steel); text-decoration: none; }
.activity-banner { display: inline-flex; align-items: center; gap: 9px; margin-top: 14px; padding: 6px 12px; border-radius: 6px; background: var(--working-bg); color: var(--working); font-weight: 600; font-size: 14px; }

/* the lifecycle track — stacked bars with angled ends, like the E */
.track-wrap { margin: 26px 0 16px; }
.track { display: flex; gap: 5px; list-style: none; margin: 0; padding: 0; }
.track-step { flex: 1; min-width: 0; }
.track-bar {
  display: block; height: 14px; background: var(--line);
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%);
}
.track-step:first-child .track-bar { border-radius: 4px 0 0 4px; }
.track-label { display: block; margin-top: 7px; font: 500 12.5px/1.2 var(--display); font-stretch: 112%; color: var(--steel); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-step.is-done .track-bar { background: linear-gradient(90deg, var(--cerulean), #00689c 45%, var(--navy)); }
.track-step.is-done .track-label { color: var(--ink); }
.track-step.is-current .track-bar { background: var(--navy); height: 14px; box-shadow: inset 0 -4px 0 var(--cerulean); }
.track-step.is-current .track-label { color: var(--navy); font-weight: 700; }
.track-step.is-held .track-bar { background: repeating-linear-gradient(135deg, var(--alert) 0 7px, #c4604d 7px 14px); }
.track-step.is-held .track-label { color: var(--alert); font-weight: 700; }
.track-step.is-stopped .track-bar { background: #a7b3c3; }

.decision-stack { display: grid; gap: 10px; margin-bottom: 18px; }
.decision {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 18px 22px; border-radius: var(--radius); color: #fff;
  background: var(--navy);
}
.decision h2 { color: #fff; font-size: 18px; }
.decision-body { margin-top: 4px; color: rgba(255, 255, 255, 0.84); max-width: 75ch; }
.decision-body .plain-list { margin: 6px 0 0; }
.decision-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.decision.tone-decide { background: linear-gradient(100deg, var(--navy) 0%, var(--navy-deep) 100%); }
.decision.tone-alert { background: #8b3222; }
.decision.tone-waiting { background: #45407a; }
.decision.tone-done { background: #235f44; }
.decision-more { display: flex; justify-content: flex-end; }
.more-actions { position: relative; }
.more-actions > summary { list-style: none; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--steel); padding: 4px 8px; border-radius: 6px; }
.more-actions > summary::-webkit-details-marker { display: none; }
.more-actions > summary::after { content: ' ▾'; }
.more-actions[open] > summary { background: var(--muted-bg); color: var(--ink); }
.more-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 220px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(16, 35, 63, 0.14); display: grid; }
.menu-item { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 5px; cursor: pointer; font-weight: 500; }
.menu-item:hover { background: var(--mist); }
.menu-item.is-danger { color: var(--alert); }
.menu-item:disabled { opacity: 0.45; cursor: not-allowed; }

.ticket-tabs { display: none; }
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 410px); gap: 20px; align-items: start; }
.col-side { position: sticky; top: 16px; }

/* work request */
.wr-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.versions { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.version { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-weight: 700; font-family: var(--display); font-stretch: 112%; font-size: 13px; }
.version-status { font-family: var(--body); font-weight: 500; color: var(--steel); margin-left: 6px; font-size: 12px; }
.version.is-active { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.note { background: var(--mist); border-radius: 6px; padding: 8px 12px; font-size: 14px; margin: 0 0 12px; }
.lead { font-size: 15.5px; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 10px; }
.prose ul, .prose ol { margin: 0 0 10px; padding-left: 20px; }
.prose li { margin-bottom: 3px; }
.prose h4, .prose h5, .prose h6 { font-size: 14.5px; margin: 14px 0 6px; }
.prose code { background: var(--mist); padding: 1px 4px; border-radius: 4px; }
.prose pre code { background: none; padding: 0; }
.quote { border-left: 4px solid var(--cerulean); padding: 4px 0 4px 14px; }
.targets { display: grid; gap: 6px; margin: 14px 0; font-size: 13.5px; }
.target { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.target strong { margin-right: 6px; }
.callout { border: 1px solid #f0d9a8; background: var(--decide-bg); border-radius: 6px; padding: 12px 14px; margin: 14px 0; }
.callout h3 { color: var(--decide); margin-bottom: 4px; }
.callout .plain-list { margin: 0; }
.wr-section { margin-top: 22px; }
.wr-section > h3 { margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
.wr-details { margin-top: 22px; }
.wr-details > summary, details > summary { cursor: pointer; font-weight: 600; color: var(--navy); }
details > summary + * { margin-top: 10px; }
.plain-list { margin: 0; padding-left: 20px; }
.plain-list li { margin-bottom: 5px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
.step-id {
  height: 26px; padding-left: 8px; display: flex; align-items: center;
  background: var(--navy); color: #fff; font: 700 12.5px/1 var(--display); font-stretch: 112%;
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
}
.step-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; }
.step-where { margin: 2px 0 6px; }
.results { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.result { display: grid; grid-template-columns: 40px 70px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 14px; }
.result.is-failed { color: var(--alert); }
.checklist { list-style: none; padding: 0; margin: 0; }
.tool-log { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.tool-log li { border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px 10px; }
.tool-log li.is-write { border-left: 4px solid var(--cerulean); }
.tool-log li.is-error { border-left: 4px solid var(--alert); }
.tool-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ua-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ua { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 6px; }
.secret { display: inline-block; max-width: 100%; padding: 4px 8px; border-radius: 4px; background: var(--mist); word-break: break-all; font-size: 12px; }
.ua.is-failed { border-color: #f0c7bf; background: var(--alert-bg); }

/* request */
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 16px; font-size: 14px; margin-bottom: 14px; }
.kv > :nth-child(odd) { color: var(--steel); }
.plain-text { white-space: pre-wrap; word-break: break-word; }
.card > .plain-text { margin-bottom: 14px; }
.attachments { margin-top: 16px; }
.attachments h3 { margin-bottom: 6px; }
.attachments ul { margin: 0; padding-left: 18px; font-size: 14px; }

/* chat */
.chat-card { display: flex; flex-direction: column; }
.chat-log { max-height: 440px; overflow-y: auto; display: grid; gap: 14px; padding-right: 4px; margin-bottom: 10px; }
.chat-empty .suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.suggestion { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; text-align: left; }
.suggestion:hover { border-color: var(--cerulean); color: var(--navy); }
.msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--display); background: var(--mist); color: var(--navy); }
.msg-claude .msg-avatar { background: var(--navy); color: #fff; }
.msg-meta { font-size: 12.5px; color: var(--steel); margin-bottom: 2px; font-weight: 600; }
.msg-body { font-size: 14.5px; min-width: 0; }
.msg-staff .msg-body .prose { background: var(--mist); border-radius: 8px; padding: 8px 11px; }
.chat-status .typing { display: flex; align-items: center; gap: 8px; color: var(--working); font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.chat-form textarea { margin-bottom: 8px; }
.chat-form-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }

/* activity timeline */
.timeline { display: grid; gap: 0; max-height: 720px; overflow-y: auto; }
.tl-item { padding: 10px 0 10px 16px; border-left: 2px solid var(--line); position: relative; font-size: 14px; }
.tl-item::before { content: ''; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--line); }
.tl-item.is-alert::before { border-color: var(--alert); background: var(--alert); }
.tl-item.is-done::before { border-color: var(--done); background: var(--done); }
.tl-email::before { border-radius: 2px; border-color: var(--cerulean); }
.tl-email.is-in::before { background: var(--cerulean); }
.tl-email.is-draft { background: var(--decide-bg); border-left-color: var(--decide); padding-right: 10px; border-radius: 0 6px 6px 0; }
.tl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 13px; color: var(--steel); }
.tl-meta strong { color: var(--ink); }
.tl-subject { font-weight: 600; margin: 3px 0; }
.tl-text { color: var(--ink); }
.tl-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tl-email details > summary { font-weight: 400; color: var(--ink); }
.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.inbox-item .tl-subject { font-size: 15.5px; }

/* dialogs & toasts */
.dlg { width: min(520px, calc(100vw - 32px)); border: 0; border-radius: 12px; padding: 24px; box-shadow: 0 24px 70px rgba(16, 35, 63, 0.3); }
.dlg-wide { width: min(760px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(16, 35, 63, 0.45); }
.dlg h2 { font-size: 19px; margin-bottom: 6px; }
.dlg > p { margin: 0 0 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.compose-assist { display: flex; gap: 8px; margin-bottom: 14px; }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(16, 35, 63, 0.25); max-width: 380px; transition: opacity 0.4s, transform 0.4s; }
.toast-error { background: var(--alert); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--paper); }
.login-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 64px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
}
.login-logo { width: min(340px, 80%); position: relative; z-index: 1; }
.login-bars { position: absolute; left: 64px; bottom: 64px; display: grid; gap: 12px; width: min(420px, 60%); }
.login-bars span { display: block; height: 26px; background: linear-gradient(90deg, rgba(0, 122, 179, 0.15), rgba(0, 122, 179, 0.75)); }
/* like the E: upper bars cut back at the bottom, lower bars reach forward */
.login-bars span:nth-child(1) { width: 100%; clip-path: polygon(0 0, 100% 0, calc(100% - 22px) 100%, 0 100%); }
.login-bars span:nth-child(2) { width: 88%; clip-path: polygon(0 0, 100% 0, calc(100% - 22px) 100%, 0 100%); }
.login-bars span:nth-child(3) { width: 82%; clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 100%, 0 100%); }
.login-bars span:nth-child(4) { width: 100%; clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 100%, 0 100%); }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 64px; max-width: 520px; }
.login-panel h1 { font-size: 30px; margin-bottom: 8px; }
.login-panel > p { margin: 0 0 26px; }
.login-msg { min-height: 1.4em; font-size: 14px; color: var(--steel); }
.login-msg.is-error { color: var(--alert); }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .ticket-grid { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; }
  .ticket-row { grid-template-columns: minmax(0, 1fr) 200px; }
  .tr-meta { display: none; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30;
    padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
    background: var(--navy);
  }
  .topbar-logo img { display: block; height: 26px; width: auto; }
  .menu-toggle { width: 40px; height: 40px; border: 0; background: transparent; display: grid; place-content: center; gap: 5px; cursor: pointer; }
  .menu-toggle span { display: block; width: 22px; height: 2px; background: #fff; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(280px, 82vw); z-index: 40; transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: 12px 0 40px rgba(16, 35, 63, 0.3); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(16, 35, 63, 0.4); z-index: 35; }
  .page { padding: 20px 16px 48px; }
  h1 { font-size: 22px; }
  .ticket-title { font-size: 22px; }
  .search { max-width: none; }
  .ticket-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px 16px; }
  .tr-state { justify-content: flex-start; }
  .tr-time { flex-basis: auto; text-align: left; margin-left: auto; }
  .track-label { display: none; }
  .track-step.is-current .track-label, .track-step.is-held .track-label { display: block; overflow: visible; }
  .decision { padding: 16px; }
  .decision-actions { width: 100%; }
  .decision-actions .btn { flex: 1 1 auto; }
  .ticket-tabs { display: flex; position: sticky; top: 60px; z-index: 10; background: var(--mist); margin: 0 -16px 14px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .ticket-tabs .tab { flex: 1; }
  .ticket-grid[data-tab='plan'] .col-request,
  .ticket-grid[data-tab='plan'] .col-side,
  .ticket-grid[data-tab='chat'] .col-main,
  .ticket-grid[data-tab='chat'] .col-activity,
  .ticket-grid[data-tab='activity'] .col-main,
  .ticket-grid[data-tab='activity'] .col-chat,
  .ticket-grid[data-tab='request'] .col-plan,
  .ticket-grid[data-tab='request'] .col-side { display: none; }
  .card { padding: 16px; }
  .chat-log { max-height: 55vh; }
  .timeline { max-height: none; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .kv > :nth-child(odd) { margin-top: 8px; font-size: 13px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-brand { padding: 40px 24px 70px; min-height: 220px; }
  .login-bars { left: 24px; bottom: 22px; width: 62%; gap: 7px; }
  .login-bars span { height: 12px; }
  .login-panel { padding: 32px 24px 48px; }
  .chat-form-row { flex-direction: column; align-items: stretch; }
  .result { grid-template-columns: 40px 60px minmax(0, 1fr); }
}
