/* Customer dashboard: calm for occasional, often non-technical requesters. */
  .summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sum-cell { padding: 18px 22px; display: grid; gap: 2px; align-content: start; }
  .sum-cell + .sum-cell { border-left: 1px solid var(--hairline); }
  .sum-value { font-size: 26px; line-height: 32px; font-weight: 620; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .sum-label { font-size: 13px; color: var(--text-2); }
  .sum-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; font-weight: 560; color: var(--violet); }
  .sum-note::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .sum-cell[data-attention="true"] .sum-value { color: var(--violet); }

  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 24px 0 18px; padding: 12px; }
  .toolbar .spacer { flex: 1 1 0; }
  .list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
  .list-count { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }

  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
  .grid > .surface.is-state { grid-column: 1 / -1; }
  .empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 56px 24px; }
  .empty-icon { width: 48px; height: 48px; margin-bottom: 8px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--text-3); }
  .empty-title { font-size: 16px; font-weight: 600; }
  .empty-text { max-width: 46ch; font-size: 14px; color: var(--text-2); text-wrap: pretty; }
  .empty .btn { margin-top: 14px; }
  .tcard {
    position: relative; display: flex; flex-direction: column; gap: 14px;
    padding: 18px 20px 0; border-radius: 16px; overflow: hidden;
    transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
  }
  .tcard:active { transform: scale(0.99); }
  .tcard:focus-visible { outline-offset: 3px; border-radius: 16px; }
  .tcard-top { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
  .tcode { color: var(--text-3); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; white-space: nowrap; }
  .tcard-top .cat { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tcard-top .cat::before { content: "·"; margin-right: 10px; }
  .tcard-top .prio { margin-left: auto; }
  .tcard-subject {
    font-size: 16px; line-height: 22px; font-weight: 560; letter-spacing: -0.01em; text-wrap: pretty;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 44px;
  }
  .tcard-owner { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--text-2); }
  .tcard-owner strong { font-weight: 560; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tcard-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: auto -20px 0; padding: 12px 20px 14px;
    box-shadow: inset 0 1px 0 var(--hairline);
    font-size: 12.5px; color: var(--text-3);
  }
  .tcard-foot .more { display: inline-flex; align-items: center; gap: 2px; flex: none; font-weight: 560; color: var(--text-2); transition: color 150ms var(--ease-out); }
  .tcard-foot .more .ic { width: 16px; height: 16px; stroke-width: 2; transition: transform 200ms var(--ease-out); }
  .tcard-foot.is-action { background: var(--violet-soft); }
  .tcard-foot.is-action .more { color: var(--violet); }
  .tcard.is-done .tcard-subject { color: var(--text-2); }

  .sk-card { display: grid; gap: 14px; padding: 18px 20px; }
  .sk-line { display: block; height: 16px; width: 100%; border-radius: 6px; }
  /* Loading fill and the realtime flash (motion catalogue: skeleton pulse 1.6 s, just updated 1600 ms). */
  .sk, .skeleton { display: block; border-radius: 6px; background: var(--surface-3); }
  @media (prefers-reduced-motion: no-preference) {
    .sk, .skeleton { animation: sk-pulse 1.6s ease-in-out infinite; }
    .just-updated { animation: updated 1600ms var(--ease-out); }
  }
  @keyframes sk-pulse { 50% { opacity: 0.55; } }
  @keyframes updated { 0% { background-color: var(--accent-soft); } 100% { background-color: transparent; } }

  @media (hover: hover) and (pointer: fine) {
    .tcard:hover { box-shadow: var(--shadow-raised); transform: translateY(-1px); }
    .tcard:active { transform: translateY(-1px) scale(0.99); }
    .tcard:hover .tcard-foot:not(.is-action) .more { color: var(--accent); }
    .tcard:hover .tcard-foot .more .ic { transform: translateX(2px); }
  }
  @media (max-width: 720px) {
    .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sum-cell:nth-child(3) { border-left: 0; }
    .sum-cell:nth-child(n + 3) { border-top: 1px solid var(--hairline); }
    .sum-cell { padding: 14px 16px; }
    .toolbar { margin: 18px 0 14px; padding: 10px; }
    .toolbar .search { flex: 1 1 100%; max-width: none; }
    .toolbar .select-wrap { flex: 1 1 0; }
    .toolbar .spacer { display: none; }
    .toolbar .btn-primary { flex: 1 1 100%; }
    .grid { grid-template-columns: 1fr; gap: 12px; }
    .list-count { display: none; }
  }

/* ---------- Solid work surfaces and controls ---------- */
.surface { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-surface); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
.detail-header { display: grid; gap: 16px; }
.detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.detail-subject { font-size: 28px; line-height: 34px; font-weight: 620; letter-spacing: -0.022em; text-wrap: pretty; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.detail-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.card { padding: 20px 22px; border-radius: var(--radius-surface); background: var(--surface); box-shadow: var(--shadow-surface); }
.section-heading { font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: -0.014em; }
.card-heading { margin-bottom: 16px; font-size: 15px; line-height: 22px; font-weight: 600; letter-spacing: -0.01em; }
.error-code { font-size: 96px; line-height: 1; font-weight: 300; letter-spacing: -0.04em; color: var(--text-2); }
.thread { display: grid; gap: 14px; }
.message { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.message[data-own="true"] { align-items: flex-end; }
.message-bubble { max-width: 72%; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); overflow-wrap: anywhere; }
.message[data-own="true"] .message-bubble { background: var(--accent-soft); }
.message-meta { color: var(--text-3); font-size: 12px; }
.message-composer { display: flex; align-items: center; gap: 8px; }
.timeline { display: grid; gap: 14px; list-style: none; }
.timeline-item { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: start; font-size: 14px; }
.timeline-item::before { content: ""; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--st, var(--accent)); box-shadow: 0 0 0 3px var(--surface); }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; top: 14px; bottom: -14px; left: 3px; width: 1px; background: var(--thread); }
.timeline-time { color: var(--text-3); font-size: 12px; }
.key-values { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; }
.key-values dt { color: var(--text-3); font-size: 13px; }
.key-values dd { min-width: 0; font-size: 14px; }
.attachment-list { display: grid; gap: 8px; }
.attachment { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.attachment .attachment-icon { flex: none; color: var(--text-2); }
.attachment-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.attachment-size { flex: none; color: var(--text-3); font-size: 12px; }
.attachment-preview { width: 64px; height: 64px; flex: none; border-radius: 10px; object-fit: cover; }
.technician-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 16px; border-radius: var(--radius-surface); background: var(--surface); box-shadow: var(--shadow-surface); }
.technician-card .avatar { --av: 40px; }
.technician-card-name { font-size: 15px; font-weight: 600; }
.technician-card-meta { color: var(--text-2); font-size: 13px; }
.technician-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#settingsSaveBar { position: sticky; bottom: 16px; z-index: 20; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-raised); }
@media (max-width: 1080px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .key-values { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

  .table-wrap { overflow-x: auto; }
  table { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 14px; }
  th.c-company { width: 200px; } th.c-priority { width: 112px; } th.c-status { width: 206px; }
  th.c-tech { width: 190px; } th.c-created { width: 104px; } th.c-sla { width: 176px; }
  .code .co { display: none; }
  thead th { height: 40px; padding: 0 12px; text-align: left; font-size: 12.5px; font-weight: 560; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--hairline); white-space: nowrap; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .sort { display: inline-flex; align-items: center; gap: 4px; height: 28px; margin: 0 -6px; padding: 0 6px; border-radius: 6px; font-weight: 560; color: inherit; transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out); }
  .sort .ic { width: 14px; height: 14px; stroke-width: 2; color: var(--text-3); }
  th[aria-sort="ascending"] .sort, th[aria-sort="descending"] .sort { color: var(--ink); }
  th[aria-sort="ascending"] .sort .ic, th[aria-sort="descending"] .sort .ic { color: var(--accent); }
  tbody td { height: 62px; padding: 10px 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr.row { cursor: pointer; transition: background-color 120ms var(--ease-out); }
  tbody tr.row.is-overdue { background: color-mix(in srgb, var(--danger) 3.5%, transparent); }
  .subject { display: block; font-weight: 560; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px; }
  .row.is-done .subject { color: var(--text-2); font-weight: 520; }
  .code { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
  .truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .muted { color: var(--text-2); }
  .tech { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .tech .truncate { min-width: 0; }
  .tech.is-empty { color: var(--text-3); }
  .table-state td { height: auto; padding: 0; }
  .sk-row td { height: 62px; }

  /* Office laptops (1366 and below) and tablets: Company moves under the subject so the Ticket column keeps its room. */
  @media (max-width: 1365px) {
    .c-company { display: none; }
    .code .co { display: inline; }
    th.c-priority { width: 104px; } th.c-status { width: 196px; } th.c-tech { width: 170px; } th.c-created { width: 96px; } th.c-sla { width: 164px; }
  }
  /* Phones and narrow windows: rows become stacked cards; the sort select takes over from the headers. */
  @media (max-width: 900px) {
    .mobile-sort { display: block; }
    .table-wrap { overflow: visible; }
    table, tbody, tbody tr, tbody td { display: block; }
    table { min-width: 0; width: 100%; }
    thead { display: none; }
    .code .co { display: none; }
    tbody tr.row {
      display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 14px 16px;
      grid-template-areas: "ticket ticket" "company company" "status sla" "tech priority";
      border-bottom: 1px solid var(--hairline);
    }
    tbody tr.row:last-child { border-bottom: 0; }
    tbody td { height: auto; padding: 0 !important; border: 0 !important; min-width: 0; }
    td.c-ticket { grid-area: ticket; }
    td.c-company { grid-area: company; display: block; font-size: 13px; }
    td.c-status { grid-area: status; align-self: center; }
    td.c-sla { grid-area: sla; text-align: right; }
    td.c-sla .sla { justify-content: flex-end; }
    td.c-tech { grid-area: tech; align-self: center; }
    td.c-priority { grid-area: priority; justify-self: end; align-self: center; }
    td.c-created { display: none; }
    .subject { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .sk-row { padding: 14px 16px; border-bottom: 1px solid var(--hairline); }
    .sk-row td { height: auto; margin-bottom: 8px; }
  }
@media (hover: hover) and (pointer: fine) {
  .sort:hover { background: var(--hover-strong); color: var(--ink); }
  tbody tr.row:hover { background: var(--surface-2); }
  tbody tr.row.is-overdue:hover { background: color-mix(in srgb, var(--danger) 6%, var(--surface-2)); }
}

.summary-admin { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.summary-admin .sum-cell[role="button"], .summary-admin .stat-card { cursor: pointer; }
.summary-admin .sum-cell[role="button"]:focus-visible, .summary-admin .stat-card:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .summary-admin .sum-cell[role="button"]:hover, .summary-admin .stat-card:hover { background: var(--hover); } }
@media (max-width: 1279px) and (min-width: 721px) { .summary-admin { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .summary-admin { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fc { --fc-border-color: var(--hairline); --fc-page-bg-color: var(--surface); --fc-today-bg-color: var(--accent-soft); --fc-neutral-bg-color: var(--surface-2); }
.fc .fc-button { height: 40px; padding: 0 18px; border: 0; border-radius: 999px; font-size: 14px; font-weight: 560; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hairline-strong); }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--button); color: var(--button-text); }
.fc-event { background: var(--st, var(--accent)); border-color: var(--st, var(--accent)); }
@media (prefers-reduced-motion: reduce) {
  .tcard, .tcard-foot .more, .tcard-foot .more .ic { transition-duration: 0ms; }
  .tcard:active { transform: none; }
}
.bar-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.bar-row { display: grid; grid-template-columns: minmax(0, auto) minmax(48px, 1fr) auto; column-gap: 12px; row-gap: 10px; align-items: center; }
.bar-label { color: var(--text-2); font-size: 13px; }
.bar-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.bar-fill { display: block; width: var(--bar-width, 0%); height: 100%; border-radius: inherit; background: var(--st, var(--pc, var(--accent))); }
.bar-count { color: var(--ink); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
@media (prefers-reduced-motion: no-preference) {
  .bar-list[data-refreshed="true"] .bar-fill { transition: width 240ms var(--ease-out); }
}
@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none !important; }
}

/* Recent activity list (manager and admin dashboards) */
.activity-list { display: grid; list-style: none; }
.activity-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.activity-item:first-child { padding-top: 0; }
.activity-item:last-child { padding-bottom: 0; border-bottom: 0; }
.activity-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--st); background: color-mix(in srgb, var(--st) 12%, transparent); }
.activity-icon .ic { width: 16px; height: 16px; stroke-width: 2; }
.activity-content { min-width: 0; }
.activity-text { font-size: 14px; overflow-wrap: anywhere; }
.activity-link { color: var(--accent); font-weight: 560; }
.activity-meta { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.activity-state { padding: 12px 0; color: var(--text-2); font-size: 14px; }
