/* Cleartwo IT Support portal: black-and-white design (tokens below, shell and components in
   "Design system" at the end of this file). */

:root {
  /* Black and white. The only colours are the priority / status LEDs (--led-*), red for
     destructive actions and errors (--red) and the notification dot. Old names (--indigo,
     --blue, --purple, --green...) map onto ink and greys so every page follows. */
  --ground: #E7E8EC;        /* page background around the surface */
  --surface-main: #F3F3F6;  /* the one large rounded surface */
  --surface: #FFFFFF;       /* cards, panels */
  --surface-soft: #F3F3F6;
  --ink: #0B0B0F;           /* text, primary buttons, active items */
  --ink-2: #3A3A44;         /* dark grey */
  --muted: #5C5C66;         /* secondary text (4.5:1 on white and #F3F3F6) */
  --grey: #8A8B95;          /* mid grey: decoration only, never text */
  --grey-soft: #EDEEF2;
  --border: #E4E5EA;
  --border-strong: #D5D6DC;
  --text: var(--ink);
  --bg: var(--ground);

  --indigo: var(--ink);
  --blue: var(--ink);
  --blue-hover: var(--ink-2);
  --blue-soft: #EDEEF2;
  --purple: var(--ink-2);
  --purple-soft: #EDEEF2;
  --green: var(--ink-2);
  --green-soft: #EDEEF2;
  --red: #D92D20;
  --red-soft: #FDECEA;

  /* Spacing 4 / 8 / 12 / 16 / 20 / 24 px. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-45: 20px;
  --sp-5: 24px;
  /* Radius: surface 28, panels 24, cards 18, inner items 14, inputs 12, pills round. */
  --radius-surface: 28px;
  --radius-panel: 24px;
  --radius: 18px;
  --radius-item: 14px;
  --radius-sm: 12px;
  --control-h: 44px;
  --control-sm: 36px;
  --pill-h: 34px;
  --page-max: 1440px;
  --rail-w: 76px;
  --fs-table: 0.9286rem; /* 13px: table cells and labels */
  /* Soft shadows only on hover / floating layers. */
  --shadow: none;
  --shadow-hover: 0 10px 28px rgba(11, 11, 15, 0.08), 0 2px 6px rgba(11, 11, 15, 0.05);
  --shadow-lg: 0 18px 50px rgba(11, 11, 15, 0.16), 0 4px 12px rgba(11, 11, 15, 0.06);
  --focus: 0 0 0 2px var(--ink);

  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; font-size: 14px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--indigo);
  line-height: 1.2;
  margin: 0 0 var(--sp-3);
  font-weight: 700;
}
h1 { font-size: 1.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.95rem; }

p { margin: 0 0 var(--sp-3); }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--purple); text-decoration: underline; text-underline-offset: 3px; }
code { background: var(--grey-soft); padding: 0.1em 0.4em; border-radius: 6px; font-size: 0.9em; }

.sprite { display: none; }
[hidden] { display: none !important; }

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
}

.muted { color: var(--muted); }
.small { font-size: 0.8571rem; } /* 12px */
.nowrap { white-space: nowrap; }
.pre-line { white-space: pre-line; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- Page structure ---- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.page-head h1 { margin-bottom: var(--sp-1); }
.page-head p { margin: 0.25rem 0 0; }
.crumbs { font-size: 0.8571rem; color: var(--muted); margin-bottom: 0.35rem !important; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--purple); }

.actions { display: flex; gap: 0.5rem; align-items: flex-start; flex-wrap: wrap; }

.section { margin-top: var(--sp-5); }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.section-head h2 { margin: 0; font-size: 1.2rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4) 18px;
  box-shadow: var(--shadow);
  margin-bottom: var(--sp-4);
}
.card-narrow { max-width: 640px; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head h2 a { color: var(--indigo); }
.card-head h2 a:hover { color: var(--purple); }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); align-items: start; }
.grid-2 > .card, .grid-2 > div > .card:last-child { margin-bottom: 0; }
.grid-2 > div > .card { margin-bottom: var(--sp-4); }
.grid-wide-left { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }

.category-grid,
.cs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
  align-items: start;
}
.category-grid .card,
.cs-grid .card { margin-bottom: 0; }

.empty { color: var(--muted); margin: 0.5rem 0; }
p.empty.card { margin-bottom: var(--sp-4); }

.link-more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.75rem;
  white-space: nowrap;
}
.card-head .link-more { margin-top: 0; }
.link-more .icon { width: 14px; height: 14px; }

/* ---- Dashboard ---- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon value" "icon label";
  column-gap: 1rem;
  align-items: center;
  margin: 0;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.stat:hover { border-color: var(--purple); color: var(--text); text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat-icon {
  grid-area: icon;
  width: 42px; height: 42px;
  border-radius: var(--radius);
  background: var(--purple-soft);
  color: var(--purple);
  display: grid;
  place-items: center;
}
.stat-icon .icon { width: 20px; height: 20px; }
.stat-value { grid-area: value; font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; color: var(--indigo); line-height: 1; }
.stat-label { grid-area: label; color: var(--muted); font-size: 0.9rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: 0; }
.list a { font-weight: 500; }
.progress-text { font-weight: 600; color: var(--purple); white-space: nowrap; }

/* ---- Rows (lists with actions) ---- */

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-actions { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; justify-content: flex-end; }
.rows-compact .row { padding: 6px 0; min-height: 36px; }
.rows-compact .row-main { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }

.step-list .row { align-items: flex-start; flex-wrap: nowrap; }
.step-list .row-main { padding-top: 0.4rem; }
.step-num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  margin-top: 0.1rem;
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ---- Instant search ---- */

.list-search { margin-bottom: var(--sp-4); }
.search-field { position: relative; display: block; max-width: 420px; }
.search-field .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input[type="search"] { padding-left: 32px; border-radius: 999px; }

/* ---- Notes on assigned services ---- */

.notes { border-top: 1px solid var(--border); margin-top: 1.25rem; padding-top: 1rem; }
.notes h4 { margin: 0 0 0.75rem; }
.note-form { gap: 0.5rem; margin-bottom: 1rem; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.note { background: var(--surface-soft); border: 1px solid var(--border); border-left: 3px solid var(--purple); border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; }
.note-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.note-author { color: var(--text); }
.note p { margin: 0.25rem 0 0; overflow-wrap: anywhere; }
.note .icon-btn { width: 30px; height: 30px; }

/* ---- Inline edit popovers ---- */

.edit { position: relative; }
.edit > summary { list-style: none; }
.edit > summary::-webkit-details-marker { display: none; }
.edit[open] > summary.icon-btn { background: var(--purple-soft); color: var(--purple); }
.edit-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 20;
  width: min(420px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4);
  display: grid;
  gap: var(--sp-3);
}
.edit-panel form + form { border-top: 1px solid var(--border); padding-top: var(--sp-3); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--indigo);
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-table);
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--purple); color: var(--purple); text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #FFFFFF; box-shadow: 0 1px 4px rgba(119, 119, 119, 0.25); }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: #FFFFFF; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--grey-soft); border-color: transparent; color: var(--text); }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--purple-soft); color: var(--purple); }
.icon-btn:disabled { opacity: 0.3; cursor: default; background: transparent; }
.icon-btn-danger:hover { background: var(--red-soft); color: var(--red); }

.btn:focus-visible,
.icon-btn:focus-visible,
.check-btn:focus-visible,
.nav a:focus-visible,
.nav-signout:focus-visible,
.filters a:focus-visible,
.edit > summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

form.inline { display: inline-flex; gap: 0.1rem; margin: 0; }

/* ---- Forms ---- */

.form { display: grid; gap: var(--sp-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.form-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: var(--sp-3); align-items: flex-end; flex-wrap: wrap; }
.field { display: grid; gap: var(--sp-1); min-width: 0; }
.field > span, .field > label { font-size: var(--fs-table); font-weight: 600; color: var(--indigo); }
.field-grow { flex: 1; min-width: 200px; }
.add-step { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 1rem; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="search"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-height: var(--control-h);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; }
input:hover,
select:hover,
textarea:hover { border-color: #D1D1D1; }
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus);
}

/* ---- Flash messages ---- */

.flash {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-4);
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-success { background: var(--green-soft); color: var(--green); border-color: #E2E2E2; }
.flash-error { background: var(--red-soft); color: var(--red); border-color: #D6D6D6; }
.flash-info { background: var(--blue-soft); color: #4F4F4F; border-color: #DFDFDF; }

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

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.8214rem; /* 11.5px */
  line-height: 1.5;
  font-weight: 600;
  white-space: nowrap;
  background: var(--grey-soft);
  color: var(--text);
}
.badge-open { background: var(--blue); color: #FFFFFF; }
.badge-customer_waiting { background: var(--purple); color: #FFFFFF; }
.badge-closed { background: var(--grey-soft); color: var(--muted); }
.badge-you { background: var(--purple-soft); color: var(--purple); margin-left: 0.4rem; }

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

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sp-3); }
.filters a {
  display: inline-flex;
  align-items: center;
  height: var(--pill-h);
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8929rem; /* 12.5px */
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.filters a:hover { border-color: var(--purple); color: var(--purple); text-decoration: none; }
.filters a.active { background: var(--indigo); border-color: var(--indigo); color: #FFFFFF; }
.filters .count { opacity: 0.7; margin-left: 0.2rem; }

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

/* Every list table fits the page: fixed column widths (a <colgroup> per table), one
   line per cell, long text cut with "…" (app.js adds the full text as a tooltip). The
   header row sticks to the top while scrolling. Only small screens scroll sideways. */
.table-wrap { overflow: visible; position: relative; } /* contains visually-hidden labels */
.table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: var(--fs-table); }
.table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  text-align: left;
  font-size: 0.7857rem; /* 11px */
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table td {
  height: 44px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table td > div, .table td .muted.small { overflow: hidden; text-overflow: ellipsis; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:nth-child(even) { background: #FCFCFC; }
.table tbody tr:hover { background: var(--blue-soft); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .right { text-align: right; }
@media (max-width: 900px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { width: max(760px, 100%); }
  .table-tickets { width: max(980px, 100%); }
  .table th { position: static; }
}

/* ---- Client details ---- */

.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 0 0 0.5rem;
}
.details dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.details dd { margin: 0.15rem 0 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---- Client service checklists ---- */

.cs-card.is-closed { background: var(--surface-soft); }
.cs-card h3 { margin-bottom: 0.2rem; }

.progress { height: 6px; background: var(--grey-soft); border-radius: 999px; overflow: hidden; margin: 0.25rem 0 0.4rem; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--purple)); border-radius: 999px; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist-live li { border-bottom: 1px solid var(--border); }
.checklist-live li:last-child { border-bottom: 0; }
.checklist-live form { margin: 0; }
.check-btn {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  width: 100%;
  padding: 0.65rem 0.35rem;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.1s;
}
.check-btn:hover { background: var(--purple-soft); }
.check-btn .check-icon { color: var(--blue); padding-top: 1px; }
.is-done .check-btn .check-icon { color: var(--purple); }
.check-btn .check-icon .icon { width: 20px; height: 20px; }
.check-text { display: grid; gap: 0.1rem; }
.is-done .check-text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, 0.25); }
.is-done .check-meta { text-decoration: none; }

/* ---- Flowchart ---- */

.flowchart {
  overflow-x: auto;
  text-align: center;
  padding: 1.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle, rgba(82, 82, 82, 0.12) 1px, transparent 1px) 0 0 / 18px 18px,
    var(--surface-soft);
}
.flowchart pre.mermaid { margin: 0; font-family: var(--font-body); background: none; white-space: pre; color: var(--muted); }
.flowchart pre.mermaid[data-processed] { white-space: normal; }
.flowchart svg { max-width: 100%; height: auto; }
.flowchart .node rect,
.flowchart .node path { filter: drop-shadow(0 2px 4px rgba(24, 24, 24, 0.12)); }
.flowchart .flowchart-link { stroke-linecap: round; }
.flowchart .is-error { color: var(--red); }

/* ---- Tickets ---- */

.comments { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: grid; gap: var(--sp-3); }
.comment { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.comment-meta { margin-bottom: 0.35rem; }
.comment p { margin: 0; overflow-wrap: anywhere; }

.status-options { display: grid; gap: 0.5rem; }
.status-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.status-option:hover { border-color: var(--purple); }
.status-option:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.status-option input { accent-color: var(--blue); margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border); display: grid; gap: 1rem; }
.timeline li { position: relative; }
.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1rem - 6px);
  top: 0.45rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--purple);
}
.timeline .icon { width: 14px; height: 14px; color: var(--muted); }

/* ---- Login & errors ---- */

.login { min-height: calc(100vh - 6.5rem); display: grid; place-items: center; }
.login-card { width: min(420px, 100%); padding: 2.25rem; margin: 0; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; margin-bottom: 2rem; }
.login-card h1 { font-size: 1.4rem; margin-bottom: 1.25rem; }
.error-card { max-width: 560px; }

/* ---- Small shared pieces ---- */

.btn-small { min-height: 28px; padding: 0 10px; font-size: 0.8571rem; }
.btn-small .icon { width: 14px; height: 14px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--grey-soft);
  color: var(--muted);
  font-size: 0.8214rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip .icon { width: 13px; height: 13px; }
.chip-category { background: var(--purple-soft); color: var(--purple); }

.no-checklist { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0.25rem 0 0; }

.mini-progress { display: flex; align-items: center; gap: 0.6rem; flex: none; width: 140px; }
.mini-progress .progress { flex: 1; margin: 0; }
.mini-progress .progress-text { font-size: 0.85rem; min-width: 2.5rem; text-align: right; }

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

.tabs {
  display: flex;
  gap: 2px;
  margin: calc(-1 * var(--sp-2)) 0 var(--sp-4);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: var(--fs-table);
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a:hover { color: var(--purple); text-decoration: none; }
.tabs a.active { color: var(--indigo); border-bottom-color: var(--blue); }
.tabs .count { background: var(--purple-soft); color: var(--purple); border-radius: 999px; padding: 0 0.45rem; font-size: 0.75rem; }

/* ---- Drag-and-drop step reordering ---- */

.drag-handle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 2rem;
  color: #C7C7C7;
  cursor: grab;
  touch-action: none;
}
.drag-handle:hover { color: var(--purple); }
.drag-handle .icon { stroke-width: 2.5; }
.step-list .row { background: var(--surface); }
.step-list .sortable-ghost { opacity: 0.4; background: var(--purple-soft); }
.step-list .sortable-chosen { box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); }
.step-list.is-saving { opacity: 0.6; pointer-events: none; }
.card-head .icon { width: 15px; height: 15px; vertical-align: -3px; }
.reorder-status { margin: 0.5rem 0 0; color: var(--muted); }
.reorder-status.is-error { color: var(--red); }

/* ---- Tutorials and attachments ---- */

.media-heading { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1.25rem 0 0.75rem; }
.media-heading:first-child { margin-top: 0; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.video-list { display: grid; gap: 1rem; }
.media-card { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.media-card figcaption { padding: 0.75rem; }
.gallery-thumb { display: block; aspect-ratio: 4 / 3; background: var(--grey-soft); border-radius: var(--radius-sm) var(--radius-sm) 0 0; overflow: hidden; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.gallery-thumb:hover img { transform: scale(1.03); }
.media-card video { display: block; width: 100%; max-height: 420px; background: #000000; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

.media-caption { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.media-text { min-width: 0; overflow-wrap: anywhere; }
.media-title { display: block; color: var(--text); }
.media-desc { margin: 0.2rem 0 0.25rem; font-size: 0.9rem; }

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.file-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.file-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--purple-soft); color: var(--purple); display: grid; place-items: center; }
.file-row .row-main { min-width: 180px; }
.file-links { display: flex; gap: 0.4rem; flex-wrap: wrap; }

input[type="file"] {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem;
  border: 1px dashed #C7C7C7;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  width: 100%;
}
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  margin-right: 0.75rem;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple);
  cursor: pointer;
}

/* ---- Knowledge base ---- */

.kb-title { font-weight: 600; font-size: 1.02rem; }
.kb-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.35rem; }
.page-head .kb-meta { margin: 0.25rem 0 0.5rem; }
.kb-rows .row { align-items: flex-start; }
.card-solution { border-top: 3px solid var(--blue); }

.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote, .prose table { margin: 0 0 0.9rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: 0.2rem 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 1.25rem 0 0.5rem; }
.prose h1 { font-size: 1.3rem; }
.prose h2 { font-size: 1.15rem; }
.prose h3 { font-size: 1rem; }
.prose pre { background: #1D1D1D; color: #F5F5F5; padding: 0.9rem 1rem; border-radius: var(--radius-sm); overflow-x: auto; font-size: 0.88rem; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose blockquote { border-left: 3px solid var(--purple); padding: 0.25rem 0 0.25rem 1rem; color: var(--muted); }
.prose img { max-width: 100%; border-radius: var(--radius-sm); }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.45rem 0.6rem; text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ---- Top bar and Log work dialog ---- */

.dialog {
  width: min(520px, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.dialog::backdrop { background: rgba(24, 24, 24, 0.35); backdrop-filter: blur(2px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { margin: 0; }
input[type="date"] {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  min-height: 42px;
}
input[type="date"]:focus { outline: none; border-color: var(--blue); box-shadow: var(--focus); }

/* ---- Created / updated lines and History panels ---- */

.record-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.35rem 0 0; font-size: 0.82rem; color: var(--muted); }

.history { margin-top: 1rem; }
.card > .history:first-child { margin-top: 0; }
.history > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--indigo);
  font-size: 0.9rem;
}
.history > summary::-webkit-details-marker { display: none; }
.history > summary:hover { color: var(--purple); }
.history > summary .count { background: var(--grey-soft); color: var(--muted); border-radius: 999px; padding: 0 0.45rem; font-size: 0.75rem; }
.history[open] > summary { margin-bottom: 0.75rem; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; max-height: 420px; overflow-y: auto; }
.history-list li { display: flex; gap: 0.75rem; align-items: flex-start; font-size: 0.9rem; }
.history-body { min-width: 0; overflow-wrap: anywhere; }
.history-action {
  flex: none;
  min-width: 6.5rem;
  text-align: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--grey-soft);
  color: var(--muted);
}
.history-created, .history-uploaded { background: var(--blue-soft); color: #4F4F4F; }
.history-step_done, .history-closed { background: var(--green-soft); color: var(--green); }
.history-status_changed, .history-commented, .history-reopened { background: var(--purple-soft); color: var(--purple); }
.history-deleted { background: var(--red-soft); color: var(--red); }

/* ---- Daily Report ---- */

.report-nav { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.report-nav > .icon-btn { border: 1px solid var(--border); width: 42px; height: 42px; }
.report-form { flex: 1; }
.report-form select { min-width: 160px; }
.report-presets { margin: 1rem 0 0; }

.report-day + .report-day { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.report-day-title { font-size: 1.05rem; color: var(--purple); margin-bottom: 1rem; }
.report-user + .report-user { margin-top: 1.25rem; }
.report-user h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.report-user ul { margin: 0; padding-left: 1.3rem; }
.report-user li { margin: 0.25rem 0; }
.copy-status { margin: 1rem 0 0; color: var(--green); }
.copy-status.is-error { color: var(--red); }

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

@media (max-width: 1100px) {
  .main { padding: 20px 20px 40px; }
  .grid-2, .grid-wide-left { grid-template-columns: 1fr; }
  .grid-2 > .card { margin-bottom: 0; }
}

@media (max-width: 860px) {
  .main { width: 100%; padding: var(--sp-4) var(--sp-3) 40px; }
  .stats { grid-template-columns: 1fr; gap: var(--sp-3); }
  .form-row { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .category-grid, .cs-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
  .edit-panel { position: fixed; left: 1rem; right: 1rem; top: auto; bottom: 1rem; width: auto; max-height: calc(100vh - 6rem); overflow-y: auto; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .mini-progress { width: 110px; }
  .tabs { margin-top: -1rem; }
  .report-nav { align-items: stretch; }
  .report-form { order: 3; flex-basis: 100%; }
  .history-action { min-width: 5.5rem; }
}

/* ---- Raw activity log page ---- */

/* One line per entry like every list table; the full summary is in the tooltip. */
.table-log td br { display: none; }
.table-log td .small { display: inline; margin-left: 6px; }

/* ---- Editable report preview ---- */

.report-preview-head .icon { width: 14px; height: 14px; }
.report-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  font-family: Calibri, Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.5;
  outline: none;
}
.report-preview:focus { border-color: var(--blue); box-shadow: var(--focus); }
.report-preview h3 { font-family: Calibri, Arial, sans-serif; font-size: 11pt; color: #000000; margin: 0 0 0.25rem; }
.report-preview .report-day-title { font-family: Calibri, Arial, sans-serif; font-size: 12pt; color: var(--indigo); text-decoration: underline; }
.report-preview .report-user + .report-user { margin-top: 1rem; }

@media (max-width: 860px) {
  .report-preview { padding: 1rem; }
}

/* ---- Delete confirmation popup ---- */

.dialog-confirm { width: min(440px, calc(100vw - 2rem)); }
.confirm-message { font-size: 1rem; font-weight: 500; margin: 0 0 1.25rem; overflow-wrap: anywhere; }
.dialog-confirm .form-actions { justify-content: flex-end; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #FFFFFF; }
.btn-danger-solid:hover { background: #3A3A3A; border-color: #3A3A3A; color: #FFFFFF; }
.table td.row-actions { width: 1%; white-space: nowrap; text-align: right; }

/* ---- Animations ----
   Subtle, quick (150-350ms) and CSS-only. Everything here is switched off for
   people who ask their system for reduced motion (see the end of this block). */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes grow-x {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes tick {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* Page content rises in, cards and stat tiles slightly staggered. */
.main > .page-head { animation: fade-up 0.3s ease-out both; }
.main > .card,
.main > .section,
.main > .grid-2,
.main > .stats,
.main > .tabs,
.main > .list-search,
.main > .category-grid,
.main > div > .category-grid { animation: fade-up 0.35s ease-out both; animation-delay: 0.05s; }
.main > .grid-2 { animation-delay: 0.08s; }
.main > .section + .section { animation-delay: 0.12s; }
.stats .stat { animation: fade-up 0.35s ease-out both; }
.stats .stat:nth-child(2) { animation-delay: 0.06s; }
.stats .stat:nth-child(3) { animation-delay: 0.12s; }
.category-grid > .card,
.cs-grid > .card { animation: fade-up 0.35s ease-out both; }
.category-grid > .card:nth-child(2), .cs-grid > .card:nth-child(2) { animation-delay: 0.04s; }
.category-grid > .card:nth-child(3), .cs-grid > .card:nth-child(3) { animation-delay: 0.08s; }
.category-grid > .card:nth-child(n+4), .cs-grid > .card:nth-child(n+4) { animation-delay: 0.12s; }

/* Flash messages slide in. */
.flash { animation: slide-down 0.3s ease-out both; }

/* Cards lift a touch on hover where they are links or hold actions. */
.card { transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease; }
/* Only on devices with a real pointer: on touch screens a stuck hover would trap
   the full-screen edit panels inside the transformed card. */
@media (hover: hover) {
  .category-grid > .card:hover,
  .cs-grid > .card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
}

/* Buttons and icon buttons: gentle press feedback. */
.btn,
.icon-btn { transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.12s; }
.btn:active,
.icon-btn:active { transform: scale(0.96); }
.btn-primary:hover { box-shadow: 0 6px 16px rgba(119, 119, 119, 0.3); transform: translateY(-1px); }


/* Table rows and list rows fade their hover colour. */
.table tbody tr,
.row,
.list li { transition: background 0.15s ease; }

/* Popovers, dialogs and the mobile menu. */
.edit[open] > .edit-panel { animation: pop-in 0.18s ease-out both; }
.dialog[open] { animation: pop-in 0.2s ease-out both; }
.dialog[open]::backdrop { animation: fade-in 0.2s ease-out both; }
.history[open] .history-list,
.report-toggle[open] > :not(summary) { animation: fade-in 0.2s ease-out both; }

/* Progress bars fill from the left. */
.progress span { transform-origin: left center; animation: grow-x 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: 0.15s; }

/* Checklist ticks pop when a step is done. */
.is-done .check-btn .check-icon .icon { animation: tick 0.35s ease-out; }
.check-btn .check-icon { transition: color 0.2s ease; }

/* Gallery images zoom slightly on hover (transition already set), tabs underline slides. */
.tabs a { transition: color 0.15s, border-color 0.2s; }

/* Status badges and chips fade in with their row. */
.badge, .chip { transition: background 0.2s, color 0.2s; }

/* Jumping to an item (e.g. /clients/5#cs-12 after ticking a step) scrolls smoothly
   and briefly highlights it. */
html { scroll-behavior: smooth; }
@keyframes target-glow {
  0%, 30% { box-shadow: 0 0 0 3px rgba(82, 82, 82, 0.35), var(--shadow-lg); }
  100% { box-shadow: var(--shadow); }
}
.card:target { animation: target-glow 1.6s ease-out both; scroll-margin-top: 1.5rem; }

/* Respect "reduce motion": no movement, no animation. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .category-grid > .card:hover,
  .cs-grid > .card:hover,
  .btn-primary:hover,
  .stat:hover { transform: none; }
}

/* ---- Ticket priority (LED flags) ----
   Bright LED colours with a glow. Every priority badge, dot and row marker shares ONE
   pulse (led-pulse, 1.5s) so they blink in step. No pulse with reduced motion. */

:root {
  --led-low: #39FF14;
  --led-normal: #00E5FF;
  --led-high: #FFB000;
  --led-urgent: #FF1744;
  --led-pulse: 1.5s;
}
.priority-low, .priority-dot-low, .ticket-row-low { --led: var(--led-low); }
.priority-normal, .priority-dot-normal, .ticket-row-normal { --led: var(--led-normal); }
.priority-high, .priority-dot-high, .ticket-row-high { --led: var(--led-high); }
.priority-urgent, .priority-dot-urgent, .ticket-row-urgent { --led: var(--led-urgent); }

/* Kept low-key: a soft glow that breathes a little, not a strong flash. */
@keyframes led-pulse {
  0%, 100% { box-shadow: 0 0 2px var(--led), 0 0 4px var(--led); }
  50% { box-shadow: 0 0 3px var(--led), 0 0 8px var(--led); }
}

.priority {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  font-size: 0.8214rem;
  font-weight: 800;
  white-space: nowrap;
  background: var(--led);
  color: #0B0B0B; /* dark text stays readable on the bright LED colours */
  box-shadow: 0 0 2px var(--led), 0 0 4px var(--led);
  animation: led-pulse var(--led-pulse) ease-in-out infinite;
}
.priority .icon { width: 13px; height: 13px; stroke-width: 2.4; }

.priority-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: 1px;
  background: var(--led);
  box-shadow: 0 0 3px var(--led), 0 0 8px var(--led);
  animation: led-pulse var(--led-pulse) ease-in-out infinite;
}

/* Rows: an LED strip down the left edge, pulsing with the badges. */
.table-tickets td:first-child { position: relative; }
.ticket-row td:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 3px;
  background: var(--led);
  animation: led-pulse var(--led-pulse) ease-in-out infinite;
}
.ticket-row-urgent { background: linear-gradient(90deg, rgba(255, 23, 68, 0.05), transparent 45%); }

/* Ticket list controls. */
/* Status and priority pills on one row, search box on the right. */
.ticket-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.ticket-filters .filters { margin-bottom: 0; }
.ticket-filters .filters-priority { padding-left: var(--sp-3); border-left: 1px solid var(--border); }
.ticket-filters .list-search { margin: 0 0 0 auto; flex: 1 1 200px; max-width: 320px; }
.ticket-filters .search-field { max-width: none; }
.ticket-filters .search-field input[type="search"] { min-height: 30px; }
.filters-priority a.active[class*="filter-priority-"] { color: #0B0B0B; }
.filters-priority a.active.filter-priority-urgent { background: var(--led-urgent); border-color: var(--led-urgent); }
.filters-priority a.active.filter-priority-high { background: var(--led-high); border-color: var(--led-high); }
.filters-priority a.active.filter-priority-normal { background: var(--led-normal); border-color: var(--led-normal); }
.filters-priority a.active.filter-priority-low { background: var(--led-low); border-color: var(--led-low); }
.filters-priority a.active .priority-dot { background: #0B0B0B; box-shadow: none; animation: none; }
.sort-link { color: inherit; display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
.sort-link:hover { color: var(--purple); text-decoration: none; }
.sort-link.is-sorted { color: var(--indigo); }
.sort-arrow { font-size: 0.65rem; opacity: 0.45; }
.sort-link.is-sorted .sort-arrow { opacity: 1; color: var(--blue); }
.list-badges { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.priority-options .status-option { padding: 0.45rem 0.75rem; }

@media (prefers-reduced-motion: reduce) {
  .priority, .priority-dot, .ticket-row td:first-child::before { animation: none !important; }
}

/* ---- Ticket reminders ---- */

.checkbox-field { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--indigo); }
.checkbox-field input { accent-color: var(--blue); width: 16px; height: 16px; }

#reminders h2 { display: inline-flex; align-items: center; gap: 0.4rem; }
#reminders h2 .icon { color: var(--purple); }
.reminder-add { margin-bottom: 0.75rem; }
.reminder-picks { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.45rem; }
.reminder-picks .chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--indigo);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.reminder-picks .chip:hover { border-color: var(--purple); color: var(--purple); }
.reminder-picks .chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #FFFFFF; }
.reminder-picks .chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.reminder-list { list-style: none; margin: 0; padding: 0; }
.reminder {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid var(--border);
}
.reminder:last-child { border-bottom: 0; }
.reminder-main { flex: 1; min-width: 0; display: grid; gap: 0.2rem; }
.reminder-when { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.reminder-when .icon { width: 15px; height: 15px; color: var(--purple); }
.reminder.is-due .reminder-when strong { color: var(--red); }
.reminder.is-done { opacity: 0.75; }
.reminder.is-done .reminder-when .icon { color: var(--green); }
.reminder-note { margin: 0; overflow-wrap: anywhere; }
.reminder-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; justify-content: flex-end; }
.chip-due { background: var(--red-soft); color: var(--red); }
.reminder-done-list { margin-top: 0.75rem; }

/* Ticket list: bell on rows with a pending reminder (tooltip: next reminder time). */
.row-reminder { display: inline-flex; vertical-align: middle; margin-left: 0.35rem; color: var(--purple); }
.row-reminder .icon { width: 15px; height: 15px; }
.row-reminder:hover { color: var(--blue); }

/* ---- Notifications bell and toasts ---- */

.bell { position: relative; margin-right: auto; }
.bell-button { position: relative; width: 40px; height: 40px; color: var(--indigo); }
.bell-button .icon { width: 21px; height: 21px; }
.bell.has-unread .bell-button .icon { animation: bell-ring 2.5s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes bell-ring {
  0%, 70%, 100% { transform: rotate(0); }
  75% { transform: rotate(14deg); }
  80% { transform: rotate(-12deg); }
  85% { transform: rotate(8deg); }
  90% { transform: rotate(-5deg); }
}
.bell-count {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--led-urgent, #FF1744);
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.bell-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 0.5rem);
  z-index: 50;
  width: min(380px, calc(100vw - 2rem));
  padding: 0.9rem;
  margin: 0;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.18s ease-out both;
}
.bell-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.bell-list { max-height: 420px; overflow-y: auto; display: grid; gap: 0.75rem; }
.bell-group h3 { margin: 0 0 0.35rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.bell-group-missed h3 { color: var(--red); }
.bell-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.notice { display: block; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); background: var(--surface-soft); color: var(--text); }
.notice:hover { background: var(--purple-soft); text-decoration: none; color: var(--text); }
.bell-group-due .notice { background: var(--blue-soft); }
.bell-group-missed .notice { background: var(--red-soft); }
.notice-title { display: block; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.notice-note { overflow-wrap: anywhere; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.5rem; }
.notice-actions .btn { padding: 0.25rem 0.6rem; font-size: 0.75rem; }

.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; display: grid; gap: 0.6rem; width: min(360px, calc(100vw - 2rem)); }
.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.25rem 0.6rem;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--purple);
  border-radius: var(--radius);
  padding: 0.8rem 0.8rem 0.7rem;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.toast { grid-template-columns: auto 1fr; }
.toast .notice-actions { grid-column: 1 / 3; }
.toast-icon { color: var(--purple); line-height: 1; }
.toast-icon .icon { width: 20px; height: 20px; }
.toast-more { justify-self: end; }
.toast.is-leaving { animation: toast-out 0.25s ease-in both; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(24px); }
}

/* ---- Searchable dropdown (combobox), e.g. client pickers ---- */

.combobox { position: relative; }
.combobox .combobox-input { padding-right: 4.2rem; cursor: text; text-overflow: ellipsis; }
.combobox.is-open .combobox-input { border-color: var(--blue); box-shadow: var(--focus); }
.combobox-native {
  position: absolute !important;
  left: 0;
  bottom: 0;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.combobox-arrow {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  cursor: pointer;
  transition: transform 0.15s, margin-top 0.15s;
}
.combobox.is-open .combobox-arrow { transform: rotate(-135deg); margin-top: -2px; border-color: var(--blue); }
.combobox-clear {
  position: absolute;
  right: 2.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--grey-soft);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  padding: 0;
}
.combobox.has-value .combobox-clear { display: inline-grid; place-items: center; }
.combobox-clear:hover { background: var(--purple-soft); color: var(--purple); }
.combobox-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 70;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.14s ease-out both;
}
.combobox-option {
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.combobox-option:hover { background: var(--surface-soft); }
.combobox-option.is-active { background: var(--blue-soft); color: var(--indigo); }
.combobox-option.is-selected { font-weight: 700; color: var(--blue); }
.combobox-option mark { background: none; color: var(--purple); font-weight: 700; padding: 0; }
.combobox-empty { padding: 0.5rem 0.7rem; color: var(--muted); font-size: 0.9rem; }

/* Lists inside the Log work dialog must not be clipped. */
.dialog { overflow: visible; }
.combobox.is-invalid .combobox-input { border-color: var(--red); box-shadow: 0 0 0 3px rgba(72, 72, 72, 0.15); }

/* ---- Email: send report, signatures, My profile ---- */


.report-sent { display: grid; gap: 0.25rem; margin: 0 0 1rem; padding: 0.7rem 1rem; border-radius: var(--radius); background: var(--green-soft); color: var(--green); font-size: 0.9rem; }
.report-sent p { margin: 0; display: flex; gap: 0.4rem; align-items: flex-start; }
.report-sent .icon { flex: none; width: 16px; height: 16px; margin-top: 0.15rem; }

.dialog.send-dialog { width: min(720px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto; }
.send-dialog .form { gap: 0.9rem; }
.send-from { margin: 0; }
.send-preview { max-height: 45vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.8rem 1rem; background: var(--surface); }
.send-signature { margin-top: 0.6rem; padding: 0.6rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.send-dialog .form-actions { justify-content: flex-end; position: sticky; bottom: -1.5rem; background: var(--surface); padding: 0.75rem 0 0.25rem; }

.token-input {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  min-height: 2.6rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: text;
}
.token-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(119, 119, 119, 0.15); }
.token-input input { flex: 1; min-width: 12rem; border: 0; outline: 0; padding: 0.3rem 0.2rem; background: transparent; font: inherit; box-shadow: none; }
.token-input input.is-invalid { color: var(--red); }
.token { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.15rem 0.3rem 0.15rem 0.6rem; border-radius: 999px; background: var(--blue-soft); color: var(--indigo); font-size: 0.85rem; font-weight: 600; }
.token-remove { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; padding: 0 0.2rem; border-radius: 999px; }
.token-remove:hover { color: var(--red); }

.edit-panel.edit-panel-wide { width: min(680px, calc(100vw - 2rem)); max-height: min(80vh, 820px); overflow-y: auto; }
.edit-section { margin: 0 0 0.25rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--purple); }

.sig-editor { display: grid; gap: 0.5rem; }
.sig-toolbar { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.sig-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--indigo);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}
.sig-tool .icon { width: 15px; height: 15px; }
.sig-tool:hover:not(:disabled) { border-color: var(--purple); color: var(--purple); }
.sig-tool:disabled { opacity: 0.45; cursor: default; }
.sig-tool.sig-mode { margin-left: auto; }
.sig-tool.sig-mode[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #FFFFFF; }
.sig-area, .sig-source { min-height: 8rem; max-height: 22rem; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; background: var(--surface); }
.sig-area:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(119, 119, 119, 0.15); }
.sig-area img { max-width: 100%; height: auto; }
.sig-source { font-family: Consolas, "Courier New", monospace; font-size: 0.82rem; width: 100%; resize: vertical; }
.sig-preview-wrap { display: grid; gap: 0.3rem; }
.sig-preview { padding: 0.7rem 0.9rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: #FFFFFF; min-height: 3rem; }

@media (max-width: 700px) {
  .token-input input { min-width: 8rem; }
}

/* ---- Avatars, My profile ---- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  background: var(--grey-soft);
  color: #FFFFFF;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  user-select: none;
}
.avatar-xs { width: 20px; height: 20px; font-size: 0.55rem; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.9rem; }
.avatar-lg { width: 88px; height: 88px; font-size: 1.8rem; box-shadow: 0 0 0 4px var(--surface), 0 6px 18px rgba(24, 24, 24, 0.18); }
.person { display: inline-flex; align-items: center; gap: 0.35rem; vertical-align: middle; }
.history-body .avatar-xs { margin-right: 0.1rem; }
.comment-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }


.user-row { align-items: center; gap: 0.85rem; }
.user-job, .profile-job { color: var(--purple); font-weight: 600; font-size: 0.85rem; }
.profile-head { justify-content: flex-start; align-items: center; gap: 1.25rem; }
.profile-head h1 { margin-bottom: 0.1rem; }
.profile-job { margin: 0 0 0.25rem; font-size: 1rem; }

.choice-group { border: 0; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.choice-group legend { font-weight: 600; color: var(--indigo); margin-bottom: 0.35rem; padding: 0; }
.choice { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.choice input { accent-color: var(--blue); width: 16px; height: 16px; }

.avatar-upload { display: grid; gap: 1rem; }
.avatar-upload-current { display: flex; align-items: center; gap: 1rem; }
.field-error { color: var(--red); margin: 0; }

.session-list .row.is-current { background: var(--blue-soft); border-radius: var(--radius-sm); }
.session-agent { max-width: 52ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Crop picture popup ---- */

.dialog.crop-dialog { width: min(560px, calc(100vw - 1rem)); max-height: calc(100vh - 1rem); overflow-y: auto; }
.crop-dialog .form-actions { justify-content: flex-end; }
.crop-body { display: flex; gap: 1rem; align-items: flex-start; margin: 1rem 0 0.75rem; }
.crop-stage {
  position: relative;
  flex: 1;
  max-width: 400px;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #F5F5F5;
  cursor: grab;
  touch-action: none; /* drag and pinch are handled in app.js */
  user-select: none;
}
.crop-stage.is-dragging { cursor: grabbing; }
.crop-stage:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.crop-stage canvas { display: block; width: 100%; height: 100%; }
/* The square crop box (80% of the stage) with the circle that will be shown; outside is dimmed. */
.crop-mask {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(24, 24, 24, 0.5);
  pointer-events: none;
}
.crop-mask::after { content: ''; position: absolute; inset: 0; border: 2px dashed rgba(255, 255, 255, 0.85); border-radius: 0; }
.crop-mask::before { content: ''; position: absolute; inset: 0; border: 2px solid #FFFFFF; border-radius: 50%; }
.crop-side { display: grid; gap: 0.5rem; justify-items: center; flex: none; }
.crop-preview { width: 96px; height: 96px; border-radius: 50%; box-shadow: 0 0 0 3px var(--surface), 0 4px 14px rgba(24, 24, 24, 0.2); background: #FFFFFF; }
.crop-preview.crop-preview-small { width: 32px; height: 32px; box-shadow: 0 0 0 2px var(--surface), 0 2px 6px rgba(24, 24, 24, 0.2); }
.crop-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.crop-zoom { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 180px; }
.crop-zoom input { flex: 1; accent-color: var(--blue); }

@media (max-width: 520px) {
  .crop-body { flex-direction: column; align-items: stretch; }
  .crop-stage { max-width: none; }
  .crop-side { grid-auto-flow: column; align-items: center; justify-content: start; }
}

/* ---- Compact list tables ---- */

/* Tickets: flag | # | Title | Client | Status | Created by | Updated by | Last updated | delete */
.table-tickets .col-flag { width: 34px; }
.table-tickets .col-id { width: 58px; }
.table-tickets .col-client { width: 17%; }
.table-tickets .col-status { width: 136px; }
.table-tickets .col-person { width: 124px; }
.table-tickets .col-updated { width: 112px; }
.table-tickets .col-actions { width: 44px; }
.table-tickets th:first-child, .table-tickets td.cell-flag { padding: 0 0 0 12px; text-overflow: clip; }
.sort-flag .icon { width: 14px; height: 14px; }
.priority-flag { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--led); color: #0B0B0B; box-shadow: 0 0 2px var(--led), 0 0 5px var(--led); animation: led-pulse var(--led-pulse) ease-in-out infinite; }
.priority-flag .icon { width: 11px; height: 11px; stroke-width: 2.6; }
.table .person { display: inline-flex; max-width: 100%; overflow: hidden; }
.table .person .avatar { flex: none; }
.table .badge { font-size: 0.7857rem; padding: 1px 8px; }
.table .row-reminder { margin-left: 4px; }
.table .row-reminder .icon { width: 13px; height: 13px; }
/* Delete: a small icon button at the end of the row, shown on hover / keyboard focus. */
.table td.row-actions { text-align: right; padding-right: 6px; overflow: visible; }
.table td.row-actions .icon-btn { width: 28px; height: 28px; }
@media (hover: hover) {
  .table tbody tr .row-actions > * { opacity: 0; transition: opacity 0.12s; }
  .table tbody tr:hover .row-actions > *,
  .table tbody tr:focus-within .row-actions > * { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .priority-flag { animation: none; } }

/* Other list tables: widths on the header cells (fixed layout takes them from the first
   row); columns without one, such as custom fields, share the width that is left. */
.table .w-xs { width: 44px; }
.table .w-id { width: 76px; }
.table .w-num { width: 96px; }
.table .w-sm { width: 116px; }
.table .w-md { width: 144px; }
.table .w-15 { width: 15%; }
.table .w-20 { width: 20%; }
.table .w-25 { width: 25%; }

/* ---- Inventory ---- */


.inv-tabs { margin-top: calc(-1 * var(--sp-2)); overflow-y: hidden; align-items: center; }
.inv-tabs-settings { margin-left: auto; }
/* "Import / Export" button on the right of the Inventory tab bar (not a tab). */
.inv-tabs .inv-io-btn { margin-left: auto; align-self: center; height: 30px; border-bottom-width: 1px; }
.inv-tabs .inv-io-btn.is-active { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.inv-tabs .inv-io-btn + .inv-tabs-extra { margin-left: 4px; }
.inv-tabs-settings .icon { width: 14px; height: 14px; }
.stock-nav { margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); }
.inv-filters { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; padding: var(--sp-3) var(--sp-4); }
.inv-filters .field { flex: 1; min-width: 150px; max-width: 240px; }
.inv-category-pick { margin-bottom: var(--sp-4); max-width: 320px; }
.req { color: var(--red); }
.chip-warn { background: #F2F2F2; color: #5E5E5E; }
.stock-ok { color: var(--green); font-weight: 700; }
.stock-low { color: var(--red); font-weight: 700; }

/* Grid (searchable, sortable, resizable inventory tables). */
.grid-card { padding: 0; overflow: hidden; }
.grid-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: 10px var(--sp-3); border-bottom: 1px solid var(--border); }
.grid-search { flex: 0 1 280px; min-width: 180px; }
.grid-search input[type="search"] { min-height: 30px; }
.grid-count { margin-left: auto; }
.grid-status.is-error { color: var(--red); }
.grid-card > .empty { padding: var(--sp-4); margin: 0; }
.grid-wrap { overflow: auto; max-height: calc(100vh - 250px); min-height: 160px; }
table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: var(--fs-table); min-width: 100%; }
.grid th, .grid td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--border); text-align: left; }
.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-soft); height: 36px; padding: 0; font-size: 0.7857rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.grid thead tr.grid-filters th { top: 36px; height: 38px; padding: 4px 6px; background: var(--surface); text-transform: none; letter-spacing: 0; }
.grid-filters input, .grid-filters select { min-height: 28px; padding: 2px 8px; font-size: 0.8571rem; }
.grid th.right, .grid td.right { text-align: right; }
.grid-sort { display: flex; align-items: center; gap: 4px; width: 100%; height: 36px; padding: 0 14px 0 10px; border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; text-align: left; overflow: hidden; }
.grid-sort > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.grid-sort:hover { color: var(--purple); }
.grid th[aria-sort="ascending"] .grid-sort, .grid th[aria-sort="descending"] .grid-sort { color: var(--indigo); }
.grid th[aria-sort="ascending"] .sort-arrow, .grid th[aria-sort="descending"] .sort-arrow { opacity: 1; color: var(--blue); }
.grid th { position: relative; }
.grid th[draggable="true"] { cursor: grab; }
.grid th.is-dragging { opacity: 0.4; }
.grid th.is-drop-target { box-shadow: inset 3px 0 0 var(--blue); }
.grid-resize { position: absolute; top: 0; right: 0; width: 8px; height: 100%; cursor: col-resize; z-index: 3; }
.grid-resize::after { content: ''; position: absolute; top: 9px; bottom: 9px; right: 3px; width: 2px; border-radius: 2px; background: var(--border); }
.grid-resize:hover::after, .is-resizing .grid-resize::after { background: var(--blue); }
.is-resizing, .is-resizing * { cursor: col-resize !important; user-select: none; }
.grid td { height: 40px; padding: 0 10px; vertical-align: middle; }
.grid tbody tr { cursor: pointer; transition: background 0.1s; }
.grid tbody tr:nth-child(even) { background: #FCFCFC; }
.grid tbody tr:hover { background: var(--blue-soft); }
.grid tbody tr:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.grid td a { color: var(--text); }
.grid td a:hover { color: var(--purple); }

/* Password / PIN */
.secret { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
.secret-value { font-family: Consolas, "Courier New", monospace; letter-spacing: 0.08em; overflow: hidden; text-overflow: ellipsis; }
.secret.is-revealed .secret-value { color: var(--indigo); background: var(--purple-soft); border-radius: 4px; padding: 0 4px; letter-spacing: 0; user-select: all; }
.secret.is-error .secret-value { color: var(--red); font-family: inherit; letter-spacing: 0; }
.secret-btn { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); cursor: pointer; padding: 0; }
.secret-btn .icon { width: 14px; height: 14px; }
.secret-btn:hover { background: var(--purple-soft); color: var(--purple); }
.secret.is-revealed [data-secret-reveal] { color: var(--blue); }

/* Access and stock status pills */
.access-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.7857rem; font-weight: 600; background: var(--grey-soft); color: var(--muted); }
.access-badge.is-granted { background: var(--green-soft); color: var(--green); }
.stock-status { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.7857rem; font-weight: 700; background: var(--grey-soft); color: var(--muted); }
.stock-status-available { background: var(--green-soft); color: var(--green); }
.stock-status-assigned { background: var(--blue-soft); color: #4F4F4F; }
.stock-status-repair { background: #F2F2F2; color: #5E5E5E; }
.stock-status-damaged { background: var(--red-soft); color: var(--red); }
.stock-status-sold { background: var(--purple-soft); color: var(--purple); }
.stock-status-disposed { text-decoration: line-through; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8214rem; font-weight: 700; }
.status-pill.is-active { background: var(--green-soft); color: var(--green); }
.status-pill.is-inactive { background: var(--grey-soft); color: var(--muted); }

/* Switch (access toggles, Active) */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: none; border-radius: 999px; background: #D1D1D1; transition: background 0.15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch.is-on, input:checked + .switch { background: var(--green); }
.switch.is-on::after, input:checked + .switch::after { transform: translateX(14px); }
.switch-field { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-table); font-weight: 600; color: var(--indigo); }
.switch-field input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-field input:focus-visible + .switch { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch-btn { display: inline-flex; align-items: center; gap: var(--sp-2); border: 0; background: none; padding: 2px; cursor: pointer; font: inherit; font-size: var(--fs-table); color: var(--muted); }
.switch-btn[aria-checked="true"] { color: var(--green); font-weight: 600; }
.switch-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

/* Forms */
.inv-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-3); }
.inv-form-grid .span-2 { grid-column: 1 / -1; }
.inv-access-set { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); margin: 0; }
.inv-access-set legend { font-weight: 700; color: var(--indigo); padding: 0 6px; }
.inv-access-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }
.serial-rows { margin: 0; padding-left: 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 12px; }
.serial-rows li::marker { color: var(--muted); font-size: 0.8571rem; }
.field-list .is-hidden-field { opacity: 0.6; }

/* Record details */
.inv-details { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-2) var(--sp-4); margin: 0; }
.inv-detail { min-width: 0; padding: 6px 8px; margin: -6px -8px; border-radius: var(--radius-sm); transition: background 0.12s; }
.inv-detail:hover, .inv-detail:focus-within { background: var(--surface-soft); }
.inv-detail-label { display: flex; align-items: center; gap: 4px; min-height: 22px; font-size: 0.7857rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.inv-detail-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-detail-value { font-weight: 500; overflow-wrap: anywhere; min-height: 22px; }
.inv-subhead { margin: var(--sp-4) 0 var(--sp-2); font-size: 0.8571rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--purple); }
.inv-hidden-note { margin: var(--sp-3) 0 0; }
/* Field tools (drag handle and the ⋯ menu) show on hover / focus; always on touch screens. */
.inv-detail .drag-handle, .access-list .drag-handle { width: 16px; height: 18px; margin-left: -4px; cursor: grab; color: var(--muted); }
.inv-detail .drag-handle .icon, .access-list .drag-handle .icon { width: 14px; height: 14px; }
.field-menu-btn { width: 24px; height: 22px; font-size: 1rem; line-height: 1; letter-spacing: 0; color: var(--muted); }
@media (hover: hover) {
  .inv-detail .drag-handle, .inv-detail .field-menu > summary, .access-list .drag-handle, .access-list .field-menu > summary { opacity: 0; transition: opacity 0.12s; }
  .inv-detail:hover .drag-handle, .inv-detail:hover .field-menu > summary, .inv-detail:focus-within .drag-handle, .inv-detail:focus-within .field-menu > summary,
  .access-list li:hover .drag-handle, .access-list li:hover .field-menu > summary, .access-list li:focus-within .drag-handle, .access-list li:focus-within .field-menu > summary,
  .field-menu[open] > summary { opacity: 1; }
}
.field-menu { text-transform: none; letter-spacing: 0; font-weight: 400; }
.field-menu .edit-panel { width: min(320px, calc(100vw - 2rem)); color: var(--text); font-size: 1rem; }
.field-menu-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.field-menu-actions .btn:disabled { opacity: 0.4; cursor: default; }
.access-name { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.add-field > summary { white-space: nowrap; }
.inv-details .sortable-ghost, .access-list .sortable-ghost { opacity: 0.4; }

/* Employee profile */
.emp-head { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; padding: var(--sp-5); background: linear-gradient(120deg, var(--surface) 55%, var(--purple-soft)); }
.emp-head.is-inactive { background: linear-gradient(120deg, var(--surface) 55%, var(--grey-soft)); }
.emp-head .avatar-lg { width: 76px; height: 76px; font-size: 1.6rem; }
.emp-id { flex: 1; min-width: 220px; }
.emp-id h1 { margin: 0 0 var(--sp-1); }
.emp-sub { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin: 0 0 var(--sp-2); color: var(--muted); }
.emp-sub span, .emp-sub a { display: inline-flex; align-items: center; gap: 5px; }
.emp-sub .icon { width: 14px; height: 14px; }
.emp-status { display: flex; align-items: center; gap: var(--sp-2); margin: 0; }
.emp-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.emp-actions summary.btn { gap: 8px; }
.emp-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: var(--sp-4); align-items: start; }
.emp-grid > .card { margin: 0; }
.access-list { list-style: none; margin: 0; padding: 0; display: grid; }
.access-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 40px; border-bottom: 1px solid var(--border); }
.access-list li:last-child { border-bottom: 0; }
.equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-3); }
.equip { margin: 0; padding: var(--sp-3) var(--sp-4); border-top: 3px solid var(--border); }
.equip.has-items { border-top-color: var(--blue); }
.equip-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.equip-head h3 { margin: 0; font-size: 1rem; }
.equip-none { margin: 0; color: var(--muted); font-style: italic; }
.equip-item + .equip-item { border-top: 1px dashed var(--border); margin-top: var(--sp-2); padding-top: var(--sp-2); }
.equip-item-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.equip-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px var(--sp-3); margin: 6px 0 0; font-size: var(--fs-table); }
.equip-facts dt { font-size: 0.7857rem; color: var(--muted); }
.equip-facts dd { margin: 0; overflow-wrap: anywhere; }
.equip-facts .span-2 { grid-column: 1 / -1; }
.equip-picker { width: min(380px, calc(100vw - 2rem)); }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; display: grid; gap: 2px; }
.pick-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 6px 4px; border-bottom: 1px solid var(--border); }

/* Summary and breakdown */
.total-row td { font-weight: 700; background: var(--surface-soft); }
.grand-row td { font-weight: 800; color: var(--indigo); background: var(--purple-soft); }
.group-row td { font-weight: 700; color: var(--purple); background: #FAFAFA; text-transform: uppercase; font-size: 0.7857rem; letter-spacing: 0.05em; }
.breakdown-cat .card-head { align-items: center; }

@media (max-width: 1000px) {
  .emp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .emp-head { padding: var(--sp-4); gap: var(--sp-3); }
  .grid-wrap { max-height: none; }
  .equip-facts { grid-template-columns: 1fr; }
}

/* ---- Inventory import ---- */

.import-steps { display: flex; flex-wrap: wrap; gap: var(--sp-2); list-style: none; margin: 0 0 var(--sp-4); padding: 0; }
.import-steps li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-table); color: var(--muted); }
.import-steps li span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--grey-soft); font-weight: 700; font-size: 0.7857rem; }
.import-steps li.is-current { border-color: var(--blue); color: var(--indigo); font-weight: 600; }
.import-steps li.is-current span { background: var(--blue); color: #FFFFFF; }
.import-steps li.is-done span { background: var(--green); color: #FFFFFF; }
.import-rules { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.import-map tr.is-skipped td { opacity: 0.55; }
.import-map select { min-height: 30px; }
.import-map td { overflow: visible; }
.import-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.import-count { margin: 0; display: grid; gap: 2px; border-top: 3px solid var(--border); }
.import-count strong { font-family: var(--font-head); font-size: 1.6rem; color: var(--indigo); line-height: 1.1; }
.import-count span { color: var(--muted); font-size: var(--fs-table); }
.import-count.is-create { border-top-color: var(--green); }
.import-count.is-update { border-top-color: var(--blue); }
.import-count.is-skip { border-top-color: var(--red); }
.import-action { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.7857rem; font-weight: 700; background: var(--grey-soft); color: var(--muted); }
.import-action-create { background: var(--green-soft); color: var(--green); }
.import-action-update { background: var(--blue-soft); color: #4F4F4F; }
.import-action-skip { background: var(--red-soft); color: var(--red); }
.import-row-skip td { background: #F9F9F9; }
.import-error { color: var(--red); }
.import-warn { color: #5E5E5E; }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.import-confirm { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.import-confirm form { margin: 0; }
.import-skips { margin: var(--sp-3) 0 0; padding-left: 18px; display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
@media (max-width: 700px) { .import-counts { grid-template-columns: 1fr 1fr; } }

/* ---- Inventory workbook ---- */
.inv-tabs-extra .icon { width: 14px; height: 14px; }
.wb-sheet.is-skipped { opacity: 0.7; }
.wb-sheet .card-head h2 { display: inline-flex; align-items: center; gap: 6px; }
.wb-result { padding: 0; }
.wb-result > summary { list-style: none; cursor: pointer; }
.wb-result > summary::-webkit-details-marker { display: none; }
.wb-result-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); }
.wb-result[open] .wb-result-head { border-bottom: 1px solid var(--border); }
.wb-result > :not(summary) { margin-left: var(--sp-4); margin-right: var(--sp-4); }
.wb-result > .table-wrap { margin-bottom: var(--sp-3); }
.wb-order { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--purple-soft); color: var(--purple); font-weight: 700; font-size: 0.7857rem; }
.wb-counts { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.wb-created { margin-top: var(--sp-3); margin-bottom: var(--sp-3); }

/* ---- Reminders: several recipients ---- */
.reminder-for { border: 0; margin: 0; padding: 0; }
.reminder-for legend { font-size: var(--fs-table); font-weight: 600; color: var(--indigo); margin-bottom: var(--sp-1); padding: 0; }
.user-checks { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow-y: auto; }
.user-check { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: var(--fs-table); background: var(--surface); }
.user-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.user-check:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); color: var(--indigo); font-weight: 600; }
.user-check:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.recipient-list { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-table); }
.recipient { display: inline-flex; align-items: center; gap: 5px; }
.recipient.is-done > span:not(.recipient-state) { text-decoration: line-through; color: var(--muted); }
.recipient-state { display: inline-flex; align-items: center; gap: 2px; font-size: 0.8571rem; color: var(--green); }
.recipient-state .icon { width: 12px; height: 12px; }

/* ---- @mentions in ticket comments ---- */
.mention { color: var(--purple); background: var(--purple-soft); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mention-box { position: relative; }
/* The backdrop repeats the text (transparent) with mentions marked, behind a textarea
   with a transparent background; both share font, padding and wrapping. */
.mention-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 1rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  overflow: hidden;
  color: transparent;
  background: var(--surface);
  border-radius: var(--radius-sm);
  pointer-events: none;
}
.mention-backdrop mark { color: transparent; background: rgba(82, 82, 82, 0.18); border-radius: 3px; }
.mention-box textarea { position: relative; z-index: 1; display: block; overflow-wrap: break-word; }
.mention-box.is-ready textarea { background: transparent; }
.mention-list {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 70;
  min-width: 240px;
  max-width: 100%;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.14s ease-out both;
}
.mention-list li { display: flex; align-items: center; gap: var(--sp-2); padding: 0.4rem 0.6rem; border-radius: 6px; cursor: pointer; font-size: var(--fs-table); }
.mention-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-list li.is-active { background: var(--blue-soft); color: var(--indigo); }
.bell-group-mentions h3 { color: var(--purple); }

/* ---- Reminder "For": chips + people dropdown (data-user-multi) ---- */
.reminder-for.is-enhanced { position: relative; }
.multi-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 28px; }
.multi-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 3px; border: 1px solid var(--blue); background: var(--blue-soft); color: var(--indigo); border-radius: 999px; font-size: var(--fs-table); font-weight: 600; }
.multi-chip-remove { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--indigo); font-size: 15px; line-height: 1; cursor: pointer; }
.multi-chip-remove:hover { background: var(--purple-soft); color: var(--purple); }
.multi-chip-remove:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.multi-toggle { justify-self: start; margin-top: 6px; }
.reminder-for.is-enhanced .multi-panel {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 75;
  width: min(340px, 100%);
  margin-top: 4px;
  padding: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.14s ease-out both;
}
.reminder-for.is-enhanced .multi-panel[hidden] { display: none; }
.multi-search { margin-bottom: var(--sp-2); }
.reminder-for.is-enhanced .user-checks { display: grid; gap: 2px; max-height: 220px; }
.reminder-for.is-enhanced .user-check { border: 0; border-radius: 6px; padding: 5px 8px 5px 6px; }
.reminder-for.is-enhanced .user-check[hidden] { display: none; }
.reminder-for.is-enhanced .user-check:hover { background: var(--surface-soft); }
.reminder-for.is-enhanced .user-check input { position: static; opacity: 1; width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }
.multi-empty { margin: 4px 0; }
.multi-panel-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--border); }
.toast-saved { grid-template-columns: auto 1fr; align-items: center; border-left-color: var(--green); font-weight: 600; }
.toast-saved .toast-icon { color: var(--green); }

/* ---- Reminder date (dd/mm/yyyy) and time (24h) fields, calendar and time list ---- */
.when-inputs { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.when-date, .when-time { position: relative; display: flex; align-items: center; }
.when-date { flex: 0 1 190px; }
.when-time { flex: 0 1 120px; }
.when-icon { position: absolute; left: 10px; display: inline-flex; color: var(--muted); pointer-events: none; }
.when-icon .icon { width: 15px; height: 15px; }
.when-inputs input[type="text"] { padding-left: 32px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.is-enhanced .when-date .when-icon { display: none; }
.is-enhanced .when-date input[type="text"] { padding-left: 10px; padding-right: 36px; }
.when-open { position: absolute; right: 3px; display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--blue); cursor: pointer; }
.when-open:hover, .when-open[aria-expanded="true"] { background: var(--blue-soft); }
.when-open:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.when-open .icon { width: 16px; height: 16px; }
.when-inputs input[aria-invalid] { border-color: var(--red); }
.date-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 80;
  width: 264px;
  padding: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.14s ease-out both;
}
.date-pop[hidden], .time-list[hidden] { display: none; }
.date-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; color: var(--indigo); font-size: var(--fs-table); }
.date-nav { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--indigo); font-size: 18px; line-height: 1; cursor: pointer; }
.date-nav:hover { background: var(--surface-soft); color: var(--purple); }
.date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 0 4px; }
.date-day { height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-table); font-variant-numeric: tabular-nums; cursor: pointer; }
.date-day:hover { background: var(--blue-soft); color: var(--indigo); }
.date-day:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.date-day.is-past { color: var(--muted); }
.date-day.is-today { box-shadow: inset 0 0 0 1px var(--purple); color: var(--purple); font-weight: 700; }
.date-day.is-selected { background: var(--blue); color: #FFFFFF; font-weight: 700; }
.date-pop-foot { display: flex; justify-content: flex-end; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.time-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.time-list li { padding: 5px 10px; border-radius: 6px; font-size: var(--fs-table); font-variant-numeric: tabular-nums; cursor: pointer; }
.time-list li:hover { background: var(--blue-soft); color: var(--indigo); }
.time-list li.is-selected { background: var(--blue); color: #FFFFFF; font-weight: 600; }
[data-reminder-when] .field-error { margin-top: 4px; }
/* A card with an open dropdown (calendar, time list, people, @mentions) sits above the
   cards after it, so the dropdown is never hidden behind the next card. */
.card:focus-within,
.card:has(.date-pop:not([hidden]), .time-list:not([hidden]), .is-enhanced .multi-panel:not([hidden]), .mention-list:not([hidden])) { position: relative; z-index: 5; }

/* ==== Ticket page (header, timeline, composer, side panel) ==== */
.tk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.tk-head-main { min-width: 0; flex: 1 1 520px; }
.tk-title { margin: 0 0 var(--sp-2); font-size: 1.5rem; line-height: 1.25; overflow-wrap: anywhere; }
.tk-no { color: var(--muted); font-weight: 600; margin-right: 2px; }
.tk-controls { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: 6px; }
.tk-client { display: inline-flex; align-items: center; gap: 6px; height: var(--pill-h); padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--indigo); font-size: var(--fs-table); font-weight: 600; max-width: 100%; }
.tk-client span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-client .icon { width: 14px; height: 14px; color: var(--purple); }
.tk-client:hover { border-color: var(--purple); color: var(--purple); text-decoration: none; }
.tk-inline { display: inline-flex; margin: 0; }
.tk-sub { margin: 0; color: var(--muted); font-size: 0.8571rem; }
.tk-sub time { color: inherit; }
.tk-head .actions { display: flex; gap: var(--sp-2); align-items: center; }

/* Status / priority as pill-shaped dropdowns, coloured like their badges. */
select.pill-select {
  width: auto;
  min-height: 0;
  height: var(--pill-h);
  padding: 0 30px 0 12px;
  border-radius: 999px;
  font-size: var(--fs-table);
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border: 1px solid transparent;
}
select.pill-select:focus-visible { box-shadow: var(--focus); }
select.pill-select.is-saving { opacity: 0.6; }
.status-select.is-open { background-color: var(--blue); color: #FFFFFF; }
.status-select.is-customer_waiting { background-color: var(--purple); color: #FFFFFF; }
.status-select.is-closed { background-color: var(--grey-soft); color: var(--muted); }
.priority-select { color: #0B0B0B; }
.priority-select.is-low { background-color: var(--led-low); }
.priority-select.is-normal { background-color: var(--led-normal); }
.priority-select.is-high { background-color: var(--led-high); }
.priority-select.is-urgent { background-color: var(--led-urgent); }
.pill-select option { background: var(--surface); color: var(--text); font-weight: 400; }

.tk-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: var(--sp-4); align-items: start; }
.tk-main { min-width: 0; display: grid; gap: var(--sp-4); }
.tk-side { min-width: 0; display: grid; gap: var(--sp-3); }
@media (min-width: 1101px) and (min-height: 760px) {
  .tk-side { position: sticky; top: var(--sp-4); }
}
.tk-card { padding: var(--sp-4); }
.tk-card > :last-child { margin-bottom: 0; }
.tk-section-title { display: flex; align-items: center; gap: 6px; margin: 0 0 var(--sp-3); font-size: 0.8571rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--indigo); }
.tk-section-title .icon { width: 14px; height: 14px; }
.tk-section-title .muted { text-transform: none; letter-spacing: 0; font-weight: 600; }
.tk-description { font-size: 1rem; line-height: 1.6; overflow-wrap: anywhere; }

/* Timeline */
.tk-timeline { min-width: 0; }
.tk-timeline > .tk-section-title { padding: 0 2px; }
.tk-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); position: relative; }
.tk-feed::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); border-radius: 2px; }
.tk-feed:empty::before { display: none; }
.tk-event { position: relative; display: flex; align-items: center; gap: var(--sp-3); padding: 0 0 0 2px; font-size: var(--fs-table); color: var(--muted); }
.tk-event-icon { position: relative; z-index: 1; display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border); color: var(--purple); }
.tk-event-icon .icon { width: 13px; height: 13px; }
.tk-event-text { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.tk-event-text strong { color: var(--text); font-weight: 600; }
.tk-event .badge { font-size: 0.75rem; padding: 0 7px; }
.tk-comment { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--sp-3); align-items: start; scroll-margin-top: 80px; }
.tk-comment-avatar { position: relative; z-index: 1; display: inline-flex; padding-top: 2px; }
.tk-comment-avatar .avatar { box-shadow: 0 0 0 3px var(--bg); }
.tk-bubble { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px 12px; transition: border-color 0.15s, box-shadow 0.15s; }
.tk-comment:target .tk-bubble { border-color: var(--blue); box-shadow: var(--focus); }
.tk-bubble-head { display: flex; align-items: center; gap: 8px; min-height: 26px; margin-bottom: 2px; font-size: var(--fs-table); }
.tk-bubble-head strong { color: var(--indigo); }
.tk-bubble-head .muted { font-size: 0.8214rem; }
.tk-bubble-actions { display: flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity 0.15s; }
.tk-bubble:hover .tk-bubble-actions, .tk-bubble:focus-within .tk-bubble-actions, .tk-bubble-actions:has(details[open]) { opacity: 1; }
@media (hover: none) { .tk-bubble-actions { opacity: 1; } }
.tk-bubble-actions .icon-btn { width: 28px; height: 28px; }
.tk-bubble-body { font-size: 1rem; line-height: 1.55; overflow-wrap: anywhere; }
.tk-bubble-files { margin-top: var(--sp-2); }

/* Composer, pinned to the bottom of the screen while the timeline scrolls past. */
.tk-composer { position: sticky; bottom: var(--sp-3); z-index: 6; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--sp-3); margin-top: var(--sp-4); }
.tk-composer-box { position: relative; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; transition: border-color 0.15s, box-shadow 0.15s; }
.tk-composer-box:focus-within { border-color: var(--blue); box-shadow: var(--shadow-lg), var(--focus); }
.tk-composer textarea { border: 0; box-shadow: none !important; resize: none; min-height: 44px; padding: 6px 8px; line-height: 1.5; }
.tk-composer .mention-backdrop { border: 0; padding: 6px 8px; line-height: 1.5; }
.tk-composer-bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); padding: 6px 2px 0; border-top: 1px solid var(--border); margin-top: 4px; }
.tk-composer-bar .file-pick { flex: 1 1 auto; min-width: 0; }
.tk-composer-hint { white-space: nowrap; }
kbd { font: inherit; font-size: 0.75rem; padding: 0 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-soft); }
.tk-composer .mention-list { top: auto; bottom: calc(100% + 16px); }
.tk-drop-hint { position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 6px; border: 2px dashed var(--blue); border-radius: var(--radius); background: rgba(242, 242, 242, 0.94); color: var(--blue); font-weight: 700; pointer-events: none; z-index: 3; }
.tk-drop-hint .icon { width: 22px; height: 22px; }
.tk-composer.is-dragging .tk-drop-hint { display: grid; }
.tk-composer .field-error { margin: 4px 6px 0; }

/* File picker chips (comment box and Attachments panel) */
.file-pick { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.file-pick-button { cursor: pointer; }
.file-chips { display: contents; list-style: none; margin: 0; padding: 0; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; height: 28px; padding: 0 4px 0 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-soft); font-size: 0.8214rem; }
.file-chip img { width: 20px; height: 20px; object-fit: cover; border-radius: 4px; }
.file-chip .icon { width: 14px; height: 14px; color: var(--purple); }
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-chip-remove { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; }
.file-chip-remove:hover { background: var(--red-soft); color: var(--red); }
.file-pick .field-error { flex-basis: 100%; margin: 0; }

/* Details */
.tk-details { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px var(--sp-3); margin: 0; font-size: var(--fs-table); align-items: center; }
.tk-details dt { color: var(--muted); }
.tk-details dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Attachments */
.tk-attach-form { margin-bottom: var(--sp-3); }
.tk-dropzone { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 14px 10px; border: 1.5px dashed #D1D1D1; border-radius: var(--radius); background: var(--surface-soft); color: var(--muted); font-size: var(--fs-table); text-align: center; transition: border-color 0.15s, background 0.15s; }
.tk-dropzone > .icon { width: 18px; height: 18px; color: var(--purple); }
.tk-dropzone .file-pick { justify-content: center; }
.tk-attach-form.is-dragging .tk-dropzone { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.tk-attach-form.is-uploading .tk-dropzone { opacity: 0.7; pointer-events: none; }
.tk-attach-form .muted.small { margin: 6px 0 0; }
.att-thumbs { list-style: none; margin: 0 0 var(--sp-2); padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--sp-2); }
.tk-bubble .att-thumbs { grid-template-columns: repeat(auto-fill, minmax(120px, 160px)); }
.att-thumb { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--grey-soft); }
.att-thumb > a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.att-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.att-thumb:hover img { transform: scale(1.04); }
.att-thumb-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; opacity: 0; transition: opacity 0.15s; }
.att-thumb:hover .att-thumb-actions, .att-thumb:focus-within .att-thumb-actions { opacity: 1; }
@media (hover: none) { .att-thumb-actions { opacity: 1; } }
.att-thumb-actions .att-mini { background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow); }
.att-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.att-file { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; padding: 6px 6px 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.att-file:hover { border-color: #D1D1D1; background: var(--surface-soft); }
.att-type { position: relative; flex: none; display: inline-grid; place-items: center; width: 30px; height: 34px; border-radius: 5px; background: var(--purple-soft); color: var(--purple); }
.att-type .icon { width: 16px; height: 16px; opacity: 0.35; }
.att-type span { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 8.5px; font-weight: 800; letter-spacing: 0.02em; }
.att-type-pdf { background: var(--red-soft); color: var(--red); }
.att-type-video { background: var(--blue-soft); color: var(--blue); }
.att-file-main { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-table); font-weight: 600; }
.att-file-main .small { font-size: 0.7857rem; }
.att-mini { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.att-mini .icon { width: 14px; height: 14px; }
.att-mini:hover { background: var(--blue-soft); color: var(--blue); text-decoration: none; }
.att-mini-danger:hover { background: var(--red-soft); color: var(--red); }
.row-files { display: inline-flex; align-items: center; gap: 1px; vertical-align: middle; margin-left: 4px; color: var(--muted); font-size: 0.7857rem; font-weight: 600; }
.row-files .icon { width: 13px; height: 13px; }
.row-files:hover { color: var(--blue); text-decoration: none; }

/* Lightbox */
dialog.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: #FFFFFF; }
dialog.lightbox::backdrop { background: rgba(9, 9, 9, 0.88); }
.lightbox-figure { display: grid; place-items: center; align-content: center; gap: 10px; width: 100%; height: 100%; margin: 0; padding: 56px 64px; box-sizing: border-box; pointer-events: none; }
.lightbox-figure img { max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); pointer-events: auto; background: #FFFFFF; }
.lightbox-figure figcaption { font-size: var(--fs-table); opacity: 0.85; text-align: center; }
.lightbox-btn { position: fixed; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: #FFFFFF; cursor: pointer; }
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.26); text-decoration: none; }
.lightbox-btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.lightbox-btn .icon { width: 18px; height: 18px; }
.lightbox-close { top: 14px; right: 14px; }
.lightbox-download { top: 14px; right: 62px; color: #FFFFFF; }
.lightbox-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-btn[hidden] { display: none; }

/* Desktop notifications banner and My profile toggle */
.push-banner { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); padding: 10px 10px 10px 14px; border: 1px solid #D3D3D3; border-left: 4px solid var(--purple); border-radius: var(--radius); background: var(--purple-soft); font-size: var(--fs-table); }
.push-banner[hidden] { display: none; }
.push-banner-icon { display: inline-flex; color: var(--purple); }
.push-banner-icon .icon { width: 18px; height: 18px; }
.push-banner-text { flex: 1; min-width: 0; }
.push-toggle [data-push-state] { margin: 0 0 var(--sp-2); font-weight: 600; }
.push-toggle [data-push-state].is-on { color: var(--green); }

@media (max-width: 1100px) {
  .tk-layout { grid-template-columns: minmax(0, 1fr); }
  .tk-side { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
}
@media (max-width: 640px) {
  .tk-title { font-size: 1.25rem; }
  .tk-head .actions { width: 100%; }
  .tk-feed::before { left: 13px; }
  .tk-comment, .tk-composer { grid-template-columns: 28px minmax(0, 1fr); gap: var(--sp-2); }
  .tk-composer { bottom: var(--sp-2); }
  .tk-composer-hint { display: none; }
  .tk-side { grid-template-columns: minmax(0, 1fr); }
  .lightbox-figure { padding: 56px 12px; }
  .push-banner { flex-wrap: wrap; }
}

/* Reminders panel inside the narrow ticket side panel: stacked rows, matching titles. */
.tk-side .reminder { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
.tk-side .reminder-actions { justify-content: flex-start; }
.tk-card .card-head { margin-bottom: var(--sp-3); }
.tk-card .card-head h2 { display: flex; align-items: center; gap: 6px; font-size: 0.8571rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--indigo); }
.tk-card .card-head h2 .muted { text-transform: none; letter-spacing: 0; font-weight: 600; }
.tk-card .card-head .tk-section-title { margin: 0; }

/* ==== GDAP ==== */
:root {
  --gdap-ok: #626262;       --gdap-ok-soft: #F2F2F2;
  --gdap-warn: #5C5C66;     --gdap-warn-soft: #F5F5F5;
  --gdap-bad: #484848;      --gdap-bad-soft: #F0F0F0;
  --gdap-expired: #252525;  --gdap-expired-soft: #DFDFDF;
}
.gdap-banner { margin-bottom: var(--sp-3); }
.gdap-sync { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 var(--sp-3); }
.gdap-sync .icon { width: 14px; height: 14px; color: var(--green); }
.gdap-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.gdap-card { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--c, var(--border)); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.gdap-card:hover, .gdap-card.is-active { text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-1px); border-color: var(--c); }
.gdap-card-value { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--c); }
.gdap-card-label { font-size: var(--fs-table); color: var(--muted); }
.gdap-card-ok { --c: var(--gdap-ok); }
.gdap-card-warn { --c: var(--gdap-warn); }
.gdap-card-bad { --c: var(--gdap-bad); }
.gdap-card-expired { --c: var(--gdap-expired); }

.gdap-table tbody tr { box-shadow: inset 3px 0 0 var(--row, transparent); }
.gdap-row-ok { --row: var(--gdap-ok); }
.gdap-row-warn { --row: var(--gdap-warn); }
.gdap-row-bad { --row: var(--gdap-bad); }
.gdap-row-expired { --row: var(--gdap-expired); }
.gdap-row-removed { --row: var(--grey); }
.gdap-table tr.gdap-row-removed td { color: var(--muted); }
.gdap-table td.gdap-link-cell { overflow: visible; }
.gdap-link-cell { position: relative; }
.gdap-link-cell > a, .gdap-link-cell > span { display: inline-block; max-width: calc(100% - 30px); overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.gdap-link-cell details.edit { display: inline-block; vertical-align: middle; }
.gdap-link-edit { width: 24px; height: 24px; opacity: 0; transition: opacity 0.15s; }
.gdap-table tr:hover .gdap-link-edit, .gdap-link-cell details[open] .gdap-link-edit, .gdap-link-edit:focus-visible { opacity: 1; }
@media (hover: none) { .gdap-link-edit { opacity: 1; } }
.gdap-link-cell .edit-panel { width: min(340px, calc(100vw - 2rem)); white-space: normal; }

.gdap-roles { display: inline-flex; flex-wrap: nowrap; gap: 4px; max-width: 100%; overflow: hidden; vertical-align: middle; }
.gdap-client-item .gdap-roles { flex-wrap: wrap; margin-top: 6px; }
.gdap-role { display: inline-block; flex: none; max-width: 180px; padding: 1px 8px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); font-size: 0.7857rem; font-weight: 600; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gdap-role.is-global { background: var(--gdap-bad); color: #FFFFFF; }
.gdap-role.is-unknown { background: var(--grey-soft); color: var(--muted); font-family: ui-monospace, monospace; font-weight: 400; }
.gdap-role-more { background: var(--grey-soft); color: var(--muted); }

.gdap-status { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.7857rem; font-weight: 700; background: var(--grey-soft); color: var(--muted); }
.gdap-status-active { background: var(--gdap-ok-soft); color: var(--gdap-ok); }
.gdap-status-expired { background: var(--gdap-expired-soft); color: var(--gdap-expired); }
.gdap-status-approvalPending, .gdap-status-activating, .gdap-status-approved, .gdap-status-created { background: var(--blue-soft); color: var(--blue); }
.gdap-status-terminated, .gdap-status-terminating, .gdap-status-terminationRequested { background: var(--red-soft); color: var(--red); }
.gdap-days { display: inline-block; min-width: 64px; padding: 1px 8px; border-radius: 999px; font-size: 0.7857rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.gdap-days-ok { background: var(--gdap-ok-soft); color: var(--gdap-ok); }
.gdap-days-warn { background: var(--gdap-warn-soft); color: var(--gdap-warn); }
.gdap-days-bad { background: var(--gdap-bad); color: #FFFFFF; }
.gdap-days-expired { background: var(--gdap-expired); color: #FFFFFF; }
.gdap-days-none, .gdap-days-removed { color: var(--muted); }

.gdap-client-card .card-head h2 .icon { color: var(--purple); }
.gdap-client-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.gdap-client-item { padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--row, var(--border)); border-radius: var(--radius-sm); background: var(--surface); }
.gdap-client-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: 2px; }
.gdap-client-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--indigo); }

.gdap-user-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px var(--sp-3); margin: 4px 0 6px; }
.gdap-user-list .choice { display: inline-flex; align-items: center; gap: 6px; }
.gdap-user-list.is-locked { opacity: 0.6; }
.grid-span { grid-column: 1 / -1; }

@media (max-width: 900px) {
  .gdap-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gdap-table { width: max(980px, 100%); }
}
.gdap-table .gd-customer { width: 17%; }
.gdap-table .gd-client { width: 13%; }
.gdap-table .gd-roles { width: 19%; }
.gdap-table .gd-status { width: 92px; }
.gdap-table .gd-end { width: 100px; }
.gdap-table .gd-days { width: 92px; }
.gdap-table .gd-extend { width: 96px; }
.gdap-table .gd-open { width: 44px; }

/* GDAP: hide toggle, superseded tag, grouped customers, bulk hide */
.gdap-table .gd-hide { width: 40px; }
.gdap-table td.gdap-hide-cell { padding-left: 6px; padding-right: 0; }
.gdap-eye { width: 26px; height: 26px; color: var(--muted); opacity: 0.45; transition: opacity 0.15s, color 0.15s; }
.gdap-table tr:hover .gdap-eye, .gdap-eye:focus-visible, .gdap-eye.is-hidden { opacity: 1; }
.gdap-eye:hover { color: var(--purple); }
.gdap-eye.is-hidden { color: var(--purple); }
.gdap-table tr.is-hidden td:not(.gdap-hide-cell) { opacity: 0.6; }
.gdap-tag { display: inline-block; margin-right: 2px; padding: 0 6px; border-radius: 999px; background: var(--grey-soft); color: var(--muted); font-size: 0.7143rem; font-weight: 700; letter-spacing: 0.02em; vertical-align: 1px; }
.gdap-table tr.gdap-group-start td { border-top: 2px solid #D1D1D1; }
.gdap-bulk { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-2); margin: calc(-1 * var(--sp-1)) 0 var(--sp-3); }
@media (hover: none) { .gdap-eye { opacity: 1; } }

/* ==== Inventory: inline values, field menu, Add field ==== */
.inv-value { position: relative; display: flex; align-items: flex-start; gap: 4px; }
.inv-value-display { flex: 1; min-width: 0; min-height: 22px; border-radius: 4px; cursor: text; }
.inv-value-display[hidden] { display: none; }
.inv-value:hover .inv-value-display { box-shadow: 0 0 0 4px var(--blue-soft); background: var(--blue-soft); }
.inv-value-edit { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity 0.12s; }
.inv-value-edit .icon { width: 13px; height: 13px; }
.inv-value:hover .inv-value-edit, .inv-value-edit:focus-visible { opacity: 1; }
.inv-value-edit:hover { color: var(--blue); background: var(--blue-soft); }
.inv-value-edit[hidden] { display: none; }
@media (hover: none) { .inv-value-edit { opacity: 1; } }
.inv-empty .inv-add-hint { display: none; color: var(--blue); font-weight: 600; font-size: var(--fs-table); }
.inv-value:hover .inv-empty .muted { display: none; }
.inv-value:hover .inv-empty .inv-add-hint { display: inline; }
.inv-value.is-saved .inv-value-display { animation: saved-flash 1.2s ease-out; }
@keyframes saved-flash { 0% { background: var(--green-soft); box-shadow: 0 0 0 4px var(--green-soft); } 100% { background: transparent; box-shadow: none; } }
.inv-inline-form { flex: 1; min-width: 0; }
.inv-inline-form[hidden] { display: none; }
.inv-inline-row { display: flex; align-items: center; gap: 4px; }
.inv-inline-row > input, .inv-inline-row > select, .inv-inline-row > textarea, .inv-inline-row > .value-secret { flex: 1; min-width: 0; min-height: 30px; padding-top: 4px; padding-bottom: 4px; font-size: var(--fs-table); }
.inv-inline-row .icon-btn { flex: none; width: 28px; height: 28px; }
.inv-inline-save { color: #FFFFFF; background: var(--blue); border-color: var(--blue); }
.inv-inline-save:hover { background: var(--blue-hover); color: #FFFFFF; }
.inv-inline-form .field-error { margin: 4px 0 0; }
.inv-inline-form .checkbox-field { margin-top: 4px; font-weight: 400; }
.value-secret { display: flex; align-items: center; gap: 2px; min-width: 0; }
.value-secret input { flex: 1; min-width: 0; }
.value-secret .icon-btn { width: 28px; height: 28px; }
.value-secret .icon-btn[aria-pressed="true"] { color: var(--blue); }

/* "⋯" menu: compact sections, one Save each */
.field-menu .edit-panel.field-menu-panel { width: min(340px, calc(100vw - 2rem)); padding: 0; display: block; overflow: hidden; }
.field-menu-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-soft); }
.field-menu-head strong { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--indigo); font-size: var(--fs-table); }
.field-menu-head .muted { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-menu-head .icon-btn { width: 26px; height: 26px; flex: none; }
.field-menu-section { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.field-menu-section:last-child { border-bottom: 0; }
.field-menu-label { font-size: 0.7857rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--purple); }
.field-menu-label .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.field-menu-row { display: flex; align-items: center; gap: 6px; }
.field-menu-row > input, .field-menu-row > select, .field-menu-row > textarea, .field-menu-row > .value-secret { flex: 1; min-width: 0; min-height: 30px; padding-top: 4px; padding-bottom: 4px; font-size: var(--fs-table); }
.field-menu-row > .btn { flex: none; }
.field-menu-section .field { gap: 2px; }
.field-menu-section .checkbox-field { font-size: 0.8571rem; }
.field-menu-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; background: var(--surface-soft); }
.field-menu-actions .field-menu-delete { margin-left: auto; }

/* "+ Add field (all records)" */
.add-field-help { margin: 0 0 var(--sp-2); }
.name-warning { display: flex; gap: 8px; padding: 8px 10px; border: 1px solid #D4D4D4; border-radius: var(--radius-sm); background: #F7F7F7; color: #505050; font-size: var(--fs-table); }
.name-warning[hidden] { display: none; }
.name-warning > .icon { flex: none; width: 15px; height: 15px; margin-top: 2px; color: #5C5C66; }
.name-warning .checkbox-field { margin-top: 6px; color: var(--text); }

/* Settings: junk field clean-up */
.card-warning { border-color: #D4D4D4; box-shadow: inset 4px 0 0 #B6B6B6, var(--shadow); }
.junk-list { margin: 0 0 var(--sp-3); padding-left: 1.2rem; font-size: var(--fs-table); }
.junk-list li { margin: 2px 0; }
.value-input { display: grid; gap: 4px; flex: 1; min-width: 0; }
.value-input > input, .value-input > select, .value-input > textarea { width: 100%; min-height: 30px; padding-top: 4px; padding-bottom: 4px; font-size: var(--fs-table); }
.value-input .checkbox-field { font-size: 0.8571rem; font-weight: 400; }
.inv-inline-row, .field-menu-row { align-items: flex-start; }
.field-menu-actions form { display: inline-flex; align-items: center; gap: 4px; margin: 0; }

/* ==== Inventory: extra fields (this record only) and the field popups ==== */
.inv-extras { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px dashed var(--border); }
.extra-tag { flex: none; padding: 0 6px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); font-size: 0.6786rem; font-weight: 700; letter-spacing: 0.02em; text-transform: none; opacity: 0; transition: opacity 0.12s; }
.inv-detail.is-extra:hover .extra-tag, .inv-detail.is-extra:focus-within .extra-tag { opacity: 1; }
@media (hover: none) { .extra-tag { opacity: 1; } }
.extra-badge { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); font-size: 0.7857rem; font-weight: 700; cursor: help; }

/* Field popups (Add field and the "⋯" edit popup) share this layout. */
.field-menu-form { display: block; margin: 0; }
.field-menu-form > label.field-menu-section, .field-menu-form > .field-menu-section { display: grid; gap: 6px; }
.field-menu-form .name-warning { margin: 0 12px 10px; }
.field-menu-save { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.field-menu-panel .value-input input, .field-menu-panel .value-input textarea, .field-menu-panel select, .field-menu-panel input[type="text"] { min-height: 32px; font-size: var(--fs-table); }
.field-scope { flex: 1; min-width: 0; font-size: 0.75rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-scope.is-shared { color: var(--blue); }
.field-scope.is-extra { color: var(--purple); }
.applies-to { border: 0; margin: 0; }
.applies-to legend { padding: 0; margin-bottom: 2px; }
.applies-to .choice { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-table); line-height: 1.35; }
.applies-to .choice input { margin-top: 2px; }
.add-field .edit-panel.field-menu-panel { width: min(360px, calc(100vw - 2rem)); }

/* ==== Stock breakdown: cards, collapsible categories / brands, employee chips ==== */
.bd-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.bd-card { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--c, var(--indigo)); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.bd-card-value { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--c, var(--indigo)); font-variant-numeric: tabular-nums; }
.bd-card-label { font-size: var(--fs-table); color: var(--muted); }
.bd-card-assigned { --c: var(--blue); }
.bd-card-stock { --c: var(--green); }
.bd-card-repair { --c: #5C5C66; }
.bd-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.bd-toolbar .list-search { flex: 1 1 320px; margin: 0; }
.bd-toggle-all { display: flex; gap: 4px; }

details.breakdown-cat { padding: 0; overflow: hidden; margin-bottom: var(--sp-3); }
.bd-cat-head { display: flex; align-items: center; gap: var(--sp-2); padding: 12px 16px; cursor: pointer; list-style: none; }
.bd-cat-head::-webkit-details-marker { display: none; }
.bd-cat-head h2 { margin: 0; font-size: 1.05rem; }
.bd-cat-head .chip { margin-left: auto; }
details.breakdown-cat[open] > .bd-cat-head { border-bottom: 1px solid var(--border); }
.bd-chevron { display: inline-flex; color: var(--muted); transition: transform 0.15s; }
.bd-chevron .icon { width: 14px; height: 14px; }
details.breakdown-cat:not([open]) > .bd-cat-head .bd-chevron { transform: rotate(-90deg); }
.bd-instock { font-size: var(--fs-table); color: var(--muted); font-weight: 600; white-space: nowrap; }
.bd-instock.has-stock { color: var(--green); }
details.breakdown-cat .table-wrap { margin: 0; border: 0; border-radius: 0; }

.breakdown-table { table-layout: fixed; width: 100%; }
.breakdown-table .bd-brand-col { width: 110px; }
.breakdown-table .bd-model-col { width: 26%; }
.breakdown-table .bd-num-col { width: 64px; }
.breakdown-table .bd-avail-col { width: 96px; }
.breakdown-table td, .breakdown-table th { padding-top: 6px; padding-bottom: 6px; }
.breakdown-table tbody tr.model-row td { height: auto; }
.breakdown-table td.num, .breakdown-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.breakdown-table .brand-row td { padding: 0; background: var(--surface-soft); border-top: 1px solid var(--border); }
.bd-brand-toggle { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 12px; border: 0; background: transparent; font: inherit; font-size: var(--fs-table); color: var(--text); text-align: left; cursor: pointer; }
.bd-brand-toggle strong { color: var(--indigo); }
.bd-brand-toggle:hover { background: var(--blue-soft); }
.bd-brand-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.bd-brand.is-collapsed .bd-brand-toggle .bd-chevron { transform: rotate(-90deg); }
.bd-brand.is-collapsed tr.model-row { display: none; }
.breakdown.is-searching .bd-brand.is-collapsed tr.model-row:not([hidden]) { display: table-row; }
.breakdown-table .group-row td { padding: 8px 12px; }
.bd-avail { display: inline-block; min-width: 28px; padding: 0 6px; border-radius: 999px; background: var(--grey-soft); color: var(--muted); font-weight: 700; text-align: center; }
.bd-avail.has-stock { background: var(--green-soft); color: var(--green); }
/* Employees: chips that wrap, so every name shows. */
.breakdown-table td.bd-people { white-space: normal; overflow: visible; text-overflow: clip; }
.bd-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.bd-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 1px 8px 1px 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 0.8214rem; line-height: 1.6; }
.bd-chip:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.bd-chip .avatar { width: 18px; height: 18px; font-size: 0.5rem; }
.bd-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-count { color: var(--muted); font-weight: 700; }
.bd-instock-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 0.7857rem; font-weight: 700; }
@media (max-width: 900px) {
  .bd-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breakdown-table { width: max(720px, 100%); }
}

/* ==== Stock: Brands & models ==== */
.brands-layout { align-items: start; }
details.brands-cat { padding: 0; overflow: hidden; margin-bottom: var(--sp-3); }
details.brands-cat:not([open]) > .bd-cat-head .bd-chevron { transform: rotate(-90deg); }
details.brands-cat[open] > .bd-cat-head { border-bottom: 1px solid var(--border); }
.brands-list { list-style: none; margin: 0; padding: 4px 0; }
.brands-brand { padding: 6px 16px; }
.brands-brand + .brands-brand { border-top: 1px solid var(--border); }
.brands-row { display: flex; align-items: center; gap: 8px; }
.brands-row strong { color: var(--indigo); }
.brands-action { margin-left: auto; opacity: 0.7; }
.brands-brand:hover .brands-action { opacity: 1; }
.brands-models { list-style: none; margin: 4px 0 2px; padding: 0 0 0 14px; display: grid; gap: 2px; font-size: var(--fs-table); }
.brands-models li { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.brands-model-action { margin-left: auto; font-size: 0.7857rem; opacity: 0; }
.brands-models li:hover .brands-model-action, .brands-model-action:focus-visible { opacity: 1; }
@media (hover: none) { .brands-model-action { opacity: 1; } }
.brands-form { position: sticky; top: var(--sp-4); }
.brands-arrow { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-table); }
.brands-arrow .icon { width: 14px; height: 14px; }
.chip-merge { background: var(--purple-soft); color: var(--purple); }
.card-narrow-wide { max-width: 900px; }

/* ==== Popovers in a top-level layer (see "Inline edit popovers" in app.js) ==== */
#popover-layer { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
#popover-layer .popover-wrap { position: static; display: block; width: 0; height: 0; margin: 0; padding: 0; }
.edit-panel.is-floating { position: fixed; z-index: 1001; margin: 0; pointer-events: auto; visibility: visible; animation: pop-in 0.16s ease-out both; text-transform: none; letter-spacing: normal; font-weight: 400; white-space: normal; text-align: left; overscroll-behavior: contain; }
.edit-panel.is-floating.is-above { animation-name: pop-in-up; }
@keyframes pop-in-up { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
/* One frame before it floats (measuring): never shown clipped in place. */
.js .edit[open] > .edit-panel:not(.is-floating) { visibility: hidden; }

/* ==== Call Switch One billing ==== */
.cs1-tabs { margin-bottom: var(--sp-4); overflow-y: hidden; }
.cs1-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.cs1-card { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--c, var(--indigo)); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.cs1-card-value { font-family: var(--font-head); font-size: 1.45rem; font-weight: 700; line-height: 1.15; color: var(--c, var(--indigo)); font-variant-numeric: tabular-nums; }
.cs1-card-label { font-size: var(--fs-table); color: var(--text); font-weight: 600; }
.cs1-card .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs1-card-excluded { --c: var(--grey); }
.cs1-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.cs1-toolbar-right { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.cs1-unknown-note { display: inline-flex; align-items: center; gap: 4px; color: #5C5C66; font-size: var(--fs-table); font-weight: 600; }
.cs1-unknown-note .icon { width: 14px; height: 14px; }
.cs1-table .cs1-money { width: 120px; }
.cs1-table .cs1-incl { width: 120px; }
.cs1-table td.num, .cs1-table th.num, .cs1-history td.num, .cs1-history th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cs1-table tr.is-excluded td { color: var(--muted); }
.cs1-table tr.is-unknown td:first-child { background: #F7F7F7; }
.cs1-table td.cs1-name-cell { overflow: visible; }
.cs1-table code, .cs1-unknown-list code, .table code { font-size: 0.8571rem; background: var(--grey-soft); padding: 1px 6px; border-radius: 4px; }
.cs1-addname { display: flex; align-items: center; gap: 4px; margin: 0; }
.cs1-addname input[type="text"] { min-height: 28px; height: 28px; padding: 2px 8px; font-size: var(--fs-table); max-width: 220px; border-color: #B6B6B6; }
.cs1-addname .icon-btn { width: 28px; height: 28px; }
.cs1-table td.cs1-charge-cell { overflow: visible; }
.cs1-override { display: inline-block; }
.cs1-charge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 6px; cursor: pointer; font-variant-numeric: tabular-nums; font-weight: 600; }
.cs1-charge .icon { width: 12px; height: 12px; opacity: 0; color: var(--muted); }
.cs1-charge:hover { background: var(--blue-soft); }
.cs1-charge:hover .icon, .cs1-charge:focus-visible .icon { opacity: 1; }
.cs1-charge.is-overridden { background: var(--purple-soft); color: var(--purple); }
.cs1-charge.is-overridden .icon { opacity: 1; color: var(--purple); }
.cs1-include { margin: 0; }
.cs1-include-select { height: 28px; min-height: 28px; padding: 2px 6px; font-size: var(--fs-table); font-weight: 600; width: 100%; }
.cs1-include-select.is-yes { color: var(--green); }
.cs1-include-select.is-no { color: var(--muted); }
.cs1-table tfoot td { font-variant-numeric: tabular-nums; border-top: 2px solid var(--border); background: var(--surface-soft); }
.cs1-preview { margin: 0 0 var(--sp-3); padding: 12px 14px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-soft); overflow-x: auto; }
.cs1-preview-table { border-collapse: collapse; font-family: Calibri, Arial, sans-serif; font-size: 11pt; }
.cs1-preview-table th, .cs1-preview-table td { padding: 4px 10px; border: 1px solid #D9D9D9; background: #FFFFFF; }
.cs1-preview-table th { background: #F2F2F2; text-align: left; }
.cs1-preview-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cs1-danger { display: flex; justify-content: flex-end; padding: 10px 14px; }
.cs1-history .cs1-history-actions { width: 112px; text-align: right; white-space: nowrap; }
.cs1-history-actions .icon-btn { width: 30px; height: 30px; }
.cs1-row-actions { display: flex; justify-content: flex-end; gap: 2px; overflow: visible; }
.cs1-unknown-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cs1-unknown-list .cs1-addname code { flex: none; }
.cs1-steps { margin: 0 0 var(--sp-3); padding-left: 1.1rem; display: grid; gap: 4px; }
.cs1-subhead { font-size: 0.8571rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--indigo); margin: var(--sp-3) 0 6px; }
.cs1-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-table); }
.cs1-recent li { display: flex; justify-content: space-between; gap: 8px; }
.cs1-h2 { margin: 0; }
.cs1-replace.is-attention { padding: 6px 10px; border-radius: var(--radius-sm); background: #F7F7F7; border: 1px solid #B6B6B6; color: #4F4F4F; font-weight: 600; }
@media (max-width: 900px) { .cs1-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cs1-table { width: max(720px, 100%); } }

/* ==== Call Switch One customers ==== */
.cs1-sync { display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; margin: 0 0 var(--sp-3); padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: var(--fs-table); }
.cs1-sync > .icon { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--green); }
.cs1-sync > span { flex: 1; min-width: 0; }
.cs1-sync.is-failed { border-color: #C3C3C3; background: var(--red-soft); color: var(--red); }
.cs1-sync.is-failed > .icon, .cs1-sync.is-off > .icon { color: currentColor; }
.cs1-sync.is-off { border-color: #D6D6D6; background: #F7F7F7; color: #4F4F4F; }
.cs1-fields { flex-basis: 100%; color: var(--muted); }
.cs1-fields summary { cursor: pointer; font-size: 0.8571rem; }
.cs1-fields code { display: block; margin-top: 4px; white-space: normal; word-break: break-word; font-size: 0.8214rem; }
.cs1-filters { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.cs1-filters select { width: auto; min-width: 150px; height: var(--pill-h); min-height: var(--pill-h); padding: 2px 8px; font-size: var(--fs-table); }
.cs1-search { position: relative; flex: 1 1 260px; max-width: 360px; }
.cs1-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.cs1-search input { width: 100%; padding-left: 32px; border-radius: 999px; }
.cs1-count { margin-left: auto; }
.cs1-customers .c-reg { width: 86px; }
.cs1-customers .c-status { width: 120px; }
.cs1-customers .c-holder { width: 8%; }
.cs1-customers .c-store { width: 84px; }
.cs1-customers .c-id { width: 104px; }
.cs1-customers .c-email { width: 10%; }
.cs1-customers .c-phone { width: 100px; }
.cs1-customers .c-users { width: 62px; }
.cs1-customers .c-numbers { width: 78px; }
.cs1-customers .c-client { width: 8%; }
.cs1-customers .cs1-cust-actions { width: 58px; }
.cs1-customers th { font-size: 0.7857rem; }
.cs1-customers th, .cs1-customers td { padding-left: 6px; padding-right: 6px; }
.cs1-customers td code { padding: 1px 4px; }
.cs1-customers .status-pill { padding: 2px 7px; }
.cs1-customers .sort-arrow { margin-left: 2px; }
.cs1-customers .cs1-row-actions { gap: 0; }
.cs1-customers td.num, .cs1-customers th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cs1-customers tr.is-removed td { color: var(--muted); }
.cs1-customers tr.is-removed td strong { font-weight: 500; text-decoration: line-through; }
.cs1-customers tr.is-unknown td:nth-child(3) { background: #F7F7F7; }
.status-pill.is-ok { background: var(--green-soft); color: var(--green); }
.status-pill.is-bad { background: var(--red-soft); color: var(--red); }
.status-pill.is-muted { background: var(--grey-soft); color: var(--muted); }
@media (max-width: 900px) { .cs1-customers { width: max(1100px, 100%); } }
.cs1-sync-details { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 6px 0 0; font-size: 0.8571rem; }
.cs1-sync-details dt { font-weight: 600; color: var(--text); }
.cs1-sync-details dd { margin: 0; min-width: 0; }
.cs1-sync-details code { display: inline; margin: 0; }
.cs1-refresh { margin-bottom: var(--sp-3); }
.cs1-refresh > summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; list-style: none; }
.cs1-refresh > summary::-webkit-details-marker { display: none; }
.cs1-refresh > summary .icon { width: 15px; height: 15px; color: var(--blue); }
.cs1-refresh[open] > summary { margin-bottom: var(--sp-3); }
.cs1-paste { font-family: Consolas, Menlo, monospace; font-size: 0.8571rem; min-height: 110px; }
.cs1-export-import { margin-top: var(--sp-3); }
.cs1-export-import > summary { cursor: pointer; }
/* Customers: status pills (Active green, Locked amber, Ceased grey, Removed red, New blue). */
.status-pill.is-warn { background: #F5F5F5; color: #5C5C66; }
.status-pill.is-info { background: var(--blue-soft); color: var(--blue); }
.cs1-topline { display: grid; gap: 4px; margin: 0 0 var(--sp-3); padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: var(--fs-table); }
.cs1-topline p { margin: 0; }
.cs1-topline-counts { font-size: 0.9286rem; }
.cs1-topline-run { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px; }
.cs1-topline-run > .icon { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--muted); }
.cs1-topline-run > span { flex: 1; min-width: 0; }
.cs1-topline-run.is-failed { color: var(--red); }
.cs1-topline-run.is-failed > .icon { color: var(--red); }
.cs1-unknown > summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; }
.cs1-unknown[open] > summary { margin-bottom: var(--sp-2); }
.cs1-unknown .count-badge { display: inline-block; min-width: 20px; padding: 0 7px; border-radius: 999px; background: #F5F5F5; color: #5C5C66; font-size: 0.7857rem; font-weight: 700; text-align: center; }

/* ==== Articles: inline editing on the article page ==== */
.kb-inline-on .kb-title { cursor: text; border-radius: 6px; padding: 0 4px; margin-left: -4px; }
.kb-inline-on .kb-title:hover, .kb-inline-on .kb-title:focus-visible { background: var(--blue-soft); outline: none; }
.kb-title-input { width: 100%; max-width: 720px; font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; color: var(--indigo); height: auto; padding: 2px 8px; }
.kb-category { position: relative; display: inline-block; }
.kb-category-btn { border: 0; cursor: pointer; font: inherit; }
.kb-category-btn .kb-caret { margin-left: 4px; font-size: 0.7em; opacity: 0.7; }
.kb-category-btn:hover { filter: brightness(0.96); }
.kb-category-menu { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 220px; max-height: 320px; overflow: auto; padding: 6px; box-shadow: 0 10px 30px rgba(9, 9, 9, 0.18); }
.kb-category-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; }
.kb-category-list button { width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; font: inherit; font-size: var(--fs-table); cursor: pointer; }
.kb-category-list button:hover, .kb-category-list button:focus-visible { background: var(--blue-soft); outline: none; }
.kb-category-list button.is-current { font-weight: 700; color: var(--purple); }
.kb-category-new { display: flex; gap: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.kb-category-new input { flex: 1; min-width: 0; height: 30px; min-height: 30px; font-size: var(--fs-table); }
.kb-section-head { display: flex; align-items: center; gap: 8px; }
.kb-section-head h2 { margin-right: auto; }
.kb-pencil { display: none; opacity: 0; transition: opacity 0.15s; }
.kb-inline-on .kb-pencil { display: inline-flex; }
.kb-inline-on .kb-section:hover .kb-pencil, .kb-pencil:focus-visible { opacity: 1; }
.kb-section.is-editing .kb-pencil { display: none; }
.kb-inline-on .kb-view { cursor: text; border-radius: 6px; margin: -4px; padding: 4px; transition: background 0.15s; }
.kb-inline-on .kb-view:hover { background: var(--surface-soft); }
.kb-placeholder { color: var(--muted); font-style: italic; }
.kb-editor { display: grid; gap: 6px; }
.kb-editor textarea { min-height: 140px; resize: vertical; font-family: Consolas, Menlo, monospace; font-size: 0.9286rem; line-height: 1.5; }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); }
.md-toolbar button { border: 0; background: transparent; padding: 3px 8px; border-radius: 4px; font: inherit; font-size: 0.8571rem; color: var(--text); cursor: pointer; }
.md-toolbar button:hover, .md-toolbar button:focus-visible { background: var(--surface); outline: none; box-shadow: 0 0 0 1px var(--border); }
.kb-attachments { position: relative; }
.kb-add-files { flex: none; }
.kb-file-actions { opacity: 0; transition: opacity 0.15s; }
.media-card:hover .kb-file-actions, .file-row:hover .kb-file-actions, .kb-file-actions:focus-within { opacity: 1; }
@media (hover: none) { .kb-file-actions { opacity: 1; } }
.kb-drop-hint { display: none; position: absolute; inset: 0; z-index: 5; border: 2px dashed var(--blue); border-radius: var(--radius); background: rgba(242, 242, 242, 0.92); color: var(--blue); font-weight: 700; align-items: center; justify-content: center; gap: 8px; pointer-events: none; }
.kb-attachments.is-dragging .kb-drop-hint { display: flex; }
.kb-uploads { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.kb-uploads:not(:empty) { margin-bottom: var(--sp-3); }
.kb-upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: var(--fs-table); transition: opacity 0.3s; }
.kb-upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.kb-upload progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--blue); }
.kb-upload-status { grid-column: 1 / -1; color: var(--muted); }
.kb-upload.is-done { border-color: #D6D6D6; }
.kb-upload.is-done .kb-upload-status { color: var(--green); }
.kb-upload.is-failed { border-color: #C3C3C3; background: var(--red-soft); }
.kb-upload.is-failed .kb-upload-status { color: var(--red); }
.toast-error { grid-template-columns: auto 1fr; align-items: center; border-left-color: var(--red); font-weight: 600; }
.toast-error .toast-icon { color: var(--red); }

/* ==========================================================================
   Design system (black and white). Shell, components, dashboard, board, journey.
   Later rules win over the older ones above; colours only through the tokens.
   ========================================================================== */

/* ---- Base ---- */
html { font-size: 14px; }
body { background: var(--ground); color: var(--ink); font-family: var(--font-body); font-size: 1rem; line-height: 1.5; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 34px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 17.5px; }
h3 { font-size: 15px; }
h4 { font-size: 14px; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { color: var(--ink); text-decoration-color: var(--ink); }
.card a, .table a, .crumbs a, .menu a, .pillnav a, .rail a, .btn, .tcard a, .tile, .stack-item, .board-more, .filters a, .tabs a, .segmented a, .link-more, .notice, .other-services a { text-decoration: none; }
.table td a:hover, .card p a:hover, .crumbs a:hover { text-decoration: underline; }
::selection { background: var(--ink); color: #FFFFFF; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn:focus-visible, .icon-btn:focus-visible, .check-btn:focus-visible, .filters a:focus-visible, .edit > summary:focus-visible,
.round-btn:focus-visible, .rail-btn:focus-visible, .pill-item:focus-visible, .avatar-btn:focus-visible, .menu-item:focus-visible, .tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.muted { color: var(--muted); }
code { background: var(--grey-soft); border-radius: 8px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 2000; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #FFFFFF; font-weight: 700; }
.skip-link:focus { top: 12px; }
.skip-link:hover, .skip-link:focus, .skip-link:focus-visible { color: #FFFFFF; } /* never the generic link colour (black on its black pill) */
.big-num { font-family: var(--font-head); font-weight: 700; font-size: 44px; line-height: 1; letter-spacing: -0.02em; color: inherit; }

/* ---- Shell: ground, one rounded surface, top bar, quick-action rail ---- */
body.is-app { min-height: 100vh; }
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "top top" "rail main";
  min-height: calc(100vh - 40px);
  margin: 20px;
  background: var(--surface-main);
  border-radius: var(--radius-surface);
}
.app-bare { display: block; margin: 0; background: none; border-radius: 0; min-height: 100vh; }
.topbar {
  grid-area: top;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px 8px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface-main);
  border-radius: var(--radius-surface) var(--radius-surface) 0 0;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 0; }
.brand-logo { display: block; height: 36px; width: auto; max-width: 150px; }
.brand-mark { display: block; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #FFFFFF; }
.brand-mark-lg { width: 56px; height: 56px; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; color: var(--ink); }
.brand-sub { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.pillnav { min-width: 0; display: flex; justify-content: center; }
.pillnav-track {
  list-style: none; margin: 0; padding: 4px; display: flex; align-items: center; gap: 2px;
  background: var(--ground); border-radius: 999px; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
}
.pillnav-track::-webkit-scrollbar { display: none; }
.pillnav-track > li { flex: none; position: relative; }
.pill-item {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2);
  font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.pill-item:hover { background: #FFFFFF; color: var(--ink); }
.pill-item.is-active { background: var(--ink); color: #FFFFFF; }
.pill-caret .icon { width: 13px; height: 13px; transition: transform 0.2s; }
[data-menu].is-open > .pill-item .pill-caret .icon { transform: rotate(180deg); }

.menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; min-width: 210px;
  padding: 8px; display: grid; gap: 2px;
  background: #FFFFFF; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: pop-in 0.16s ease-out both;
}
.menu-right { left: auto; right: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 12px;
  border: 0; border-radius: var(--radius-item); background: transparent; color: var(--ink);
  font: inherit; font-weight: 600; font-size: 13.5px; text-align: left; cursor: pointer; text-decoration: none;
}
.menu-item:hover { background: var(--surface-main); color: var(--ink); text-decoration: none; }
.menu-item.is-active { background: var(--ink); color: #FFFFFF; }
.menu-item .icon { color: var(--muted); }
.menu-item.is-active .icon { color: #FFFFFF; }
.menu-form { margin: 0; }
.menu-who { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.menu-who strong { display: block; line-height: 1.2; }
.menu-who .small { display: block; }

.topbar-tools { display: flex; align-items: center; gap: 8px; }
.tool { position: relative; }
.round-btn, .avatar-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border-radius: 50%; border: 1px solid var(--border); background: #FFFFFF; color: var(--ink); cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.round-btn:hover { border-color: var(--border-strong); background: #FFFFFF; transform: translateY(-1px); }
.round-btn .icon { width: 19px; height: 19px; }
.avatar-btn { border: 0; background: transparent; }
.avatar-btn .avatar { width: 44px; height: 44px; font-size: 14px; }
.search-pop { width: min(380px, calc(100vw - 32px)); padding: 10px; }
.search-pop-form { display: flex; gap: 8px; }
.search-pop-form input { flex: 1; min-width: 0; }

/* Notifications bell: the red dot with the count is the notification colour. */
.bell { margin: 0; }
.bell-button { width: 44px; height: 44px; color: var(--ink); }
.bell-button .icon { width: 19px; height: 19px; }
.bell-count { top: -2px; right: -2px; background: var(--red); color: #FFFFFF; box-shadow: 0 0 0 2px var(--surface-main); }
.bell-panel { left: auto; right: 0; top: calc(100% + 8px); border-radius: var(--radius); padding: 14px; }
.notice { border-radius: var(--radius-item); background: var(--surface-main); }
.notice:hover { background: var(--grey-soft); }
.bell-group-due .notice { background: var(--grey-soft); }
.bell-group-missed .notice { background: var(--red-soft); }

.rail { grid-area: rail; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 0 24px; position: sticky; top: 76px; align-self: start; }
.rail-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border-radius: 50%; border: 1px solid var(--border); background: #FFFFFF; color: var(--ink); cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.rail-btn:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.rail-btn .icon { width: 19px; height: 19px; }
.rail-primary { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.rail-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.rail-btn[data-tip]::after, .rail-btn[data-tip]::before { opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; }
.rail-btn[data-tip]::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translate(-4px, -50%);
  padding: 6px 10px; border-radius: 10px; background: var(--ink); color: #FFFFFF; font-size: 12.5px; font-weight: 600; white-space: nowrap; z-index: 70;
}
.rail-btn[data-tip]:hover::after, .rail-btn[data-tip]:focus-visible::after { opacity: 1; transform: translate(0, -50%); }

.main {
  grid-area: main; min-width: 0; width: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: 16px 28px 40px 8px;
}
.app-bare .main { max-width: none; padding: 0; }

/* ---- Page structure ---- */
.page-head { margin-bottom: 20px; align-items: flex-end; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px !important; }
.crumbs a { color: var(--muted); }
.actions { align-items: center; }
.section-head h2 { font-size: 17.5px; }

/* ---- Cards and panels ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: none; margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 24px; margin-bottom: 20px; }
.panel h2 { font-size: 17.5px; }
.panel-dark { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.panel-dark h2, .panel-dark a:not(.btn) { color: #FFFFFF; }
.card.is-inverted, .tcard.is-inverted { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.card.is-inverted h2, .card.is-inverted h3, .card.is-inverted a:not(.btn) { color: #FFFFFF; }
.card.is-inverted .muted { color: #C9CAD1; }
.card-head h2 a { color: var(--ink); }
.card { transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease; }
@media (hover: hover) {
  a.card:hover, .category-grid > .card:hover, .cs-grid > .card:hover, .tcard:hover, .tile:hover, .stat:hover,
  .gdap-card:hover, a.cs1-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
}
a.card { display: block; color: inherit; }
.grid-2 { gap: 20px; }

/* ---- Buttons ---- */
.btn {
  min-height: var(--control-h); padding: 0 20px; gap: 8px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: #FFFFFF; color: var(--ink);
  font-size: 14px; font-weight: 700; box-shadow: none;
}
.btn:hover { border-color: var(--ink); color: var(--ink); background: #FFFFFF; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #FFFFFF; box-shadow: none; }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); color: #FFFFFF; transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.btn-secondary { background: var(--ground); border-color: var(--ground); color: var(--ink); }
.btn-secondary:hover { background: #DCDDE2; border-color: #DCDDE2; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--ground); border-color: var(--ground); color: var(--ink); }
.btn-light { background: #FFFFFF; border-color: #FFFFFF; color: var(--ink); }
.btn-light:hover { background: var(--ground); border-color: var(--ground); }
.btn-danger { color: var(--red); border-color: var(--border-strong); }
.btn-danger:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #FFFFFF; }
.btn-danger-solid:hover { background: #B42318; border-color: #B42318; color: #FFFFFF; }
.btn-small { min-height: var(--control-sm); padding: 0 14px; font-size: 13px; }
.btn .icon { width: 16px; height: 16px; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; color: var(--ink-2); }
.icon-btn:hover { background: var(--ground); color: var(--ink); }
.icon-btn-danger:hover { background: var(--red-soft); color: var(--red); }
.segmented { display: inline-flex; padding: 4px; gap: 2px; background: var(--ground); border-radius: 999px; }
.segmented a { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; color: var(--ink-2); font-weight: 700; font-size: 13.5px; }
.segmented a:hover { background: #FFFFFF; color: var(--ink); }
.segmented a.is-active { background: var(--ink); color: #FFFFFF; }

/* ---- Forms ---- */
.field > span, .field > label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="search"],
input[type="number"], input[type="url"], input[type="date"], input[type="time"], select, textarea {
  min-height: var(--control-h); border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: #FFFFFF; color: var(--ink); padding: 8px 14px; font-size: 14px;
}
textarea { padding: 10px 14px; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: var(--grey); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
select { appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230B0B0F' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
select[multiple] { background-image: none; padding-right: 14px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 17px; height: 17px; }
.search-field input[type="search"] { padding-left: 38px; border-radius: 999px; }
.search-field .icon { left: 14px; }
.flash { border-radius: var(--radius-item); padding: 12px 16px; font-weight: 600; }
.flash-success, .flash-info { background: #FFFFFF; color: var(--ink); border-color: var(--border); }
.flash-error { background: var(--red-soft); color: #9F1C12; border-color: #F5C2BC; }
.field-error, .is-error { color: var(--red); }

/* ---- Badges, status pills, chips ---- */
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1.5px solid transparent; }
.badge-open { background: transparent; color: var(--ink); border-color: var(--ink); }
.badge-open::before { content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--ink); }
.badge-customer_waiting { background: var(--ink-2); color: #FFFFFF; }
.badge-closed { background: var(--ground); color: var(--muted); }
.badge-you { background: var(--ground); color: var(--ink); }
.chip { border-radius: 999px; background: var(--ground); color: var(--ink-2); font-weight: 600; }
.chip-category, .chip-stage { background: var(--ground); color: var(--ink); }
.chip-due { background: var(--ink); color: #FFFFFF; }
.status-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1.5px solid transparent; }
.status-pill.is-ok, .status-pill.is-active { background: transparent; color: var(--ink); border-color: var(--ink); }
.status-pill.is-warn { background: var(--ink-2); color: #FFFFFF; }
.status-pill.is-muted, .status-pill.is-inactive { background: var(--ground); color: var(--muted); }
.status-pill.is-bad { background: var(--ink); color: #FFFFFF; }
.status-pill.is-info { background: #FFFFFF; color: var(--ink); border-color: var(--border-strong); }
.count-chip, .count-badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: #FFFFFF; font-size: 12px; font-weight: 700; }

/* ---- Filter pills and tabs (one track, active = black) ---- */
.filters { gap: 2px; padding: 4px; background: var(--ground); border-radius: 999px; display: inline-flex; flex-wrap: wrap; margin-bottom: 12px; }
.filters a { height: var(--pill-h); padding: 0 14px; border: 0; border-radius: 999px; color: var(--ink-2); font-weight: 700; font-size: 13px; gap: 6px; background: transparent; }
.filters a:hover { background: #FFFFFF; color: var(--ink); }
.filters a.active { background: var(--ink); color: #FFFFFF; }
.filters .count { opacity: 0.6; font-weight: 600; }
.filters-priority a.active[class*="filter-priority-"] { color: #FFFFFF; background: var(--ink); border-color: var(--ink); }
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; margin: 0 0 20px; background: var(--ground); border: 0; border-radius: 999px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border: 0; border-radius: 999px; color: var(--ink-2); font-weight: 700; font-size: 13.5px; margin: 0; }
.tabs a:hover { background: #FFFFFF; color: var(--ink); }
.tabs a.active, .tabs a[aria-current="page"] { background: var(--ink); color: #FFFFFF; border: 0; }
.tabs a .count { background: rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 0 6px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.filter-row .filters { margin-bottom: 0; }
.filter-field { min-width: 180px; }
.filter-field select, .filter-field .combobox-input { min-height: 40px; border-radius: 999px; }
.filter-search { flex: 1 1 220px; max-width: 340px; }
.filter-search input[type="search"] { min-height: 40px; }

/* ---- Tables ---- */
.table th { background: var(--surface); font-size: 11px; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; height: 38px; }
.table td { height: 44px; }
.table tbody tr:nth-child(even) { background: transparent; }
.table tbody tr:hover { background: var(--surface-main); }
.table .row-actions, .table td.row-actions > * { opacity: 0; transition: opacity 0.15s; }
.table tr:hover .row-actions, .table tr:hover td.row-actions > *, .table .row-actions:focus-within, .table td.row-actions > :focus-within { opacity: 1; }
@media (hover: none) { .table .row-actions, .table td.row-actions > * { opacity: 1; } }
.sort-link:hover { color: var(--ink); }
.sort-link.is-sorted, .sort-link.is-sorted .sort-arrow { color: var(--ink); }
.ticket-row-urgent { background: none; }

/* ---- Priority LEDs (the only colour): one shared 1.6s pulse ---- */
:root { --led-pulse: 1.6s; }
.led { --led: var(--grey); display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--led); box-shadow: 0 0 3px var(--led), 0 0 7px var(--led); animation: led-pulse var(--led-pulse) ease-in-out infinite; }
.led-low { --led: var(--led-low); }
.led-normal { --led: var(--led-normal); }
.led-high { --led: var(--led-high); }
.led-urgent { --led: var(--led-urgent); }
.led-sort { --led: var(--border-strong); box-shadow: none; animation: none; }
.priority { background: none; box-shadow: none; animation: none; padding: 0; gap: 7px; color: var(--ink-2); font-weight: 700; font-size: 13px; }
.priority .icon { display: none; }
.priority.is-dot-only { gap: 0; }
.priority-dot { animation-duration: var(--led-pulse); }
.ticket-row td:first-child::before { animation-duration: var(--led-pulse); }
.pill-select.priority-select, .pill-select.status-select { background-color: #FFFFFF; color: var(--ink); border: 1px solid var(--border-strong); }
@media (prefers-reduced-motion: reduce) { .led { animation: none !important; } }

/* ---- Avatars and stacks ---- */
.avatar { border-radius: 50%; }
.avatar-initials { color: #FFFFFF; font-weight: 700; }
.avatar-empty { display: inline-grid; place-items: center; background: var(--ground); color: var(--muted); font-weight: 700; }
.avatar-lg { box-shadow: 0 0 0 4px #FFFFFF; }
.avatar-stack { display: flex; align-items: center; padding-left: 10px; }
.stack-item { position: relative; margin-left: -10px; border-radius: 50%; box-shadow: 0 0 0 3px var(--surface-main); transition: transform 0.15s; }
.stack-item:hover { transform: translateY(-3px); z-index: 2; }
.stack-item .avatar { display: block; }
.stack-count { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--ink); color: #FFFFFF; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--surface-main); }
.stack-more { display: inline-grid; place-items: center; width: 40px; height: 40px; background: var(--ground); color: var(--ink); font-weight: 700; font-size: 13px; }

/* ---- Popovers, dialogs, toasts, combobox, date picker, progress ---- */
.edit-panel, #popover-layer .edit-panel { border-radius: var(--radius); border: 1px solid var(--border); background: #FFFFFF; box-shadow: var(--shadow-lg); }
.dialog { border-radius: var(--radius-panel); border: 1px solid var(--border); padding: 24px; box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(11, 11, 15, 0.42); backdrop-filter: blur(3px); }
.toast { border-radius: var(--radius); border: 0; border-left: 0; background: var(--ink); color: #FFFFFF; box-shadow: var(--shadow-lg); }
.toast .toast-icon, .toast-saved .toast-icon { color: #FFFFFF; }
.toast .notice-title, .toast .muted { color: #FFFFFF; }
.toast .btn { background: #FFFFFF; color: var(--ink); border-color: #FFFFFF; }
.toast .btn-ghost { background: transparent; color: #FFFFFF; border-color: rgba(255, 255, 255, 0.35); }
.toast-error { background: #FFFFFF; color: var(--ink); border: 1px solid var(--border); border-left: 4px solid var(--red); }
.toast-error .toast-icon { color: var(--red); }
.combobox-list, .mention-list, .date-pop, .time-list, .multi-panel { border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-lg); background: #FFFFFF; }
.combobox-list li.is-active, .combobox-option.is-active, .mention-list li.is-active, .time-list .is-active { background: var(--ink); color: #FFFFFF; }
.date-pop .is-selected, .date-pop [aria-selected="true"], .date-pop .is-today { border-radius: 10px; }
.date-pop .is-selected, .date-pop [aria-selected="true"] { background: var(--ink); color: #FFFFFF; }
.progress { height: 8px; border-radius: 999px; background: var(--ground); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--w, 0%); border-radius: 999px; background: var(--ink); transform-origin: left center; animation: grow-x 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: 0.15s; }
.progress-lg { height: 10px; width: min(320px, 100%); }
.progress-light { background: rgba(255, 255, 255, 0.2); }
.progress-light > span { background: #FFFFFF; }
.history summary { color: var(--ink); }
.history-action { background: var(--ground); color: var(--ink-2); border-radius: 999px; }
.record-meta { color: var(--muted); }
.report-toggle > summary { color: var(--ink); }

/* ---- Big numbers in summary tiles on every page ---- */
.stat-value, .cs1-card-value, .gdap-card-value, .bd-card-value, .inv-card-value, .summary-value { font-family: var(--font-head); font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.stat, .cs1-card, .gdap-card { border-radius: var(--radius); border: 1px solid var(--border); background: #FFFFFF; box-shadow: none; }
.cs1-card { border-left: 1px solid var(--border); }
.cs1-card-value, .gdap-card-value { font-size: 30px; }

/* ---- Dashboard ---- */
.dash-head { align-items: flex-end; }
.dash-date { margin: 0 0 4px !important; color: var(--muted); font-weight: 700; font-size: 13px; }
.dash-people { display: flex; align-items: center; gap: 14px; }
.dash-people-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.summary { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.summary h2 { margin: 0; font-size: 15px; }
.summary-chart, .summary-gauge { min-width: 0; }
.summary-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chart-legend { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.chart-legend strong { color: var(--ink); margin-right: 8px; }
.legend-key { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.key-opened, .bar-opened { background: repeating-linear-gradient(135deg, #CFD0D6 0 3px, #EDEEF2 3px 7px); }
.key-closed, .bar-closed { background: var(--ink); }
.bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; height: 190px; align-items: end; }
.bar-day { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 8px; }
.bar-pair { display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 100%; padding: 0 4px; border-radius: var(--radius-item); }
.bar-day.is-today .bar-pair { background: var(--surface-main); }
.bar { position: relative; width: min(26px, 40%); height: var(--h); min-height: 4px; border-radius: 9px 9px 5px 5px; transform-origin: bottom; animation: bar-grow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: var(--d, 0ms); }
.bar-num { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); padding: 0 2px; border-radius: 4px; background: #FFFFFF; font-size: 11px; font-weight: 700; color: var(--ink-2); } /* on the white card above the bar; the solid background keeps it measurable */
.bar-label { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.bar-day.is-today .bar-label { color: var(--ink); }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.gauge { position: relative; display: grid; justify-items: center; margin-top: 8px; }
.gauge svg { width: 100%; max-width: 260px; height: auto; overflow: visible; }
.gauge-tick { stroke: var(--grey-soft); stroke-width: 6; stroke-linecap: round; }
.gauge-tick.is-on { stroke: var(--ink); animation: tick-fill 0.25s ease-out both; animation-delay: var(--d, 0ms); }
@keyframes tick-fill { from { stroke: var(--grey-soft); } to { stroke: var(--ink); } }
.gauge-value { position: absolute; bottom: 2px; display: grid; justify-items: center; gap: 4px; text-align: center; }
.gauge-value .big-num { font-size: 40px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 190px; padding: 20px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-main); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; transition: transform 0.22s, box-shadow 0.22s;
}
.tile-label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-arrow { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #FFFFFF; color: var(--ink); flex: none; }
.tile-arrow .icon { transform: rotate(-45deg); transition: transform 0.2s; }
.tile:hover .tile-arrow .icon, a:hover > .tile-arrow .icon { transform: rotate(0); }
.tile-dark { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.tile-dark .tile-label { color: #D5D6DC; }
.tile-dark .tile-arrow { background: #FFFFFF; }
.board-wrap { margin-top: 4px; }

/* ---- Ticket board ---- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.board-col { background: var(--ground); border-radius: var(--radius-panel); padding: 14px; min-height: 120px; transition: background 0.15s, box-shadow 0.15s; }
.panel .board-col { background: var(--surface-main); }
.board-col.is-over { box-shadow: inset 0 0 0 2px var(--ink); }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 12px; }
.board-col-head h2 { margin: 0; font-size: 15px; }
.board-cards { display: grid; gap: 10px; }
.board-empty { margin: 0; padding: 18px 10px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-item); text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.board-more { display: block; padding: 8px; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tcard { position: relative; display: grid; gap: 6px; padding: 14px 16px; background: #FFFFFF; border: 1px solid var(--border); border-radius: var(--radius); transition: transform 0.22s, box-shadow 0.22s; animation: fade-up 0.4s ease-out both; }
.tcard-top { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.tcard-date { margin-left: auto; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-main); display: inline-flex; align-items: center; }
.tcard-title { margin: 0; font-family: var(--font-body); font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.tcard-link { color: inherit; }
.tcard-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tcard-link:focus-visible { outline: none; }
.tcard-link:focus-visible::after { outline: 2px solid var(--ink); outline-offset: 2px; }
.tcard-client { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.tcard-foot { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.tcard-meta { display: inline-flex; align-items: center; gap: 4px; }
.tcard-meta .icon { width: 14px; height: 14px; }
.tcard-who { margin-left: auto; position: relative; z-index: 1; }
.tcard.is-inverted .tcard-top, .tcard.is-inverted .tcard-client, .tcard.is-inverted .tcard-foot { color: #C9CAD1; }
.tcard.is-inverted .tcard-date { background: rgba(255, 255, 255, 0.12); color: #FFFFFF; }
.tcard.is-inverted .tcard-title { color: #FFFFFF; }
.is-draggable .tcard { cursor: grab; }
.tcard.is-dragging { opacity: 0.45; transform: rotate(-1.5deg); }
.tcard.is-saving { opacity: 0.6; }

/* ---- Ticket page ---- */
.tk-card { border-radius: var(--radius); }
.tk-reminders.is-inverted { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.tk-reminders.is-inverted h2, .tk-reminders.is-inverted .reminder-when, .tk-reminders.is-inverted summary, .tk-reminders.is-inverted strong { color: #FFFFFF; }
.tk-reminders.is-inverted .muted, .tk-reminders.is-inverted .small { color: #D5D6DC; }
.tk-reminders.is-inverted .empty { color: #D5D6DC; }
.tk-reminders.is-inverted .reminder { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); border-radius: var(--radius-item); }
.tk-reminders.is-inverted .btn { background: #FFFFFF; color: var(--ink); border-color: #FFFFFF; }
.tk-reminders.is-inverted .btn-ghost { background: transparent; color: #FFFFFF; border-color: rgba(255, 255, 255, 0.35); }
.tk-reminders.is-inverted .chip { background: rgba(255, 255, 255, 0.14); color: #FFFFFF; }
.tk-reminders.is-inverted .chip-due { background: #FFFFFF; color: var(--ink); }
.tk-reminders.is-inverted .icon-btn { color: #FFFFFF; }
.tk-reminders.is-inverted .icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.tk-reminders.is-inverted .field > span, .tk-reminders.is-inverted label { color: #FFFFFF; }
.tk-reminders.is-inverted a:not(.btn) { color: #FFFFFF; }
.tk-reminders.is-ringing h2 .icon { animation: bell-ring 2.6s ease-in-out infinite; transform-origin: 50% 10%; }
.tk-attachments .tk-dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius-item); background: var(--surface-main); }
.tk-attachments.is-dragging .tk-dropzone, .tk-attach-form.is-dragging .tk-dropzone { border-color: var(--ink); background: #FFFFFF; }
.tk-bubble { border-radius: var(--radius); background: #FFFFFF; border: 1px solid var(--border); }
.tk-composer { border-radius: var(--radius); }
.tk-assign { display: inline-flex; align-items: center; gap: 6px; }
.tk-assign .pill-select { min-height: 32px; height: 32px; }
.mention, .mention-backdrop mark { background: var(--ground); color: var(--ink); font-weight: 700; border-radius: 4px; }
.mention-backdrop mark { color: transparent; }

/* ---- Journey (client services and the Services page) ---- */
.journey-panel { overflow: hidden; }
.journey-scroll { overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: thin; }
.journey { list-style: none; margin: 0; padding: 0; display: flex; align-items: stretch; width: max-content; min-width: 100%; }
.stage { display: flex; align-items: center; flex: none; animation: fade-up 0.45s ease-out both; animation-delay: var(--d, 0ms); }
.stage-card { width: 270px; align-self: stretch; padding: 12px; border-radius: var(--radius); background: var(--surface-main); display: grid; align-content: start; gap: 10px; }
.stage-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 0; }
.stage-name { font-family: var(--font-head); font-weight: 600; font-size: 14px; }
.stage-count { font-size: 12px; font-weight: 700; color: var(--muted); }
.stage.is-done .stage-count { color: var(--ink); }
/* Full URLs (scheme included) wrap inside their cell instead of overflowing it. */
.url-text, .report-preview td[data-cell="urls"] a, td[data-cell="urls"] { overflow-wrap: anywhere; word-break: break-word; }

/* ---- Vendors & Quotes (views/vq) and Send through Outlook ---- */
.send-connect { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border: 1px solid #D5D6DC; border-radius: var(--radius-item, 14px); background: #F3F3F6; margin: 0 0 12px; }
.send-connect p { margin: 0; flex: 1 1 260px; }
.send-outlook, .vq-send-mode, .outlook-state, .user-outlook { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vq-send-mode { margin: 0 0 12px; }
.vq-mode-panel .vq-send-mode, .vq-mode-panel .send-connect { margin: 0; }
.vq-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.vq-cat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px 12px; }
.vq-cats legend, .vq-new fieldset legend { font-weight: 600; margin-bottom: 6px; }
.vq-vendor-panel { width: min(560px, calc(100vw - 32px)); }
.vq-cat-panel { width: min(340px, calc(100vw - 32px)); }
.vq-cat-edit { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; max-height: 240px; overflow: auto; }
.vq-cat-edit li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 2px 10px; border-radius: 10px; }
.vq-cat-edit li:hover { background: #F3F3F6; }
.vq-details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.vq-details dt { color: var(--muted); font-size: 13px; }
.vq-details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.vq-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.vq-timeline li { display: grid; gap: 2px; padding-left: 14px; border-left: 2px solid #D5D6DC; overflow-wrap: anywhere; }
.vq-ev-accepted, .vq-ev-sent { border-left-color: var(--ink) !important; }
.vq-ev-send_failed { border-left-color: var(--red) !important; }
.vq-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 2px; }
.vq-items { display: grid; gap: 8px; margin-bottom: 8px; }
.vq-item, .vq-item-head { display: grid; grid-template-columns: minmax(0, 2fr) 84px minmax(0, 2fr) 36px; gap: 8px; align-items: center; }
.vq-item-head { font-size: 12px; color: var(--muted); font-weight: 600; }
.vq-pick { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; max-height: 420px; overflow: auto; }
.vq-pick-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 16px; align-items: center; padding: 8px 12px; border: 1px solid #E4E5EA; border-radius: var(--radius-item, 14px); }
.vq-pick-row.is-on { border-color: var(--ink); background: #F3F3F6; }
.vq-pick-row .checkbox-field { min-width: 0; }
.vq-compare { table-layout: auto; min-width: calc(160px + var(--vendors, 2) * 220px); }
.vq-compare th, .vq-compare td { white-space: normal; vertical-align: top; overflow: visible; text-overflow: clip; height: auto; padding-top: 10px; padding-bottom: 10px; }
.vq-compare thead th { text-transform: none; font-size: 14px; color: var(--ink); }
.vq-compare thead th a { font-weight: 700; display: block; margin-bottom: 4px; }
.vq-compare .vq-rowhead { width: 140px; text-transform: uppercase; font-size: 11px; color: var(--muted); text-align: left; font-weight: 600; }
.vq-compare .is-lowest, .vq-compare td.vq-price .vq-low { font-weight: 800; }
.vq-compare thead th.is-accepted { box-shadow: inset 0 -3px 0 var(--ink); }
.vq-compare tbody tr:hover { background: transparent; }
.vq-emails { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vq-notes { max-width: 280px; overflow-wrap: anywhere; }
.vq-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.vq-file { display: flex; align-items: center; gap: 6px; min-width: 0; }
.vq-file a { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.vq-file a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.vq-message { padding: 12px 14px; background: #F3F3F6; border-radius: var(--radius-item, 14px); overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .vq-item, .vq-item-head { grid-template-columns: minmax(0, 1fr) 72px 36px; }
  .vq-item input[name="item_specs"] { grid-column: 1 / 3; grid-row: 2; }
  .vq-item-head span:nth-child(3) { display: none; }
  .vq-pick-row { grid-template-columns: minmax(0, 1fr); }
  .vq-details { grid-template-columns: minmax(0, 1fr); }
}

/* Bulk ticking: "Mark stage done" under the stage name, the Shift+click hint, the Undo toast. */
.stage-done-form { margin: 2px 6px 0; }
.stage-done-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid #D5D6DC; border-radius: 999px; background: #FFFFFF; color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.stage-done-btn .icon { width: 13px; height: 13px; }
.stage-done-btn:hover { background: #F3F3F6; border-color: var(--ink); }
.stage-done-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.journey-hint { margin: 8px 0 0; }
.toast-undo { grid-template-columns: auto 1fr auto; align-items: center; position: relative; overflow: hidden; }
.toast-undo-form { margin: 0; }
.toast-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.2); }
.toast-timer span { display: block; height: 100%; background: #FFFFFF; transform-origin: left; animation: undo-timer linear forwards; }
@keyframes undo-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .toast-timer span { animation: none; } }
.stage-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.jstep-form { margin: 0; }
.jstep-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 8px 12px; border-radius: var(--radius-item); border: 1px solid var(--border); background: #FFFFFF; color: var(--ink); font: inherit; text-align: left; }
button.jstep-row { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
button.jstep-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.jstep-mark { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; }
.jstep-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--grey); }
.jstep-text { display: grid; min-width: 0; flex: 1; }
.jstep-title { font-weight: 700; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.jstep-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.jstep-tick { flex: none; display: inline-flex; color: var(--ink); }
.jstep-tick .icon { width: 15px; height: 15px; stroke-width: 2.4; }
.jstep-tick .icon + .icon { margin-left: -9px; }
.jstep.is-done .jstep-tick { animation: tick-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both; animation-delay: calc(var(--d, 0ms) + 250ms); }
@keyframes tick-pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.jstep.is-current .jstep-row { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.jstep.is-current .jstep-meta { color: #C9CAD1; }
.jstep.is-todo .jstep-row { background: transparent; border: 1.5px dashed var(--border-strong); }
.jstep.is-todo .jstep-title { color: var(--ink-2); }
.is-template .jstep-row { background: #FFFFFF; }
.spin-ring { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.25); border-top-color: #FFFFFF; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.connector { flex: none; width: 54px; display: flex; align-items: center; }
.cdot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.connector.is-dashed .cdot { background: #FFFFFF; border: 2px solid var(--grey); }
.cline { flex: 1; height: 2px; background: var(--ink); transform-origin: left center; animation: draw-x 0.5s ease-out both; animation-delay: calc(var(--d, 0ms) + 200ms); }
.connector.is-dashed .cline { background: none; border-top: 2px dashed var(--grey); height: 0; }
@keyframes draw-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.stage-finish { align-items: stretch; }
.finish-tile { width: 150px; display: grid; align-content: center; justify-items: center; gap: 4px; padding: 16px; border-radius: var(--radius); border: 1.5px dashed var(--border-strong); text-align: center; color: var(--ink-2); }
.finish-icon .icon { width: 24px; height: 24px; }
.stage-finish.is-done .finish-tile { background: var(--ink); color: #FFFFFF; border: 0; }
.journey-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 10px 0 6px; }
.journey-progress-text { font-size: 14px; color: var(--ink-2); }
.other-services { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.other-services a { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 14px; border-radius: var(--radius-item); background: rgba(255, 255, 255, 0.07); color: #FFFFFF; }
.other-services a:hover { background: rgba(255, 255, 255, 0.13); }
.other-services .progress { grid-column: 1 / -1; height: 6px; }
.other-name { font-weight: 700; }
.other-count { color: #D5D6DC; font-weight: 700; }
.cs-card { display: grid; gap: 8px; }
.cs-card .card-head { margin: 0; }
.cs-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0 0; }
.cs-card.is-closed { opacity: 0.8; }

/* ---- Login and error pages ---- */
body.is-bare { background: var(--ground); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); padding: 36px; background: #FFFFFF; border: 1px solid var(--border); border-radius: var(--radius-panel); animation: fade-up 0.4s ease-out both; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 22px; }
.login-card h1 { font-size: 26px; text-align: center; }
.error-card { max-width: 560px; margin: 10vh auto; }

/* ---- Load animations: sections fade / slide up, staggered ~80ms ---- */
.main > .page-head, .main > .reveal, .main > .panel, .main > .card, .main > .section, .main > .grid-2, .main > .tabs, .main > .board-wrap { animation: fade-up 0.45s ease-out both; }
.main > :nth-child(2) { animation-delay: 0.08s; }
.main > :nth-child(3) { animation-delay: 0.16s; }
.main > :nth-child(4) { animation-delay: 0.24s; }
.main > :nth-child(5) { animation-delay: 0.32s; }
.main > :nth-child(n+6) { animation-delay: 0.4s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---- Responsive ---- */
@media (max-width: 1279.98px) {
  .summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 1023.98px) {
  .topbar { grid-template-columns: auto auto; grid-template-areas: "brand tools" "nav nav"; row-gap: 10px; }
  .topbar > .brand { grid-area: brand; }
  .topbar > .pillnav { grid-area: nav; justify-content: flex-start; }
  .topbar > .topbar-tools { grid-area: tools; justify-self: end; }
  .pillnav-track { max-width: 100%; }
  .board { grid-template-columns: 1fr; }
}
@media (max-width: 1023.98px) {
  .app { margin: 10px; border-radius: 22px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; min-height: calc(100vh - 20px); }
  .topbar { padding: 12px 14px 6px; border-radius: 22px 22px 0 0; }
  .main { padding: 10px 14px 104px; }
  h1 { font-size: 26px; }
  .rail {
    position: fixed; top: auto; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 80;
    flex-direction: row; gap: 8px; padding: 8px; background: #FFFFFF; border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-lg);
  }
  .rail-btn[data-tip]::after { left: 50%; top: auto; bottom: calc(100% + 10px); transform: translate(-50%, 4px); }
  .rail-btn[data-tip]:hover::after, .rail-btn[data-tip]:focus-visible::after { transform: translate(-50%, 0); }
  .summary { grid-template-columns: 1fr; }
  .tile { min-height: 140px; }
  .dash-head { align-items: flex-start; }
  .panel { padding: 18px; border-radius: 20px; }
  .filter-field, .filter-search { flex: 1 1 100%; max-width: none; }
  .stage-card { width: 240px; }
  .bell-panel, .menu-right { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; }
}
@media (max-width: 480px) {
  .topbar-tools .tool[data-search] { display: none; }
  .brand-name { display: none; }
}

/* ---- Reduced motion: nothing moves ---- */
@media (prefers-reduced-motion: reduce) {
  .bar, .gauge-tick.is-on, .cline, .jstep-tick, .spin-ring, .tcard, .stage, .progress > span, .menu, .main > * { animation: none !important; }
  .spin-ring { border-top-color: #FFFFFF; }
  a.card:hover, .tcard:hover, .tile:hover, .rail-btn:hover, .round-btn:hover, .btn-primary:hover, button.jstep-row:hover, .stack-item:hover { transform: none !important; }
}
/* Stack: a small overlap, so each count badge sits clear of the next avatar's initials. */
.avatar-stack { padding-left: 0; gap: 0; }
.stack-item { margin-left: 0; }
.stack-item + .stack-item { margin-left: -6px; }
.stack-count { z-index: 3; top: -6px; right: 0; }
.dash-people { flex-wrap: wrap; }
.grid-2 > *, .grid-wide-left > * { min-width: 0; }
@media (max-width: 1023.98px) {
  .grid-2, .grid-wide-left { grid-template-columns: minmax(0, 1fr); }
  /* The sticky comment box stays above the quick-action bar. */
  .tk-composer { bottom: 84px; }
}
.btn { max-width: 100%; }
.panel-dark .btn { white-space: normal; height: auto; padding-top: 8px; padding-bottom: 8px; text-align: left; }
/* Screen-reader-only stays 1px even where a form rule sets a width. */
.visually-hidden { width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; border: 0 !important; }

/* ==========================================================================
   Round 2: white ticket cards, brighter LEDs, Updates, tooltips, motion, responsive.
   ========================================================================== */

/* ---- Ticket cards: always white; hover only lifts (text colour never changes) ---- */
.tcard, .tcard.is-inverted { background: #FFFFFF; color: var(--ink); border-color: var(--border); }
.tcard.is-inverted .tcard-title, .tcard-title, .tcard-link, .tcard-link:hover, .tcard:hover .tcard-link { color: var(--ink); }
.tcard.is-inverted .tcard-top, .tcard.is-inverted .tcard-client, .tcard.is-inverted .tcard-foot { color: var(--muted); }
.tcard.is-inverted .tcard-date { background: var(--surface-main); color: var(--muted); }
.tcard-no { color: var(--ink-2); }

/* ---- Priority LEDs: 10px solid dot, 10px glow, a ring expanding to 8px every 1.4s ---- */
:root { --led-pulse: 1.4s; }
.led { position: relative; width: 10px; height: 10px; background: var(--led); box-shadow: 0 0 10px var(--led); animation: none; }
.led::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--led) 70%, transparent);
  animation: led-ring var(--led-pulse) ease-out infinite;
}
.led-sort::after { display: none; }
@keyframes led-ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--led) 70%, transparent); }
  100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--led) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .led::after { animation: none !important; box-shadow: none; } }

/* ---- Tickets list: delete in its own 40px column, never over Last updated ---- */
.table-tickets .col-actions { width: 40px; }
.table td.row-actions.cell-actions { display: table-cell; width: 40px; padding: 0 6px 0 0; text-align: right; overflow: hidden; }
.table td.row-actions.cell-actions form { display: inline-flex; }
.table td.row-actions .icon-btn, .table td.cell-actions .icon-btn { width: 28px; height: 28px; }
.table-tickets td.right { padding-right: 12px; }

/* ---- Dashboard: Open per person side by side (8px gap), Updates ---- */
.avatar-row { gap: 8px; padding-left: 0; }
.avatar-row .stack-item, .avatar-row .stack-item + .stack-item { margin-left: 0; }
.avatar-row .stack-count { top: -6px; right: -6px; }
.updates-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.updates-col .board-col-head h3 { margin: 0; font-size: 15px; }
.link-more { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.link-more:hover { color: var(--ink); text-decoration: underline; }
.ucard {
  display: grid; gap: 8px; padding: 14px 16px; background: #FFFFFF; color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius); transition: transform 0.22s, box-shadow 0.22s;
  animation: fade-up 0.4s ease-out both;
}
.ucard:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.ucard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.ucard-kicker { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucard-title { font-weight: 700; font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.ucard-progress { display: flex; align-items: center; gap: 10px; }
.ucard-progress .progress { flex: 1; height: 6px; }
.ucard-count { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.ucard-foot { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ucard-when { margin-left: auto; white-space: nowrap; }

/* ---- Rail tooltips: in a layer on <body>, right of the button with an arrow ---- */
.rail-btn[data-tip]::after, .rail-btn[data-tip]::before { display: none !important; }
.tip {
  position: fixed; z-index: 3000; pointer-events: none; padding: 6px 10px; border-radius: 8px;
  background: var(--ink); color: #FFFFFF; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  opacity: 0; transition: opacity 0.15s ease-out;
}
.tip.is-shown { opacity: 1; }
.tip::before { content: ""; position: absolute; top: 50%; left: -5px; margin-top: -5px; border: 5px solid transparent; border-left: 0; border-right-color: var(--ink); }
.tip.tip-above::before { top: 100%; left: 50%; margin: 0 0 0 -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--ink); }

/* ---- Client picker: light grey highlight, bold match, tick on the chosen one ---- */
.combobox .combobox-input, .combobox .combobox-input:focus { background: #FFFFFF; color: var(--ink); }
.combobox-list li.combobox-option { position: relative; padding-right: 30px; color: var(--ink); background: transparent; }
.combobox-list li.combobox-option:hover, .combobox-list li.combobox-option.is-active { background: var(--surface-main); color: var(--ink); }
.combobox-list li.combobox-option mark { background: none; color: var(--ink); font-weight: 800; padding: 0; }
.combobox-list li.combobox-option.is-selected { color: var(--ink); font-weight: 600; }
.combobox-list li.combobox-option.is-selected::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 5px; height: 10px; margin-top: -7px;
  border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.mention-list li.is-active { background: var(--surface-main); color: var(--ink); }
::selection { background: #D5D6DC; color: var(--ink); }

/* ---- Motion ---- */
/* Page content fades in on navigation; Board / List, tabs and filters reload the page, so
   they get the same fade. */
.main { animation: page-in 0.35s ease-out both; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
/* Buttons press down slightly. */
.btn:active, .round-btn:active, .rail-btn:active, .icon-btn:active, .pill-item:active, .segmented a:active, .filters a:active, .tabs a:active { transform: scale(0.97); }
/* Dropdowns, popovers and modals scale in from 0.96 with a fade. */
@keyframes pop-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pop-in-up { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.menu { transform-origin: top left; }
.menu-right { transform-origin: top right; }
.bell-panel:not([hidden]), .combobox-list:not([hidden]), .date-pop:not([hidden]), .time-list:not([hidden]), .mention-list:not([hidden]) { animation: pop-in 0.16s ease-out both; transform-origin: top center; }
dialog[open] { animation: pop-in 0.18s ease-out both; }
dialog[open]::backdrop { animation: fade-in 0.18s ease-out both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
/* Toasts slide in from the top right and fade out. */
.toasts { top: 20px; right: 20px; bottom: auto; z-index: 1500; }
.toast { animation: toast-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.toast.is-leaving { animation: toast-leave 0.3s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translate(24px, -8px); } to { opacity: 1; transform: none; } }
@keyframes toast-leave { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(16px); } }
/* The bell shakes briefly when a new notification arrives. */
.bell-button.is-shaking .icon { animation: bell-shake 0.8s ease-in-out both; transform-origin: 50% 10%; }
@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(16deg); } 30% { transform: rotate(-14deg); } 45% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); }
}
/* New comments, notes and cards slide in. */
.is-new { animation: slide-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
/* Skeleton shimmer while something loads. */
.skeleton-list { display: grid; gap: 10px; padding: 6px 2px; }
.skeleton { display: block; height: 14px; border-radius: 8px; background: linear-gradient(90deg, #EDEEF2 25%, #F7F7F9 50%, #EDEEF2 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton-short { width: 60%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .main, .ucard, .toast, .is-new, .skeleton, dialog[open], .bell-button.is-shaking .icon { animation: none !important; }
  .btn:active, .round-btn:active, .rail-btn:active, .icon-btn:active, .pill-item:active, .segmented a:active, .filters a:active, .tabs a:active, .ucard:hover { transform: none !important; }
  .tip { transition: none; }
}

/* ---- Responsive: fluid from 1920 down to 1280, tablet and phone ---- */
.app { margin: clamp(8px, 1.4vw, 20px); min-height: calc(100vh - 2 * clamp(8px, 1.4vw, 20px)); }
.main { padding: 16px clamp(14px, 2vw, 28px) 40px 8px; }
h1 { font-size: clamp(24px, 2.4vw, 34px); }
.big-num { font-size: clamp(32px, 3vw, 44px); }
.gauge-value .big-num { font-size: clamp(30px, 2.7vw, 40px); }
.menu-label { display: block; padding: 8px 12px 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.menu-item-sub { padding-left: 20px; }
@media (max-width: 1439.98px) {
  .topbar { gap: 12px; }
  .pill-item { padding: 0 11px; font-size: 13px; height: 34px; }
}
@media (max-width: 1279.98px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .updates-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .updates-grid > :last-child { grid-column: 1 / -1; }
  .table-tickets .col-created, .table-tickets .cell-created { display: none; }
}
@media (max-width: 1023.98px) {
  .updates-grid, .board, .grid-2, .grid-wide-left, .summary { grid-template-columns: minmax(0, 1fr); }
  .updates-grid > :last-child { grid-column: auto; }
  .main { padding: 10px 14px 104px; }
  .tk-composer { bottom: 84px; }
}

/* ==========================================================================
   Round 3: logo, micro-interactions, avatars. All motion off with reduced motion.
   ========================================================================== */

/* ---- Logo: only the round icon turns, 8s a turn; on hover 2s a turn and 1.08 bigger ----
   The outer ring always turns at 8s; the inner one only runs while hovered (8/3s a turn),
   so together they make 2s a turn and never jump back when the mouse leaves. */
/* The logo is static: no rotation; only a subtle scale on hover. */
.brand-spin { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; transition: scale 0.2s ease-out; }
.brand-spin-fast { display: block; width: 100%; height: 100%; }
.brand-spin .brand-mark { width: 100%; height: 100%; }
.brand:hover .brand-spin { scale: 1.05; }

/* ---- Pill nav: a quick horizontal buzz on hover (plus the white background) ---- */
.pill-item:hover { animation: buzz 0.3s ease-in-out; }
@keyframes buzz { 0% { transform: translateX(0); } 25% { transform: translateX(-2px); } 50% { transform: translateX(2px); } 75% { transform: translateX(-1px); } 100% { transform: translateX(0); } }

/* ---- Quick-action rail: bounce (1.08 with an overshoot), the icon tilts -8deg and back ---- */
.rail-btn { transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s, border-color 0.15s; }
.rail-btn:hover { transform: scale(1.08); }
.rail-btn:hover .icon { animation: icon-tilt 0.35s ease-in-out; }
.rail-btn:active { transform: scale(0.97); }
@keyframes icon-tilt { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg); } }

/* ---- Bell: swings on hover; the red badge pops in ---- */
.bell-button:hover .icon { animation: bell-swing 0.5s ease-in-out; transform-origin: 50% 10%; }
@keyframes bell-swing { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(12deg); } 50% { transform: rotate(-10deg); } 75% { transform: rotate(5deg); } }
.bell-count:not([hidden]) { animation: badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }

/* ---- Primary buttons: a light shine sweeps across on hover ---- */
.btn-primary { position: relative; overflow: hidden; isolation: isolate; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.26), transparent);
  transform: skewX(-20deg); opacity: 0;
}
.btn-primary:hover::after { animation: shine 0.6s ease-out; }
@keyframes shine { from { left: -60%; opacity: 1; } to { left: 130%; opacity: 1; } }

/* ---- Cards: arrow icons slide 3px right on hover ---- */
svg.icon:has(> use[href="#i-arrow-right"]) { transition: transform 0.2s ease-out; }
a:hover svg.icon:has(> use[href="#i-arrow-right"]), button:hover svg.icon:has(> use[href="#i-arrow-right"]) { transform: translateX(3px); }
.tile:hover .tile-arrow .icon, a:hover > .tile-arrow .icon, .cs-card:hover .tile-arrow .icon { transform: rotate(0) translateX(3px); }

/* ---- Toggles and checkboxes ---- */
.switch { transition: background 0.2s; }
.switch::after { transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.switch.is-on, input:checked + .switch { background: var(--ink); }
input[type="checkbox"]:not(.visually-hidden, .switch-field input, .user-check input) {
  appearance: none; -webkit-appearance: none; flex: none; display: inline-block; vertical-align: middle;
  width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--border-strong); border-radius: 5px;
  background: #FFFFFF no-repeat center / 12px 12px; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
input[type="checkbox"]:not(.visually-hidden, .switch-field input, .user-check input):hover { border-color: var(--ink-2); }
input[type="checkbox"]:not(.visually-hidden, .switch-field input, .user-check input):checked {
  background-color: var(--ink); border-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23FFFFFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5'/%3E%3C/svg%3E");
  animation: check-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
input[type="checkbox"]:not(.visually-hidden, .switch-field input, .user-check input):disabled { opacity: 0.5; cursor: not-allowed; }
@keyframes check-pop { from { transform: scale(0.75); } to { transform: scale(1); } }

/* ---- Success toasts: the tick draws itself ---- */
.toast-tick svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.toast-tick circle { stroke-dasharray: 63; stroke-dashoffset: 63; animation: draw 0.4s ease-out 0.1s forwards; }
.toast-tick path { stroke-dasharray: 16; stroke-dashoffset: 16; animation: draw 0.3s ease-out 0.4s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- Avatars: initials perfectly centred, about 38% of the circle; raise on hover ---- */
.avatar { --av: 28px; width: var(--av); height: var(--av); padding: 0; transition: transform 0.15s ease-out; }
.avatar-xs { --av: 20px; }
.avatar-sm { --av: 28px; }
.avatar-md { --av: 40px; }
.avatar-lg { --av: 88px; }
.avatar-btn .avatar { --av: 44px; width: var(--av); height: var(--av); }
.emp-head .avatar-lg { --av: 76px; width: var(--av); height: var(--av); }
.bd-chip .avatar { --av: 18px; width: var(--av); height: var(--av); }
.avatar-initials, .stack-item .avatar-initials {
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; padding: 0; text-indent: 0; letter-spacing: 0; text-align: center;
  font-size: calc(var(--av) * 0.38); color: #FFFFFF; font-weight: 700; overflow: hidden;
}
.stack-item .avatar-initials { display: flex; }
.avatar:hover { transform: translateY(-2px); }
/* Open per person: the count sits centred under the avatar, clear of the initials. */
.avatar-row { padding-bottom: 10px; }
.avatar-row .stack-count { top: auto; right: auto; bottom: -10px; left: 50%; transform: translateX(-50%); }
.avatar-row .stack-item:hover { transform: translateY(-2px); }
.avatar-row .stack-item:hover .avatar { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .pill-item:hover, .rail-btn:hover .icon, .bell-button:hover .icon, .bell-count:not([hidden]),
  .btn-primary:hover::after, input[type="checkbox"]:checked { animation: none !important; }
  .brand:hover .brand-spin { scale: none; }
  .rail-btn:hover, .avatar:hover, .avatar-row .stack-item:hover,
  a:hover svg.icon:has(> use[href="#i-arrow-right"]), button:hover svg.icon:has(> use[href="#i-arrow-right"]) { transform: none !important; }
  .toast-tick circle, .toast-tick path { animation: none !important; stroke-dashoffset: 0; }
}

/* ==========================================================================
   Spellchecker (public/js/spell.js): underlines and the suggestion popup.
   ========================================================================== */
/* A layer on top of the field repeating its text (transparent) with the misspelt words
   underlined; it ignores the mouse, so the field underneath works as normal. */
.spell-layer {
  position: absolute; z-index: 3; margin: 0; overflow: hidden; pointer-events: none;
  color: transparent; background: transparent; border-color: transparent !important;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; scrollbar-width: none;
  transition: none !important; animation: none !important; box-shadow: none !important; outline: none !important;
}
.spell-layer::-webkit-scrollbar { display: none; }
/* (Two rules: a browser without ::highlight() would drop a combined selector list.) */
.spell-layer *, .spell-bad { transition: none !important; animation: none !important; }
.spell-bad {
  color: transparent;
  text-decoration: underline wavy var(--led-urgent);
  text-decoration-thickness: 1.5px;
  text-decoration-skip-ink: none;
  text-underline-offset: 3px;
}
::highlight(spell-error) {
  text-decoration: underline wavy var(--led-urgent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.spell-pop {
  position: fixed; z-index: 3200; min-width: 180px; max-width: 280px; padding: 6px;
  display: grid; gap: 2px; background: #FFFFFF; color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius-item); box-shadow: var(--shadow-lg);
  animation: pop-in 0.16s ease-out both; transform-origin: top left;
}
.spell-pop-list { display: grid; gap: 2px; }
.spell-pop-list .skeleton { margin: 6px 8px; }
.spell-opt {
  display: block; width: 100%; min-height: 32px; padding: 6px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.spell-opt:hover, .spell-opt:focus-visible, .spell-opt.is-active { background: var(--surface-main); outline: none; }
.spell-suggestion:hover, .spell-suggestion:focus-visible, .spell-suggestion.is-active { font-weight: 700; }
.spell-opt-action { color: var(--ink-2); font-weight: 600; }
.spell-opt:disabled { opacity: 0.6; cursor: wait; }
.spell-pop-sep { height: 1px; margin: 4px 2px; background: var(--border); }
.spell-none { margin: 0; padding: 6px 10px; font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .spell-pop { animation: none; } }

/* ---- Daily Report preview: each line edits on its own ---- */
.report-preview [contenteditable="true"] { position: relative; border-radius: 6px; outline: none; transition: background 0.15s, box-shadow 0.15s; }
.report-preview [contenteditable="true"]:hover { background: var(--surface-main); }
.report-preview [contenteditable="true"]:focus { background: #FFFFFF; box-shadow: 0 0 0 2px var(--ink); }
.report-preview li[contenteditable="true"] { padding: 1px 4px; margin-left: -4px; }
/* Lines that change this copy only: a small hint on hover (not part of the text). */
.report-preview [data-preview-only]:hover::after, .report-preview [data-preview-only]:focus::after {
  content: "Preview only"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  padding: 1px 8px; border-radius: 999px; background: var(--ground); color: var(--muted);
  font-family: var(--font-body); font-size: 11px; font-weight: 700; text-decoration: none; pointer-events: none;
}
.report-preview li[data-preview-only] { padding-right: 96px; }
/* Saving your logged work, then a small "Saved" tick that fades. */
.report-preview li.is-saving { opacity: 0.6; }
.report-preview li.is-saved::after {
  content: "\2713  Saved"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  padding: 1px 8px; border-radius: 999px; background: var(--ink); color: #FFFFFF;
  font-family: var(--font-body); font-size: 11px; font-weight: 700; pointer-events: none;
  animation: saved-tick 1.8s ease-out both;
}
.report-preview li.is-error { box-shadow: 0 0 0 2px var(--red); }
@keyframes saved-tick { 0% { opacity: 0; transform: translateY(-50%) scale(0.8); } 12% { opacity: 1; transform: translateY(-50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .report-preview li.is-saved::after { animation: none; } }

/* ==========================================================================
   Cloudflare (views/cloudflare): tiles, domains table, domain page, accounts.
   Status pills are greyscale; red LED = a problem, amber = expiring within 30 days.
   ========================================================================== */
.cf-check-line { display: flex; align-items: center; gap: 6px; margin: -8px 0 16px; }
.cf-check-line .icon { width: 14px; height: 14px; }
.cf-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.cf-tile { min-height: 120px; background: #FFFFFF; }
.cf-tile .tile-label { display: inline-flex; align-items: center; gap: 8px; }
.cf-tile.has-problem { border-color: var(--border-strong); }
.cf-table .cf-led { width: 30px; padding-right: 0; text-overflow: clip; }
.cf-table .cf-domain { width: 21%; }
.cf-table .cf-client { width: 15%; }
.cf-table .cf-account { width: 14%; }
.cf-table .cf-status { width: 118px; }
.cf-table .cf-ns { width: 13%; }
.cf-table .cf-expiry { width: 16%; }
.cf-table .cf-checked { width: 104px; }
.cf-table th.cf-actions, .cf-table td.cf-actions { width: 80px; }
.cf-table td.cf-actions { display: table-cell; text-align: right; padding-right: 6px; white-space: nowrap; }
.cf-table td.cf-actions form { display: inline-flex; }
.cf-table td.cf-actions .icon-btn { width: 30px; height: 30px; }
.cf-table td .icon { width: 13px; height: 13px; vertical-align: -2px; }
.cf-table tr.is-hidden-row td { color: var(--muted); }
.cf-head-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 6px 0 0; }
.page-head h1 .led { vertical-align: middle; margin-right: 4px; }
.cf-fields { display: grid; grid-template-columns: minmax(140px, max-content) minmax(0, 1fr); gap: 10px 20px; margin: 0; }
.cf-fields dt { color: var(--muted); font-weight: 700; font-size: 13px; }
.cf-fields dd { margin: 0; overflow-wrap: anywhere; }
.cf-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; position: relative; }
.cf-timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.cf-event { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 12px; align-items: start; }
.cf-event-dot { width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: #FFFFFF; border: 2px solid var(--ink-2); position: relative; z-index: 1; }
.cf-event-ns_changed .cf-event-dot, .cf-event-deleted .cf-event-dot, .cf-event-expired .cf-event-dot, .cf-event-moved .cf-event-dot { background: var(--led-urgent); border-color: var(--led-urgent); }
.cf-event-expiring .cf-event-dot { background: var(--led-high); border-color: var(--led-high); }
.cf-event-back_to_cloudflare .cf-event-dot, .cf-event-re_added .cf-event-dot { background: var(--ink); border-color: var(--ink); }
.cf-link-cell { overflow: visible; }
.cf-link-form { display: block; margin: 0; }
.cf-link-form select, .cf-link-form .combobox-input { min-height: 34px; height: 34px; font-size: 13px; }
.cf-accounts-table td { height: auto; padding-top: 8px; padding-bottom: 8px; }
.cf-problems { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.cf-client-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cf-client-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border-radius: var(--radius-item); background: var(--surface-main); }
.cf-led-space { display: inline-block; width: 10px; }
/* Dashboard: the small Domains tile next to the greeting. */
.dash-head .mini-tile { margin-left: auto; margin-right: 8px; }
.mini-tile {
  display: grid; grid-template-columns: auto auto; grid-template-areas: "label label" "value sub"; align-items: baseline; gap: 2px 8px;
  min-width: 150px; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: #FFFFFF; color: var(--ink);
  transition: transform 0.22s, box-shadow 0.22s;
}
.mini-tile:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.mini-tile-label { grid-area: label; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.mini-tile-value { grid-area: value; font-family: var(--font-head); font-weight: 700; font-size: 26px; line-height: 1; }
.mini-tile-sub { grid-area: sub; font-size: 12.5px; color: var(--muted); font-weight: 600; }
@media (max-width: 1279.98px) { .cf-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1023.98px) {
  .cf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-head .mini-tile { margin-left: 0; }
  .cf-table { width: max(900px, 100%); }
}
@media (prefers-reduced-motion: reduce) { .mini-tile:hover { transform: none; } }

/* ---- Live search: one x to clear (the browser's own is hidden), loading state ---- */
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search-field, .search, .search-pop-form, .grid-search { position: relative; }
.search-field input[type="search"], .search input[type="search"], .search-pop-form input[type="search"], .grid-search input[type="search"] { padding-right: 36px; }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); z-index: 2;
  display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
  background: var(--ground); color: var(--ink-2); font: inherit; font-size: 16px; line-height: 1; cursor: pointer;
}
.search-clear:hover { background: var(--border-strong); color: var(--ink); }
.search-clear[hidden] { display: none; }
.search-pop-form { display: block; }
.search-pop-form input[type="search"] { width: 100%; }
.cs1-filter-links { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Cloudflare expiry lookups */
.cf-rdap { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin: -6px 0 16px; }
.cf-rdap-bar { flex: 1 1 200px; max-width: 360px; }
.cf-rdap-bar > span { animation: none; transition: width 0.4s ease-out; }
.cf-unknown { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .cf-rdap-bar > span { transition: none; } }

/* ---- Microsoft > Email Services ---- */
.m365-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.m365-table .m365-domain { width: 28%; }
.m365-table .m365-status { width: 24%; }
.m365-table .m365-managed { width: 12%; }
.m365-table .m365-provider { width: 16%; }
.m365-table .m365-checked { width: 110px; }
.m365-records td { height: auto; padding-top: 10px; padding-bottom: 10px; white-space: normal; vertical-align: top; }
.m365-records .m365-found, .m365-records .m365-expected { overflow-wrap: anywhere; font-size: 13px; }
.m365-records tr.is-bad-row td:first-child { box-shadow: inset 3px 0 0 var(--led-urgent); }
.m365-mark { font-size: 15px; line-height: 1; }
.m365-hint { margin-top: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface-main); color: var(--ink-2); display: flex; gap: 6px; align-items: flex-start; }
.m365-hint .icon { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.choice.is-disabled { opacity: 0.65; cursor: not-allowed; }
.m365-event-issues .cf-event-dot, .m365-event-error .cf-event-dot { background: var(--led-urgent); border-color: var(--led-urgent); }
.m365-event-healthy .cf-event-dot { background: var(--ink); border-color: var(--ink); }
@media (max-width: 1023.98px) { .m365-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .m365-table { width: max(760px, 100%); } }
.m365-records .m365-col-record { width: 210px; }
.m365-records .m365-col-status { width: 72px; }
.m365-records .m365-col-found { width: 32%; }
/* The spelling popup is shown in the top layer (popover API): undo the browser's popover
   defaults (centred, inset 0); its top / left come from the word's own box. */
.spell-pop[popover] { inset: auto; margin: 0; overflow: visible; width: auto; height: auto; }
.spell-pop.is-above { transform-origin: bottom left; }
/* Email Services row actions: their own fixed 80px column, the two icons side by side. */
.m365-table th.m365-actions, .m365-table td.m365-actions { width: 80px; padding: 0 8px 0 0; text-align: right; overflow: visible; }
.m365-actions-box { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.m365-actions-box form { display: inline-flex; margin: 0; }
.m365-actions-box .icon-btn { width: 32px; height: 32px; }
.icon-btn.is-busy { pointer-events: none; opacity: 0.7; }
.icon-btn.is-busy .icon { animation: spin 0.8s linear infinite; }
.m365-toast { grid-template-columns: auto 1fr auto; }
.m365-toast .btn { min-height: 0; height: 30px; }
/* Email Services domain page: where each record lives, provider default records, summary. */
.m365-where { display: block; margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; font-weight: 400; }
.m365-by { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 999px; background: var(--surface-main); color: var(--ink-2); font-size: 12px; }
.m365-missing { display: flex; gap: 10px; align-items: flex-start; }
.m365-missing .icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
@media (prefers-reduced-motion: reduce) { .icon-btn.is-busy .icon { animation: none; } }
/* Dashboard Email services card (views/partials/dash-email.ejs): 4th column of Updates on wide
   screens, 2 x 2 from 1024px to 1439px, one column below. */
.updates-grid.updates-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.updates-grid.updates-grid-4 > :last-child { grid-column: auto; }
@media (max-width: 1439.98px) { .updates-grid.updates-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1023.98px) { .updates-grid.updates-grid-4 { grid-template-columns: minmax(0, 1fr); } }
.dash-email-title { display: flex; align-items: center; gap: 8px; }
.dash-email-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--border); color: var(--ink-2); font: 700 12px/1 Poppins, sans-serif; }
.dash-email-count.has-issues { background: var(--ink); color: #FFFFFF; }
.dash-email-domain { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-email-reason { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.dash-email-provider { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dash-email-who { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--surface-main); border: 1px solid var(--border); color: var(--ink-2); font-size: 11.5px; font-weight: 700; }
.dash-email-ok { justify-items: start; padding: 18px 16px; }
.dash-email-tick { color: var(--ink); line-height: 0; }
.dash-email-tick svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dash-email-tick circle { stroke-dasharray: 63; stroke-dashoffset: 63; animation: draw 0.5s ease-out 0.2s forwards; }
.dash-email-tick path { stroke-dasharray: 16; stroke-dashoffset: 16; animation: draw 0.35s ease-out 0.6s forwards; }
.dash-email-more { padding: 2px 4px; }
@media (prefers-reduced-motion: reduce) { .dash-email-tick circle, .dash-email-tick path { animation: none; stroke-dashoffset: 0; } }
/* Email Services: the reason of a failing record and the "Not right" list on the domain page. */
.m365-problem { display: block; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--red); }
.m365-reasons { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-item); background: var(--red-soft); color: var(--ink); font-size: 13px; }
.m365-reasons ul { margin: 4px 0 0; padding-left: 18px; }
.m365-reasons li { margin: 2px 0; }
/* Email Services list: the status as an LED + label (green glowing Healthy, red pulsing
   Issues / Error, grey dot Not Microsoft, hollow = not checked). */
.m365-state { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.m365-state strong { font-weight: 700; }
.led.led-steady::after { display: none; }
.led.led-off { --led: var(--grey); box-shadow: none; }
.led.led-off::after { display: none; }
.led.led-hollow { background: transparent; border: 2px solid var(--grey); }
.m365-table .m365-domain { width: 30%; }
.m365-table .m365-status { width: 30%; }
/* Email Services domain page: Records table = Status | Record | Current status | Expected record |
   How to fix. Fixed widths, long values wrap inside their cell. */
.m365-records { table-layout: fixed; width: 100%; }
.m365-records th.m365-col-status, .m365-records td.m365-col-status { width: 52px; text-align: center; }
.m365-records .m365-col-record { width: 19%; }
.m365-records .m365-col-found { width: 24%; }
.m365-records .m365-col-expected { width: 21%; }
.m365-records .m365-col-fix { width: auto; }
.m365-records td { overflow: visible; text-overflow: clip; }
.m365-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: 0; }
.m365-mark .icon { width: 14px; height: 14px; stroke-width: 3; }
.m365-mark.is-ok { background: var(--led-low); color: var(--ink); box-shadow: 0 0 8px color-mix(in srgb, var(--led-low) 55%, transparent); }
.m365-mark.is-bad { background: var(--red); color: #FFFFFF; }
.m365-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; word-break: break-word; }
.dmarc-preview { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 0; padding: 10px 12px; background: var(--surface, #F3F3F6); border-radius: var(--radius-sm, 12px); }
.m365-none { color: var(--red); font-weight: 700; font-size: 13px; }
.m365-found .m365-by { display: table; margin-top: 6px; }
.m365-step { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-main); margin-bottom: 6px; font-size: 12.5px; }
.m365-step.is-remove { display: block; border-color: color-mix(in srgb, var(--red) 35%, var(--border)); background: var(--red-soft); }
.m365-step-head { font-weight: 700; color: var(--ink); }
.m365-step dl { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 3px 8px; margin: 0; }
.m365-step dt { color: var(--muted); font-weight: 600; }
.m365-step dd { margin: 0; display: flex; align-items: flex-start; gap: 4px; min-width: 0; }
.m365-step dd .m365-code { flex: 1; min-width: 0; }
.m365-copy { flex: none; width: 24px !important; height: 24px !important; margin-top: -3px; }
.m365-copy .icon { width: 13px; height: 13px; }
.m365-copy .icon + .icon { display: none; }
.m365-copy.is-copied .icon:first-child { display: none; }
.m365-copy.is-copied .icon + .icon { display: inline-block; }
.m365-step-note { margin: 2px 0 0; }
@media (max-width: 1100px) { .m365-records { width: max(920px, 100%); } }
.crumbs .crumb-sep { margin: 0 6px; color: var(--grey); }
.crumbs [aria-current="page"] { color: var(--ink-2); }
/* Section overview pages (views/overview.ejs): one white card per sub-section. */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.ov-card {
  display: flex; flex-direction: column; gap: 10px; padding: 20px; background: #FFFFFF; color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius); transition: transform 0.22s, box-shadow 0.22s;
}
.ov-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.ov-card-top { display: flex; align-items: center; justify-content: space-between; }
.ov-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #FFFFFF; }
.ov-icon .icon { width: 20px; height: 20px; }
.ov-title { font: 600 17px/1.3 Poppins, sans-serif; }
.ov-desc { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.ov-stats { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.ov-stat { display: grid; gap: 2px; min-width: 0; }
.ov-num { display: inline-flex; align-items: center; gap: 8px; font: 700 26px/1.1 Poppins, sans-serif; }
.ov-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.ov-card:hover .tile-arrow { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { .ov-card:hover { transform: none; } }
/* Email Services DKIM: the key status under the CNAME target; "DKIM enabled" when on. */
.m365-key { display: block; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.m365-key.is-bad { color: var(--red); }
.m365-good { display: block; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--ink); }
.m365-step.is-note { display: block; line-height: 1.5; }
/* Reminder calendar: always its own light colours, whatever card it opens from (the Reminders
   card is black). Month / year title (opens the month picker), today outlined, the chosen day
   black, past days grey and disabled, a Today button. */
.date-pop { background: #FFFFFF; color: var(--ink); color-scheme: light; }
.date-pop-head { color: var(--ink); gap: 6px; }
.date-title { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: 700 14px/1 Poppins, sans-serif; cursor: pointer; }
.date-title:hover { background: var(--surface-main); }
.date-nav { color: var(--ink); }
.date-nav:hover { background: var(--surface-main); color: var(--ink); }
.date-nav:disabled { color: var(--border-strong); cursor: default; background: transparent; }
.date-dow { color: var(--muted); }
.date-day { color: var(--ink); }
.date-day:hover { background: var(--surface-main); color: var(--ink); }
.date-day:focus-visible, .date-month:focus-visible, .date-title:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.date-pop .date-day.is-today, .date-pop .date-month.is-today { background: transparent; color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--ink); }
.date-pop .date-day.is-selected, .date-pop .date-month.is-selected { background: var(--ink); color: #FFFFFF; font-weight: 700; box-shadow: none; }
.date-pop .date-day.is-past, .date-pop .date-month.is-past { color: var(--border-strong); background: transparent; cursor: default; }
.date-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.date-month { height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.date-month:hover:not(:disabled) { background: var(--surface-main); }
.date-pop .date-today { background: #FFFFFF; color: var(--ink); border: 1px solid var(--border); }
.date-pop .date-today:hover { background: var(--surface-main); color: var(--ink); }
/* "Draft restored · Clear" at the top of a popup / popover form ("Modal close guard" in app.js). */
.draft-note { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-main); color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.draft-note .link-button { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.draft-note .link-button:hover { color: var(--red); }

/* ==========================================================================
   Dark surfaces: black panels (Other services), inverted cards, the ticket Reminders card,
   black tiles, the current journey step. One set of rules for everything on them, so no hover,
   focus or active state can turn text the colour of its background (checked with
   npm run contrast). Hover / focus / active only change background, border, shadow or
   transform; text keeps its colour.
   - Text and links: white (muted #C9CAD1); links stay white on hover (underline only).
   - Light buttons (default, light, secondary, primary): white, black text; hover #E7E8EC.
   - Ghost / outline buttons, icon buttons, chips: white text; hover white 10%.
   - Inputs and selects: the normal light field (white, black text).
   - Anything light that opens inside (popovers, menus, date picker, lists) is light again.
   ========================================================================== */
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark, .jstep.is-current .jstep-row) { color: #FFFFFF; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(h2, h3, strong, legend, summary, .field > span, label) { color: #FFFFFF; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.muted, .small, .empty, .tile-label) { color: #C9CAD1; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) a:not(.btn):not(.chip),
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) a:not(.btn):not(.chip):is(:hover, :focus, :focus-visible, :active) { color: #FFFFFF; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) a:not(.btn):not(.chip):hover { text-decoration-color: #FFFFFF; }
.other-services a:is(:hover, :focus-visible) { color: #FFFFFF; background: rgba(255, 255, 255, 0.13); text-decoration: none; }
/* Light buttons on dark. */
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.btn, .btn-light, .btn-secondary, .btn-primary),
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.btn, .btn-light, .btn-secondary, .btn-primary):is(:hover, :focus, :focus-visible, :active) { color: var(--ink); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.btn, .btn-light, .btn-secondary, .btn-primary) { background: #FFFFFF; border-color: #FFFFFF; box-shadow: none; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.btn, .btn-light, .btn-secondary, .btn-primary):hover { background: var(--ground); border-color: var(--ground); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .btn-danger,
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .btn-danger:is(:hover, :focus, :focus-visible, :active) { color: var(--red); background: #FFFFFF; border-color: #FFFFFF; }
/* Ghost / outline buttons, icon buttons and chips on dark. */
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .btn-ghost, :is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .btn-ghost:is(:hover, :focus, :focus-visible, :active),
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .icon-btn, :is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .icon-btn:is(:hover, :focus, :focus-visible, :active) { color: #FFFFFF; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .chip:not(.chip-due):not([aria-pressed="true"]), :is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .chip:not(.chip-due):not([aria-pressed="true"]):is(:hover, :focus, :focus-visible, :active) { color: #FFFFFF; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .btn-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.35); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .icon-btn { background: transparent; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .chip:not(.chip-due):not([aria-pressed="true"]) { background: rgba(255, 255, 255, 0.14); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .btn-ghost:hover, :is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .icon-btn:hover,
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .chip:not(.chip-due):not([aria-pressed="true"]):hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.5); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.chip-due, .chip[aria-pressed="true"]),
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.chip-due, .chip[aria-pressed="true"]):is(:hover, :focus, :focus-visible, :active) { background: #FFFFFF; color: var(--ink); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.status-pill, .badge, .count-chip) { background: #FFFFFF; color: var(--ink); border-color: #FFFFFF; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .link-more,
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .link-more:is(:hover, :focus-visible) { color: #FFFFFF; }
/* Fields on dark: the normal light field. */
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea, .combobox-input) {
  background: #FFFFFF; color: var(--ink); border-color: var(--border-strong);
}
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(input, textarea)::placeholder { color: var(--muted); }
/* Light things that open inside a dark surface are light again. */
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.edit-panel, .menu, .date-pop, .time-list, .combobox-list, .multi-panel, .mention-list) { color: var(--ink); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.edit-panel, .menu, .date-pop, .time-list, .combobox-list, .multi-panel, .mention-list) :is(h2, h3, strong, legend, summary, .field > span, label, a:not(.btn)) { color: var(--ink); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.edit-panel, .menu, .date-pop, .time-list, .combobox-list, .multi-panel, .mention-list) :is(.muted, .small, .empty) { color: var(--muted); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.edit-panel, .multi-panel) .btn.btn-ghost,
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.edit-panel, .multi-panel) .btn.btn-ghost:is(:hover, :focus, :focus-visible, :active) { color: var(--ink-2); border-color: transparent; }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) :is(.edit-panel, .multi-panel) .btn.btn-ghost:hover { background: var(--ground); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .edit-panel :is(.chip:not(.chip-due):not([aria-pressed="true"]), .icon-btn.icon-btn),
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .edit-panel :is(.chip:not(.chip-due):not([aria-pressed="true"]), .icon-btn.icon-btn):is(:hover, :focus, :focus-visible, :active) { color: var(--ink); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .edit-panel .chip:not(.chip-due):not([aria-pressed="true"]) { background: var(--ground); }
:is(.panel-dark, .card.is-inverted, .tk-reminders.is-inverted, .tile-dark) .edit-panel :is(.chip:not(.chip-due):not([aria-pressed="true"]), .icon-btn.icon-btn):hover { background: var(--border-strong); }
/* Danger buttons: red text needs a white background (4.9:1); hover changes only the border / shadow. */
.btn-danger:hover, .btn-danger:focus-visible { color: var(--red); background: #FFFFFF; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* ==========================================================================
   THE search box (views/partials/search-input.ejs): every search in the portal looks and
   behaves the same. Icon 14px from the left, vertically centred, never in the way of the
   mouse; 40px of left padding so the text and placeholder never sit under it; the × (added
   by app.js) on the right with 36px of right padding. Its width comes from where it sits.
   ========================================================================== */
.search-box { position: relative; display: block; width: 100%; max-width: 420px; min-width: 0; margin: 0; }
.search-box[hidden] { display: none; }
.search-box > .icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px;
  margin: 0; color: var(--muted); pointer-events: none; z-index: 1;
}
.search-box > input[type="search"] {
  display: block; width: 100%; height: 40px; min-height: 40px; margin: 0;
  padding: 0 36px 0 40px !important; border-radius: 999px; text-indent: 0; line-height: 38px;
}
.search-box > .search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); z-index: 1; }
/* Where it sits. */
.list-search > .search-box { max-width: 420px; }
.filter-search.search-box { flex: 1 1 220px; max-width: 340px; }
.cs1-search.search-box { flex: 1 1 260px; max-width: 360px; }
.grid-search.search-box { flex: 0 1 280px; min-width: 180px; }
.ticket-filters > .search-box { margin-left: auto; flex: 1 1 200px; max-width: 320px; }
.search-pop-form .search-box { max-width: none; }
.multi-search.search-box { max-width: none; margin-bottom: var(--sp-2); }
@media (max-width: 1023.98px) { .filter-search.search-box, .cs1-search.search-box, .ticket-filters > .search-box { flex: 1 1 100%; max-width: none; } }
.search-pop-form .search-box > input[type="search"], .menu .search-box > input[type="search"] { height: 40px; min-height: 40px; margin: 0; flex: none; }

/* ---- Daily Report table (views/report/_table.ejs) ----
   Its look (dark blue header, grey borders, Calibri 11pt, coloured status) is inline so copies
   paste into Outlook the same; here only the page's editing hints. Cells are white inline, so
   hover / focus use an inset outline; "Preview only" and "Saved" sit on the cell's top edge. */
.report-preview .report-table, .send-preview .report-table { table-layout: fixed; }
.report-preview .report-table td, .send-preview .report-table td { overflow-wrap: anywhere; word-break: normal; white-space: normal; }
.report-preview .report-table td { position: relative; }
.report-preview .report-table td[contenteditable="true"] { border-radius: 0; transition: box-shadow 0.15s; }
.report-preview .report-table td[contenteditable="true"]:hover { box-shadow: inset 0 0 0 1px var(--grey); background: #FFFFFF; }
.report-preview .report-table td[contenteditable="true"]:focus { box-shadow: inset 0 0 0 2px var(--ink); background: #FFFFFF; }
.report-preview .report-table [data-preview-only]:hover::after, .report-preview .report-table [data-preview-only]:focus::after {
  top: -9px; right: 2px; transform: none; z-index: 2; font-size: 10px; padding: 0 6px; line-height: 16px;
}
.report-preview .report-table td.is-saving { opacity: 0.6; }
.report-preview .report-table td.is-error { box-shadow: inset 0 0 0 2px var(--red); }
.report-preview .report-table td.is-saved::after {
  content: "\2713  Saved"; position: absolute; top: -9px; right: 2px; z-index: 2;
  padding: 0 6px; border-radius: 999px; background: var(--ink); color: #FFFFFF; line-height: 16px;
  font-family: var(--font-body); font-size: 10px; font-weight: 700; pointer-events: none;
  animation: saved-tick-edge 1.8s ease-out both;
}
@keyframes saved-tick-edge { 0% { opacity: 0; } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
/* Status of your own rows ("Daily Report preview table"): bold coloured text, then a 10px grey "▾"
   6px after it on the same line, in a soft rounded button; a click on either opens .status-pop. The
   chevron is a CSS ::after (not in the DOM), so Copy, Copy for email, Send report and the plain text
   never contain it. The column fits "In progress ▾" / "Not started ▾" on one line. */
.report-preview td[data-cell="status"] { min-width: 136px; }
/* The header cells carry an inline width (for the email); the preview overrides the Status one. */
.report-preview .report-table th:nth-child(2) { width: 136px !important; min-width: 136px; }
.report-preview [data-status-pick] {
  display: inline-flex; align-items: center; gap: 6px; margin: -3px 0 -3px -7px; padding: 3px 7px; border-radius: 999px;
  cursor: pointer; white-space: nowrap; transition: background 0.12s, box-shadow 0.12s;
}
.report-preview [data-status-pick]::after {
  content: '▾'; flex: none; font-family: 'Segoe UI Symbol', 'Segoe UI', Arial, sans-serif; font-size: 10px; line-height: 1; font-weight: 400; color: #5C5C66; transition: transform 0.15s;
}
.report-preview [data-status-pick]:hover, .report-preview [data-status-pick][aria-expanded="true"] { background: #F3F3F6; box-shadow: inset 0 0 0 1px #D5D6DC; }
.report-preview [data-status-pick][aria-expanded="true"]::after { transform: rotate(180deg); }
.report-preview [data-status-pick]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.status-pop {
  position: fixed; z-index: 1100; display: grid; gap: 2px; min-width: 168px; padding: 6px;
  background: #FFFFFF; border: 1px solid var(--border); border-radius: var(--radius-item); box-shadow: var(--shadow-lg);
  animation: pop-in 0.14s ease-out both; transform-origin: top left;
}
.status-pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; text-align: left; white-space: nowrap; cursor: pointer;
}
.status-pop-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.status-pop-item:hover, .status-pop-item:focus-visible { background: #F3F3F6; outline: none; }
.status-pop-item.is-current { font-weight: 800; }
.status-pop-item.is-current::after {
  content: ''; margin-left: auto; width: 5px; height: 10px; margin-top: -3px;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg);
}
@media (prefers-reduced-motion: reduce) { .status-pop { animation: none; } .report-preview [data-status-pick], .report-preview [data-status-pick]::after { transition: none; } }
.report-preview .report-user + .report-user { margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .report-preview .report-table td.is-saved::after { animation: none; } }
/* Log work form: Status and Time required side by side. "Your logged work": status pill + flags. */
.lw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lw-row-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.lw-status { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-main); color: var(--ink); border: 1px solid var(--border); }
.lw-status-done { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.lw-status-in_progress { background: var(--surface-main); color: var(--ink); border-color: var(--ink); }
.lw-status-blocked { background: #FFFFFF; color: var(--red); border-color: var(--red); }
.lw-status-not_started { background: var(--ground); color: var(--ink-2); }
.lw-flag { display: inline-flex; color: var(--ink-2); }
.lw-flag .icon { width: 14px; height: 14px; }
@media (max-width: 600px) { .lw-grid { grid-template-columns: minmax(0, 1fr); } }

/* Your logged work: "Ongoing" (entries not Done, carried onto each working day's report). */
.lw-ongoing { margin-bottom: var(--sp-16); padding-bottom: var(--sp-12); border-bottom: 1px solid var(--border); }
.lw-section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 var(--sp-8); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.lw-section-title .count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: #FFFFFF; font-size: 11px; letter-spacing: 0; }
.lw-removed { font-size: 12px; color: var(--muted); }
.row.is-removed .pre-line { color: var(--muted); text-decoration: line-through; }
.lw-ongoing-actions { display: flex; align-items: center; gap: 6px; }
.lw-history { margin-top: 4px; font-size: 12px; }
.lw-history summary { cursor: pointer; color: var(--muted); width: max-content; }
.lw-history summary:hover { text-decoration: underline; }
.lw-history ol { margin: 4px 0 0; padding-left: 18px; }
.lw-history li { margin: 0 0 2px; }

/* ---- Modals always fit the window ----
   Every <dialog class="dialog"> is at most 90vh (100dvh - 32px on small screens) and scrolls
   inside itself: the header (title + x) sticks to the top and the last .form-actions (Save /
   Cancel) sticks to the bottom with a thin top border, so Save is never below the screen.
   Lists that open inside (client picker, calendar, time list, people picker) float above it
   ("Floating lists in modals" in app.js), so the scrolling body never clips them. */
.dialog:not(.lightbox) {
  max-height: min(90vh, calc(100dvh - 32px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 0;
  padding-bottom: 0;
  background: #FFFFFF;
}
.dialog.dialog-confirm { padding-top: 24px; padding-bottom: 24px; }
.dialog .dialog-head { position: sticky; top: 0; z-index: 6; margin: 0; padding: 24px 0 12px; background: #FFFFFF; }
.dialog:not(.dialog-confirm) > .form-actions:last-child,
.dialog:not(.dialog-confirm) > form > .form-actions:last-child {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin-top: 4px;
  padding: 12px 0 24px;
  background: #FFFFFF;
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 14px -14px rgba(11, 11, 15, 0.35);
}
.dialog > :last-child:not(.form-actions):not(form), .dialog > form > :last-child:not(.form-actions) { margin-bottom: 24px; }
.dialog.send-dialog, .dialog.crop-dialog { max-height: min(90vh, calc(100dvh - 32px)); }
.dialog .is-floating-list { position: fixed; z-index: 80; }
@media (max-width: 640px) { .dialog:not(.lightbox):not(.dialog-confirm) { width: calc(100vw - 16px); } }

/* ---- Log work form: compact (views/partials/log-work-fields.ejs) ---- */
.lw-fields { display: grid; gap: 12px; }
.lw-fields textarea { resize: vertical; }
.lw-more { border-top: 1px solid var(--border); padding-top: 8px; }
.lw-more > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--ink); list-style: none; padding: 4px 0; }
.lw-more > summary::-webkit-details-marker { display: none; }
.lw-more > summary .icon { width: 14px; height: 14px; transition: transform 0.15s; }
.lw-more[open] > summary .icon { transform: rotate(180deg); }
.lw-more > summary:hover { text-decoration: underline; }
.lw-more-body { display: grid; gap: 12px; margin-top: 8px; }
@media (max-width: 640px) { .lw-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-height: 800px) {
  .dialog .form, .lw-fields, .lw-more-body { gap: 8px; }
  .dialog .dialog-head { padding-top: 16px; padding-bottom: 8px; }
  .dialog:not(.dialog-confirm) > .form-actions:last-child, .dialog:not(.dialog-confirm) > form > .form-actions:last-child { padding-bottom: 16px; padding-top: 10px; }
  .dialog :is(input[type="text"], input[type="date"], input:not([type]), select, .combobox-input) { min-height: 40px; height: 40px; }
  .dialog .btn:not(.btn-small) { min-height: 40px; height: 40px; }
  .dialog .field > span { margin-bottom: 2px; }
}
@media (prefers-reduced-motion: reduce) { .lw-more > summary .icon { transition: none; } }

/* Daily Report preview on small screens: each person's table keeps a readable width and scrolls
   sideways inside its own box (page CSS only; copies and the email keep the inline table). */
.report-preview .report-user { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.report-preview .report-table { min-width: 760px; }

/* Export CSV (views/partials/export-csv.ejs): the button, then a small "Export all" link, at the
   end of the filter row (wraps under it on small screens). */
.export-csv { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; white-space: nowrap; }
.export-csv .export-all { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.export-csv .export-all:hover { text-decoration-thickness: 2px; }
@media (max-width: 640px) { .export-csv { margin-left: 0; } }
.filter-row > .list-search { margin: 0; flex: 1 1 220px; max-width: 340px; } /* Cloudflare Accounts: search and Export on one line */
.ticket-filters .export-csv { margin-left: 0; } /* the search before it already sits on the right */

/* Floating popovers move with the translate property (placePopover in app.js): no layout work
   while the page scrolls; their own scrolling stays inside them. */
.edit-panel.is-floating { will-change: translate; overscroll-behavior: contain; }

/* While a popover or a drawer is open (html.has-overlay, setOverlay() in app.js) nothing on
   the page behind lifts or animates on hover, so it never moves under the open panel. */
html.has-overlay .main :hover:not(dialog *),
html.has-overlay .rail :hover,
html.has-overlay .topbar :hover { transform: none !important; translate: none !important; transition: none !important; animation: none !important; }

/* ---- Side drawer (<dialog class="dialog drawer">, "Side drawers" in app.js) ----
   From the right, 480px wide, full height (full width on phones). Header and footer stay put;
   only the body scrolls, and its scrolling never scrolls the page behind. */
.dialog.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(480px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  border: 0; border-left: 1px solid var(--border); border-radius: var(--radius-panel) 0 0 var(--radius-panel);
  overflow: hidden; background: #FFFFFF; box-shadow: var(--shadow-lg);
}
.dialog.drawer[open] { display: flex; flex-direction: column; animation: drawer-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.dialog.drawer::backdrop { background: rgba(11, 11, 15, 0.42); backdrop-filter: blur(2px); }
.dialog.drawer .drawer-head {
  position: static; flex: none; display: flex; align-items: center; gap: 12px; margin: 0;
  padding: 18px 20px; border-bottom: 1px solid var(--border); background: #FFFFFF;
}
.drawer-title { flex: 1 1 auto; min-width: 0; }
.drawer-title h2 { margin: 0; font-size: 18px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-title .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 24px; -webkit-overflow-scrolling: touch; }
.drawer-section { padding: 16px 0; border-bottom: 1px solid var(--border); }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section > .edit-section { margin-top: 0; }
.drawer-form { display: block; }
.drawer-form .drawer-section { display: grid; gap: 12px; }
.dialog.drawer > .drawer-foot, .dialog.drawer > .form-actions:last-child {
  position: static; flex: none; margin: 0; padding: 14px 20px; background: #FFFFFF;
  border-top: 1px solid var(--border); box-shadow: 0 -10px 14px -14px rgba(11, 11, 15, 0.35);
}
@media (max-width: 640px) {
  .dialog.drawer:not(.lightbox):not(.dialog-confirm) { width: 100vw; border-left: 0; border-radius: 0; } /* beats the general phone width of modals */
}
@media (prefers-reduced-motion: reduce) { .dialog.drawer[open] { animation: none; } }
.drawer-body > .drawer-error { margin: 16px 0 0; }

/* ---- Top bar: three areas and "priority+" navigation ("Top bar navigation" in app.js) ----
   The logo and the icons on the right keep their size; only the nav between them shrinks.
   The script shows as many pills as fit and lists the rest in "More"; the current page's pill
   always stays. Below 1100px the logo is the icon only; below 900px (html.nav-collapsed) the
   nav is one "Menu" button opening a full-width menu. Without JavaScript the track scrolls. */
.topbar { display: flex; align-items: center; gap: 16px; }
.topbar > .brand { flex: none; }
.topbar > .pillnav { flex: 1 1 0; min-width: 0; display: flex; justify-content: center; }
.topbar > .topbar-tools { flex: none; margin-left: auto; }
html.js .pillnav-track { overflow: hidden; }
.pillnav-track > li[hidden], .nav-more-entry[hidden] { display: none !important; }
.pill-menu-icon { display: none; }
.pill-menu-icon .icon { width: 16px; height: 16px; }
.nav-more-menu { max-height: calc(100dvh - 96px); overflow-y: auto; overscroll-behavior: contain; }
.nav-more-entry + .nav-more-entry .menu-label { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 10px; }
html.nav-collapsed .pillnav { justify-content: flex-start; }
html.nav-collapsed .pill-menu-icon { display: inline-flex; }
html.nav-collapsed .pillnav-track { background: transparent; padding: 0; }
html.nav-collapsed .pillnav-more > .pill-item { background: #FFFFFF; border: 1px solid var(--border); height: 44px; padding: 0 16px; color: var(--ink); }
html.nav-collapsed .nav-more-menu.is-full { width: auto; }
@media (max-width: 1099.98px) {
  .brand-name { display: none; }
}
@media (max-width: 1023.98px) {
  .topbar { gap: 10px; }
}
/* Page headers: the actions wrap under the title and never leave the window. */
.page-head > * { min-width: 0; max-width: 100%; }
.page-head > .actions { justify-content: flex-end; }
@media (max-width: 640px) {
  .page-head > .actions { justify-content: flex-start; }
}
