/* Makerspace Nanaimo support desk.
   1. Fonts (self-hosted, from brand/mockups/fonts; OFL).
   2. App components: copied verbatim from brand/service-desk/html/styles.css (the brand's
      reference implementation). Update by re-copying, not by editing in place.
   3. Desk additions, using only tokens from tokens.css (copied from brand/tokens.css). */

@font-face {
  font-family: 'Archivo Black';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Archivo-Black-400-normal-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Atkinson-Hyperlegible-400-italic-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Atkinson-Hyperlegible-400-normal-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/Atkinson-Hyperlegible-700-normal-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/IBM-Plex-Mono-400-normal-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/IBM-Plex-Mono-500-normal-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/IBM-Plex-Mono-700-normal-latin.woff2') format('woff2');
}

/* ===== 2. Reference components (brand/service-desk/html/styles.css) ===== */
/* Makerspace Nanaimo service desk — shared components. Theme comes from official tokens.css via html[data-theme] */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family-sans);
  font-size: 16px;
  line-height: var(--line-height-body-sm);
  font-weight: var(--font-weight-regular);
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ----- App shell ----- */
.topbar {
  height: var(--layout-topbar-height);
  background: var(--color-red);
}
.app-header {
  height: var(--layout-header-height);
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: 0 var(--layout-page-pad);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.brand img {
  width: var(--logo-header-size);
  height: var(--logo-header-size);
}
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-name {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-display);
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text);
}
html[data-theme="shop-floor"] .brand-name { color: var(--color-indigo); }
.brand-app {
  font-family: var(--font-family-mono);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-overline);
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.app-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-left: auto;
  font-size: var(--font-size-body-sm);
  font-weight: var(--font-weight-bold);
}
.app-nav a {
  color: var(--color-text-muted);
  min-height: var(--control-tap-min);
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  border-bottom: 3px solid transparent;
}
.app-nav a:hover { color: var(--color-text); }
.app-nav a[aria-current="page"] {
  color: var(--color-indigo);
  border-bottom-color: var(--color-red);
}
html[data-theme="night-bench"] .app-nav a[aria-current="page"] {
  color: var(--color-white);
}
.header-tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.theme-switch {
  display: flex;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 40px;
}
.theme-switch a {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
  background: transparent;
  white-space: nowrap;
}
.theme-switch a[aria-current="true"] {
  background: var(--color-indigo);
  color: var(--color-text-inverse);
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-tap-min);
  padding: 0 4px 0 4px;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-body-sm);
  color: var(--color-text);
}

/* ----- Layout ----- */
.page {
  width: 100%;
  max-width: calc(var(--layout-grid-max) + 2 * var(--layout-page-pad));
  margin: 0 auto;
  padding: var(--space-6) var(--layout-page-pad) var(--space-8);
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
.page-kicker {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-overline);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-overline);
  text-transform: uppercase;
  color: var(--color-red-ink);
  margin-bottom: var(--space-2);
}
html[data-theme="night-bench"] .page-kicker { color: var(--color-red-bright); }
.page-head h1 {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-display);
  font-size: var(--font-size-h2);
  line-height: var(--line-height-h2);
  letter-spacing: var(--letter-spacing-display);
  color: var(--color-text);
}
html[data-theme="shop-floor"] .page-head h1 { color: var(--color-indigo); }
.page-note {
  font-size: var(--font-size-caption);
  line-height: var(--line-height-caption);
  color: var(--color-text-muted);
  max-width: 28em;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-button-height);
  min-width: var(--control-tap-min);
  padding: 12px var(--control-button-padding-x);
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-button);
  white-space: nowrap;
}
.btn:focus-visible {
  outline: var(--control-focus-width) solid var(--color-focus-ring);
  outline-offset: var(--control-focus-offset);
}
.btn-accent {
  background: var(--color-red-ink);
  color: var(--color-text-inverse);
  border-color: var(--color-red-ink);
}
.btn-primary {
  background: var(--color-indigo);
  color: var(--color-text-inverse);
  border-color: var(--color-indigo);
}
.btn-secondary {
  background: transparent;
  color: var(--color-indigo);
  border-color: var(--color-indigo);
}
html[data-theme="night-bench"] .btn-secondary {
  color: var(--color-white);
  border-color: var(--color-white);
}
.btn-ghost {
  background: transparent;
  color: var(--color-indigo);
  border-color: transparent;
  padding-left: 14px;
  padding-right: 14px;
}
html[data-theme="night-bench"] .btn-ghost { color: var(--color-white); }

/* ----- Badges ----- */
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family-mono);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}
.badge-open { color: var(--color-status-open); background: var(--color-status-open-bg); }
.badge-progress { color: var(--color-status-progress); background: var(--color-status-progress-bg); }
.badge-waiting { color: var(--color-status-waiting); background: var(--color-status-waiting-bg); }
.badge-resolved { color: var(--color-status-resolved); background: var(--color-status-resolved-bg); }
.badge-low { color: var(--color-priority-low); background: var(--color-priority-low-bg); }
.badge-medium { color: var(--color-priority-medium); background: var(--color-priority-medium-bg); }
.badge-high { color: var(--color-priority-high); background: var(--color-priority-high-bg); }
.badge-urgent { color: var(--color-priority-urgent); background: var(--color-priority-urgent-bg); }
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  color: var(--color-text-soft);
  font-family: var(--font-family-mono);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

/* ----- Filter chips ----- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5) var(--space-7);
  margin-bottom: var(--space-5);
}
.filter-group { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.filter-label {
  font-family: var(--font-family-mono);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-overline);
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}
.chip:focus-visible {
  outline: var(--control-focus-width) solid var(--color-focus-ring);
  outline-offset: var(--control-focus-offset);
}
.chip[aria-pressed="true"] {
  background: var(--color-indigo);
  border-color: var(--color-indigo);
  color: var(--color-text-inverse);
}

/* ----- Ticket table / list ----- */
.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
table.tickets {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-body-sm);
}
.tickets th {
  text-align: left;
  font-family: var(--font-family-mono);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-overline);
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-line);
}
.tickets td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-line);
  vertical-align: middle;
  color: var(--color-text-soft);
}
.tickets tr:last-child td { border-bottom: 0; }
.tickets tbody tr:hover td { background: var(--color-indigo-soft); }
.tickets a.title-link {
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
}
.tickets a.title-link:hover { color: var(--color-indigo); }
html[data-theme="night-bench"] .tickets a.title-link:hover { color: var(--color-red-bright); }
.tickets .id {
  font-family: var(--font-family-mono);
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.tickets .updated { white-space: nowrap; font-size: 14px; color: var(--color-text-muted); }
.mobile-list { display: none; }

/* ----- Detail layout ----- */
.crumb {
  font-size: var(--font-size-caption);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.crumb a { color: var(--color-indigo); font-weight: var(--font-weight-bold); }
html[data-theme="night-bench"] .crumb a { color: var(--color-red-bright); }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--layout-grid-gutter);
  align-items: start;
}
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}
.panel-body { padding: var(--space-5); }
.ticket-title {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-display);
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text);
  margin: 0 0 var(--space-3);
}
.ticket-flags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-5); }

/* Chat */
.thread { display: flex; flex-direction: column; gap: var(--space-4); }
.msg {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--space-3);
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-indigo-soft);
  color: var(--color-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}
html[data-theme="night-bench"] .avatar { color: var(--color-white); }
.msg-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: 4px;
}
.msg-name { font-weight: var(--font-weight-bold); font-size: 14px; color: var(--color-text); }
.msg-time {
  font-family: var(--font-family-mono);
  font-size: 12px;
  color: var(--color-text-muted);
}
.bubble {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
}
.bubble-in { background: var(--color-chat-incoming-bg); }
.bubble-out { background: var(--color-chat-outgoing-bg); }
.composer {
  margin-top: var(--space-5);
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}
.composer textarea {
  flex: 1;
  min-height: 48px;
  max-height: 120px;
  resize: none;
  padding: 12px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
}
.composer textarea:focus-visible {
  outline: var(--control-focus-width) solid var(--color-focus-ring);
  outline-offset: var(--control-focus-offset);
  border-color: var(--color-indigo);
}

/* Sidebar */
.sidebar { padding: 0; overflow: hidden; }
.sidebar h2 {
  font-family: var(--font-family-mono);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-overline);
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 14px 20px;
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-line);
}
.dl { padding: 8px 20px 20px; }
.dl-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-line);
  align-items: center;
}
.dl-row:last-child { border-bottom: 0; }
.dl-row dt {
  font-size: 13px;
  color: var(--color-text-muted);
}
.dl-row dd { font-size: 14px; font-weight: var(--font-weight-bold); color: var(--color-text); }

/* ----- Forms ----- */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5) var(--space-5);
}
.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.field-span { grid-column: 1 / -1; }
.field label, .field .label {
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-caption);
  color: var(--color-text);
}
.req { color: var(--color-error); }
.field input, .field select, .field textarea {
  height: var(--control-input-height);
  width: 100%;
  padding: 0 12px;
  background: var(--color-surface);
  color: var(--color-text);
  border: var(--control-input-border-width) solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-body-sm);
}
html[data-theme="night-bench"] .field input,
html[data-theme="night-bench"] .field select,
html[data-theme="night-bench"] .field textarea {
  background: var(--color-bg);
}
.field textarea { height: auto; min-height: 96px; padding: 12px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: var(--color-text-muted); }
.field select { appearance: none; background-image: none; }
.help {
  font-size: var(--font-size-caption);
  line-height: var(--line-height-caption);
  color: var(--color-text-muted);
}
.field-error input, .field-error select, .field-error textarea {
  border-color: var(--color-error);
  background: var(--color-error-bg);
}
.field-error .error-msg {
  font-size: var(--font-size-caption);
  line-height: var(--line-height-caption);
  color: var(--color-error);
  font-weight: var(--font-weight-bold);
}
.field-focus input, .field-focus select, .field-focus textarea {
  border-color: var(--color-indigo);
  outline: var(--control-focus-width) solid var(--color-focus-ring);
  outline-offset: var(--control-focus-offset);
}
html[data-theme="night-bench"] .field-focus input,
html[data-theme="night-bench"] .field-focus select,
html[data-theme="night-bench"] .field-focus textarea {
  border-color: var(--color-white);
}
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

/* Avatars in header */
.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}


.compact-meta { display: none; }

/* Mobile nav */
.bottom-nav { display: none; }
.sample-tag {
  font-family: var(--font-family-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ----- Mobile ----- */
@media (max-width: 767px) {
  .app-header {
    height: 72px;
    padding: 0 var(--layout-page-pad-sm);
    gap: var(--space-3);
  }
  .brand img { width: 48px; height: 48px; }
  .brand-name { font-size: 16px; }
  .app-nav, .theme-switch { display: none; }
  .page {
    padding: var(--space-5) var(--layout-page-pad-sm) 88px;
  }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head h1 { font-size: var(--font-size-h3); line-height: var(--line-height-h3); }
  .filters { gap: var(--space-4); margin-bottom: var(--space-4); }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .table-wrap { display: none; }
  .mobile-list { display: flex; flex-direction: column; gap: var(--space-3); }
  .ticket-card {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    padding: 14px 16px;
  }
  .ticket-card .row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
  }
  .ticket-card .title-link {
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    font-size: 16px;
    line-height: 1.3;
  }
  .ticket-card .meta {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 6px 0 10px;
  }
  .ticket-card .flags { display: flex; gap: 8px; flex-wrap: wrap; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .ticket-title { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-card { padding: var(--space-5); }
  .field textarea { min-height: 80px; }
  .page-head .page-note { display: none; }
  .page-head { margin-bottom: var(--space-4); }
  .compact-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    padding: 12px 16px;
    margin-bottom: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    font-size: 13px;
  }
  .compact-meta div { min-width: 0; }
  .compact-meta .k { color: var(--color-text-muted); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-family-mono); margin-bottom: 2px; }
  .compact-meta .v { font-weight: var(--font-weight-bold); color: var(--color-text); }
  .sidebar { display: none; } /* full sidebar is a desktop pattern; compact-meta is the mobile stand-in, shown in the fold */
  .bottom-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 64px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-line);
    z-index: 20;
  }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 12px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-muted);
    min-height: 48px;
  }
  .bottom-nav a[aria-current="page"] { color: var(--color-indigo); }
  html[data-theme="night-bench"] .bottom-nav a[aria-current="page"] { color: var(--color-white); }
}

/* ===== 3. Desk additions ===== */
.theme-switch button {
  display: inline-flex; align-items: center; padding: 0 10px; border: 0;
  font-size: 12px; font-weight: var(--font-weight-bold);
  color: var(--color-text-muted); background: transparent; white-space: nowrap;
}
.theme-switch button[aria-pressed="true"] { background: var(--color-indigo); color: var(--color-text-inverse); }
.theme-switch button:focus-visible { outline: 3px solid var(--color-focus-ring); outline-offset: -3px; }
.signout { margin: 0; }
.link { color: var(--color-indigo); font-weight: var(--font-weight-bold); text-decoration: underline; }
html[data-theme="night-bench"] .link { color: var(--color-red-bright); }
.signout button {
  background: none; border: 0; min-height: var(--control-tap-min); padding: 0 4px;
  font-size: var(--font-size-body-sm); font-weight: var(--font-weight-bold); color: var(--color-text-muted);
}
.signout button:hover { color: var(--color-text); text-decoration: underline; }
.notice {
  border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: var(--space-5);
  font-weight: var(--font-weight-bold);
}
.notice-ok { color: var(--color-success); background: var(--color-success-bg); }
.notice-error { color: var(--color-error); background: var(--color-error-bg); }
.cards { display: grid; gap: var(--space-5); max-width: 760px; }
.card-head {
  padding: 14px var(--space-5); background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-line);
  font-family: var(--font-family-mono); font-size: 12px; font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-overline); text-transform: uppercase; color: var(--color-text-muted);
}
.facts { display: grid; grid-template-columns: 140px 1fr; }
.facts dt, .facts dd { padding: 12px 0; border-bottom: 1px solid var(--color-line); }
.facts dt { color: var(--color-text-muted); font-size: 14px; }
.facts dd { font-weight: var(--font-weight-bold); overflow-wrap: anywhere; }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }
.card-actions { margin-top: var(--space-5); display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.help { color: var(--color-text-muted); font-size: 14px; }
.empty { text-align: center; padding: var(--space-8) var(--space-5); }
.empty h2 { font-size: var(--font-size-h3); margin-bottom: var(--space-3); }
.empty p { color: var(--color-text-soft); max-width: 46ch; margin: 0 auto; }
.auth { min-height: calc(100vh - var(--layout-topbar-height)); display: grid; place-items: center; padding: var(--space-6) var(--layout-page-pad-sm); }
.auth-card { width: 100%; max-width: 440px; text-align: center; }
.auth-card img { width: 96px; height: 96px; margin: 0 auto var(--space-4); }
.auth-card h1 {
  font-family: var(--font-family-display); font-weight: var(--font-weight-display);
  font-size: var(--font-size-h3); line-height: 1.15; margin-bottom: var(--space-2);
}
html[data-theme="shop-floor"] .auth-card h1 { color: var(--color-indigo); }
.auth-card .lead { color: var(--color-text-soft); margin-bottom: var(--space-5); }
.auth-card .btn { width: 100%; }
.auth-card .notice { text-align: left; }
.auth-card form { margin-top: var(--space-4); }
a.chip { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.chip .count { font-family: var(--font-family-mono); font-size: 12px; opacity: .85; }
.msg-body { min-width: 0; flex: 1; }
.msg-addr { font-size: 13px; color: var(--color-text-muted); overflow-wrap: anywhere; }
.msg-meta { flex-wrap: wrap; column-gap: 10px; row-gap: 2px; }
.msg-time { white-space: nowrap; }
.bubble { overflow-wrap: anywhere; }
.msg-files { margin-top: 6px; font-size: 14px; }
.msg-files:empty { display: none; }
/* Conversation actions, notes, history (step 6) */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-bottom: var(--space-4); }
.toolbar form { margin: 0; }
.more-actions { margin-bottom: var(--space-5); }
.more-actions summary { cursor: pointer; font-weight: var(--font-weight-bold); color: var(--color-text-soft); min-height: var(--control-tap-min); display: inline-flex; align-items: center; }
.more-actions summary { list-style: none; gap: 8px; }
.more-actions summary::-webkit-details-marker { display: none; }
.more-actions summary::before { content: "▸"; color: var(--color-indigo); transition: transform .15s; display: inline-block; }
html[data-theme="night-bench"] .more-actions summary::before { color: var(--color-red-bright); }
.more-actions[open] summary::before { transform: rotate(90deg); }
.more-actions summary:focus-visible { outline: var(--control-focus-width) solid var(--color-focus-ring); outline-offset: var(--control-focus-offset); }
.more-grid { display: grid; gap: var(--space-4); padding: var(--space-4) var(--space-5); background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-sm); }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin: 0; }
.inline-form label, .field-label { font-weight: var(--font-weight-bold); font-size: 14px; }
.inline-form select, .inline-form input[type="date"], .inline-form input[type="text"] {
  min-height: var(--control-tap-min); padding: 0 12px; border: 2px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); font: inherit;
}
.inline-form select:focus-visible, .inline-form input:focus-visible { outline: var(--control-focus-width) solid var(--color-focus-ring); outline-offset: var(--control-focus-offset); }
.btn.danger { color: var(--color-error); }
html[data-theme="night-bench"] .btn.danger { color: var(--color-red-bright); }
.bubble-note { background: var(--color-warning-bg); color: var(--color-text); border-left: 4px solid var(--color-warning); }
html[data-theme="night-bench"] .bubble-note { color: var(--color-text); }
.event { font-size: 13px; color: var(--color-text-muted); padding-left: 52px; }
.event time { font-family: var(--font-family-mono); }
.note-composer { flex-wrap: wrap; }
.note-composer .field-label { flex-basis: 100%; }
.note-composer textarea { max-height: 240px; resize: vertical; }
table.rules { width: 100%; border-collapse: collapse; margin-bottom: var(--space-5); font-size: 14px; }
table.rules th { text-align: left; font-family: var(--font-family-mono); font-size: 12px; text-transform: uppercase; letter-spacing: var(--letter-spacing-overline); color: var(--color-text-muted); padding: 8px 8px 8px 0; border-bottom: 1px solid var(--color-line); }
table.rules td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--color-line); overflow-wrap: anywhere; }
table.rules code { font-family: var(--font-family-mono); }
.rule-form input[type="text"] { flex: 1 1 200px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.notice-info { color: var(--color-info); background: var(--color-info-bg); }
html[data-theme="night-bench"] .notice-info { color: var(--color-text); background: var(--color-indigo-soft); }
.candidate { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; padding: 12px 16px; margin-bottom: var(--space-4);
  border: 2px dashed var(--color-border); border-radius: var(--radius-sm); }
.candidate p { flex: 1 1 260px; margin: 0; }
.candidate form { margin: 0; }
.search { display: flex; gap: var(--space-3); align-items: center; margin-bottom: var(--space-5); flex-wrap: wrap; }
.search input { flex: 1 1 260px; min-height: var(--control-tap-min); padding: 0 12px; border: 2px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); font: inherit; }
.search input:focus-visible { outline: var(--control-focus-width) solid var(--color-focus-ring); outline-offset: var(--control-focus-offset); }
.page-foot { display: none; }
@media (max-width: 767px) {
  /* Phones: the header has no room, so the theme switch sits at the foot of every page. */
  .page-foot { display: flex; justify-content: center; padding: 0 var(--layout-page-pad-sm) 96px; margin-top: calc(-1 * var(--space-5)); }
  .page-foot .theme-switch { display: flex; }
  .note-composer { flex-direction: column; align-items: stretch; }
  .note-composer .btn { align-self: flex-start; }
  .event { padding-left: 0; }
  /* Filter rules: one small block per rule instead of a crushed table */
  table.rules thead { display: none; }
  table.rules, table.rules tbody { display: block; }
  table.rules tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--color-line); }
  table.rules td { display: block; border: 0; padding: 0; }
  table.rules td:nth-child(1) { grid-column: 1; font-family: var(--font-family-mono); font-size: 12px; text-transform: uppercase; color: var(--color-text-muted); }
  table.rules td:nth-child(2) { grid-column: 1; }
  table.rules td:nth-child(3) { grid-column: 1; color: var(--color-text-soft); }
  table.rules td:nth-child(4) { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .facts { grid-template-columns: 1fr; }
  .facts dt { padding-bottom: 0; border-bottom: 0; }
  .facts dd { padding-top: 2px; }
  .user-chip { display: none; }   /* name/avatar dropped on phones so the logo and Sign out fit */
  .header-tools { margin-left: auto; }
  .signout button { white-space: nowrap; }
}

/* Reply box (step 7) */
.reply-composer { flex-direction: column; align-items: stretch; min-width: 0; border-top: 1px solid var(--color-line); padding-top: var(--space-5); }
.reply-composer textarea { width: 100%; box-sizing: border-box; max-height: none; min-height: 200px; resize: vertical; line-height: 1.5; }
.reply-composer .test-mode { margin: 0; }
.reply-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2) var(--space-3); align-items: center; }
.reply-fields label { font-weight: var(--font-weight-bold); font-size: 14px; }
.reply-fields input {
  width: 100%; box-sizing: border-box; min-height: var(--control-tap-min); padding: 0 12px; border: 2px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-bg); color: var(--color-text); font: inherit; min-width: 0;
}
.reply-fields input:focus-visible { outline: var(--control-focus-width) solid var(--color-focus-ring); outline-offset: var(--control-focus-offset); }
.reply-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.reply-actions .help { flex: 1 1 200px; }
.reply-actions input[type="file"] { max-width: 100%; font-size: 14px; }
.send-problem { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin: var(--space-2) 0 0; }
.detail-grid > * { min-width: 0; }
.reply-composer .field-label, .msg-addr { overflow-wrap: anywhere; }

/* Saved replies and notices (step 8) */
.lead-help { max-width: 70ch; margin-bottom: var(--space-5); }
.saved { padding: var(--space-4) 0; border-bottom: 1px solid var(--color-line); }
.saved:last-child { border-bottom: 0; }
.saved-title { font-size: 16px; margin: 0 0 var(--space-2); }
.saved-body { margin-bottom: var(--space-2); }
.saved-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-start; }
.saved-edit { flex-basis: 100%; }
.saved-edit summary, .saved-picker summary { cursor: pointer; font-weight: var(--font-weight-bold); font-size: 14px; }
.saved-form { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.saved-form input, .saved-form textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 2px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-bg); color: var(--color-text); font: inherit;
}
.saved-form textarea { resize: vertical; line-height: 1.5; }
.saved-form input:focus-visible, .saved-form textarea:focus-visible { outline: var(--control-focus-width) solid var(--color-focus-ring); outline-offset: var(--control-focus-offset); }
.saved-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-1); }
.saved-list li { display: flex; align-items: center; gap: var(--space-2); }
.plain-list { margin: 0 0 var(--space-3); padding-left: 1.2em; line-height: 1.7; }

/* Member panel (step 9) */
.sidebar h2 + .dl, .sidebar h2 + .member-note { margin-top: 0; }
.member-note { padding: var(--space-3) var(--space-5); margin: 0; }
.bubble-discarded { opacity: 0.6; text-decoration: line-through; text-decoration-thickness: 1px; }
