/* Squirrel Control. Brand: navy #0b1b33, squirrel orange #e8731c, headset sky #4fb3e8, cream #fde6c6.
   Light and dark themes via prefers-color-scheme. */
:root {
  --navy: #0b1b33;
  --navy-2: #13294a;
  --orange: #e8731c;
  --orange-hover: #cf6212;
  --sky: #4fb3e8;
  --cream: #fde6c6;

  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #13202f;
  --muted: #5d6b7a;
  --line: #e2e6eb;
  --line-strong: #c9d0d8;
  --hover: rgba(11, 27, 51, 0.04);
  --accent: var(--orange);
  --on-accent: #ffffff;
  --link: #1f6fb0;
  --ok: #2f8a55;    --ok-bg: #e5f4ea;
  --warn: #a86200;  --warn-bg: #fff1d6;
  --bad: #c0352b;   --bad-bg: #fde8e6;
  --info-bg: #e6f3fb;
  --note-bg: #fff8e8;
  --radius: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a121e;
    --card: #111c2c;
    --text: #e6ebf1;
    --muted: #94a3b4;
    --line: #22324a;
    --line-strong: #33465f;
    --hover: rgba(255, 255, 255, 0.05);
    --link: #7cc4ef;
    --ok: #6fd39a;    --ok-bg: #12301f;
    --warn: #f2b453;  --warn-bg: #3a2a0c;
    --bad: #ff7b70;   --bad-bg: #3d1614;
    --info-bg: #0f2a40;
    --note-bg: #2a2210;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 8px; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--hover); padding: 2px 5px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; margin: 0; }
.icon { flex: none; vertical-align: -3px; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

/* ---- Shell: navy rail + content ---- */
.shell { display: flex; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; width: 232px; flex: none; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 14px 10px;
  background: var(--navy); color: #dbe5f0;
}
.rail a, .rail-btn {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px;
  color: #c9d6e4; font: inherit; font-weight: 500; text-decoration: none; background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
}
.rail a:hover, .rail-btn:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.rail a.on { background: rgba(232, 115, 28, 0.18); color: #fff; box-shadow: inset 3px 0 0 var(--orange); }
.rail .brand { padding: 6px 8px 16px; gap: 10px; color: #fff; }
.rail .brand:hover { background: none; }
.rail .brand span { display: flex; flex-direction: column; font-weight: 800; font-size: 17px; line-height: 1.1; letter-spacing: -0.01em; }
.rail .brand small { font-size: 11px; font-weight: 700; color: var(--sky); letter-spacing: 0.08em; }
.rail-spacer { flex: 1; }
.count { margin-left: auto; background: var(--orange); color: #fff; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.count.soft { background: rgba(255, 255, 255, 0.14); }
.main { flex: 1; min-width: 0; padding: 24px 32px 48px; max-width: 1240px; }
.main.solo { margin: 0 auto; }

/* ---- Page parts ---- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.head-side { display: flex; align-items: center; gap: 8px; }
.crumbs { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 620px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.card.flush > .card-title { padding: 14px 18px 0; }
.empty { padding: 28px 18px; margin: 0; text-align: center; color: var(--muted); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.two-col.even { grid-template-columns: 1fr 1fr; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: flex; flex-direction: column; gap: 4px; margin: 0; color: var(--text); }
.tile:hover { border-color: var(--orange); text-decoration: none; }
.tile span { color: var(--muted); font-size: 13px; }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; background: var(--info-bg); }
.flash.success { background: var(--ok-bg); }
.flash.error { background: var(--bad-bg); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); display: flex; flex-direction: column; }
a.stat:hover { border-color: var(--orange); text-decoration: none; }
.stat b { font-size: 28px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.warn { background: var(--warn-bg); border-color: transparent; }
.stat.bad { background: var(--bad-bg); border-color: transparent; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 99px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a:hover { background: var(--hover); text-decoration: none; }
.tabs a.on { background: var(--navy); color: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.pager { display: flex; gap: 8px; justify-content: center; }

/* ---- Ticket list ---- */
.tlist { display: flex; flex-direction: column; }
.trow { display: flex; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--text); }
.tlist > .trow:first-child { border-top: 0; }
.trow:hover { background: var(--hover); text-decoration: none; }
.tnum { font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); width: 82px; flex: none; }
.tmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tsubject { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmeta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tside { display: flex; align-items: center; gap: 10px; flex: none; }
.tassignee { font-size: 13px; color: var(--muted); width: 120px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--hover); border: 1px solid var(--line); white-space: nowrap; }
.pill.big { font-size: 14px; padding: 4px 12px; }
.pill.soft { border-color: transparent; }
.clock { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; background: var(--ok-bg); color: var(--ok); }
.clock.met { background: transparent; color: var(--muted); font-weight: 500; }
.clock.warn { background: var(--warn-bg); color: var(--warn); }
.clock.urgent, .clock.overdue { background: var(--bad-bg); color: var(--bad); }
.tag-private { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); vertical-align: middle; }

/* ---- Ticket timeline ---- */
.timeline { min-width: 0; }
.msg { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.msg.note { background: var(--note-bg); border-color: transparent; }
.msg.reply { border-left: 3px solid var(--orange); }
.msg header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.msg header time { margin-left: auto; }
.msg .kind { font-size: 12px; font-weight: 600; color: var(--muted); }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.event { font-size: 13px; color: var(--muted); margin: 0 0 12px 12px; }
.composer textarea { min-height: 90px; }
.row-end { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; font-size: 12px; font-weight: 700; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 12px; }
label > input, label > select, label > textarea { display: block; margin-top: 4px; width: 100%; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--sky); outline: none; box-shadow: 0 0 0 3px rgba(79, 179, 232, 0.25); }
select:disabled { opacity: 0.7; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; margin: 0; }
label.check.inline { display: inline-flex; margin-right: 12px; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.help { margin: -8px 0 12px; font-size: 13px; color: var(--muted); }
.hours { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.hours label { font-size: 12px; margin: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--on-accent); }
.btn.primary:hover { background: var(--orange-hover); }
.btn.wide { width: 100%; margin-top: 4px; }
button.link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; font-size: 13px; cursor: pointer; }
form.inline { display: inline; }
.share { display: flex; gap: 6px; flex-wrap: wrap; }
.share select { flex: 1; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 10px 18px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 18px; border-top: 1px solid var(--line); vertical-align: top; }
.table tbody tr:first-child td { border-top: 0; }
.table.compact td { padding: 5px 0; }
tr.archived, .list-item.archived summary { opacity: 0.55; }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
ul.plain li { padding: 6px 0; border-top: 1px solid var(--line); }
ul.plain li:first-child { border-top: 0; }

.list-item { border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item summary { padding: 12px 18px; cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list-item summary:hover { background: var(--hover); }
.item-form, .item-actions { padding: 0 18px 12px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Org chart ---- */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 22px; padding-left: 16px; border-left: 2px solid var(--line); }
.tree li { padding: 6px 0; }
.person { display: flex; align-items: center; gap: 10px; }

/* ---- Login ---- */
.login { max-width: 420px; margin: 8vh auto 0; }
.login-logo { display: block; width: 100%; height: auto; margin-bottom: 20px; border-radius: 12px; background: #fff; padding: 6px; }
.qr { display: flex; justify-content: center; }
.qr svg { background: #fff; border-radius: 8px; }

@media (max-width: 960px) {
  .two-col, .two-col.even { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .rail { position: static; height: auto; width: 100%; flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .rail a span:not(.avatar), .rail-btn span { display: none; }
  .rail .brand span { display: none; }
  .rail-spacer { display: none; }
  .rail a, .rail-btn { width: auto; padding: 8px; }
  .main { padding: 16px; }
  .tassignee, .tnum { display: none; }
  .trow { padding: 12px 16px; }
  .tside .pill { display: none; }
  .hours { grid-template-columns: repeat(4, 1fr); }
}

/* ---- New ticket, contact picker ---- */
.rail a.new-ticket { background: var(--orange); color: #fff; justify-content: center; margin-bottom: 8px; box-shadow: none; }
.rail a.new-ticket:hover { background: var(--orange-hover); }
.new-ticket-form { max-width: 860px; }
fieldset.section { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 18px; }
fieldset.section:first-of-type { border-top: 0; padding-top: 0; }
fieldset.section > legend { font-size: 15px; font-weight: 700; padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.mode-switch { margin-bottom: 10px; }
.mode-new { display: none; }
form:has(input[name=contact_mode][value=new]:checked) .mode-new { display: block; }
form:has(input[name=contact_mode][value=new]:checked) .mode-existing { display: none; }
.tag-choices { display: flex; flex-wrap: wrap; gap: 4px 0; }
.field { margin-bottom: 12px; }
.field-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.picker { position: relative; margin-bottom: 4px; }
.picker input[type=search] { width: 100%; }
.picker-chosen { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; }
.picker-chosen[hidden], .picker input[hidden], .picker-results[hidden] { display: none; }
.picker-results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: 4px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); max-height: 320px; overflow-y: auto; }
.picker-results li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.picker-results li[aria-selected=true], .picker-results li:hover { background: var(--hover); }
.picker-results li.none { cursor: default; color: var(--muted); }
.help.ok { color: var(--ok); }
.help.warn { color: var(--warn); }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---- Phase 2: composer, presence, triage ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--card); }
.pill.small { font-size: 11px; padding: 1px 7px; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.ok { color: var(--ok); }
.composer { scroll-margin-top: 16px; }
.composer-tabs { display: flex; gap: 4px; margin: -4px 0 12px; }
.composer-tabs .tab { position: relative; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 12px; border-radius: 99px; font-weight: 600; cursor: pointer; color: var(--muted); }
.composer-tabs .tab input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.composer-tabs .tab:has(input:checked) { background: var(--navy); color: #fff; }
.composer-tabs .tab:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.composer-tabs .tab:has(input:focus-visible) { outline: 2px solid var(--sky); }
.composer .pane-note { display: none; }
.composer:has(input[value=note]:checked) .pane-note { display: block; }
.composer:has(input[value=note]:checked) .pane-reply { display: none; }
.composer textarea { width: 100%; margin-bottom: 10px; }
.composer-foot { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.composer-foot label { margin: 0; flex: 1; min-width: 160px; }
.canned { margin-bottom: 8px; }
.canned select { width: 100%; }
.msg-actions { margin-top: 8px; text-align: right; }
.presence { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; background: var(--warn-bg); color: var(--text); font-weight: 600; }
.presence[hidden], [data-presence-reload][hidden] { display: none; }
.preview-title { font-size: 20px; margin: 0 0 4px; }

.triage { display: grid; grid-template-columns: 330px minmax(0, 1fr) 370px; gap: 16px; align-items: start; }
.triage-list { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; margin: 0; }
.triage-preview .card { margin: 0; }
.triage-assign { position: sticky; top: 16px; margin: 0; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); background: var(--hover); }
.bulk-bar select { flex: 1; min-width: 0; font-size: 13px; padding: 5px 6px; }
.bulk-bar .btn { padding: 5px 10px; font-size: 13px; }
.tq { list-style: none; margin: 0; padding: 0; }
.tq li { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-top: 1px solid var(--line); }
.tq li:first-child { border-top: 0; }
.tq li.on { background: rgba(232, 115, 28, 0.1); box-shadow: inset 3px 0 0 var(--orange); }
.tq li input { margin-top: 4px; }
.tq a { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--text); }
.tq a:hover { text-decoration: none; }
.tq-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tq .tnum { width: auto; }
.agent-filter { width: 100%; margin-bottom: 8px; }
.agents { max-height: 330px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.agent { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 10px; border-top: 1px solid var(--line); font-weight: 400; cursor: pointer; }
.agent:first-child { border-top: 0; }
.agent:hover { background: var(--hover); }
.agent:has(input:checked) { background: rgba(232, 115, 28, 0.12); }
.agent input { margin: 0; }
.agent-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.agent-main .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.agent[hidden] { display: none; }
.triage-assign .grid-3 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1280px) {
  .triage { grid-template-columns: 300px minmax(0, 1fr); }
  .triage-assign { grid-column: 2; position: static; }
}
@media (max-width: 900px) {
  .triage { grid-template-columns: 1fr; }
  .triage-list, .triage-assign { position: static; max-height: none; grid-column: auto; }
}
.agent > input { display: inline-block; width: auto; flex: none; margin: 0; }
.bulk-bar select { flex: 1 1 28%; }
.bulk-bar .btn { flex: 1 1 100%; }
.btn + .help, form + .help, .composer-foot + .help { margin-top: 8px; }

/* ---- Phase 3: email ---- */
code.wrap { word-break: break-all; white-space: normal; }
ul.files { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.anchor { scroll-margin-top: 80px; }
.timeline-bar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: -4px 0 8px; }
form:has(input[name=contact_mode][value=none]:checked) .mode-existing { display: none; }

/* ---- Groups / sub-tickets ---- */
.subtickets .sub-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.subtickets .sub-head .card-title { margin: 0; }
.subtickets .sub-head .btn { margin-left: auto; padding: 5px 10px; font-size: 13px; }
.progress { height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; margin-bottom: 10px; }
.progress span { display: block; height: 100%; background: var(--ok); }
.subtree { list-style: none; margin: 0; padding: 0; }
.subtree .subtree { margin-left: 14px; padding-left: 12px; border-left: 2px solid var(--line); }
.sub-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.sub-row a { flex: 1; min-width: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-row .tnum { width: auto; margin-right: 4px; }
.sub-row.done a { color: var(--muted); text-decoration: line-through; }
.sub-state { width: 16px; text-align: center; color: var(--muted); }
.sub-row.done .sub-state { color: var(--ok); }
.sub-meta { display: flex; align-items: center; gap: 6px; flex: none; }

/* ---- Collapsible messages; reply box closed until opened ---- */
details.msg > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
details.msg > summary::-webkit-details-marker { display: none; }
details.msg > summary time { margin-left: auto; }
details.msg[open] > summary { margin-bottom: 8px; }
details.msg .chevron { color: var(--muted); font-size: 12px; transition: transform 0.15s; display: inline-block; width: 10px; }
details.msg[open] .chevron { transform: rotate(90deg); }
details.msg .snippet { display: none; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.msg:not([open]) .snippet { display: inline; }
details.msg:not([open]) { padding-top: 10px; padding-bottom: 10px; }
.timeline-bar button.link { font-size: 13px; }

.composer .pane-reply, .composer .pane-note { display: none; }
.composer:has(input[value=reply]:checked) .pane-reply { display: block; }
.composer:has(input[value=note]:checked) .pane-note { display: block; }
.composer:has(input[value=note]:checked) .pane-reply { display: none; }
.composer:has(input[value=closed]:checked) .composer-tabs { margin-bottom: -4px; }
.composer-tabs { align-items: center; flex-wrap: wrap; }
.composer-tabs .tab { border: 1px solid var(--line-strong); }
.composer-tabs .tab:has(input:checked) { border-color: var(--navy); }
.composer-tabs .tab .icon { margin-right: 2px; }
.composer-tabs .cancel { display: none; border-color: transparent; }
.composer:not(:has(input[value=closed]:checked)) .composer-tabs .cancel { display: inline-flex; }
.composer-tabs .keys { margin-left: auto; }
.match-actions { padding: 12px 18px; border-top: 1px solid var(--line); }
.match-actions > span:last-child { flex: none; white-space: nowrap; }

/* ---- Formatting editor, Expand, attachments ---- */
.composer .sun-editor { border-radius: 8px; border-color: var(--line-strong); margin-bottom: 10px; font-family: var(--font); }
.composer .sun-editor .se-toolbar { border-radius: 8px 8px 0 0; }
.composer .expand { display: none; padding: 5px 10px; font-size: 13px; }
.composer:not(:has(input[value=closed]:checked)) .expand { display: inline-flex; }
.composer.is-full { position: fixed; inset: 0; z-index: 50; margin: 0; border-radius: 0; overflow-y: auto; display: flex; flex-direction: column; }
.composer.is-full form { flex: 1; display: flex; flex-direction: column; }
.composer.is-full:has(input[value=note]:checked) .pane-note,
.composer.is-full:has(input[value=reply]:checked) .pane-reply { display: flex; }
.composer.is-full .editor-holder { flex: 1; display: flex; flex-direction: column; }
.composer.is-full .sun-editor { flex: 1; display: flex; flex-direction: column; }
.composer.is-full .sun-editor .se-container { flex: 1; display: flex; flex-direction: column; }
.composer.is-full .sun-editor .se-wrapper { flex: 1; }
.composer.is-full .sun-editor .se-wrapper-inner { min-height: calc(100vh - 470px) !important; max-height: calc(100vh - 470px) !important; }
.composer.is-full .dropzone label { padding: 6px; }
.composer.is-full textarea { flex: 1; }
body.composer-full { overflow: hidden; }

.dropzone { margin-bottom: 10px; }
.dropzone label { display: flex; align-items: center; gap: 6px; justify-content: center; margin: 0; padding: 10px; border: 2px dashed var(--line-strong); border-radius: 8px; color: var(--muted); font-weight: 500; cursor: pointer; }
.dropzone label:hover, .dropzone.dragging label { border-color: var(--orange); color: var(--text); background: rgba(232, 115, 28, 0.06); }
.dropzone input:focus-visible + label { outline: 2px solid var(--sky); }
.file-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
.file-list li { padding: 2px 0; }
.file-list li.too-big { color: var(--bad); }

.body.rich { white-space: normal; }
.body.rich p { margin: 0 0 8px; }
.body.rich img { max-width: 100%; height: auto; }
.body.rich table { border-collapse: collapse; margin: 8px 0; }
.body.rich th, .body.rich td { border: 1px solid var(--line-strong); padding: 5px 8px; vertical-align: top; }
.body.rich figure { margin: 8px 0; overflow-x: auto; }
.body.rich blockquote { margin: 8px 0; padding-left: 10px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.body.rich ul, .body.rich ol { margin: 0 0 8px; padding-left: 24px; }
/* The editing area is a square box inside the rounded editor frame; round its bottom so the frame's corners show. */
.composer .sun-editor .se-wrapper, .composer .sun-editor .se-wrapper-inner, .new-ticket-form .sun-editor .se-wrapper, .new-ticket-form .sun-editor .se-wrapper-inner { border-radius: 0 0 7px 7px; }
.new-ticket-form .sun-editor { border-radius: 8px; border-color: var(--line-strong); margin-bottom: 10px; }
.new-ticket-form .sun-editor .se-toolbar { border-radius: 8px 8px 0 0; }
.composer .expand span { display: inline-flex; align-items: center; gap: 6px; }
.composer .expand .when-full, .composer.is-full .expand .when-small { display: none; }
.composer.is-full .expand .when-full { display: inline-flex; }

/* ---- @mentions ---- */
.mention { display: inline-block; padding: 0 6px; border-radius: 99px; background: rgba(79, 179, 232, 0.16); color: #1f6fb0; font-weight: 600; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .body.rich .mention { color: #7cc4ef; } }
.mention-item small { color: #6b7785; margin-left: 4px; }

/* ---- Followers row above the conversation ---- */
.followers-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.follower { display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 2px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); font-size: 13px; }
.follower .avatar { width: 22px; height: 22px; font-size: 9px; }
.follower-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; border-radius: 50%; }
.follower-x:hover { color: var(--bad); background: var(--bad-bg); }
.btn.small-btn { padding: 3px 10px; font-size: 13px; border-radius: 99px; }
.btn.following { border-color: var(--ok); color: var(--ok); }
.add-follower { position: relative; }
.add-follower > summary { list-style: none; }
.add-follower > summary::-webkit-details-marker { display: none; }
.add-follower-pop { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; display: flex; gap: 6px; padding: 10px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); }
.add-follower-pop select { min-width: 180px; }
.conv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.conv-head .followers-bar, .conv-head .timeline-bar { margin: 0; }

/* ---- Pop-up alerts ---- */
.alerts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px)); }
.alert-toast { display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 12px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line-strong); border-left: 5px solid var(--warn); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }
.alert-toast.urgent, .alert-toast.overdue { border-left-color: var(--bad); }
.alert-toast.overdue { background: var(--bad-bg); }
.alert-toast a { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--text); }
.alert-toast a:hover { text-decoration: none; }
.alert-toast a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.alert-toast small { color: var(--muted); }
.alert-close { border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); }

/* ---- Time tracking ---- */
.time-fields { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end; }
.time-fields label { margin: 0; flex: 0 0 auto; }
.time-fields label.grow { flex: 1 1 200px; }
.time-fields label.wide { flex-basis: 100%; }
.time-fields input[name=duration] { width: 110px; }
.time-buttons { display: flex; gap: 8px; margin-top: 12px; }
.timer-bar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: -4px 0 16px; border-radius: var(--radius); background: var(--ok-bg); }
.timer-bar > div { flex: 1; display: flex; flex-direction: column; }
.timer-bar b { font-size: 20px; font-variant-numeric: tabular-nums; }
.timer-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .timer-dot { animation: none; } }
.timer-count { font-variant-numeric: tabular-nums; }
.week-grid th.today { color: var(--orange); }
.week-grid tfoot th, .week-grid tfoot td { border-top: 1px solid var(--line); }
.short { color: var(--warn); }
.table-scroll { overflow-x: auto; }
.inline-form { display: inline; }
.link-btn { border: 0; background: none; padding: 0; color: var(--link); cursor: pointer; font: inherit; }
.link-btn.small { font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.review-form { display: inline-flex; gap: 6px; align-items: center; }
.review-form input { width: 180px; padding: 4px 8px; font-size: 13px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.bar { display: inline-block; height: 8px; width: 80px; border-radius: 99px; background: linear-gradient(90deg, var(--orange) var(--w), var(--hover) var(--w)); vertical-align: middle; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
/* Headers and filter bars that stay at the top while you scroll (person pickers on Time off, My time, Reports). */
@media (min-width: 761px) {
  .sticky-bar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 0; box-shadow: 0 1px 0 var(--line); }
  .page-head.sticky-head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 0; margin-top: -12px; box-shadow: 0 1px 0 var(--line); }
}
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.time-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.time-box input { width: 90px; padding: 4px 8px; }
.time-box select { padding: 4px 8px; font-size: 13px; }
.time-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.time-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.time-quick select { flex: 1; min-width: 0; padding: 4px 8px; font-size: 13px; }
.row-end .time-box { flex: 1; }

/* ---- Customer portal ---- */
.portal-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 24px; background: var(--navy); color: #fff; }
.portal-brand { color: #fff; font-weight: 800; font-size: 18px; }
.portal-brand span { color: var(--orange); }
.portal-brand:hover { text-decoration: none; }
.portal-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.portal-nav > a:not(.btn) { color: #fff; }
.portal-nav .muted { color: #c6cfdc; }
.portal-nav .link-btn { color: #fff; }
.portal-main { max-width: 900px; margin: 0 auto; padding: 24px 16px 48px; }
.portal-thread .message.from-us { border-left: 3px solid var(--orange); }
.portal-thread .message-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.portal-thread .files { margin: 10px 0 0; padding-left: 18px; }
.portal-main textarea, .portal-main input[name=subject] { width: 100%; box-sizing: border-box; }

/* ---- UDAS form on private notes ---- */
.udas { margin: 10px 0; }
.udas-fields { display: none; margin-top: 10px; }
.udas-toggle:checked ~ .udas-fields { display: block; }
.udas-btn .when-on, .udas-toggle:checked + .udas-btn .when-off { display: none; }
.udas-toggle:checked + .udas-btn .when-on { display: inline; }
.udas-toggle:focus-visible + .udas-btn { outline: 2px solid var(--orange); outline-offset: 2px; }
.udas-block { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 6px 0 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--ok-bg); font-size: 14px; }
.udas-block dt { font-weight: 700; }
.udas-block dd { margin: 0; white-space: pre-wrap; }
.jira-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.jira-create { margin: 10px 0; }
.jira-create summary { cursor: pointer; color: var(--link); }
.jira-link { display: flex; gap: 6px; margin-top: 8px; }
.jira-link input { flex: 1; min-width: 0; padding: 4px 8px; font-size: 13px; }

/* ---- AI assistant ---- */
.ai-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ai-result { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--hover); max-height: 420px; overflow: auto; }
.ai-answer .ai-q { margin: 0 0 8px; }
.portal-foot { text-align: center; padding: 0 16px 32px; font-size: 14px; color: var(--muted); }
.ai-question { display: block; width: 100%; min-height: 110px; margin-bottom: 12px; font-size: 16px; line-height: 1.5; }

/* ---- Ask AI chat box (every staff page) ---- */
.aichat-launch { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border: 0; border-radius: 99px; background: var(--navy); color: #fff; font: 700 15px var(--font); box-shadow: 0 10px 30px rgba(11, 27, 51, 0.35); cursor: pointer; }
.aichat-launch:hover { background: var(--navy-2); }
.aichat-launch .icon { color: var(--orange); }
.aichat-dot { display: none; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); }
.aichat-launch.has-news .aichat-dot { display: inline-block; }
.aichat-panel { position: fixed; z-index: 60; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line-strong); box-shadow: 0 20px 50px rgba(11, 27, 51, 0.28); }
.aichat-panel[hidden] { display: none; }
.aichat[data-mode="float"] .aichat-panel { right: 20px; bottom: 20px; width: 400px; height: min(600px, calc(100vh - 40px)); border-radius: 16px; overflow: hidden; }
.aichat[data-mode="dock"] .aichat-panel { top: 0; right: 0; bottom: 0; width: 400px; border-width: 0 0 0 1px; box-shadow: -8px 0 24px rgba(11, 27, 51, 0.08); }
body.ai-docked .shell { padding-right: 400px; }
body.ai-docked .alerts { right: 416px; }
.aichat-head { display: flex; align-items: center; gap: 4px; padding: 12px 10px 12px 16px; background: var(--navy); color: #fff; }
.aichat-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.aichat-head b { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.aichat-head b .icon { color: var(--orange); }
.aichat-head span { font-size: 12px; color: #c6cfdc; }
.aichat-btn { border: 0; background: none; color: #dfe6ef; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.aichat-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.aichat[data-mode="dock"] [data-ai-mode="dock"], .aichat[data-mode="float"] [data-ai-mode="float"] { background: rgba(255, 255, 255, 0.16); color: #fff; }
.aichat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.aichat-empty { color: var(--muted); font-size: 14px; margin: auto 0; text-align: center; padding: 0 12px; }
.aichat-msg { max-width: 88%; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.aichat-msg.q { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.aichat-msg.a { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.aichat-msg.error { border-color: transparent; background: var(--bad-bg); color: var(--bad); }
.aichat-msg.thinking { color: var(--muted); }
.aichat-msg.thinking::after { content: ''; display: inline-block; width: 1.4em; text-align: left; animation: aichat-dots 1.2s steps(4, end) infinite; }
@keyframes aichat-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .aichat-msg.thinking::after { animation: none; content: '…'; } }
.aichat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--line); background: var(--card); }
.aichat-form textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; font-size: 14px; }
.aichat-send { padding: 9px 12px; }
.aichat-foot { display: flex; justify-content: space-between; gap: 8px; padding: 0 12px 10px; font-size: 12px; color: var(--muted); background: var(--card); }
@media (max-width: 760px) {
  .aichat[data-mode="float"] .aichat-panel, .aichat[data-mode="dock"] .aichat-panel { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; }
  body.ai-docked .shell { padding-right: 0; }
  .aichat-launch { right: 12px; bottom: 12px; }
}
@media print { .aichat { display: none; } }
body:has(.aichat) .main { padding-bottom: 96px; }
@media (max-width: 760px) { .aichat [data-ai-mode="dock"] { display: none; } }
.range-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -4px 0 16px; }
.range-bar input[type=date] { padding: 6px 8px; }
.range-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.range-presets a { padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 13px; font-weight: 600; }
.range-presets a:hover { text-decoration: none; border-color: var(--line-strong); }
.range-presets a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.time-missing { margin: 8px 0 0; font-size: 13px; color: var(--warn); min-height: 1em; }
.time-missing:empty { display: none; }
.time-fields label.is-missing input, .time-fields label.is-missing select { border-color: var(--warn); box-shadow: 0 0 0 2px var(--warn-bg); }
.time-buttons button:disabled { opacity: 0.5; cursor: not-allowed; }
.time-fields .ticket-found { display: block; margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--muted); max-width: 260px; }
.time-fields label.from-ticket select { background: var(--hover); }
.time-fields label.from-ticket::after { content: 'From the ticket'; display: block; margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }

/* My account: remembered devices. Settings: duration with "Never". */
.device-list { list-style: none; margin: 0 0 12px; padding: 0; }
.device-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.device-list li:last-child { border-bottom: 0; }
.small-head { font-size: 14px; margin: 16px 0 4px; }
fieldset.duration { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
fieldset.duration legend { width: 100%; }
fieldset.duration input { width: 110px; }
fieldset.duration select { width: auto; }
.warn-text { color: var(--warn); }
.recovery-codes { columns: 2; column-gap: 24px; padding-left: 24px; margin: 16px 0; font-size: 16px; line-height: 2; }
.recovery-codes code { font-size: 16px; letter-spacing: .04em; }
.card > .actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media print {
  .rail, .page-head .crumbs, .card > .actions, .aichat { display: none !important; }
}
.stack-form { margin-bottom: 8px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.filter-bar label { margin: 0; flex: 1 1 150px; }
.filter-bar .btn { margin-bottom: 1px; }
.filter-bar input, .filter-bar select { height: 40px; box-sizing: border-box; }

/* My time: List / Sheet switch and the sheet */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg a { padding: 7px 14px; font-size: 14px; font-weight: 600; color: inherit; text-decoration: none; }
.seg a + a { border-left: 1px solid var(--line); }
.seg a.on { background: var(--hover); }
.time-sheet .sheet-all { padding: 16px 20px 8px; border-bottom: 1px solid var(--line); }
.sheet-all-fields { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.sheet-all-fields label { margin: 0; flex: 0 1 180px; }
.sheet-all-fields label.grow { flex: 1 1 220px; }
.sheet-all-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 8px; }
.sheet-table { min-width: 1100px; }
.sheet-table th, .sheet-table td { padding: 4px 6px; vertical-align: middle; }
.sheet-table input, .sheet-table select { padding: 5px 7px; font-size: 13px; min-width: 0; width: 100%; }
.sheet-table .sheet-time { width: 80px; }
.sheet-table .sheet-ticket { width: 100px; }
.sheet-table td:nth-child(3) select { min-width: 170px; }
.sheet-table td:nth-child(4) select { min-width: 130px; }
.sheet-table td:nth-child(5) select { width: 90px; }
.sheet-table td:nth-child(7) input { min-width: 160px; }
.sheet-date { white-space: nowrap; font-weight: 600; font-size: 13px; text-align: left; }
.sheet-table [data-day-total] { white-space: nowrap; }
.sheet-row.first > * { border-top: 2px solid var(--line); }
.sheet-row.more > * { border-top: 0; }
.sheet-row.weekend, .sheet-row.holiday { background: var(--hover); }
.sheet-row.today .sheet-date { color: var(--link); }
.sheet-row.locked { color: var(--muted, #666); }
.sheet-row.removing td { opacity: .5; text-decoration: line-through; }
.sheet-row.is-missing td, .sheet-row.has-error td { background: var(--bad-bg); }
.sheet-msg td { border-top: 0; padding-top: 0; }
.sheet-error { color: var(--bad); font-size: 13px; }
.sheet-save { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px 20px; background: var(--card, #fff); border-top: 1px solid var(--line); z-index: 2; }
.sheet-save .time-missing { margin: 0; }

/* Time off */
.card-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.card.flush > .card-head .card-title { margin: 0; padding: 0; }
.card-head .actions { display: flex; gap: 6px; align-items: center; }
.pad { padding: 8px 18px 14px; margin: 0; }
.bad-text { color: var(--bad); }
table.cal { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 640px; }
table.cal th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px; text-align: left; border-bottom: 1px solid var(--line); }
table.cal td { vertical-align: top; height: 92px; padding: 4px 5px; border: 1px solid var(--line); }
table.cal td.off { background: var(--hover); }
table.cal td.other { opacity: .5; }
table.cal td.today .cal-day { color: var(--on-accent); background: var(--accent); border-radius: 99px; padding: 0 7px; }
.cal-day { display: inline-block; font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.cal-item { display: block; font-size: 12px; line-height: 1.3; padding: 2px 6px; margin-bottom: 2px; border-radius: 6px; background: var(--ok-bg); color: var(--ok); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
a.cal-item:hover { text-decoration: none; filter: brightness(.96); }
.cal-item.pending { background: var(--warn-bg); color: var(--warn); border: 1px dashed currentColor; }
.cal-item.unpaid { background: var(--info-bg); color: var(--link); }
.cal-item.other-person { background: var(--hover); color: var(--muted); font-weight: 500; }
.cal-key { padding: 8px 18px 14px; margin: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cal-key .cal-item { display: inline-block; margin: 0; }
.type-choice { display: grid; gap: 6px; }
.type-option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin: 0; }
.type-option:has(input:checked) { border-color: var(--accent); background: var(--note-bg); }
.type-option input { margin-top: 3px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row-2[hidden] { display: none; }
dl.facts { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; text-align: right; }
@media (max-width: 640px) { .row-2 { grid-template-columns: 1fr; } }
.mode-choice .help { margin: 6px 0 0; }
.mode-choice .check.inline { margin-right: 14px; }

/* Keep your place: a confirmation that would be out of sight pops up instead */
.flash.toast { position: fixed; top: 16px; right: 16px; left: auto; z-index: 60; max-width: min(440px, calc(100vw - 32px)); margin: 0; box-shadow: 0 8px 28px rgba(11, 27, 51, .18); cursor: pointer; transition: opacity .3s, transform .3s; }
.flash.toast.gone { opacity: 0; transform: translateY(-8px); pointer-events: none; }
a.loading { opacity: .6; }

/* Phone calls on a ticket */
.phone-call + .phone-call { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.phone-audio { width: 100%; margin: 8px 0; }
.transcript { white-space: pre-wrap; max-height: 360px; overflow-y: auto; }
