/* mako.support's own pieces, loaded after the kit's mk.css and mk-brand.css (the gold tokens; see KIT.md). */

/* mako.support sells no content, and the owner copies addresses and text out of the desk:
   undo the kit's copy protection (mk.css "Protect the content"). Printing a thread is allowed too. */
html { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
@media print { body { display: block !important; } .mk-tabbar, .mk-appbar .mk-actions, .sp-reply, .sp-thread-side form { display: none !important; } }

/* Below: kit tokens only; no raw colours. */

/* Pages with a side column (Pulse, Spend, a contact, Status): one column on phones, the side column from 900px. */
.sp-main { display: grid; gap: var(--mk-s-4); }
.sp-layout { display: grid; gap: var(--mk-gap-card); min-width: 0; }
.sp-side { display: grid; gap: var(--mk-s-3); align-content: start; min-width: 0; }
.sp-tabs { display: flex; gap: var(--mk-s-2); overflow-x: auto; margin: 0 calc(-1 * var(--mk-gutter)); padding: var(--mk-s-1) var(--mk-gutter) var(--mk-s-1); scrollbar-width: none; }
.sp-tabs .mk-chip { flex: none; gap: var(--mk-s-1); font-size: 13px; }
.sp-help { font-size: 13.5px; line-height: 1.5; }
.sp-list-wrap { display: grid; gap: var(--mk-s-4); align-content: start; min-width: 0; }

/* Above a kit record list: the server search (it finds past what the page shows) with its selects, and the page's action. */
.sp-tools { display: flex; flex-wrap: wrap; align-items: end; gap: var(--mk-gap-in); min-width: 0; }
.sp-tools-find { display: flex; flex: 1 1 20rem; flex-wrap: wrap; align-items: end; gap: var(--mk-gap-in); min-width: 0; margin: 0; }
.sp-tools-find .mk-search { flex: 1 1 16rem; margin: 0; }
.sp-tools-find .sp-field { flex: 1 1 10rem; }
.sp-tools-act { display: flex; flex: 0 1 auto; align-items: center; gap: var(--mk-s-2); margin: 0; }
.sp-tools-act .mk-btn { min-height: 52px; }

/* A record row with buttons (Outreach): the kit's row look, the link beside the actions. */
.sp-act-link { display: flex; flex: 1; gap: var(--mk-s-3); min-width: 0; color: inherit; text-decoration: none; }
.sp-act-link:focus-visible { outline: 2.5px solid var(--mk-brand); outline-offset: 2px; }
.sp-act-buttons { display: flex; flex: none; align-self: center; gap: var(--mk-s-1); }
.sp-act-buttons form { margin: 0; }
.sp-tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--mk-s-1); }

.sp-avatar, .sp-dir { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--mk-tint); color: var(--mk-brand-ink); font-size: 16px; font-weight: 750; }
.sp-dir .mk-icon { width: 20px; height: 20px; }
.sp-dir-out { background: transparent; box-shadow: inset 0 0 0 1px var(--mk-edge); color: var(--mk-muted); }
.sp-dir-form { background: color-mix(in srgb, var(--mk-dot) 18%, transparent); color: var(--mk-ink); }

.sp-pages { display: flex; align-items: center; justify-content: center; gap: var(--mk-s-3); font-size: 13px; }
.sp-pages [aria-disabled="true"] { opacity: .35; }

/* Forms */
.sp-field { display: grid; gap: var(--mk-s-1); min-width: 0; }
.sp-field > span:first-child { color: var(--mk-muted); font-size: 13px; font-weight: 650; }
.sp-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--mk-s-3); }
.sp-form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--mk-s-3); }
.sp-form-note { font-size: 14px; }
.sp-form-note[data-tone="bad"] { color: var(--mk-negative); }
.sp-fine { font-size: 13px; }

/* Home: the owner's three numbers. */
.sp-today { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: var(--mk-s-3); }
.sp-stat { overflow-wrap: break-word; gap: 2px; justify-items: start; min-height: 44px; padding: var(--mk-s-3) var(--mk-s-4); color: var(--mk-muted); text-decoration: none; font-size: 13px; font-weight: 650; }
.sp-stat-n { color: var(--mk-ink); font-size: 26px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.sp-stat-flag { box-shadow: var(--mk-shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--mk-dot) 70%, transparent); }
.sp-apps .mk-family + .mk-family { margin-top: var(--mk-s-5); }

/* A thread */
.sp-thread { display: grid; gap: var(--mk-gap-card); min-width: 0; }
.sp-thread-main { display: grid; gap: var(--mk-s-4); align-content: start; min-width: 0; }
.sp-thread-card { gap: var(--mk-s-3); }
.sp-thread-who { display: flex; align-items: center; gap: var(--mk-s-3); min-width: 0; }
.sp-thread-who > span:last-child { display: grid; min-width: 0; }
.sp-thread-who strong, .sp-thread-who .mk-muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-thread-who .mk-muted { font-size: 13px; }
.sp-thread-form { display: grid; gap: var(--mk-s-3); }
.sp-status-pick { display: flex; flex-wrap: wrap; gap: var(--mk-s-1); margin: 0; padding: 0; border: 0; }
.sp-status-pick legend { width: 100%; margin-bottom: var(--mk-s-1); padding: 0; color: var(--mk-muted); font-size: 13px; font-weight: 650; }
.sp-status-pick .mk-chip { flex: 1 0 auto; cursor: pointer; }
.sp-status-pick .mk-chip:has(input:focus-visible) { outline: 2.5px solid var(--mk-brand); outline-offset: 2px; }

.sp-convo { display: grid; gap: var(--mk-s-3); margin: 0; padding: 0; list-style: none; }
.sp-msg { gap: var(--mk-s-3); }
.sp-msg-out { background: color-mix(in srgb, var(--mk-tint) 55%, var(--mk-glass)); }
.sp-msg-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--mk-s-3); align-items: start; }
.sp-msg-who { display: grid; gap: 1px; min-width: 0; font-size: 13px; }
.sp-msg-who strong { font-size: 15px; }
.sp-msg-who > * { overflow-wrap: anywhere; }
.sp-msg-head time { font-size: 12.5px; white-space: nowrap; }
.sp-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.6; max-height: 70vh; overflow-y: auto; }
.sp-attach { display: flex; flex-wrap: wrap; gap: var(--mk-s-1); margin: 0; padding: 0; list-style: none; }

.sp-reply { gap: var(--mk-s-3); }
.sp-reply form { display: grid; gap: var(--mk-s-3); }
.sp-reply-meta { display: grid; gap: 2px; margin: 0; font-size: 13.5px; }
.sp-reply-meta div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--mk-s-2); }
.sp-reply-meta dt { color: var(--mk-muted); }
.sp-reply-meta dd { margin: 0; overflow-wrap: anywhere; }
textarea.sp-reply-body { min-height: 180px; }

/* Settings sheet */
.sp-settings { display: grid; gap: var(--mk-s-5); }
.sp-settings .mk-menu { margin: 0; }
.sp-mailbox { min-height: 64px; }
.sp-mailbox .mk-menu-label { display: grid; gap: 2px; min-width: 0; }
.sp-mailbox .mk-menu-label .mk-muted { overflow: hidden; font-size: 12.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.sp-ok, .sp-warn { flex: none; padding: var(--mk-s-1) var(--mk-s-2); border-radius: 999px; font-size: 12px; font-weight: 700; }
.sp-ok { background: var(--mk-tint); color: var(--mk-brand-ink); }
.sp-warn { box-shadow: inset 0 0 0 1px var(--mk-negative); color: var(--mk-negative); }
.sp-field-row .mk-menu-label { flex: 1; }
.sp-btn-small { min-height: 44px; }
.sp-help { margin-top: var(--mk-s-2); }

@media (min-width: 600px) {
  .sp-form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tablets and desktops: filters on the left, the list beside them; a thread with its card on the right. */
@media (min-width: 900px) {
  .sp-layout { grid-template-columns: var(--mk-side-w) minmax(0, 1fr); align-items: start; }
  .sp-side { position: sticky; top: calc(var(--mk-bar-h) + var(--mk-s-6)); }
  .sp-tabs { flex-direction: column; margin: 0; padding: 0; overflow: visible; }
  .sp-tabs .mk-chip { justify-content: space-between; padding: 0 var(--mk-s-4); }
  .sp-side .sp-form-row { grid-template-columns: minmax(0, 1fr); }
  .sp-thread { grid-template-columns: minmax(0, 1fr) var(--mk-rail-w); align-items: start; }
  .sp-thread-side { order: 2; position: sticky; top: calc(var(--mk-bar-h) + var(--mk-s-6)); }
  .sp-thread-side .sp-form-row { grid-template-columns: minmax(0, 1fr); }
  .sp-msg { padding: var(--mk-s-5); }
  .sp-stat-n { font-size: 32px; }
}


.sp-thread-app { margin: var(--mk-s-2) 0 0; }

/* Triage: urgency flags (one hue each, from the tokens) and the type pickers on a ticket. */
.sp-qcard-ticket { margin: 0 0 var(--mk-s-3); padding: var(--mk-s-3); border-radius: var(--mk-r-card); box-shadow: inset 0 0 0 1px var(--mk-edge); }
.sp-qcard-ticket p { margin: var(--mk-s-1) 0 0; color: var(--mk-muted); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.sp-section-title { margin: var(--mk-s-4) 0 var(--mk-s-2); font-size: 15px; font-weight: 700; }

/* Drafts and Answers: a line of preview under a row's subject, the draft's bar over the reply box. */
.sp-draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--mk-s-2); margin-bottom: var(--mk-s-3); }
.sp-draft-bar .sp-fine { flex: 1; margin: 0; }
.sp-draft-bar form { margin: 0; }
.sp-answer-pick { margin-bottom: var(--mk-s-2); }
.sp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--mk-s-2); }
.sp-later { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--mk-s-2); margin-top: var(--mk-s-3); }
.sp-answer-edit form { display: grid; gap: var(--mk-s-3); }
.sp-btn-wide { width: 100%; }

/* Pulse and Spend: the kit's stat tiles and charts, then small tables. */
.sp-chart { gap: var(--mk-s-3); }
.sp-chart .sp-section-title { margin: 0; }
.sp-table-wrap { overflow-x: auto; }
.sp-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.sp-table th, .sp-table td { padding: var(--mk-s-2) var(--mk-s-2); border-bottom: 1px solid var(--mk-edge); text-align: end; white-space: nowrap; }
.sp-table th:first-child { text-align: start; }
.sp-table thead th { color: var(--mk-muted); font-size: 12.5px; font-weight: 650; }
.sp-table tbody tr:last-child > * { border-bottom: 0; }


/* Status: the summary, each product's state, and incidents with their updates. */
.sp-status-sum { display: flex; align-items: center; gap: var(--mk-s-3); padding: var(--mk-s-4); font-size: 16px; }
.sp-status-sum .mk-icon { flex: none; width: 24px; height: 24px; }
.sp-state-ok .mk-icon { color: var(--mk-brand); }
.sp-state-bad .mk-icon { color: var(--mk-negative); }
.sp-status-new { padding: var(--mk-s-3); }
.sp-status-new > summary { list-style: none; }
.sp-status-new > summary::-webkit-details-marker { display: none; }
.sp-status-new[open] > summary { margin-bottom: var(--mk-s-3); }
.sp-incident { gap: var(--mk-s-3); }
.sp-incident-head { display: grid; gap: var(--mk-s-2); }
.sp-incident-head h3 { margin: 0; font-size: 16px; }
.sp-incident-updates { display: grid; gap: var(--mk-s-3); margin: 0; padding: 0; list-style: none; }
.sp-incident-updates li { padding-inline-start: var(--mk-s-3); border-inline-start: 2px solid var(--mk-edge); font-size: 14px; }
.sp-incident-updates time { font-size: 12.5px; }
.sp-incident-updates p { margin: var(--mk-s-1) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-incident-form { padding-top: var(--mk-s-3); border-top: 1px solid var(--mk-edge); }
@media (max-width: 599px) { .sp-table .sp-wide { display: none; } .sp-table th, .sp-table td { padding: var(--mk-s-2) var(--mk-s-1); } }
