/* Tree Manager console. 10Coins MBO colours, Hum Pay feel. Tokens and rationale in DESIGN.md. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #132023;
  --panel: #0c1619;
  --surface: #0f1c20;
  --card: #16292e;
  --card-hover: #1a3036;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --teal: #72c9b1;
  --teal-dim: rgba(114, 201, 177, 0.14);
  --teal-glow: rgba(114, 201, 177, 0.35);
  --amber: #e8a500;
  --amber-dim: rgba(232, 165, 0, 0.14);
  --red: #ff3d71;
  --red-dim: rgba(255, 61, 113, 0.14);
  --green: #00d68f;
  --green-dim: rgba(0, 214, 143, 0.14);
  --text: #f4f8f7;
  --text-muted: #b0bec5;
  --text-dim: #6c8a80;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, Menlo, monospace;
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-pill: 999px;
  --shadow-rest: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-elev: 0 6px 18px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 14px 40px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 200ms;
  --tap: 44px;
  --topbar: 56px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 15% -10%, rgba(114, 201, 177, 0.07), transparent 60%);
  color: var(--text);
  font: 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--teal); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: #9be0cd; }
h1, h2, .column-title, .brand-mark {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 20px; line-height: 1.3; margin-bottom: 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
h1 .pill, h2 .count { vertical-align: middle; }
p { margin: 0 0 8px; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 4px; }
.eyebrow a { color: var(--text-dim); }
.eyebrow a:hover { color: var(--teal); }
.error { color: #ff7a95; background: var(--red-dim); border: 1px solid rgba(255, 61, 113, 0.3); border-radius: var(--radius-btn); padding: 10px 12px; }
.empty { color: var(--text-dim); font-style: italic; padding: 14px 12px; border: 1px dashed var(--border); border-radius: var(--radius-btn); text-align: center; }
.key { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--teal); letter-spacing: 0.01em; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.07); color: var(--text-muted); font: 600 11.5px/1 var(--font-ui); letter-spacing: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  height: var(--topbar); padding: 0 clamp(16px, 4vw, 32px);
  background: rgba(12, 22, 25, 0.78);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--teal); color: #06201a; font-size: 13px; font-weight: 700; letter-spacing: -0.03em; box-shadow: 0 4px 14px var(--teal-glow); }
.brand-text { font-weight: 600; letter-spacing: -0.01em; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  border-radius: var(--radius-pill); white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav a.active { color: var(--teal); background: var(--teal-dim); }
.logout { margin-left: auto; }

/* Page */
.page { max-width: 1440px; margin: 0 auto; padding: 22px clamp(16px, 4vw, 32px) 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 18px; }
.page-head > div > p:last-child { margin-bottom: 0; }
.head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.foot { margin-top: 20px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 18px 20px; box-shadow: var(--shadow-rest); }
.panel.elev { box-shadow: var(--shadow-elev); }
.two-col { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .two-col { grid-template-columns: 3fr 2fr; } }
.stack-lg { display: grid; gap: 18px; align-content: start; }
.stack { display: grid; gap: 8px; }
.stack label, .inline-form label { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
.stack .btn { justify-self: start; margin-top: 6px; }
.login { max-width: 420px; margin: 48px auto; padding: 28px; }
.login h1 { margin-bottom: 6px; }

/* Buttons and forms */
.btn, .text-link, .sort-select {
  font: inherit; cursor: pointer;
  transition: transform 180ms var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 18px; font-size: 13px; font-weight: 600; border: 1px solid transparent; border-radius: var(--radius-btn); background: transparent; color: var(--text); }
.btn-sm { min-height: 34px; padding: 6px 14px; font-size: 12.5px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #06201a; border-radius: var(--radius-pill); padding-inline: 24px; text-transform: uppercase; letter-spacing: 0.1em; font-size: 12.5px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.btn-primary:hover { box-shadow: 0 6px 18px var(--teal-glow); transform: translateY(-1px); }
.btn-outline { border-color: var(--teal); color: var(--teal); }
.btn-outline:hover { background: var(--teal-dim); }
.btn-danger { border-color: rgba(255, 61, 113, 0.6); color: var(--red); }
.btn-danger:hover { background: var(--red-dim); }
.btn-ghost { color: var(--text-muted); border-color: var(--border-strong); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.text-link { display: inline-flex; align-items: center; gap: 4px; background: none; border: none; padding: 0; color: var(--teal); font-size: 12.5px; font-weight: 500; min-height: 28px; }
.text-link:hover { color: #9be0cd; }
.text-link .arrow { display: inline-block; transition: transform var(--dur) var(--ease); }
.text-link:hover .arrow { transform: translateX(3px); }
.inline { display: inline; margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.inline-form input { flex: 1 1 160px; width: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
input[type="text"], input[type="password"], input[type="datetime-local"], textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn); padding: 9px 12px; min-height: 40px; width: 100%;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input:focus, textarea:focus, .sort-select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-dim); }
::placeholder { color: var(--text-dim); }

/* Sync status with the live dot */
.sync-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-rest); transition: opacity var(--dur) var(--ease); }
.sync-status.htmx-request { opacity: 0.55; }
.sync-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sync-text { font-weight: 500; }
.live { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; flex: 0 0 auto; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.live-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--text-dim); opacity: 0; }
.sync-status.is-ok .live-dot { background: var(--green); animation: hum-dot 2.2s ease-in-out infinite; }
.sync-status.is-ok .live-ring { border-color: var(--green); animation: hum-ring 2.2s ease-out infinite; }
.sync-status.is-error .live-dot { background: var(--red); }
.sync-status.is-error .sync-text { color: #ff7a95; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); vertical-align: middle; }
.dot.is-ok { background: var(--green); }
.dot.is-error { background: var(--red); }
.dot.is-running { background: var(--amber); }
@keyframes hum-dot { 0%, 100% { opacity: 0.7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes hum-ring { 0% { opacity: 0.5; transform: scale(0.6); } 100% { opacity: 0; transform: scale(1.6); } }

/* Chips and pills */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; margin-bottom: 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px 0 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--panel); color: var(--text-muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 180ms var(--ease); }
.chip b { color: var(--text); font-weight: 600; }
.chip:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.chip-dot, .column-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
.pill-green { background: var(--green-dim); color: var(--green); }
.pill-amber { background: var(--amber-dim); color: var(--amber); }
.pill-red { background: var(--red-dim); color: #ff7a95; }
.pill-dim { background: rgba(255, 255, 255, 0.07); color: var(--text-muted); }
.pill-type { background: rgba(255, 255, 255, 0.06); color: var(--text-dim); font-weight: 500; }

/* Board */
.board { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 14px; -webkit-overflow-scrolling: touch; }
.column { flex: 0 0 clamp(290px, 86vw, 360px); scroll-snap-align: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 12px; min-height: 240px; transition: opacity var(--dur) var(--ease); }
.column.htmx-request .cards { opacity: 0.45; }
@media (min-width: 900px) { .column { flex-basis: clamp(280px, 19.5vw, 380px); } }
.column-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 4px 12px; }
.column-title { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; }
.column-dot { color: inherit; }
.cards { display: grid; gap: 10px; transition: opacity var(--dur) var(--ease); }
.column-note { text-align: center; padding: 6px 0 2px; }
.stage-in_progress { color: var(--text-muted); }
.stage-in_qa { color: var(--amber); }
.stage-qa_passed { color: var(--teal); }
.stage-scheduled { color: var(--green); }
.stage-released { color: var(--text-dim); }
.column-title .count { color: var(--text-muted); }

.sort { display: inline-flex; flex: 0 0 auto; }
.sort-select {
  appearance: none; -webkit-appearance: none;
  max-width: 150px; min-height: 30px; padding: 4px 26px 4px 11px;
  color: var(--text-muted); background-color: var(--panel);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23b0bec5' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
.sort-select:hover { color: var(--text); border-color: var(--border-strong); }

.card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 12px 14px 10px; color: var(--text); box-shadow: var(--shadow-rest); transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.card::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--border-strong); }
.card.stage-in_qa::before { background: var(--amber); }
.card.stage-qa_passed::before { background: var(--teal); }
.card.stage-scheduled::before { background: var(--green); }
.card.stage-released::before { background: var(--text-dim); }
.card.is-stuck::before, .card.is-flagged::before { background: var(--red); }
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-elev); }
.card.hover-lift:hover { background: var(--card-hover); border-color: var(--border-strong); }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-top .age { margin-left: auto; }
.age { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.ring { --pct: 0; --ring: var(--teal); width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; background: conic-gradient(var(--ring) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.1) 0); -webkit-mask: radial-gradient(circle at center, transparent 55%, #000 58%); mask: radial-gradient(circle at center, transparent 55%, #000 58%); transition: --pct var(--dur) var(--ease); }
.card.stage-in_qa .ring { --ring: var(--amber); }
.card.stage-scheduled .ring { --ring: var(--green); }
.card.stage-released .ring { --ring: var(--text-dim); }
.ring.is-stuck { --ring: var(--red); }
.summary { margin: 8px 0 8px; font-size: 14px; line-height: 1.45; letter-spacing: -0.005em; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--text-muted); font-size: 12px; }
.card-meta .fix { color: var(--text); }
.who { display: inline-flex; align-items: center; gap: 7px; }
.avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: var(--text-muted); font-size: 10px; font-weight: 600; letter-spacing: 0.02em; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 6px; }
.card-actions:empty { display: none; }
.card-row { display: grid; gap: 6px; margin-bottom: 12px; }
.card-row .card { margin-bottom: 0; }
.card-row > form { justify-self: end; }

/* Rows and lists */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-btn); background: var(--surface); transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), border-color var(--dur) var(--ease); }
.row.hover-lift:hover { border-color: var(--border-strong); }
.row .arrow { color: var(--text-dim); margin-left: auto; }
.row-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; flex: 1; min-width: 200px; color: var(--text); }
.row-main:hover { color: var(--text); }
.row-title { font-weight: 500; }
.row.status-done .row-title, .row.status-cancelled .row-title { color: var(--text-muted); }

/* Digest */
.digest-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .digest-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1300px) { .digest-grid { grid-template-columns: repeat(3, 1fr); } }
.digest-card h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.digest-card.is-empty { opacity: 0.7; }
.digest-section h3 { display: flex; align-items: center; gap: 8px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.lines li:last-child { border-bottom: none; }
.line-summary { flex: 1 1 200px; }
.notes { margin-top: 12px; white-space: pre-wrap; color: var(--text-muted); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-btn); }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); padding: 10px 14px; }
.table td { padding: 10px 14px; border-top: 1px solid var(--border); white-space: nowrap; vertical-align: top; }
.table tr:hover td { background: rgba(255, 255, 255, 0.025); }
.table tr.status-error td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* Telegram updates switch */
.switch-form { display: inline-flex; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px 0 8px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--panel); color: var(--text-muted); font: inherit; cursor: pointer; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform 180ms var(--ease); }
.switch:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.12); transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
.switch.is-on { color: var(--text); }
.switch.is-on .switch-track { background: var(--teal-dim); box-shadow: inset 0 0 0 1px var(--teal-glow); }
.switch.is-on .switch-knob { transform: translateX(16px); background: var(--teal); }
.switch-label { font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.switch-form.htmx-request .switch { opacity: 0.6; }

/* Priorities */
.pill-prio { background: var(--teal-dim); color: var(--teal); }
.pill-prio.is-urgent { background: var(--red-dim); color: #ff7a95; }
.prio-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 12px; }
.prio-head h2 { margin-bottom: 8px; }
.prio-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.prio-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: var(--tap); padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-btn); background: var(--surface); transition: border-color var(--dur) var(--ease); }
.prio-item:hover { border-color: var(--border-strong); }
.prio-item.is-urgent { border-color: rgba(255, 61, 113, 0.35); }
.prio-item.is-handled { opacity: 0.65; }
.prio-item.is-handled .prio-summary { text-decoration: line-through; }
.prio-summary { flex: 1; min-width: 160px; }
.chip.is-active { color: var(--text); border-color: var(--teal); background: var(--teal-dim); }

/* Today: headline and the digest lines */
.headline { font-size: 16px; line-height: 1.5; margin: 0 0 6px; max-width: 72ch; }
.digest-card h2 .muted { font: 500 12.5px/1.3 var(--font-ui); letter-spacing: 0; }
.quiet { margin: 0 0 14px; }
.line-heading { padding-top: 6px; }
.line-heading:first-child { padding-top: 0; }
.line-person { font-weight: 600; }
.line-footer { margin: 8px 0 0; }
.no-release { margin-top: 18px; }
.no-release > summary { cursor: pointer; font-weight: 600; }
.prio-history { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.prio-history > summary { display: flex; align-items: center; gap: 8px; min-height: 28px; cursor: pointer; list-style: none; color: var(--text-muted); font-size: 12.5px; font-weight: 500; }
.prio-history > summary::-webkit-details-marker { display: none; }
.prio-history > summary::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur) var(--ease); }
.prio-history[open] > summary::before { transform: rotate(45deg); }
.prio-history > summary:hover { color: var(--text); }
.prio-list-block + .prio-list-block { margin-top: 14px; }
.prio-history .prio-list-block { margin-top: 12px; }
.prio-list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin-bottom: 6px; }
.prio-list-head p { margin: 0; }
.prio-label-edit summary { list-style: none; cursor: pointer; }
.prio-label-edit summary::-webkit-details-marker { display: none; }
.prio-label-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.prio-label-form input[type="text"] { min-height: 34px; padding: 0 10px; font-size: 13px; width: min(100%, 260px); }
.prio-list.is-past .prio-item { opacity: 0.8; }
.prio-list.is-past .prio-item.is-handled { opacity: 0.55; }
.reply { white-space: pre-wrap; font: 13px/1.5 var(--mono); color: var(--text); margin: 0 0 18px; }

/* Phones */
@media (max-width: 768px) {
  h1 { font-size: 26px; }
  .topbar { gap: 10px; }
  .brand-text { display: none; }
  .btn, .nav a { min-height: var(--tap); }
  .btn-sm { min-height: 40px; }
  .page { padding-top: 16px; }
  .page-head { gap: 12px; }
  .sync-status { width: 100%; }
  .chips { position: sticky; top: var(--topbar); z-index: 10; margin: 0 calc(-1 * clamp(16px, 4vw, 32px)); padding: 8px clamp(16px, 4vw, 32px) 10px; background: rgba(19, 32, 35, 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .board { margin: 0 calc(-1 * clamp(16px, 4vw, 32px)); padding: 6px clamp(16px, 4vw, 32px) 14px; scroll-padding: 0 clamp(16px, 4vw, 32px); }
  .table td, .table th { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Ticket page (section S) */
.ticket-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 18px; align-items: start; }
.ticket-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.ticket-title .key { font-size: 15px; }
.ticket-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--text-muted); font-size: 12.5px; }
.ticket-meta b { color: var(--text); font-weight: 500; }
.ticket-meta .avatar { vertical-align: middle; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; }
.rendered { line-height: 1.55; overflow-wrap: anywhere; font-size: 13.5px; }
.rendered p { margin: 0 0 10px; }
.rendered p:last-child { margin-bottom: 0; }
.rendered ul, .rendered ol { margin: 0 0 10px; padding-left: 22px; }
.rendered pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-btn); padding: 10px 12px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; }
.rendered code, .rendered tt { font-family: var(--mono); font-size: 12.5px; }
.rendered table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 0 0 10px; }
.rendered th, .rendered td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.rendered blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--border-strong); color: var(--text-muted); }
.rendered a { color: var(--teal); }
.rendered h1, .rendered h2, .rendered h3, .rendered h4, .rendered h5, .rendered h6 { font-size: 15px; margin: 12px 0 6px; }
.img-placeholder { display: inline-block; padding: 1px 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius-pill); color: var(--text-muted); font-size: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 4px 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: none; }
.timeline .when { color: var(--text-muted); font-size: 12px; padding-top: 3px; white-space: nowrap; }
.timeline .head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 4px; }
.timeline .who { font-weight: 500; font-size: 13px; }
.timeline .note-body { white-space: pre-wrap; font-size: 13.5px; }
.timeline li.is-note { background: var(--teal-dim); margin: 0 -8px; padding: 10px 8px; border-radius: var(--radius-btn); border-bottom: none; }
.related h3 { font-family: var(--font-ui); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 4px; }
.related h2 + h3 { margin-top: 0; }
.note-form textarea { width: 100%; min-height: 84px; box-sizing: border-box; }
@media (max-width: 860px) {
  .ticket-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}
