/* Standalone ticket workbench styles for alternate Fossil skins.
 * Fallback tokens sit in a CSS cascade layer so skins that define their own
 * unlayered :root tokens (Refined Dark, Refined Light, Craft Design) always win. */
@layer tkt-fallback {
  :root {
    --bg: #ffffff; --surface: #f4f6f8; --surface2: #e7ebf0; --border: #cfd6de;
    --text: #1c1e22; --muted: #565e68; --link: #1c5ea0; --link-hover: #134678;
    --on-accent: #ffffff; --input-bg: #ffffff; --rule: #e4e8ed; --btn-hover: #dde3ea;
    --green: #166534; --red: #b42318; --yellow: #8a5600;
    --green-rgb: 22 101 52; --red-rgb: 180 35 24; --yellow-rgb: 138 86 0;
    --link-rgb: 28 94 160; --muted-rgb: 86 94 104; --shadow-rgb: 15 23 42;
    --popup-shadow: 0.14;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  }
  body.fossil-dark-style {
    --bg: #1c1e22; --surface: #272a30; --surface2: #31353d; --border: #41454e;
    --text: #e8e9eb; --muted: #b3b8c0; --link: #7fb6ef; --link-hover: #a3cbf5;
    --on-accent: #0b0d10; --input-bg: #15171a; --rule: #2c2f35; --btn-hover: #3b4049;
    --green: #6fd48f; --red: #f08a7e; --yellow: #f2c94c;
    --green-rgb: 111 212 143; --red-rgb: 240 138 126; --yellow-rgb: 242 201 76;
    --link-rgb: 127 182 239; --muted-rgb: 179 184 192; --shadow-rgb: 0 0 0;
    --popup-shadow: 0.5;
  }
}

/* Ticket UI (Option B templates: reportlist, view, new, edit) */
.tkt-shell { display: grid; gap: 1rem; margin: 0.5rem 0 1.5rem; min-width: 0; }
.tkt-shell button { text-transform: none; letter-spacing: normal; }
.tkt-row-meta code, .tkt-bcard-id, .tkt-ref-id, .tkt-ref-id code {
  background: transparent !important; border: 0 !important; padding: 0 !important;
}
/* Dedupe Fossil submenu actions already promoted into the workbench header */
body:has(.tkt-shell[data-tkt-page="reportlist"] a.tkt-btn-primary[href="tktnew"]) .submenu a[href$="/tktnew"],
body:has(.tkt-shell[data-tkt-page="tktview"] .tkt-head-top a[href*="/tktedit/"]) .submenu a[href*="/tktedit"] {
  display: none;
}
body:has(.tkt-shell .tkt-empty) .tkt-facets .tkt-clear-btn { display: none; }
/* Adjacent ticket routes: /tkthistory double-frame removal and /attachlist cards */
body.cpage-tkthistory ol.tkt-changes blockquote {
  border: 0 !important; padding: 0 !important; margin: 0.35rem 0 !important;
  background: transparent !important;
}
body.cpage-attachlist .content > ol {
  list-style: none !important; padding: 0; margin: 0.75rem 0;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); overflow: hidden;
}
body.cpage-attachlist .content > ol > li {
  list-style: none !important; padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--rule); line-height: 1.5; font-size: 0.92em;
}
body.cpage-attachlist .content > ol > li:last-child { border-bottom: 0; }
body.cpage-attachlist .content > ol > li:hover { background: var(--surface); }
.tkt-head-sub .copy-button {
  width: 26px !important; height: 26px !important;
  min-width: 26px !important; min-height: 26px !important;
  vertical-align: middle;
}
.tkt-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.tkt-search {
  flex: 1 1 16rem; min-width: 0; display: flex; align-items: center; gap: 0.45rem;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 0 0.65rem;
}
.tkt-search:focus-within { border-color: var(--link); }
.tkt-search svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.tkt-search input[type="text"], .tkt-search input[type="search"] {
  width: 100%; border: 0 !important; background: transparent !important;
  color: var(--text); font-family: var(--font); font-size: 0.9em;
  padding: 0.48rem 0 !important; outline: none; margin: 0 !important;
}
.tkt-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
a.tkt-search-clear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 4px; color: var(--muted) !important;
  flex-shrink: 0; text-decoration: none !important;
}
a.tkt-search-clear:hover { background: var(--surface2); color: var(--text) !important; }
a.tkt-search-clear svg { width: 14px; height: 14px; }
.tkt-btn, a.tkt-btn, input.tkt-btn, button.tkt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  box-sizing: border-box;
  padding: 0.45rem 0.85rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text) !important;
  font-family: var(--font); font-size: 0.88em; font-weight: 500;
  text-decoration: none !important; cursor: pointer; white-space: nowrap; line-height: 1.3;
}
.tkt-btn:hover, a.tkt-btn:hover, input.tkt-btn:hover, button.tkt-btn:hover { background: var(--btn-hover); }
.tkt-btn-primary, a.tkt-btn-primary, input.tkt-btn-primary, button.tkt-btn-primary {
  background: var(--link) !important; border-color: var(--link) !important;
  color: var(--on-accent) !important;
}
.tkt-btn-primary:hover, a.tkt-btn-primary:hover, input.tkt-btn-primary:hover, button.tkt-btn-primary:hover {
  background: var(--link-hover) !important; border-color: var(--link-hover) !important;
}
.tkt-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.tkt-presets { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
a.tkt-preset {
  padding: 0.28rem 0.65rem; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted) !important; font-size: 0.84em;
  font-weight: 500; text-decoration: none !important; white-space: nowrap;
}
a.tkt-preset:hover { background: var(--surface); color: var(--text) !important; }
a.tkt-preset.is-active {
  background: rgb(var(--link-rgb) / 0.14); border-color: var(--link); color: var(--text) !important;
}
.tkt-list {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg);
}
.tkt-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.45rem 0.75rem; padding: 0.72rem 0.9rem;
  border-bottom: 1px solid var(--rule); align-items: start;
}
.tkt-row:last-child { border-bottom: 0; }
.tkt-row:hover { background: var(--surface); }
.tkt-state-ico { width: 16px; height: 16px; margin-top: 0.18rem; display: inline-flex; }
.tkt-state-ico svg { width: 16px; height: 16px; }
.tkt-state-open { color: var(--green); }
.tkt-state-review { color: var(--yellow); }
.tkt-state-closed { color: var(--muted); }
.tkt-state-deleted { color: var(--red); opacity: 0.75; }
.tkt-row-main { display: grid; gap: 0.28rem; min-width: 0; }
.tkt-row-titleline { display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; align-items: baseline; }
a.tkt-row-title { font-weight: 600; color: var(--text) !important; text-decoration: none; overflow-wrap: anywhere; }
a.tkt-row-title:hover { color: var(--link) !important; text-decoration: underline; }
.tkt-tag {
  display: inline-block; font-size: 0.76em; padding: 0.08rem 0.45rem; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); white-space: nowrap;
}
.tkt-tag-crit { background: rgb(var(--red-rgb) / 0.14); color: var(--red); border-color: transparent; }
.tkt-tag-warn { background: rgb(var(--yellow-rgb) / 0.15); color: var(--yellow); border-color: transparent; }
.tkt-tag-ok { background: rgb(var(--green-rgb) / 0.14); color: var(--green); border-color: transparent; }
.tkt-tag-info { background: rgb(var(--link-rgb) / 0.14); color: var(--link); border-color: transparent; }
.tkt-row-meta {
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline;
  font-size: 0.8em; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tkt-row-meta code { font-family: var(--mono); font-size: 0.95em; color: var(--link); }
button.tkt-time-btn {
  border: 0; background: transparent; padding: 0; margin: 0;
  min-height: 0; border-radius: 0;
  color: inherit; font: inherit; cursor: pointer;
  text-align: left; white-space: nowrap;
  text-decoration: underline dotted transparent; text-underline-offset: 2px;
}
button.tkt-time-btn:hover {
  background: transparent; border-color: transparent;
  color: var(--text); text-decoration-color: var(--muted);
}
.tkt-row-right {
  display: grid; grid-template-columns: auto 2.5rem 2.2rem;
  align-items: center; justify-items: end; gap: 0.45rem;
  font-size: 0.8em; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tkt-cnt-slot {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.25rem;
  min-width: 2.5rem; font-variant-numeric: tabular-nums;
}
.tkt-cnt-slot.is-ci { min-width: 2.1rem; }
.tkt-cnt-slot svg { width: 13px; height: 13px; flex-shrink: 0; }
.tkt-empty { padding: 1.5rem 1rem; color: var(--muted); font-size: 0.92em; text-align: center; }
.tkt-anon-cta { padding: 0.72rem 1rem; font-size: 0.88em; color: var(--muted); }
.tkt-count-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 0.5rem; font-size: 0.84em; color: var(--muted);
}
details.tkt-drawer {
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 0.65rem 0.9rem;
}
details.tkt-drawer > summary { cursor: pointer; font-weight: 600; font-size: 0.9em; color: var(--text); }
details.tkt-drawer ol { margin: 0.65rem 0 0.25rem; padding-left: 1.4rem; }
details.tkt-drawer li { margin: 0.25rem 0; }
.tkt-drawer-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.6rem; font-size: 0.88em; }

/* Ticket detail & form two-column layout */
.tkt-head {
  display: grid; gap: 0.45rem; padding-bottom: 0.85rem; border-bottom: 1px solid var(--border);
}
.tkt-head-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.5rem 1rem; }
.tkt-head h2.tkt-title { margin: 0 !important; font-size: 1.35em; line-height: 1.3; overflow-wrap: anywhere; }
.tkt-head-sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem;
  font-size: 0.86em; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tkt-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 16.5rem; gap: 1.25rem; align-items: start;
}
.tkt-main { display: grid; gap: 0.95rem; min-width: 0; }
.tkt-sidebar {
  display: grid; gap: 0.75rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.85rem 1rem; font-size: 0.88em; min-width: 0;
}
.tkt-field { display: grid; gap: 0.22rem; min-width: 0; }
.tkt-field-label { font-size: 0.8em; font-weight: 600; color: var(--muted); }
.tkt-field-val { color: var(--text); overflow-wrap: anywhere; }
.tkt-field select, .tkt-field input[type="text"], .tkt-field input:not([type]) {
  width: 100%; max-width: 100%; box-sizing: border-box; margin: 0;
}
.tkt-side-hd {
  font-size: 0.78em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
  margin-bottom: -0.25rem;
}
.tkt-kv { display: grid; gap: 0; }
.tkt-kv-meta {
  border-top: 1px solid var(--border); padding-top: 0.35rem; margin-top: 0.1rem;
}
.tkt-field.tkt-kv-row {
  display: grid; grid-template-columns: 5.35rem minmax(0, 1fr);
  gap: 0.2rem 0.65rem; align-items: baseline;
  padding: 0.4rem 0; border-bottom: 1px solid var(--rule);
}
.tkt-field.tkt-kv-row:last-child { border-bottom: 0; padding-bottom: 0.05rem; }
.tkt-field.tkt-kv-row .tkt-field-label {
  font-size: 0.86em; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.tkt-field.tkt-kv-row .tkt-field-val {
  font-size: 0.94em; color: var(--text); min-width: 0; overflow-wrap: anywhere;
}
.tkt-field.tkt-kv-row .tkt-field-val.is-muted { color: var(--muted); }
.tkt-field.tkt-kv-row .tkt-field-val.is-mono { font-family: var(--mono); font-size: 0.88em; }
.tkt-field.tkt-kv-row .tkt-field-val.is-time {
  font-size: 0.88em; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tkt-kv-status {
  display: inline-flex; align-items: center; gap: 0.42rem; font-weight: 600;
}
.tkt-kv-status i {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--muted);
}
.tkt-kv-status.is-open i { background: var(--green); }
.tkt-kv-status.is-review i { background: var(--yellow); }
.tkt-card {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); min-width: 0;
}
form.tkt-card { overflow: visible; }
form.tkt-card > .tkt-card-hdr { border-radius: 7px 7px 0 0; }
.tkt-card-hdr {
  background: var(--surface); padding: 0.52rem 0.85rem; border-bottom: 1px solid var(--border);
  font-size: 0.85em; color: var(--muted);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.35rem 0.75rem;
}
.tkt-card-hdr-r { display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.tkt-fmt-pill {
  font-family: var(--mono); font-size: 0.82em; padding: 0.04rem 0.38rem;
  border-radius: 4px; border: 1px solid var(--border); background: var(--bg); color: var(--muted);
}
.tkt-attach-slot:empty { display: none; }
.tkt-shell:has(.tkt-attach-box) + section.attachlist { display: none; }
.tkt-attach-list .tkt-attach-name { font-family: var(--mono); font-size: 0.92em; font-weight: 500; white-space: nowrap; }
.tkt-card-hdr strong { color: var(--text); }
.tkt-card-body { padding: 0.85rem 1rem; overflow-wrap: anywhere; }
.tkt-card-body > :first-child { margin-top: 0; }
.tkt-card-body > :last-child { margin-bottom: 0; }
.tkt-card-body pre { overflow-x: auto; max-width: 100%; }
.tkt-card-body.tkt-plain > pre.verbatim {
  background: transparent; border: 0; border-radius: 0;
  padding: 0; margin: 0;
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--mono); font-size: 0.9em; line-height: 1.55;
  color: var(--text);
}
.tkt-plain a.tkt-plain-url { word-break: break-word; }
.tkt-form-stack { display: grid; gap: 0.75rem; padding: 0.85rem 1rem; }
.tkt-form-stack input[type="text"], .tkt-form-stack textarea {
  width: 100%; max-width: 100%; box-sizing: border-box;
}
.tkt-form-stack textarea.wikiedit {
  min-height: 11rem; font-family: var(--mono); font-size: 0.9em; line-height: 1.5; resize: vertical;
}
.tkt-form-actions {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem;
}
.tkt-form-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.tkt-preview-box {
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  padding: 0.85rem 1rem;
}
.tkt-preview-box h3 { margin: 0 0 0.5rem !important; font-size: 0.92em; color: var(--muted); }
.tkt-help { font-size: 0.8em; color: var(--muted); }

/* Ticket UI Option B extensions (state counts, table, board, inline edits, slash/similar/lightbox) */
.tkt-sr-only, .tkt-toggle-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.tkt-head-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.55rem 0.75rem;
}
.tkt-head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.tkt-seg {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--bg);
}
.tkt-seg a, .tkt-seg button {
  border: 0; border-right: 1px solid var(--border); border-radius: 0;
  background: transparent; color: var(--muted) !important;
  font-family: var(--font); font-size: 0.84em; font-weight: 500;
  padding: 0.38rem 0.68rem; cursor: pointer;
  display: inline-flex; align-items: baseline; gap: 0.35rem;
  text-decoration: none !important; white-space: nowrap; line-height: 1.25;
}
.tkt-seg a:last-child, .tkt-seg button:last-child { border-right: 0; }
.tkt-seg a:hover, .tkt-seg button:hover { background: var(--surface); color: var(--text) !important; }
.tkt-seg a.is-active, .tkt-seg button[aria-pressed="true"] {
  background: var(--surface2); color: var(--text) !important; font-weight: 600;
}
.tkt-seg svg { width: 14px; height: 14px; flex-shrink: 0; align-self: center; }
.tkt-cnt { font-family: inherit; font-size: 0.92em; font-variant-numeric: tabular-nums; color: var(--muted); }
.tkt-seg a.is-active .tkt-cnt { color: var(--text); }
.tkt-btn.is-active, a.tkt-btn.is-active { background: var(--surface2); border-color: var(--link); }

.tkt-queues { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
a.tkt-qpill {
  display: inline-flex; align-items: baseline; gap: 0.38rem;
  padding: 0.28rem 0.68rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text) !important; font-size: 0.82em; font-weight: 500;
  text-decoration: none !important; line-height: 1.25; white-space: nowrap;
}
a.tkt-qpill:hover { border-color: var(--muted); background: var(--surface2); }
a.tkt-qpill.is-on {
  border-color: var(--link); background: rgb(var(--link-rgb) / 0.14);
  color: var(--link) !important; font-weight: 600;
}
a.tkt-qpill.is-on .tkt-cnt { color: var(--link); }
a.tkt-qpill.is-saved {
  background: transparent; border-style: dashed; color: var(--muted) !important;
}
a.tkt-qpill.is-saved:hover {
  border-color: var(--link); background: rgb(var(--link-rgb) / 0.08); color: var(--link) !important;
}

.tkt-owner {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 0.88em; font-weight: 500;
  padding: 0.1rem 0.45rem; border-radius: 999px;
  background: rgb(var(--link-rgb) / 0.12); color: var(--link);
  white-space: nowrap;
}
.tkt-owner.is-unassigned {
  background: transparent; color: var(--muted);
  border: 1px dashed var(--border);
}
.tkt-owner.is-orphan {
  background: rgb(var(--yellow-rgb) / 0.14); color: var(--yellow);
  border: 1px dashed rgb(var(--yellow-rgb) / 0.45);
}

details.tkt-rpt-pop { position: relative; }
details.tkt-rpt-pop > summary { list-style: none; }
details.tkt-rpt-pop > summary::-webkit-details-marker { display: none; }
details.tkt-rpt-pop > summary::after { content: " ▾"; font-size: 0.85em; color: var(--muted); }
.tkt-rpt-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  box-sizing: border-box;
  width: min(26rem, 90vw); max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.7rem 0.85rem 0.9rem; box-shadow: 0 12px 32px rgb(var(--shadow-rgb) / var(--popup-shadow, 0.35));
  display: grid; gap: 0.5rem; font-size: 0.86em;
}
.tkt-rpt-hdr { font-weight: 600; font-size: 0.9em; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 0.35rem; }
.tkt-rpt-list { display: grid; gap: 2px; margin-bottom: 0.25rem; }
.tkt-rpt-menu ol { margin: 0; padding-left: 1.35rem; display: grid; gap: 0.32rem; color: var(--muted); }
.tkt-rpt-menu li { line-height: 1.38; }
.tkt-rpt-menu ol a { color: var(--text) !important; text-decoration: none; }
.tkt-rpt-menu ol a:hover { color: var(--link) !important; text-decoration: underline; }
.tkt-pager { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.tkt-col-foot {
  font-size: 0.78em; color: var(--muted); text-align: center;
  padding: 0.45rem 0.35rem 0.15rem; border-top: 1px dashed var(--border);
}
.tkt-bcard-meta { min-width: 0; overflow-wrap: anywhere; }
.tkt-bcard-id { color: var(--link); }
.tkt-bcard-cnt { display: inline-flex; align-items: center; gap: 0.2rem; vertical-align: -1px; }
.tkt-bcard-cnt svg { width: 12px; height: 12px; flex-shrink: 0; }
.tkt-bcard-act { display: inline-flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }

.tkt-facets { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.tkt-facet {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); padding: 0.14rem 0.25rem 0.14rem 0.55rem;
  font-size: 0.82em; color: var(--muted);
}
.tkt-facet.is-on { border-color: var(--link); background: rgb(var(--link-rgb) / 0.10); color: var(--text); }
.tkt-facet select {
  border: 0; background-color: transparent; color: var(--text);
  font-size: 1em; font-weight: 500; padding: 0.24rem 1.55rem 0.24rem 0.2rem;
  background-position: right 0.35rem center; width: auto;
}
details.tkt-fpop { position: relative; display: inline-block; }
details.tkt-fpop > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 0.38rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); padding: 0.34rem 0.58rem;
  font-size: 0.82em; color: var(--muted); line-height: 1.25;
  font-family: var(--font);
}
details.tkt-fpop > summary::-webkit-details-marker { display: none; }
details.tkt-fpop > summary:hover { border-color: var(--muted); color: var(--text); }
details.tkt-fpop.is-on > summary {
  border-color: var(--link); background: rgb(var(--link-rgb) / 0.10); color: var(--text);
}
details.tkt-fpop > summary strong { color: var(--text); font-weight: 500; }
details.tkt-fpop > summary svg { width: 12px; height: 12px; color: var(--muted); flex-shrink: 0; }
.tkt-fpop-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 75;
  box-sizing: border-box;
  min-width: 12.5rem; max-width: min(20rem, 86vw); max-height: 18rem; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
  padding: 0.25rem 0.25rem 0.55rem; scroll-padding-bottom: 0.55rem;
  box-shadow: 0 10px 28px rgb(var(--shadow-rgb) / var(--popup-shadow, 0.35));
  display: grid; gap: 1px;
}
.tkt-fpop-menu.is-right { left: auto; right: 0; }
.tkt-fpop-search {
  position: sticky; top: 0; z-index: 1;
  width: 100%; box-sizing: border-box;
  margin: 0 0 0.2rem; padding: 0.3rem 0.5rem; min-height: 0;
  font-size: 0.84em; border-radius: 5px;
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
}
a.tkt-fpop-item, button.tkt-fpop-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  width: 100%; box-sizing: border-box; border: 0; border-radius: 5px;
  background: transparent; color: var(--text) !important;
  font-family: var(--font); font-size: 0.86em; font-weight: 400;
  padding: 0.36rem 0.55rem; min-height: 0; text-align: left;
  text-decoration: none !important; cursor: pointer;
}
a.tkt-fpop-item[hidden], button.tkt-fpop-item[hidden] { display: none; }
a.tkt-fpop-item:hover, button.tkt-fpop-item:hover { background: var(--surface2); border-color: transparent; }
a.tkt-fpop-item.is-cur, button.tkt-fpop-item.is-cur {
  background: var(--surface2); color: var(--link) !important; font-weight: 600;
}
.tkt-fpop-cnt { font-family: var(--mono); font-size: 0.88em; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.tkt-fpop-item.is-cur .tkt-fpop-cnt { color: var(--link); }
details.tkt-side-pop { position: relative; width: 100%; }
details.tkt-side-pop > summary {
  list-style: none; cursor: pointer; user-select: none; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between; gap: 0.4rem;
  width: 100%; padding: 0.38rem 0.6rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--input-bg); color: var(--text); font-family: var(--font); font-size: 0.92em;
}
details.tkt-side-pop > summary::-webkit-details-marker { display: none; }
details.tkt-side-pop > summary:hover { border-color: var(--muted); }
details.tkt-side-pop > summary svg { width: 12px; height: 12px; color: var(--muted); flex-shrink: 0; }
details.tkt-side-pop .tkt-fpop-menu { width: 100%; min-width: 100%; box-sizing: border-box; }
a.tkt-clear-btn { font-size: 0.84em; padding: 0.25rem 0.4rem; }

.tkt-tw {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border); border-radius: 8px;
  background:
    linear-gradient(to right, var(--bg) 30%, transparent),
    linear-gradient(to right, transparent, var(--bg) 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgb(var(--shadow-rgb) / 0.26), transparent),
    radial-gradient(farthest-side at 100% 50%, rgb(var(--shadow-rgb) / 0.26), transparent) 100% 0;
  background-repeat: no-repeat;
  background-color: var(--bg);
  background-size: 32px 100%, 32px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
table.tkt-table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
table.tkt-table thead th {
  text-align: left; background: var(--surface); color: var(--muted);
  border-bottom: 1px solid var(--border); padding: 0.5rem 0.58rem;
  font-weight: 600; font-size: 0.88em; white-space: nowrap;
}
table.tkt-table thead th a { color: inherit; text-decoration: none; }
table.tkt-table thead th a:hover { color: var(--text); text-decoration: underline; }
table.tkt-table thead th.is-sorted { color: var(--text); }
table.tkt-table thead th:not(.is-sorted) a::after { content: " ↕"; opacity: 0.35; font-size: 0.85em; }
table.tkt-table thead th:not(.is-sorted) a:hover::after { opacity: 0.85; }
table.tkt-table tbody td {
  padding: 0.5rem 0.58rem; border-bottom: 1px solid var(--rule);
  vertical-align: top; color: var(--text); white-space: nowrap;
}
table.tkt-table tbody tr:last-child td { border-bottom: 0; }
table.tkt-table tbody tr:hover { background: var(--surface); }
table.tkt-table td.c-id { font-family: var(--mono); font-size: 0.9em; }
table.tkt-table td.c-id .tkt-state-ico { margin-top: 0; vertical-align: -3px; margin-right: 0.35rem; }
table.tkt-table td.c-title { min-width: 12rem; width: 100%; font-weight: 500; white-space: normal; }
table.tkt-table td.c-as { max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; }
table.tkt-table td.c-sub { max-width: 11.5rem; overflow: hidden; text-overflow: ellipsis; }
table.tkt-table td.c-muted { color: var(--muted); }

.tkt-board-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem; font-size: 0.84em; color: var(--muted);
}
.tkt-board-ctrls { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.tkt-col-win {
  font-family: var(--mono); font-size: 0.78em; font-weight: 500; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 0.04rem 0.34rem;
}
.tkt-col.is-terminal .tkt-col-hdr { color: var(--muted); }
.tkt-moved-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.55rem 0.85rem; border-radius: 6px;
  border: 1px solid var(--link); background: rgb(var(--link-rgb) / 0.12);
  font-size: 0.86em; color: var(--text);
}
.tkt-moved-banner[hidden] { display: none; }
.tkt-board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(16.5rem, 18rem);
  gap: 0.75rem; align-items: start;
  overflow-x: auto; padding-bottom: 0.5rem;
}
.tkt-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.6rem; display: grid; gap: 0.55rem; min-width: 0;
  max-height: min(74vh, 46rem); overflow-y: auto; align-content: start;
}
.tkt-col.is-over { border-color: var(--link); background: rgb(var(--link-rgb) / 0.10); }
.tkt-col-hdr {
  position: sticky; top: -0.6rem; z-index: 2; background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 0.4rem;
  font-size: 0.85em; font-weight: 600; color: var(--text);
  padding: 0.4rem 0.15rem 0.38rem; margin: -0.4rem -0.15rem 0; border-bottom: 1px solid var(--border);
}
.tkt-col-hdr-l { display: inline-flex; align-items: center; gap: 0.4rem; }
.tkt-col-cnt { font-family: var(--mono); font-size: 0.88em; color: var(--muted); font-weight: 500; }
.tkt-col-empty { padding: 0.85rem 0.4rem; font-size: 0.84em; }
.tkt-bcard {
  background: var(--bg); border: 1px solid var(--border); border-radius: 7px;
  padding: 0.62rem 0.7rem; display: grid; gap: 0.45rem; position: relative;
}
.tkt-bcard[draggable="true"] { cursor: grab; }
.tkt-bcard:hover { border-color: var(--muted); }
.tkt-bcard.is-held { opacity: 0.45; }
a.tkt-bcard-title {
  font-size: 0.88em; font-weight: 600; color: var(--text) !important;
  line-height: 1.32; text-decoration: none; overflow-wrap: anywhere;
}
a.tkt-bcard-title:hover { color: var(--link) !important; text-decoration: underline; }
.tkt-bcard-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tkt-bcard-foot {
  display: grid; gap: 0.4rem;
  font-size: 0.78em; color: var(--muted);
}
.tkt-bcard-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.55rem;
  font-family: var(--mono); min-width: 0;
}
.tkt-bcard-act {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.35rem;
  font-family: var(--font);
}
details.tkt-mv-wrap { position: relative; }
details.tkt-mv-wrap > summary { list-style: none; }
details.tkt-mv-wrap > summary::-webkit-details-marker { display: none; }
.tkt-mv-btn {
  font-family: var(--font); font-size: 0.95em; font-weight: 500;
  padding: 0.15rem 0.48rem; border-radius: 5px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.tkt-mv-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 40;
  min-width: 120px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: 0.25rem; box-shadow: 0 8px 20px rgb(var(--shadow-rgb) / var(--popup-shadow, 0.3));
  display: grid; gap: 2px;
}
.tkt-mv-menu form { margin: 0; }
.tkt-mv-menu button {
  text-align: left; border: 0; background: transparent; color: var(--text);
  font-size: 0.95em; padding: 0.32rem 0.52rem; border-radius: 5px; width: 100%;
}
.tkt-mv-menu button:hover { background: var(--surface2); }

/* Inline title edit on tktview (pure CSS checkbox toggle) */
.tkt-title-wrap { display: flex; align-items: flex-start; gap: 0.45rem; flex: 1 1 auto; min-width: 0; }
.tkt-pen-btn {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 0.24rem 0.36rem; border-radius: 5px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tkt-pen-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.tkt-pen-btn svg { width: 15px; height: 15px; }
.tkt-title-edit { display: none; flex-wrap: wrap; gap: 0.45rem; align-items: center; flex: 1 1 20rem; min-width: 0; }
.tkt-title-edit input[type="text"] { flex: 1 1 16rem; min-width: 0; font-size: 1.02em; font-weight: 600; }
#tkt-edit-title-toggle:checked ~ .tkt-title-wrap { display: none; }
#tkt-edit-title-toggle:checked ~ .tkt-title-edit { display: flex; }

/* Interleaved timeline events and backlinks */
.tkt-event-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start; gap: 0.35rem 0.55rem;
  padding: 0.48rem 0.25rem; border-top: 1px solid var(--rule);
  font-size: 0.85em; color: var(--muted);
}
.tkt-event-body { min-width: 0; line-height: 1.5; overflow-wrap: anywhere; }
.tkt-event-row strong { color: var(--text); font-weight: 600; }
.tkt-event-ico {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); flex-shrink: 0;
}
.tkt-event-ico svg { width: 12px; height: 12px; }
.tkt-event-time { margin-left: auto; font-family: var(--mono); font-size: 0.88em; white-space: nowrap; }
.tkt-refs-list { list-style: none !important; margin: 0; padding: 0; display: grid; }
.tkt-refs-list li {
  list-style: none !important;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: baseline; gap: 0.25rem 0.55rem;
  padding: 0.52rem 0.85rem; border-bottom: 1px solid var(--rule); font-size: 0.87em;
}
.tkt-refs-list li:last-child { border-bottom: 0; }
.tkt-refs-list svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; align-self: center; }
.tkt-ref-id { font-family: var(--mono); font-size: 0.94em; white-space: nowrap; }
.tkt-ref-msg { color: var(--text); min-width: 0; overflow-wrap: anywhere; line-height: 1.45; }
.tkt-ref-msg p { display: inline; margin: 0; }
.tkt-ref-msg i { color: var(--muted); }
.tkt-ref-msg .tkt-tag { margin-left: 0.35rem; vertical-align: 1px; }

/* Inline sidebar edit + composer close + slash menu + drafts */
.tkt-side-form { display: grid; gap: 0.72rem; }
.tkt-side-status {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.84em; color: var(--muted); padding-bottom: 0.35rem; border-bottom: 1px solid var(--border);
}
.tkt-side-status strong { color: var(--text); }
.tkt-saved-msg { color: var(--green); font-family: var(--mono); font-size: 0.9em; }
.tkt-side-form.is-js .tkt-side-submit { display: none; }
.tkt-composer-wrap { position: relative; }
.tkt-close-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.tkt-close-group select { font-size: 0.86em; padding: 0.34rem 1.8rem 0.34rem 0.55rem; width: auto; }
.tkt-draft-pill { font-family: var(--mono); font-size: 0.86em; color: var(--green); }
.tkt-draft-pill[hidden] { display: none; }
.tkt-slash-menu {
  position: absolute; left: 0.85rem; bottom: calc(100% + 4px); z-index: 90;
  width: 245px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.3rem;
  box-shadow: 0 10px 28px rgb(var(--shadow-rgb) / var(--popup-shadow, 0.35));
  display: grid; gap: 2px;
}
.tkt-slash-menu[hidden] { display: none; }
.tkt-slash-item {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  width: 100%; border: 0; background: transparent; color: var(--text);
  font-size: 0.84em; padding: 0.38rem 0.58rem; border-radius: 5px; text-align: left;
}
.tkt-slash-item:hover, .tkt-slash-item.is-active { background: var(--surface2); }
.tkt-slash-item code { font-size: 0.85em; color: var(--muted); }

/* New ticket cadence: type radios, similar-ticket box, triage chips, keyboard card */
.tkt-new-grid { display: grid; grid-template-columns: minmax(0, 1fr) 17.5rem; gap: 1.25rem; align-items: start; }
.tkt-types-strip { display: flex; flex-wrap: wrap; gap: 0.4rem; border: 0; padding: 0; margin: 0; }
.tkt-type-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.34rem 0.72rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 0.86em; font-weight: 500; cursor: pointer; position: relative;
}
.tkt-type-pill input { position: absolute; opacity: 0; pointer-events: none; }
.tkt-type-pill:has(input:checked) {
  border-color: var(--link); background: rgb(var(--link-rgb) / 0.14); color: var(--text); font-weight: 600;
}
input.tkt-new-title { font-size: 1.12em; font-weight: 600; padding: 0.52rem 0.72rem; }
.tkt-similar {
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
  padding: 0.6rem 0.8rem; display: grid; gap: 0.38rem; font-size: 0.86em;
}
.tkt-similar[hidden] { display: none; }
.tkt-similar-h { color: var(--muted); font-weight: 600; font-size: 0.92em; }
.tkt-similar ul { list-style: none !important; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.tkt-similar li { list-style: none !important; display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.tkt-chips-row { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.tkt-chip-field {
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 2.1rem; padding: 0 0.35rem 0 0.65rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; font-size: 0.86em; color: var(--text); cursor: pointer;
}
.tkt-chip-field:focus-within {
  border-color: var(--link); box-shadow: 0 0 0 2px rgb(var(--link-rgb) / 0.22);
}
.tkt-chip-field:has(select option[value=""]:checked) {
  border-style: dashed; background: transparent; color: var(--muted);
}
.tkt-chip-field:has(select option[value=""]:checked) .tkt-chip-k { display: none; }
.tkt-chip-k { font-size: 0.92em; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tkt-chip-field select, .tkt-chip-field input {
  width: auto; min-width: 0; border: 0; background-color: transparent;
  color: inherit; font-size: 1em; font-weight: 500;
  padding: 0.22rem 1.45rem 0.22rem 0.1rem;
  background-position: right 0.35rem center;
  field-sizing: content;
}
.tkt-chip-field input { padding-right: 0.45rem; width: 7.5rem; }
.tkt-chip-field select:focus, .tkt-chip-field input:focus { outline: none; }
.tkt-kbd-dl kbd {
  font-size: 0.88em; padding: 1px 4px; border: 1px solid var(--border);
  border-radius: 3px; background: var(--bg); color: var(--text);
}

/* Write / Preview tabs + forced-preview submit gate */
.tkt-card-hdr-l { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }
.tkt-tabs {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--bg);
}
.tkt-tab {
  border: 0; border-right: 1px solid var(--border); border-radius: 0;
  background: transparent; color: var(--muted);
  font-family: var(--font); font-size: 0.92em; font-weight: 500;
  padding: 0.22rem 0.62rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.tkt-tab:last-child { border-right: 0; }
.tkt-tab:hover { background: var(--surface2); color: var(--text); }
.tkt-tab[aria-selected="true"] { background: var(--surface2); color: var(--text); font-weight: 600; }
.tkt-tab-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--yellow); }
.tkt-tab-dot.is-ok { background: var(--green); }
.tkt-tab-dot[hidden] { display: none; }
.tkt-preview-pane {
  min-height: 7.5rem; padding: 0.85rem 1rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); overflow-wrap: anywhere; line-height: 1.5;
}
.tkt-preview-pane[hidden] { display: none; }
.tkt-preview-pane > :first-child { margin-top: 0; }
.tkt-preview-pane > :last-child { margin-bottom: 0; }
.tkt-preview-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem;
  margin-bottom: 0.6rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
  font-size: 0.8em; color: var(--muted); font-family: var(--mono);
}
.tkt-gate-note { color: var(--yellow); font-weight: 500; }
.tkt-gate-note.is-ready { color: var(--green); }
.tkt-btn:disabled, input.tkt-btn:disabled, button.tkt-btn:disabled {
  opacity: 1; cursor: not-allowed;
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--muted) !important;
}

/* Option C: exact Old -> New field diff chips + hover refpop */
.tkt-diff-val {
  display: inline-block; padding: 0.04rem 0.38rem; border-radius: 4px;
  font-family: var(--mono); font-size: 0.9em;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.tkt-diff-old { text-decoration: line-through; color: var(--muted); }
.tkt-diff-arrow { display: inline-flex; align-items: center; color: var(--muted); vertical-align: -2px; }
.tkt-diff-arrow svg { width: 13px; height: 13px; }
#tkt-refpop {
  position: fixed; z-index: 300; max-width: 340px; min-width: 240px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 0.7rem 0.82rem; box-shadow: 0 12px 32px rgb(var(--shadow-rgb) / var(--popup-shadow, 0.42));
  font-size: 0.84em; line-height: 1.42; pointer-events: none;
}
#tkt-refpop[hidden] { display: none; }
#tkt-refpop .rp-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.3rem; }
#tkt-refpop .rp-kind { font-family: var(--mono); font-size: 0.86em; color: var(--muted); }
#tkt-refpop .rp-title { font-weight: 600; color: var(--text); margin-bottom: 0.32rem; overflow-wrap: anywhere; }
#tkt-refpop .rp-body { color: var(--muted); margin-bottom: 0.35rem; overflow-wrap: anywhere; }
#tkt-refpop .rp-foot { font-family: var(--mono); font-size: 0.84em; color: var(--muted); }
.tkt-kbd-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.85rem 0.95rem; display: grid; gap: 0.6rem; font-size: 0.84em;
}
.tkt-kbd-card h3 { margin: 0 !important; font-size: 0.95em !important; color: var(--text); }
.tkt-kbd-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.42rem 0.7rem; margin: 0; align-items: baseline; }
.tkt-kbd-dl dt { font-family: var(--mono); white-space: nowrap; }
.tkt-kbd-dl dd { margin: 0; color: var(--muted); }
.tkt-kv-trunc { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Attachment image thumbnail grid + lightbox (enhanced over Fossil's section.attachlist) */
.tkt-attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.65rem; margin: 0.6rem 0; }
.tkt-attach-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); display: grid; }
.tkt-attach-thumb {
  border: 0; padding: 0; background: var(--surface); cursor: zoom-in;
  display: block; width: 100%; height: 130px; overflow: hidden; border-bottom: 1px solid var(--border);
}
.tkt-attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tkt-attach-meta { padding: 0.45rem 0.65rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-size: 0.8em; }
.tkt-attach-name { font-family: var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.tkt-lightbox {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  padding: 0; max-width: min(900px, calc(100vw - 2rem)); width: 100%;
  box-shadow: 0 18px 48px rgb(var(--shadow-rgb) / 0.55);
}
dialog.tkt-lightbox::backdrop { background: rgba(0, 0, 0, 0.7); }
.tkt-lb-bar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.88em; }
.tkt-lb-body { padding: 1rem; background: var(--bg); text-align: center; }
.tkt-lb-body img { max-height: 72vh; max-width: 100%; border-radius: 6px; border: 1px solid var(--border); }

/* Read-only summary view (4 aggregate breakdown cards) */
.tkt-summary-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem; align-items: start;
}
.tkt-sum-card {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); overflow: hidden; min-width: 0;
}
.tkt-sum-hdr {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0.52rem 0.8rem; font-size: 0.86em; color: var(--muted);
}
.tkt-sum-hdr strong { color: var(--text); font-weight: 600; }
.tkt-sum-scroll { max-height: 24rem; overflow-y: auto; }
table.tkt-sum-table {
  width: 100%; border-collapse: collapse; font-size: 0.86em;
  font-variant-numeric: tabular-nums;
}
table.tkt-sum-table thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; background: var(--surface); color: var(--muted);
  border-bottom: 1px solid var(--border); padding: 0.4rem 0.7rem;
  font-weight: 600; font-size: 0.86em; white-space: nowrap;
}
table.tkt-sum-table thead th.num, table.tkt-sum-table tbody td.num {
  text-align: right; font-family: var(--mono); font-size: 0.92em; white-space: nowrap;
}
table.tkt-sum-table tbody td {
  padding: 0.42rem 0.7rem; border-bottom: 1px solid var(--rule);
  color: var(--text); vertical-align: middle;
}
table.tkt-sum-table tbody tr:last-child td { border-bottom: 0; }
table.tkt-sum-table tbody tr:hover { background: var(--surface); }
table.tkt-sum-table td a { color: inherit; text-decoration: none; }
table.tkt-sum-table td a:hover { color: var(--link); text-decoration: underline; }
a.tkt-sum-link {
  display: inline-flex; align-items: center; gap: 0.42rem;
  font-weight: 500; color: var(--text) !important;
}
a.tkt-sum-link:hover { color: var(--link) !important; }
a.tkt-sum-link .tkt-state-ico { margin-top: 0; flex-shrink: 0; }
.tkt-sum-muted { color: var(--muted) !important; }
.tkt-sum-pct {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.45rem;
}
.tkt-sum-bar {
  display: inline-block; width: 3.4rem; height: 6px; border-radius: 999px;
  background: var(--surface2); overflow: hidden; vertical-align: middle;
}
.tkt-sum-bar i {
  display: block; height: 100%; border-radius: 999px; background: var(--green);
}

@media screen and (max-width: 760px) {
  .tkt-layout, .tkt-new-grid, .tkt-summary-grid { grid-template-columns: 1fr; }
  .tkt-row { grid-template-columns: auto minmax(0, 1fr); }
  .tkt-row-right {
    grid-column: 2; display: flex; flex-wrap: wrap; justify-content: flex-start;
    gap: 0.45rem 0.65rem;
  }
  .tkt-cnt-slot:empty { display: none; }
  .tkt-refs-list li { grid-template-columns: auto auto minmax(0, 1fr); }
  .tkt-refs-list .tkt-event-time { grid-column: 2 / -1; margin-left: 0; font-size: 0.82em; }
  .tkt-attach-list li { grid-template-columns: auto minmax(0, 1fr); }
  .tkt-attach-list .tkt-attach-name { grid-column: 2; white-space: normal; overflow-wrap: anywhere; }
  .tkt-attach-list .tkt-ref-msg { grid-column: 2; }
  .tkt-attach-list .tkt-event-time { grid-column: 2; }
  .tkt-event-row { grid-template-columns: auto minmax(0, 1fr); }
  .tkt-event-row .tkt-event-time { grid-column: 2; margin-left: 0; font-size: 0.82em; }
}
@media screen and (max-width: 640px) {
  .tkt-shell { gap: 0.65rem; }
  .tkt-head-bar { gap: 0.4rem; }
  .tkt-head-tools { width: 100%; justify-content: space-between; gap: 0.4rem; }
  .tkt-seg a, .tkt-seg button { min-height: 36px; padding: 0.34rem 0.5rem; font-size: 0.84em; align-items: center; }
  .tkt-queues, .tkt-facets {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; padding-bottom: 2px;
  }
  .tkt-queues::-webkit-scrollbar, .tkt-facets::-webkit-scrollbar { display: none; }
  .tkt-queues > *, .tkt-facets > * { flex-shrink: 0; }
  a.tkt-qpill, details.tkt-fpop > summary { min-height: 34px; align-items: center; padding-top: 0.3rem; padding-bottom: 0.3rem; }
  .tkt-toolbar .tkt-search { flex: 1 1 100%; }
  .tkt-toolbar > .tkt-btn, .tkt-toolbar > button { flex: 1 1 0; height: 36px; min-height: 36px; }
  .tkt-board { grid-auto-columns: min(85vw, 19rem); scroll-snap-type: x proximity; }
  .tkt-col { scroll-snap-align: start; max-height: 68vh; }
  .tkt-head-sub .copy-button { width: 32px !important; height: 32px !important; }
  .tkt-rpt-menu { padding-bottom: 0.9rem; }
}
