/*
 * Support Dashboard — Savecall CI design system.
 * Tokens follow the savecall-ci skill (html-core §1): --sc-* custom properties.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sc-blue: #0c69b2;
  --sc-gray: #616d7e;
  --sc-light-gray: #e6e6e6;
  --sc-light-blue: #1d9dd9;
  --sc-dark-blue: #163e64;
  --sc-teal: #28787e;
  --sc-accent-red: #ef1b30;
  --sc-accent-orange: #f5a623;
  /* Darkened yellow — a bright one is unreadable as text on white. */
  --sc-accent-yellow: #a67c00;
  --sc-text: #333333;
  --sc-text-secondary: #666666;
  --sc-bg-light: #f5f7fa;
  --sc-border: #e0e4e8;
  --sc-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --sc-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
  --sc-radius: 8px;
  --sc-transition: all 0.3s ease;
  --sc-bg-body: #f2f4f7;
  --sc-bg-card: #ffffff;
  --sc-bg-table-alt: #fafbfc;
}

body {
  font-family:
    'Segoe UI',
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--sc-text);
  background: var(--sc-bg-body);
  transition:
    background 0.3s ease,
    color 0.3s ease;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Shared width container — topbar, page and footer all align on it. */

.container {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.3;
}

a {
  color: var(--sc-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--sc-light-blue);
}

/* ---------- Top bar ---------- */

.topbar {
  background: linear-gradient(135deg, var(--sc-dark-blue) 0%, #0a5290 100%);
  color: #ffffff;
  position: relative;
  box-shadow: var(--sc-shadow);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.topbar__logo {
  height: 30px;
  width: auto;
  display: block;
  transition: transform 0.3s ease;
}

.topbar__logo:hover {
  transform: scale(1.04);
}

.topbar__separator {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.25);
}

.topbar__title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

/* Deployed version — quiet on purpose, it is a diagnostic, not a headline. */

.topbar__version {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  cursor: help;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar__user {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
}

.page {
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
  flex: 1;
}

/* ---------- Buttons ---------- */

.btn {
  font: inherit;
  border-radius: 6px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--sc-transition);
}

.btn--primary {
  background: var(--sc-blue);
  border-color: var(--sc-blue);
  color: #ffffff;
  font-weight: 600;
}

.btn--primary:hover {
  background: var(--sc-dark-blue);
  transform: translateY(-1px);
  box-shadow: var(--sc-shadow);
}

/* Decision buttons in the open-actions table — compact, two per row. */

.btn--approve,
.btn--reject {
  padding: 0.28rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn--approve {
  background: var(--sc-blue);
  border-color: var(--sc-blue);
  color: #ffffff;
}

.btn--approve:hover {
  background: var(--sc-dark-blue);
}

.btn--reject {
  background: transparent;
  border-color: var(--sc-border);
  color: var(--sc-text-secondary);
}

.btn--reject:hover {
  border-color: var(--sc-accent-red);
  color: var(--sc-accent-red);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: progress;
}

.decision {
  display: flex;
  gap: 0.4rem;
}

.decision__form {
  display: inline;
}

.decision__done {
  font-size: 0.78rem;
  color: var(--sc-text-secondary);
}

/* Standalone decision page — full-size buttons, unlike the compact table row. */

.decision--page {
  gap: 0.75rem;
}

.decision--page .btn {
  padding: 0.6rem 1.8rem;
  font-size: 0.95rem;
}

/* Full summary on the decision page — the tables clamp it to three lines. */

.decision-summary {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-bottom: 1px solid var(--sc-border);
  margin-bottom: 1.5rem;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sc-text-secondary);
  border-radius: var(--sc-radius) var(--sc-radius) 0 0;
  transition: var(--sc-transition);
}

.tab::after {
  content: '';
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: -1px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--sc-blue);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab:hover {
  color: var(--sc-blue);
  background: var(--sc-bg-light);
}

.tab:hover::after {
  transform: scaleX(0.55);
}

.tab--active {
  color: var(--sc-blue);
}

.tab--active::after {
  transform: scaleX(1);
}

/* Panels are rendered for both tabs; only the active one is shown. */

.tabpanel {
  display: none;
}

.tabpanel--active {
  display: block;
  animation: panel-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- KPI row ---------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Two-card row: both cards share the full content width, one half each. */

.kpi-row--duo {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.kpi {
  position: relative;
  display: block;
  /* Both cards are links now — no underline, colours come from the children. */
  color: inherit;
  background: var(--sc-bg-card);
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius);
  padding: 1.1rem 1.25rem;
  overflow: hidden;
  box-shadow: var(--sc-shadow);
  transition: var(--sc-transition);
  animation: card-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.kpi:nth-child(2) {
  animation-delay: 0.06s;
}

.kpi::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--sc-blue);
  transform: scaleY(0.35);
  transform-origin: center;
  transition: transform 0.3s ease;
}

.kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--sc-shadow-lg);
  border-color: var(--sc-blue);
}

/* Without a jump target the card is plain text — no lift, no pointer. */

.kpi:not([href]),
.kpi:not([href]):hover {
  transform: none;
  box-shadow: var(--sc-shadow);
  border-color: var(--sc-border);
  cursor: default;
}

.kpi:hover::before {
  transform: scaleY(1);
}

.kpi--actions::before {
  background: var(--sc-accent-orange);
}

.kpi__value {
  display: block;
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--sc-dark-blue);
}

.kpi__label {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sc-gray);
}

.kpi__sub,
.kpi__hint {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.76rem;
}

.kpi__sub--alert {
  color: var(--sc-accent-red);
  font-weight: 700;
}

.kpi__hint {
  color: var(--sc-blue);
  opacity: 0;
  transform: translateY(2px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.kpi:hover .kpi__hint,
.kpi:focus-visible .kpi__hint {
  opacity: 1;
  transform: none;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Panels ---------- */

.panel {
  background: var(--sc-bg-card);
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--sc-shadow);
  transition:
    box-shadow 0.3s ease,
    border-color 0.3s ease,
    background 0.3s ease;
  animation: card-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.panel:hover {
  box-shadow: var(--sc-shadow-lg);
}

.panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--sc-border);
}

.panel__title {
  font-size: 1.1rem;
  color: var(--sc-blue);
}

.panel__meta {
  font-size: 0.78rem;
  color: var(--sc-gray);
}

.panel__dot {
  opacity: 0.5;
  padding: 0 0.15rem;
}

/* ---------- Aggregation bars ---------- */

.agg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.75rem;
}

.agg__title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sc-gray);
  margin-bottom: 0.75rem;
}

.agg__row {
  display: grid;
  grid-template-columns: 10rem 1fr 4.5rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0;
}

.agg__label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--sc-text);
  /* Status rows carry a second line ("wartet auf uns"), so no ellipsis here. */
  overflow-wrap: anywhere;
}

.agg__track {
  height: 9px;
  border-radius: 999px;
  background: var(--sc-bg-light);
  overflow: hidden;
}

.agg__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sc-blue), var(--sc-light-blue));
  /* Bars grow from zero on every render — the width comes from the template. */
  animation: bar-grow 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes bar-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.agg__fill {
  transform-origin: left center;
}

.agg__fill--new,
.agg__fill--open {
  background: linear-gradient(90deg, #d99a00, #f5a623);
}

.agg__fill--pending,
.agg__fill--hold {
  background: linear-gradient(90deg, var(--sc-teal), #4db8bf);
}

.agg__fill--solved,
.agg__fill--closed {
  background: linear-gradient(90deg, var(--sc-gray), #9ba4b0);
}

.agg__hint {
  display: block;
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--sc-gray);
  text-transform: none;
  letter-spacing: 0;
}

.agg__fill--unassigned {
  background: linear-gradient(90deg, #b3121f, var(--sc-accent-red));
}

.agg__value {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--sc-dark-blue);
  text-align: right;
}

/* Must follow the base rule: same specificity, later declaration wins. */

.agg__value--unassigned {
  color: var(--sc-accent-red);
}

.agg__percent {
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--sc-gray);
}

/* ---------- Conversation cards ---------- */

.convo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem;
}

.convo {
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius);
  padding: 0.9rem 1rem;
  background: var(--sc-bg-table-alt);
  transition: var(--sc-transition);
}

.convo:hover {
  transform: translateY(-2px);
  border-color: var(--sc-blue);
  box-shadow: var(--sc-shadow-lg);
}

.convo__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.convo__ticket {
  font-weight: 700;
  font-size: 0.85rem;
}

.convo__subject {
  font-size: 0.92rem;
  color: var(--sc-dark-blue);
  margin: 0.45rem 0 0.7rem;
}

.convo__message {
  border-left: 3px solid var(--sc-blue);
  padding: 0.35rem 0 0.35rem 0.7rem;
  margin-bottom: 0.6rem;
  transition: border-color 0.2s ease;
}

.convo__message--internal {
  border-left-color: #f5a623;
}

.convo__meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: baseline;
  font-size: 0.7rem;
  margin-bottom: 0.15rem;
}

.convo__author {
  font-weight: 700;
  color: var(--sc-text);
}

.convo__visibility {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sc-gray);
}

.convo__time {
  color: var(--sc-gray);
  font-size: 0.7rem;
}

.convo__excerpt {
  font-size: 0.82rem;
  color: var(--sc-text-secondary);
  line-height: 1.5;
}

.convo__more {
  font-size: 0.72rem;
  color: var(--sc-gray);
  font-style: italic;
}

/* ---------- Filters ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--sc-border);
}

.filters__group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filters__label {
  color: var(--sc-gray);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filters__link {
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  color: var(--sc-blue);
  font-size: 0.84rem;
  border: 1px solid transparent;
  transition: var(--sc-transition);
}

.filters__link:hover {
  border-color: var(--sc-blue);
  background: var(--sc-bg-light);
  transform: translateY(-1px);
}

.filters__link--active {
  background: var(--sc-blue);
  color: #ffffff;
  box-shadow: var(--sc-shadow);
}

.filters__link--active:hover {
  color: #ffffff;
  background: var(--sc-dark-blue);
}

/* ---------- Chips ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--sc-border);
  background: var(--sc-bg-light);
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--sc-transition);
}

.chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--sc-shadow);
}

.chip__count {
  background: var(--sc-blue);
  color: #ffffff;
  border-radius: 999px;
  min-width: 1.6rem;
  padding: 0.05rem 0.45rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.chip--proposed .chip__count {
  background: #d99a00;
}

.chip--blocked .chip__count {
  background: var(--sc-accent-red);
}

.chip--unknown .chip__count {
  background: var(--sc-gray);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--sc-radius);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.table th {
  text-align: left;
  color: var(--sc-gray);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.55rem 0.75rem;
  border-bottom: 2px solid var(--sc-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--sc-bg-card);
  z-index: 1;
}

.table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--sc-border);
  vertical-align: top;
}

/* Shifted log rows can carry 170-char unbroken tokens (Outlook entry ids) in
   the assignee column. Without the cap and the break they stretch the column
   and push the whole table past the viewport. */

.table__assignee {
  max-width: 9rem;
  overflow-wrap: anywhere;
}

/* Combined action names like `draft_reply+draft_sideconvo` have no break
   opportunity and would otherwise widen the column past the viewport. */

.table__action {
  /* Floor keeps `manual_review` on one line; the cap plus the break lets
     combined names like `draft_reply+draft_sideconvo` wrap instead of
     stretching the table past the viewport. */
  min-width: 8rem;
  max-width: 10rem;
  overflow-wrap: anywhere;
}

.table tbody tr {
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.table tbody tr:nth-child(even) {
  background: var(--sc-bg-table-alt);
}

.table tbody tr:hover {
  background: rgba(12, 105, 178, 0.07);
}

.table__nowrap {
  white-space: nowrap;
}

.table__summary {
  max-width: 34rem;
  min-width: 16rem;
}

/* Long bot summaries would otherwise stretch rows to several hundred pixels. */

.table__clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: help;
}

/*
 * Waiting duration — colour escalates the longer an action sits unhandled:
 * yellow under four hours, orange from four, red from a day.
 */

.waiting {
  color: var(--sc-text-secondary);
  cursor: help;
}

.waiting--normal {
  color: var(--sc-accent-yellow);
  font-weight: 600;
}

.waiting--warn {
  color: var(--sc-accent-orange);
  font-weight: 600;
}

.waiting--alert {
  color: var(--sc-accent-red);
  font-weight: 700;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: var(--sc-transition);
}

.badge--proposed {
  background: #fff4d6;
  color: #8a6100;
}

/* Approved but not sent yet — the bot still has to act on it. */

.badge--approved {
  background: #e3eefb;
  color: var(--sc-blue);
}

.badge--sent,
.badge--solved {
  background: #e0f2e9;
  color: #1d6f42;
}

.badge--blocked {
  background: #fdecea;
  color: #8a2620;
}

.badge--rejected,
.badge--denied,
.badge--unknown,
.badge--closed {
  background: var(--sc-light-gray);
  color: var(--sc-text-secondary);
}

.badge--ticket,
.badge--new,
.badge--open,
.badge--pending,
.badge--hold {
  background: #e3eefb;
  color: var(--sc-dark-blue);
}

/* ---------- Error boxes and notes ---------- */

.error-box {
  background: #fdecea;
  border-left: 4px solid var(--sc-accent-red);
  color: #8a2620;
  border-radius: 0 var(--sc-radius) var(--sc-radius) 0;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.86rem;
}

.empty-note {
  color: var(--sc-gray);
  font-size: 0.88rem;
  padding: 0.5rem 0;
}

.malformed-note {
  color: var(--sc-gray);
  font-size: 0.75rem;
  margin-top: 0.75rem;
}

/* ---------- Login ---------- */

.login {
  display: flex;
  justify-content: center;
  padding-top: 3.5rem;
}

.login__panel {
  width: 100%;
  max-width: 25rem;
}

.login__heading {
  color: var(--sc-blue);
  font-size: 1.3rem;
}

.login__hint {
  font-size: 0.82rem;
  color: var(--sc-gray);
  margin: 0.35rem 0 1rem;
}

/* Microsoft sign-in — the only way in; there is no local password form. */

.login__ms {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-top: 0.4rem;
}

/* ---------- Ticket detail page ---------- */

.back-link {
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-block;
  transition: transform 0.2s ease;
}

.back-link:hover {
  transform: translateX(-3px);
}

.detail-head {
  margin-bottom: 1.5rem;
  animation: card-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.detail-head__title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.9rem;
}

.detail-head__subject {
  font-size: 1.4rem;
  color: var(--sc-dark-blue);
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem 1.5rem;
  background: var(--sc-bg-card);
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--sc-shadow);
}

.detail-meta__item dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sc-gray);
  margin-bottom: 0.15rem;
}

.detail-meta__item dd {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sc-text);
}

/* Conversation threads (main and side conversations) */

.thread {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.thread__item {
  border-left: 3px solid var(--sc-blue);
  background: var(--sc-bg-table-alt);
  border-radius: 0 var(--sc-radius) var(--sc-radius) 0;
  padding: 0.7rem 1rem;
  transition: var(--sc-transition);
}

.thread__item:hover {
  box-shadow: var(--sc-shadow);
  transform: translateX(2px);
}

.thread__item--internal {
  border-left-color: #f5a623;
}

.thread--nested {
  margin-top: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px dashed var(--sc-border);
}

.thread__meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: baseline;
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}

.thread__author {
  font-weight: 700;
  color: var(--sc-text);
  font-size: 0.82rem;
}

.thread__visibility,
.thread__to {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sc-gray);
}

.thread__time {
  color: var(--sc-gray);
  margin-left: auto;
}

.thread__subject {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sc-blue);
  margin-bottom: 0.25rem;
}

.thread__body {
  font-size: 0.86rem;
  color: var(--sc-text-secondary);
  line-height: 1.6;
  /* Bodies arrive as plain text — keep the sender's paragraph breaks. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Side conversation cards */

.sidecon {
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  transition: var(--sc-transition);
}

.sidecon:last-child {
  margin-bottom: 0;
}

.sidecon:hover {
  border-color: var(--sc-blue);
  box-shadow: var(--sc-shadow);
}

.sidecon__header {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.sidecon__subject {
  font-size: 0.95rem;
  color: var(--sc-dark-blue);
}

.sidecon__participants {
  font-size: 0.76rem;
  color: var(--sc-gray);
  margin-top: 0.3rem;
}

.sidecon__label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.convo__external {
  font-size: 0.7rem;
  margin-left: auto;
  white-space: nowrap;
}

/* ---------- Resolved-per-week trend ---------- */

.trend {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: end;
  gap: 0.6rem;
  height: 150px;
  padding-top: 0.5rem;
}

.trend__week {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  height: 100%;
}

.trend__count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sc-dark-blue);
}

.trend__bar-wrap {
  flex: 1;
  width: 100%;
  max-width: 44px;
  display: flex;
  align-items: flex-end;
  background: var(--sc-bg-light);
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}

.trend__bar {
  width: 100%;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--sc-light-blue), var(--sc-blue));
  transform-origin: bottom center;
  animation: bar-rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes bar-rise {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

.trend__label {
  font-size: 0.68rem;
  color: var(--sc-gray);
  white-space: nowrap;
}

/* The running week is incomplete — mark it instead of pretending it is final. */

.trend__week--current .trend__bar {
  background: repeating-linear-gradient(
    135deg,
    var(--sc-light-blue) 0 6px,
    rgba(29, 157, 217, 0.45) 6px 12px
  );
}

.trend__week--current .trend__label {
  font-weight: 700;
  color: var(--sc-blue);
}

.trend__note {
  margin-top: 0.9rem;
  font-size: 0.72rem;
  color: var(--sc-gray);
  line-height: 1.5;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .topbar__title {
    display: none;
  }

  .agg__row {
    grid-template-columns: 7rem 1fr 3.5rem;
  }

  .table__summary {
    max-width: 16rem;
  }
}

/* Motion is decorative only — respect the OS preference. */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
