/* ════════════════════════════════════════════════════════════════════
   Service tickets v2: list, ticket and raise page (Features/ServiceTickets)

   S9's partner language on Ambolt Web's tokens: sentence case, one calm
   page title, 16px panels with a hairline border, Inter body and Plus
   Jakarta Sans headings, soft pills that say whose move it is, red only
   for overdue or escalated, one column on a phone with no sideways scroll,
   44px touch targets on touch screens.

   Colours come only from css/ev/tokens.css (--ev-*), so per-brand colours
   and html[data-theme="dark"] need no extra rules beyond the few at the
   foot. Plan: docs/plans/partner-tickets-rebuild.md
   ════════════════════════════════════════════════════════════════════ */

.tk {
    --tk-radius: 16px;
    --tk-body: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --tk-display: "Plus Jakarta Sans", "Inter", "Segoe UI", sans-serif;
    --tk-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --tk-mine: color-mix(in srgb, var(--ev-primary) 9%, var(--ev-surface));
    --tk-mine-border: color-mix(in srgb, var(--ev-primary) 28%, var(--ev-border));
    --tk-hover: color-mix(in srgb, var(--ev-primary) 4%, var(--ev-surface));
    font-family: var(--tk-body);
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--ev-text);
    max-width: 1200px;
}
.tk *, .tk *::before, .tk *::after { box-sizing: border-box; }
.tk a { color: var(--ev-primary); text-decoration: none; }
.tk a:hover { text-decoration: underline; text-underline-offset: 3px; }
.tk h1, .tk h2, .tk h3 { font-family: var(--tk-display); word-spacing: 0.09em; margin: 0; text-wrap: balance; }
.tk p { margin: 0; }
.tk .material-icons { font-size: 18px; line-height: 1; vertical-align: -4px; }
.tk-muted { color: var(--ev-text-muted); }
.tk-mono { font-family: var(--tk-mono); font-size: 0.78rem; color: var(--ev-text-muted); font-variant-numeric: tabular-nums; }
.tk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tk-show-phone { display: none; }
.tk-grow { flex: 1; min-width: 0; }

/* ── Header ─────────────────────────────────────────────────────────── */
.tk-crumb { font-size: 0.8125rem; color: var(--ev-text-muted); margin: 2px 0 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 20px; }
.tk-head-text { min-width: 0; }
.tk-title { font-size: 1.75rem; line-height: 2.25rem; font-weight: 700; letter-spacing: -0.015em; }
.tk-sub { margin-top: 6px; color: var(--ev-text-muted); display: flex; gap: 4px 8px; flex-wrap: wrap; align-items: center; }
.tk-sub a { font-weight: 500; }
.tk-sub-sep { color: var(--ev-border-strong); }
.tk-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.tk-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px; padding: 0 14px; border-radius: 10px;
    border: 1px solid var(--ev-border-strong); background: var(--ev-surface); color: var(--ev-text);
    font: 500 0.875rem var(--tk-body); cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.tk a.tk-btn { color: var(--ev-text); text-decoration: none; }
.tk-btn:hover:not(:disabled) { border-color: var(--ev-text-muted); background: var(--tk-hover); }
.tk-btn:focus-visible, .tk-row:focus-visible, .tk-seg button:focus-visible, .tk-chip:focus-visible,
.tk-cat:focus-visible, .tk a:focus-visible, .tk-link:focus-visible { outline: 2px solid var(--ev-primary); outline-offset: 2px; }
.tk-btn--primary, .tk a.tk-btn--primary { background: var(--ev-primary); border-color: var(--ev-primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.tk-btn--primary:hover:not(:disabled) { background: var(--ev-primary-hover); border-color: var(--ev-primary-hover); }
/* Disabled never looks like a paler primary: it goes neutral, so enabled and disabled can't be confused in dark mode. */
.tk-btn:disabled, .tk-btn--primary:disabled {
    background: var(--ev-surface-2); border-color: var(--ev-border); color: var(--ev-text-muted);
    box-shadow: none; cursor: not-allowed; opacity: 1;
}
.tk-btn--ghost { border-color: transparent; background: transparent; color: var(--ev-text-muted); }
.tk-btn--sm { height: 32px; padding: 0 12px; font-size: 0.8125rem; border-radius: 8px; }
.tk-icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--ev-text-muted); cursor: pointer; padding: 0; }
.tk-icon-btn:hover { background: var(--ev-surface-2); color: var(--ev-text); }
.tk-icon-btn .material-icons { font-size: 16px; vertical-align: 0; }
.tk-link { background: none; border: 0; padding: 0; color: var(--ev-primary); font: inherit; font-weight: 500; cursor: pointer; }
.tk-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tk-spin { animation: tk-spin 1s linear infinite; }
@keyframes tk-spin { to { transform: rotate(360deg); } }

/* ── Panels ─────────────────────────────────────────────────────────── */
.tk-panel { background: var(--ev-surface); border: 1px solid var(--ev-border); border-radius: var(--tk-radius); }
.tk-pad { padding: 18px 20px; }
.tk-panel-title { font-family: var(--tk-display); font-size: 0.9375rem; font-weight: 600; word-spacing: 0.09em; }
.tk-panel-note { margin-top: 4px; color: var(--ev-text-muted); font-size: 0.8125rem; }

.tk-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--ev-border); background: var(--ev-surface); margin-bottom: 16px; }
.tk-alert--info { border-left: 3px solid var(--ev-primary); }
.tk-alert--ok { border-left: 3px solid var(--ev-success); }
.tk-alert--ok > .material-icons { color: var(--ev-success); }

/* Slim reminder: no fill, an amber edge, one line. */
.tk-strip {
    display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px 6px 14px; margin-bottom: 14px;
    border: 1px solid var(--ev-border); border-left: 3px solid var(--ev-warn); border-radius: 12px; background: var(--ev-surface);
}
.tk-strip > .material-icons { color: var(--ev-warn); }
.tk-strip .tk-grow { font-size: 0.8125rem; color: var(--ev-text-muted); }
.tk-strip strong { color: var(--ev-text); font-weight: 600; }

/* ── Pills (whose move) ─────────────────────────────────────────────── */
.tk-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.tk-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tk-pill--you { background: var(--ev-warn-soft); color: var(--ev-warn); }
.tk-pill--us { background: var(--ev-primary-soft); color: var(--ev-primary); }
.tk-pill--late { background: var(--ev-danger-soft); color: var(--ev-danger); }
.tk-pill--done { background: var(--ev-success-soft); color: var(--ev-success); }
.tk-pill--flag { background: transparent; color: var(--ev-danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ev-danger) 45%, transparent); }
.tk-pill--flag::before { display: none; }
.tk-promise { font-size: 0.78rem; color: var(--ev-text-muted); margin-top: 4px; }
.tk-promise--late { color: var(--ev-danger); }
.tk-flag { color: var(--ev-danger); font-weight: 600; }

/* ── Toolbar ────────────────────────────────────────────────────────── */
.tk-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tk-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--ev-border); border-radius: 12px; background: var(--ev-surface); padding: 3px; gap: 2px; }
.tk-seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 9px; color: var(--ev-text-muted); font: 500 0.8125rem var(--tk-body); cursor: pointer; white-space: nowrap; }
.tk-seg button:hover { color: var(--ev-text); }
.tk-seg button.is-on { background: var(--ev-primary-soft); color: var(--ev-primary); font-weight: 600; }
.tk-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ev-warn); color: #fff; font-size: 0.72rem; font-weight: 700; }
.tk-search { flex: 1 1 260px; min-width: 200px; position: relative; }
.tk-search .material-icons { position: absolute; left: 12px; top: 10px; color: var(--ev-text-muted); pointer-events: none; }
.tk-search input { width: 100%; height: 38px; }
.tk-input, .tk-search input, .tk-select, .tk-textarea {
    border: 1px solid var(--ev-border-strong); border-radius: 10px; background: var(--ev-surface); color: var(--ev-text);
    font: 400 0.875rem var(--tk-body); min-height: 38px; padding: 0 12px; width: 100%;
}
.tk .tk-search input { padding-left: 38px; }
.tk-textarea { padding: 10px 12px; min-height: 96px; resize: vertical; line-height: 1.5; }
.tk-input:focus, .tk-search input:focus, .tk-select:focus, .tk-textarea:focus { outline: none; border-color: var(--ev-primary); box-shadow: 0 0 0 3px var(--ev-primary-ring); }
.tk-input--error, .tk-select--error { border-color: var(--ev-danger); }

.tk-menu { position: relative; }
.tk-menu > summary { list-style: none; }
.tk-menu > summary::-webkit-details-marker { display: none; }
.tk-menu-list { position: absolute; right: 0; top: 42px; z-index: var(--ev-z-dropdown, 50); min-width: 200px; padding: 6px; background: var(--ev-surface); border: 1px solid var(--ev-border); border-radius: 12px; box-shadow: var(--ev-shadow-pop); display: grid; gap: 2px; }
.tk-menu-list button { text-align: left; border: 0; background: transparent; min-height: 36px; padding: 8px 10px; border-radius: 8px; font: 500 0.8125rem var(--tk-body); color: var(--ev-text); cursor: pointer; display: flex; gap: 8px; align-items: center; }
.tk-menu-list button:hover:not(:disabled) { background: var(--ev-surface-2); }
.tk-menu-list button:disabled { opacity: .55; cursor: default; }

/* Filters panel */
.tk-filters { padding: 16px 20px; margin-bottom: 12px; }
.tk-filters-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px 14px; align-items: start; }
.tk-filters .svc-input, .tk-form .svc-input { min-height: 38px; border-radius: 10px; }
.tk-filters .svc-label, .tk-form .svc-label { font-weight: 600; font-size: 0.8125rem; color: var(--ev-text); margin-bottom: 6px; }
.tk-field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.tk-field > legend { padding: 0; margin: 0 0 6px; }
.tk-field--range { grid-column: span 2; }
.tk-field--toggles { grid-column: span 3; }
.tk-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.tk-label { font-weight: 600; font-size: 0.8125rem; color: var(--ev-text); }
.tk-label .tk-muted { font-weight: 400; }
.tk-help { font-size: 0.78rem; color: var(--ev-text-muted); }
.tk-error { font-size: 0.78rem; color: var(--ev-danger); font-weight: 500; }
.tk-filters-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ev-border); flex-wrap: wrap; align-items: center; }

/* Chips */
.tk-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tk-chips-label { font-size: 0.8125rem; color: var(--ev-text-muted); margin-right: 2px; }
.tk-chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border: 1px solid var(--ev-border); border-radius: 999px; font: 500 0.8125rem var(--tk-body); color: var(--ev-text-muted); background: var(--ev-surface); cursor: pointer; white-space: nowrap; }
.tk-chip:hover { color: var(--ev-text); border-color: var(--ev-border-strong); }
.tk-chip.is-on { background: var(--ev-primary-soft); border-color: var(--ev-primary-ring); color: var(--ev-primary); }
.tk-chip .material-icons { font-size: 15px; vertical-align: 0; }
.tk-chip-x { border: 0; background: none; padding: 0; color: inherit; cursor: pointer; display: inline-flex; align-items: center; font: inherit; }
.tk-chip-x:has(.material-icons) { width: 24px; height: 24px; margin-right: -8px; justify-content: center; border-radius: 50%; }
.tk-chip-x:has(.material-icons):hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.tk-saveview { display: inline-flex; gap: 6px; align-items: center; }
.tk-saveview input { height: 30px; min-height: 30px; width: 180px; border-radius: 999px; font-size: 0.8125rem; }

/* ── Rows ───────────────────────────────────────────────────────────── */
.tk-rows { overflow: hidden; }
.tk-group { padding: 9px 20px; font-size: 0.78rem; font-weight: 600; color: var(--ev-text-muted); background: var(--ev-surface-2); border-bottom: 1px solid var(--ev-border); }
.tk-row {
    display: grid; grid-template-columns: 10px minmax(0, 1fr) 190px 250px 64px 18px; gap: 16px; align-items: center;
    padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--ev-border); color: var(--ev-text); text-decoration: none;
    transition: background-color .12s;
}
.tk a.tk-row { color: var(--ev-text); text-decoration: none; }
.tk-row:hover { background: var(--tk-hover); }
.tk-rows .tk-row:last-of-type { border-bottom: 0; }
.tk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ev-primary); }
.tk-dot--off { background: transparent; }
.tk-row-subj { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-row--unread .tk-row-subj { font-weight: 700; }
.tk-row-meta { font-size: 0.8125rem; color: var(--ev-text-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-row-customer { font-size: 0.8125rem; font-weight: 500; color: var(--ev-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-row-pills { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tk-row-when-inline { display: none; }
.tk-row-when { font-size: 0.8125rem; color: var(--ev-text-muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tk-row-go { color: var(--ev-text-muted); font-size: 18px !important; transition: transform .15s; }
.tk-row:hover .tk-row-go { transform: translateX(2px); color: var(--ev-text); }
.tk-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--ev-border); font-size: 0.8125rem; color: var(--ev-text-muted); flex-wrap: wrap; }
.tk-count { font-size: 0.8125rem; color: var(--ev-text-muted); }
.tk-empty { padding: 48px 20px; text-align: center; color: var(--ev-text-muted); }
.tk-empty .material-icons { font-size: 32px; color: var(--ev-text-soft, var(--ev-text-muted)); }
.tk-empty strong { display: block; color: var(--ev-text); font-size: 0.9375rem; margin: 8px 0 4px; }
.tk-empty .tk-btn { margin-top: 12px; }
.tk-skel { height: 56px; margin: 8px 18px; border-radius: 10px; background: linear-gradient(90deg, var(--ev-surface-2), var(--ev-bg), var(--ev-surface-2)); background-size: 200% 100%; animation: tk-shimmer 1.4s ease-in-out infinite; }
@keyframes tk-shimmer { to { background-position: -200% 0; } }

/* ── Ticket page ────────────────────────────────────────────────────── */
.tk-status { padding: 16px 20px; }
.tk-status-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tk-status-line .tk-grow { min-width: 220px; }
.tk-track { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(var(--tk-steps, 5), 1fr); gap: 6px; }
.tk-track li { font-size: 0.75rem; color: var(--ev-text-muted); min-width: 0; }
.tk-track li::before { content: ""; display: block; height: 4px; border-radius: 4px; background: var(--ev-border); margin-bottom: 6px; }
.tk-track .is-done::before, .tk-track .is-current::before { background: var(--ev-primary); }
.tk-track .is-current { color: var(--ev-text); font-weight: 600; }
.tk-track-when { display: block; font-weight: 400; color: var(--ev-text-muted); }
.tk-track-phone { display: none; font-size: 0.8125rem; color: var(--ev-text-muted); margin-top: 12px; }

.tk-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; margin-top: 16px; }
.tk-thread { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.tk-day { align-self: stretch; display: flex; align-items: center; gap: 10px; font-size: 0.72rem; font-weight: 600; color: var(--ev-text-muted); }
.tk-day::before, .tk-day::after { content: ""; flex: 1; height: 1px; background: var(--ev-border); }
.tk-msg { max-width: 80%; align-self: flex-start; }
.tk-msg--mine { align-self: flex-end; }
.tk-msg-head { font-size: 0.78rem; color: var(--ev-text-muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tk-msg-head strong { color: var(--ev-text); font-weight: 600; }
.tk-msg--mine .tk-msg-head { justify-content: flex-end; }
.tk-bubble { padding: 10px 14px; border-radius: 14px; background: var(--ev-surface-2); border: 1px solid var(--ev-border); overflow-wrap: anywhere; }
.tk-msg--mine .tk-bubble { background: var(--tk-mine); border-color: var(--tk-mine-border); border-bottom-right-radius: 4px; }
.tk-msg:not(.tk-msg--mine) .tk-bubble { border-bottom-left-radius: 4px; }
.tk-msg--internal .tk-bubble { background: var(--ev-warn-soft); border-style: dashed; border-color: var(--ev-warn); }
.tk-bubble p { margin: 0 0 8px; }
.tk-bubble p:last-child { margin-bottom: 0; }
.tk-bubble ul, .tk-bubble ol { margin: 0 0 8px; padding-left: 20px; }
.tk-tag { display: inline-flex; align-items: center; height: 18px; font-size: 0.68rem; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--ev-surface-2); color: var(--ev-text-muted); border: 1px solid var(--ev-border); }
.tk-tag--warn { background: var(--ev-warn); color: #fff; border-color: transparent; }
.tk-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tk-file { display: inline-flex; gap: 8px; align-items: center; min-height: 32px; padding: 4px 10px; border: 1px solid var(--ev-border); border-radius: 8px; background: var(--ev-surface); font: 500 0.8125rem var(--tk-body); color: var(--ev-text); cursor: pointer; max-width: 100%; }
.tk-file:hover:not(:disabled) { border-color: var(--ev-border-strong); }
.tk-file span:not(.material-icons) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-event { align-self: center; font-size: 0.75rem; color: var(--ev-text-muted); text-align: center; display: inline-flex; gap: 6px; align-items: center; }
.tk-event .material-icons { font-size: 14px; vertical-align: 0; }
.tk-composer { border-top: 1px solid var(--ev-border); padding: 14px 20px 16px; background: var(--ev-surface); border-radius: 0 0 var(--tk-radius) var(--tk-radius); scroll-margin-top: 96px; }
.tk-composer .tk-textarea { min-height: 88px; }
.tk-composer-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-top: 10px; }
.tk-composer-foot .tk-grow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tk-composer-foot .ev-field { margin: 0; }
.tk-composer-foot .ev-upload-btn { height: 32px; font-size: 0.8125rem; }
.tk-composer.is-focus { animation: tk-pulse 1.2s ease-out 1; }
@keyframes tk-pulse { 0% { box-shadow: inset 0 0 0 2px var(--ev-primary); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
.tk-facts { display: grid; grid-template-columns: 96px 1fr; gap: 10px 12px; font-size: 0.8125rem; margin: 12px 0 0; }
.tk-facts dt { color: var(--ev-text-muted); font-weight: 400; }
.tk-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.tk-side .tk-panel + .tk-panel { margin-top: 16px; }
.tk-side .tk-files { flex-direction: column; align-items: stretch; }
.tk-side-files { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ev-border); }
.tk-actions { display: grid; gap: 10px; margin-top: 12px; justify-items: start; }
.tk-escalate { display: grid; gap: 8px; width: 100%; }

/* ── Raise page ─────────────────────────────────────────────────────── */
.tk-steps { list-style: none; display: flex; gap: 22px; margin: 0 0 18px; padding: 0; font-size: 0.8125rem; color: var(--ev-text-muted); flex-wrap: wrap; }
.tk-steps li { display: inline-flex; align-items: center; gap: 8px; }
.tk-steps b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--ev-border-strong); font-size: 0.72rem; }
.tk-steps .is-current { color: var(--ev-text); font-weight: 600; }
.tk-steps .is-current b { background: var(--ev-primary); border-color: var(--ev-primary); color: #fff; }
.tk-steps .is-done b { background: var(--ev-success-soft); border-color: var(--ev-success); color: var(--ev-success); }
.tk-steps-phone { display: none; font-size: 0.8125rem; color: var(--ev-text-muted); margin: 0 0 14px; }
.tk-steps-phone strong { color: var(--ev-text); }
.tk-form { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.tk-form [data-step] > .tk-field + .tk-field, .tk-form [data-step] > * + .tk-field { margin-top: 20px; }
.tk-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.tk-cat {
    position: relative; text-align: left; border: 1px solid var(--ev-border-strong); border-radius: 12px; padding: 12px 14px; min-height: 64px;
    background: var(--ev-surface); color: var(--ev-text); font: 400 0.8125rem var(--tk-body); cursor: pointer; display: grid; align-content: start; gap: 2px;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.tk-cat strong { display: block; font-size: 0.875rem; font-weight: 600; padding-right: 22px; }
.tk-cat span { color: var(--ev-text-muted); }
.tk-cat:hover { border-color: var(--ev-text-muted); }
.tk-cat.is-on { border-color: var(--ev-primary); box-shadow: inset 0 0 0 1px var(--ev-primary); background: var(--tk-mine); }
.tk-cat.is-on::after { content: "check_circle"; font-family: "Material Icons"; font-size: 18px; position: absolute; top: 10px; right: 10px; color: var(--ev-primary); }
.tk-prios { display: grid; grid-template-columns: repeat(var(--tk-prios, 4), minmax(0, 1fr)); gap: 8px; }
.tk-prios .tk-cat { min-height: 44px; align-content: center; }
.tk-dup { border: 1px solid var(--ev-border); border-left: 3px solid var(--ev-warn); background: var(--ev-surface); border-radius: 12px; padding: 12px 14px; font-size: 0.8125rem; display: grid; gap: 8px; }
.tk-dup-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tk-dup-row > span { min-width: 0; }
.tk-nudge { font-size: 0.8125rem; padding: 9px 0; border-top: 1px solid var(--ev-border); display: flex; gap: 8px; align-items: flex-start; }
.tk-nudge:first-of-type { border-top: 0; }
.tk-nudge .material-icons { color: var(--ev-warn); }
.tk-nudge--ok .material-icons { color: var(--ev-success); }
.tk-inline-nudge { display: flex; gap: 6px; align-items: center; font-size: 0.78rem; color: var(--ev-warn); font-weight: 500; }
.tk-inline-nudge .material-icons { font-size: 16px; vertical-align: 0; }
.tk-form-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--ev-border); flex-wrap: wrap; }
.tk-review { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px 12px; font-size: 0.875rem; align-items: start; margin: 0; }
.tk-review dt { color: var(--ev-text-muted); }
.tk-review dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.tk-summary { display: grid; grid-template-columns: 76px 1fr; gap: 8px 10px; font-size: 0.8125rem; margin: 12px 0 0; }
.tk-summary dt { color: var(--ev-text-muted); }
.tk-summary dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tk-summary .tk-empty-val { color: var(--ev-text-muted); font-style: italic; }
.tk-side-stack > .tk-panel + .tk-panel { margin-top: 16px; }

.tk-toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.tk-toggle { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--ev-border-strong); border-radius: 12px; cursor: pointer; background: var(--ev-surface); margin: 0; }
.tk-toggle input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ev-primary); flex: none; }
.tk-toggle > span { display: grid; gap: 2px; font-size: 0.8125rem; color: var(--ev-text-muted); }
.tk-toggle strong { color: var(--ev-text); font-size: 0.875rem; font-weight: 600; }
.tk-toggle.is-on { border-color: var(--ev-primary); box-shadow: inset 0 0 0 1px var(--ev-primary); background: var(--tk-mine); }
.tk-next { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 18px; border-radius: 12px; background: var(--tk-mine); border: 1px solid var(--tk-mine-border); font-size: 0.8125rem; color: var(--ev-text-muted); }
.tk-next strong { color: var(--ev-text); }
.tk-next .material-icons { color: var(--ev-primary); }
.tk-prios .tk-cat span { font-size: 0.75rem; }

/* ── Self-serve on the raise page ───────────────────────────────────── */
.tk-selfserve { padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--ev-success) 7%, var(--ev-surface)); border: 1px solid color-mix(in srgb, var(--ev-success) 30%, var(--ev-border)); display: grid; gap: 8px; }
.tk-selfserve-title { font-size: 0.8125rem; font-weight: 600; color: var(--ev-success); display: flex; gap: 6px; align-items: center; }
.tk-selfserve-title .material-icons { font-size: 16px; vertical-align: 0; }
.tk a.tk-selfserve-link, .tk a.tk-answer { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--ev-surface); border: 1px solid var(--ev-border); color: var(--ev-text); text-decoration: none; transition: border-color .15s; }
.tk a.tk-selfserve-link:hover, .tk a.tk-answer:hover { border-color: var(--ev-text-muted); text-decoration: none; }
.tk-selfserve-link > span:nth-child(2), .tk-answer > span:nth-child(2) { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 0.8125rem; color: var(--ev-text-muted); }
.tk-selfserve-link strong, .tk-answer strong { color: var(--ev-text); font-weight: 600; font-size: 0.875rem; }
.tk-selfserve-link > .material-icons:first-child, .tk-answer > .material-icons:first-child { color: var(--ev-primary); margin-top: 2px; }
.tk-selfserve-go { color: var(--ev-text-muted); font-size: 16px !important; }
.tk-answers { display: grid; gap: 8px; }
.tk-answers .tk-panel-title { margin-bottom: 2px; }
.tk-answers-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 6px; }

/* ── Dark ───────────────────────────────────────────────────────────── */
/* The primary navy lightens in dark mode, so white text drops to ~3:1; dark ink keeps it AA. */
html[data-theme="dark"] .tk-btn--primary:not(:disabled),
html[data-theme="dark"] .tk a.tk-btn--primary,
html[data-theme="dark"] .tk-steps .is-current b,
html[data-theme="dark"] .tk-badge { color: #0f172a; }
html[data-theme="dark"] .tk { --tk-mine: color-mix(in srgb, var(--ev-primary) 16%, var(--ev-surface)); --tk-hover: color-mix(in srgb, var(--ev-primary) 7%, var(--ev-surface)); }

/* ── Touch: 44px targets wherever a finger is the pointer ───────────── */
@media (pointer: coarse) {
    .tk-btn, .tk-btn--sm, .tk-seg button, .tk-chip, .tk-input, .tk-select, .tk-search input, .tk-file, .tk-cat, .tk-menu-list button { min-height: 44px; }
    .tk-btn--sm { height: auto; }
    .tk-chip-x:has(.material-icons) { width: 32px; height: 32px; }
    .tk-icon-btn { width: 40px; height: 40px; }
}

/* ── Phone ──────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
    .tk { padding-bottom: 72px; }
    .tk-title { font-size: 1.5rem; line-height: 1.95rem; }
    .tk-show-phone { display: inline; }
    .tk-hide-phone { display: none !important; }
    .tk-fab {
        position: fixed; right: 16px; bottom: 16px; z-index: 30; height: 52px !important; padding: 0 20px !important;
        border-radius: 26px !important; box-shadow: 0 8px 24px rgba(15, 23, 42, .25) !important;
    }
    .tk-row { grid-template-columns: 8px minmax(0, 1fr); gap: 4px 10px; padding: 12px 14px; }
    .tk-row > .tk-row-status { grid-column: 2; }
    .tk-row-customer, .tk-row-when, .tk-row-go { display: none; }
    .tk-row-when-inline { display: inline; margin-left: auto; font-size: 0.75rem; color: var(--ev-text-muted); }
    .tk-row-meta { white-space: normal; }
    .tk-group { padding: 9px 14px; }
    .tk-seg { width: 100%; flex-wrap: nowrap; }
    .tk-seg button { flex: 1; justify-content: center; padding: 0 8px; }
    .tk-bar > .tk-search { flex-basis: 100%; }
    .tk-bar > .tk-btn { flex: 1; }
    .tk-chips.tk-views { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .tk-filters-grid { grid-template-columns: 1fr 1fr; }
    .tk-field--range, .tk-field--toggles, .tk-filters-grid > .tk-field:first-child { grid-column: 1 / -1; }
    .tk-cols, .tk-form { grid-template-columns: 1fr; }
    .tk-track { display: none; }
    .tk-track-phone { display: block; }
    .tk-msg { max-width: 92%; }
    .tk-thread { padding: 14px; }
    .tk-composer { padding: 12px 14px 14px; }
    .tk-facts { grid-template-columns: 110px 1fr; }
    .tk-steps { display: none; }
    .tk-steps-phone { display: block; }
    .tk-cats { grid-template-columns: 1fr 1fr; }
    .tk-prios { grid-template-columns: 1fr 1fr; }
    .tk-review { grid-template-columns: 1fr auto; }
    .tk-review dt { grid-column: 1 / -1; margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .tk-skel, .tk-spin, .tk-composer.is-focus { animation: none; }
    .tk-row-go { transition: none; }
}

.tk-link--muted { color: var(--ev-text-muted); font-weight: 400; font-size: 0.8125rem; }
.tk-visibility { display: flex; gap: 6px; align-items: center; margin: 8px 0 0; }
.tk-visibility .material-icons { font-size: 15px; vertical-align: 0; }
.tk-alert .tk-grow { flex: 1; min-width: 0; }
.tk-alert { align-items: center; }
html[data-theme="dark"] .tk-tag--warn { color: #0f172a; }
.tk-escalated { display: inline-flex; color: var(--ev-danger); }
.tk-escalated .material-icons { font-size: 16px; vertical-align: 0; }
.tk-count-plain { font-weight: 600; color: inherit; margin-left: 2px; }
.tk-filters .tk-chip { height: 38px; padding: 0 14px; }
.tk-views .tk-chips-label { white-space: nowrap; }
.tk-crumb-refresh { margin-left: auto; }

/* ── Service reports / Ops performance ───────────────────────────────
   Plain HTML charts on the tokens: one colour per meaning, numbers you can
   read without a legend, and the same look in light, dark and on a phone. */
.tk-report-bar { align-items: center; }
.tk-report-range { display: inline-grid; grid-template-columns: 150px auto 150px; gap: 8px; align-items: center; }
.tk-report-customer { flex: 1 1 240px; min-width: 220px; }
.tk-report-customer .svc-picker { width: 100%; }
.tk-report-customer .svc-input { min-height: 38px; border-radius: 10px; }
.tk-report-scope { margin: 0 0 14px; font-size: 0.8125rem; color: var(--ev-text-muted); }
.tk-report-body { display: grid; gap: 16px; transition: opacity .15s; }
.tk-report-body.is-busy { opacity: .55; }
.tk-report-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tk-report-card-head.tk-pad { margin-bottom: 0; }

.tk-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tk-tile { display: grid; gap: 6px; align-content: start; padding: 16px 18px; background: var(--ev-surface); border: 1px solid var(--ev-border); border-radius: var(--tk-radius); }
.tk-tile-label { font-size: 0.8125rem; font-weight: 600; color: var(--ev-text-muted); }
.tk-tile-value { font-family: var(--tk-display); font-size: 1.875rem; line-height: 2.25rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tk-tile-sep { color: var(--ev-text-muted); font-weight: 400; }
.tk-tile-note { font-size: 0.8125rem; color: var(--ev-text-muted); }
.tk-tile-bad { color: var(--ev-danger); font-weight: 600; }
.tk-meter { display: block; height: 6px; border-radius: 6px; background: var(--ev-surface-2); overflow: hidden; }
.tk-meter > span { display: block; height: 100%; border-radius: 6px; background: var(--ev-text-muted); }
.tk-meter--good > span { background: var(--ev-success); }
.tk-meter--watch > span { background: var(--ev-warn); }
.tk-meter--behind > span { background: var(--ev-danger); }

.tk-legend { display: flex; gap: 16px; font-size: 0.8125rem; color: var(--ev-text-muted); margin-bottom: 10px; }
.tk-legend span { display: inline-flex; gap: 6px; align-items: center; }
.tk-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.tk-key--raised, .tk-trend-bar--raised { background: var(--ev-primary); }
.tk-key--closed, .tk-trend-bar--closed { background: var(--ev-success); }
.tk-trend-plot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.tk-trend-scale { display: flex; flex-direction: column; justify-content: space-between; height: 220px; font-size: 0.72rem; color: var(--ev-text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.tk-trend-cols {
    display: grid; grid-template-columns: repeat(var(--tk-cols), minmax(0, 1fr)); column-gap: 4px; align-items: start;
    /* Gridlines at the top and the middle of the scale; the baseline is each column's own bottom edge. */
    background:
        linear-gradient(var(--ev-border), var(--ev-border)) 0 0 / 100% 1px no-repeat,
        linear-gradient(var(--ev-border), var(--ev-border)) 0 110px / 100% 1px no-repeat,
        linear-gradient(var(--ev-border-strong), var(--ev-border-strong)) 0 219px / 100% 1px no-repeat;
}
.tk-trend-col { display: grid; grid-template-rows: 220px auto; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.tk-trend-bars { display: flex; gap: 2px; align-items: flex-end; justify-content: center; height: 220px; width: 100%; min-width: 0; }
.tk-trend-bar { flex: 0 1 14px; min-width: 2px; border-radius: 3px 3px 0 0; }
.tk-trend-col:hover .tk-trend-bar { filter: brightness(1.12); }
.tk-trend-x { display: block; height: 22px; font-size: 0.72rem; line-height: 16px; color: var(--ev-text-muted); text-align: center; white-space: nowrap; padding-top: 6px; overflow: visible; }
.tk-chart-empty { padding: 24px 0; text-align: center; margin: 0; }

.tk-report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.tk-bars { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.tk-bars-row { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 8fr) 76px; gap: 10px; align-items: center; font-size: 0.8125rem; }
.tk-bars-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-bars-track { display: block; height: 8px; border-radius: 8px; background: var(--ev-surface-2); overflow: hidden; }
.tk-bars-fill { display: block; height: 100%; border-radius: 8px; background: var(--ev-primary); }
.tk-bars-value { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.tk-bars-value .tk-muted { font-weight: 400; }

.tk-report-table { overflow: hidden; }
.tk-table-scroll { overflow-x: auto; }
.tk-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.tk-table th { text-align: left; font-weight: 600; color: var(--ev-text-muted); padding: 8px 20px; border-top: 1px solid var(--ev-border); border-bottom: 1px solid var(--ev-border); background: var(--ev-surface-2); white-space: nowrap; }
.tk-table td { padding: 10px 20px; border-bottom: 1px solid var(--ev-border); }
.tk-table tr:last-child td { border-bottom: 0; }
.tk-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tk-share-col { width: 30%; }
.tk-share-col .tk-bars-track { display: inline-block; width: calc(100% - 48px); vertical-align: middle; margin-right: 8px; }
.tk-staff-only { display: inline-flex; gap: 6px; align-items: center; font-size: 0.78rem; color: var(--ev-text-muted); }
.tk-staff-only .material-icons { font-size: 15px; vertical-align: 0; }
.tk-rate--good { color: var(--ev-success); font-weight: 600; }
.tk-rate--watch { color: var(--ev-warn); font-weight: 600; }
.tk-rate--behind { color: var(--ev-danger); font-weight: 600; }

@media (max-width: 1100px) {
    .tk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tk-report-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
    .tk-tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
    .tk-tile { padding: 14px; }
    .tk-tile-value { font-size: 1.5rem; line-height: 1.9rem; }
    .tk-report-grid { grid-template-columns: 1fr; }
    .tk-report-range { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); width: 100%; }
    .tk-trend-scale, .tk-trend-bars { height: 160px; }
    .tk-trend-col { grid-template-rows: 160px auto; }
    .tk-trend-cols {
        background:
            linear-gradient(var(--ev-border), var(--ev-border)) 0 0 / 100% 1px no-repeat,
            linear-gradient(var(--ev-border), var(--ev-border)) 0 80px / 100% 1px no-repeat,
            linear-gradient(var(--ev-border-strong), var(--ev-border-strong)) 0 159px / 100% 1px no-repeat;
    }
    .tk-table th, .tk-table td { padding-left: 14px; padding-right: 14px; }
    .tk-share-col { display: none; }
}

/* ── Known issues on the raise page ──────────────────────────────────
   What the team already knows about: one calm card in the info colour, the "no ticket needed" action first. */
.tk-known { padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--ev-primary) 6%, var(--ev-surface)); border: 1px solid color-mix(in srgb, var(--ev-primary) 28%, var(--ev-border)); display: grid; gap: 8px; }
.tk-known-title { font-size: 0.8125rem; font-weight: 600; color: var(--ev-primary); display: flex; gap: 6px; align-items: center; margin: 0; }
.tk-known-title .material-icons { font-size: 16px; vertical-align: 0; }
.tk-known-item { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--ev-surface); border: 1px solid var(--ev-border); }
.tk-known-text { margin: 0; font-size: 0.875rem; color: var(--ev-text); overflow-wrap: anywhere; }
.tk-known-meta { font-size: 0.78rem; color: var(--ev-text-muted); }
.tk-known-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.tk-known-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 2px; }
@media (max-width: 600px) {
    .tk-known-actions .tk-btn, .tk-known-foot .tk-btn { width: 100%; justify-content: center; }
    .tk-known-foot .tk-help { display: none; }
}
