/* MSB Helpdesk - Base CSS
 *
 * Design tokens aligned with the Nexus (Client Web) design system so
 * Concierge reads as part of the same product family when users are
 * deep-linked over from Nexus:
 *   - Nexus primary blue (#0057B6) as the brand/accent color
 *   - Lato as the typeface
 *   - Red reserved for real error states only (no decorative red)
 *   - Generous whitespace, clean panels, no gradients
 *
 * Avoiding: emoji, em-dashes in UI strings, any "AI sparkle" iconography.
 * Visual register is "senior bank UI", not "consumer SaaS".
 */

/* -------------------------------------------------------------------------- */
/* Tokens                                                                     */
/* -------------------------------------------------------------------------- */
:root {
  /* Brand — accent matches Nexus $primary (#0057B6); chrome matches the actual
     rendered navbar/sidebar background (#001124, from .navbar-theme-primary:not(.headroom)
     in ClientApp/src/scss/nexus/_variables.scss / compiled Nexus CSS). */
  --msb-navy:        #0057B6;
  --msb-navy-dark:   #004A9B;
  --msb-navy-darker: #003D7F;
  --msb-chrome:      #001124;
  --msb-chrome-dark: #000c18;
  --msb-navy-soft:   #4C89CC;

  /* Surface */
  --bg-page:    #f4f6f9;
  --bg-panel:   #ffffff;
  --bg-muted:   #f7f9fc;
  --bg-sunken:  #eef1f6;

  /* Text */
  --text-strong: #0f172a;
  --text-body:   #1f2937;
  --text-muted:  #5b6675;
  --text-faint:  #8a94a3;
  --text-on-navy: #ffffff;

  /* Border */
  --border-strong: #d4dae3;
  --border-soft:   #e3e8ef;
  --border-faint:  #eef1f6;

  /* Status — informational, mapped to existing chip colors */
  --status-new:        #2a64d6;
  --status-open:       var(--msb-navy);
  --status-awaiting:   #b47000;
  --status-resolved:   #2c7a3a;
  --status-closed:     #6b7280;
  --status-snoozed:    #6f4ab0;

  --priority-low:    #6b7280;
  --priority-normal: var(--msb-navy);
  --priority-high:   #b47000;
  /* --priority-urgent removed — chips use --error directly */

  --sla-ok:     #2c7a3a;
  --sla-warn:   #b47000;
  /* --sla-breach removed — chips use --error directly */

  /* Status triplets — solid / soft (background) / border. Red is reserved for real alerts. */
  --success:        #15803D;
  --success-soft:   #ECFDF5;
  --success-border: #BBF7D0;
  --success-dark:   #14532D;

  --warning:        #B45309;
  --warning-soft:   #FEF3C7;
  --warning-border: #FCD34D;

  --error:          #B91C1C;
  --error-soft:     #FEF2F2;
  --error-border:   #FECACA;
  --error-dark:     #991B1B;

  /* Layout — radius/shadow scale matches Nexus $border-radius / $box-shadow */
  --radius-sm: 4px;
  --radius:    5px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 18px rgba(46, 54, 80, 0.02);
  --shadow:    0 8px 16px rgba(46, 54, 80, 0.15);

  /* Spacing — styleguide-aligned 1-10 scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  32px;
  --space-8:  40px;
  --space-9:  48px;
  --space-10: 64px;

  --font-sans: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

  --content-max: 1200px;
  --content-narrow: 720px;
}

/* -------------------------------------------------------------------------- */
/* Reset / base                                                               */
/* -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-body);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main.page {
  flex: 1;
}

h1, h2, h3, h4 { color: var(--text-strong); font-weight: 600; margin: 0; }
h1 { font-size: 24px; line-height: 1.3; }
h2 { font-size: 19px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.35; }
h4 { font-size: 14px; line-height: 1.4; }

p { margin: 0 0 var(--space-3) 0; }
p:last-child { margin-bottom: 0; }

a { color: var(--msb-navy); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--msb-navy-dark); }

code, pre { font-family: var(--font-mono); font-size: 13px; }

/* -------------------------------------------------------------------------- */
/* Site header                                                                */
/* -------------------------------------------------------------------------- */
.site-header {
  background: var(--msb-chrome);
  color: var(--text-on-navy);
}
.site-header .inner {
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  column-gap: var(--space-7);
  min-height: 64px;
}
.site-header .nav-toggle { display: none; }
.site-header .header-back {
  display: flex;
  align-items: center;
  flex: none;
}
.site-header .header-collapsible {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.site-header .brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-on-navy);
  text-decoration: none;
}
.site-header .brand .logo {
  height: 32px;
  width: auto;
  display: block;
}
.site-header .brand .product {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.site-header .brand .product .lighter {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  margin-left: 6px;
}
.site-header nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  flex-wrap: nowrap;
  flex: 1;
  min-width: 0;
}
.site-header .header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: none;
}
.site-header nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  white-space: nowrap;
}
.site-header nav a:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.site-header nav a.active { background: var(--msb-navy); color: #ffffff; font-weight: 600; }
.site-header nav a.bold { font-weight: 600; color: #ffffff; }

.site-header .nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  white-space: nowrap;
}
.site-header .nav-back:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.site-header .nav-back svg { flex: none; opacity: 0.7; }
.site-header .nav-back + .nav-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 var(--space-2);
}

/* Dropdown group (e.g. the OTIS cluster) — collapses several related links
   behind one trigger so the top nav doesn't overflow/wrap on admin pages. */
.site-header .nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.site-header .nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.85);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.site-header .nav-dropdown-chev { flex: none; margin-top: 1px; }
.site-header .nav-dropdown:hover .nav-dropdown-trigger,
.site-header .nav-dropdown:focus-within .nav-dropdown-trigger {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}
.site-header .nav-dropdown.active .nav-dropdown-trigger {
  background: var(--msb-navy);
  color: #ffffff;
  font-weight: 600;
}
.site-header .nav-dropdown.bold .nav-dropdown-trigger {
  font-weight: 600;
  color: #ffffff;
}
.site-header .nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  /* No gap between trigger and menu (not even a small margin) — a gap here
     breaks :hover continuity when the pointer crosses it diagonally, which
     is exactly what caused the dropdown to disappear mid-hover. */
  margin-top: 0;
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 170px;
  padding: 6px;
  z-index: 50;
}
.site-header .nav-dropdown:hover .nav-dropdown-menu,
.site-header .nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}
.site-header .nav-dropdown-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-body);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}
.site-header .nav-dropdown-menu a:hover { background: var(--bg-muted); color: var(--text-body); }
.site-header .nav-dropdown-menu a.active { background: var(--msb-navy); color: #ffffff; font-weight: 600; }
.site-header .user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.95);
}
.site-header .user-chip .role {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

/* -------------------------------------------------------------------------- */
/* Mobile nav — below this width the nav items (there can be 8+ once the
   OTIS cluster is included) no longer fit on one line. Collapse everything
   behind a hamburger toggle instead of letting it wrap/overlap.           */
/* -------------------------------------------------------------------------- */
@media (max-width: 1300px) {
  .site-header .inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    column-gap: var(--space-3);
  }
  .site-header .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 36px;
    height: 32px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    flex: none;
  }
  .site-header .nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: #ffffff;
    border-radius: 1px;
  }
  .site-header .header-collapsible {
    display: none;
    flex-basis: 100%;
    order: 3;
    flex-direction: column;
    align-items: stretch;
    padding-top: var(--space-4);
  }
  .site-header.nav-open .header-collapsible { display: flex; }
  .site-header nav {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;
    width: 100%;
  }
  .site-header nav a { padding: 10px 12px; }
  .site-header .header-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }
  .site-header .header-actions .btn {
    width: 100%;
    text-align: center;
    margin-left: 0 !important;
  }
  .site-header .user-chip { width: 100%; }

  /* OTIS-style dropdown groups: tap-to-expand inline instead of a hover
     popover (touch has no hover, and position:absolute doesn't make sense
     stacked inside a mobile menu). */
  .site-header .nav-dropdown { width: 100%; display: block; }
  .site-header .nav-dropdown-trigger { width: 100%; justify-content: space-between; padding: 10px 12px; }
  .site-header .nav-dropdown-menu {
    display: none;
    position: static;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.06);
    width: 100%;
    margin-top: 2px;
  }
  .site-header .nav-dropdown.open .nav-dropdown-menu { display: block; }
  .site-header .nav-dropdown-menu a { color: rgba(255, 255, 255, 0.85); }
  .site-header .nav-dropdown-menu a:hover { background: rgba(255, 255, 255, 0.1); color: #ffffff; }
}

/* -------------------------------------------------------------------------- */
/* Layout                                                                     */
/* -------------------------------------------------------------------------- */
.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-7) var(--space-6);
}
.page.narrow { max-width: var(--content-narrow); }

.page-header {
  margin-bottom: var(--space-6);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}
.page-header .titles h1 { margin-bottom: 4px; }
.page-header .titles .subtitle { color: var(--text-muted); font-size: 14px; }
.page-header .actions { display: flex; gap: var(--space-2); }

/* Cards / panels */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.panel.tight { padding: var(--space-4); }
.panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-6)) var(--space-5);
  padding: var(--space-3) var(--space-6);
  background: rgba(0, 87, 182, 0.04);
  border-bottom: 1px solid var(--border-soft);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.panel .panel-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--msb-navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.panel.tight .panel-header {
  margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-4);
  padding: var(--space-3) var(--space-4);
}
/* Sentence-case muted meta for the panel-header right slot — counter-balance
   to the uppercase navy title on the left. Use this instead of .section-eyebrow
   inside .panel-header. */
.panel .panel-header .panel-header-meta {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

/* -------------------------------------------------------------------------- */
/* Forms                                                                      */
/* -------------------------------------------------------------------------- */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-4);
}
.form-row > label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-body);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-row label .req { color: var(--error); margin-left: 3px; }
.form-row .hint { font-size: 12px; color: var(--text-muted); }
.form-row .error { font-size: 13px; color: var(--error); margin-top: 4px; line-height: 1.4; }

input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], textarea, select {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-body);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.4;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--msb-navy);
  box-shadow: 0 0 0 3px rgba(0, 87, 182, 0.12);
}
textarea { min-height: 120px; resize: vertical; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%236C757D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
  padding-right: 32px;
  height: 36px;
}

.form-row.compact { margin-bottom: var(--space-3); }
.form-grid {
  display: grid;
  gap: var(--space-4) var(--space-5);
  grid-template-columns: 1fr 1fr;
}
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 680px) { .form-grid { grid-template-columns: 1fr; } }

/* Radio / checkbox groups */
.choice-group { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-5); }
.choice-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  background: var(--bg-panel);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.choice-group input { margin: 0; accent-color: var(--msb-navy); }
.choice-group label:has(input:checked) {
  border-color: var(--msb-navy);
  background: rgba(0, 87, 182, 0.04);
}

/* -------------------------------------------------------------------------- */
/* Buttons                                                                    */
/* -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  background: var(--bg-panel);
  color: var(--text-body);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  line-height: 1.2;
}
.btn:hover { color: var(--text-strong); border-color: var(--border-strong); }
.btn.btn-primary {
  background: var(--msb-navy);
  color: var(--text-on-navy);
  border-color: var(--msb-navy);
}
.btn.btn-primary:hover { background: var(--msb-navy-dark); border-color: var(--msb-navy-dark); color: #ffffff; }
.btn.btn-accent {
  background: var(--msb-navy);
  color: #ffffff;
  border-color: var(--msb-navy);
}
.btn.btn-accent:hover { background: var(--msb-navy-dark); border-color: var(--msb-navy-dark); }
.btn.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-body); }
.btn.btn-ghost:hover { background: var(--bg-sunken); }
.btn.btn-link { background: transparent; border-color: transparent; color: var(--msb-navy); padding: 4px 6px; }
.btn.btn-link:hover { color: var(--msb-navy-dark); text-decoration: underline; }
.btn.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn.btn-block { width: 100%; justify-content: center; }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.55; cursor: not-allowed; pointer-events: none;
}

/* -------------------------------------------------------------------------- */
/* Chips / pills (status, priority, SLA)                                      */
/* -------------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  background: var(--bg-sunken);
  color: var(--text-muted);
  white-space: nowrap;
}
.chip.status-new      { background: rgba(42, 100, 214, 0.12); color: var(--status-new); }
.chip.status-open     { background: rgba(0, 87, 182, 0.12);  color: var(--status-open); }
.chip.status-awaiting { background: rgba(180, 112, 0, 0.14); color: var(--status-awaiting); }
.chip.status-resolved { background: rgba(44, 122, 58, 0.13); color: var(--status-resolved); }
.chip.status-closed   { background: rgba(107, 114, 128, 0.16); color: var(--status-closed); }
.chip.status-snoozed  { background: rgba(111, 74, 176, 0.14); color: var(--status-snoozed); }

.chip.priority-low,
.chip.priority-normal { background: rgba(107, 114, 128, 0.16); color: var(--priority-low); }
.chip.priority-high   { background: rgba(180, 112, 0, 0.14);  color: var(--priority-high); }
.chip.priority-urgent { background: var(--error-soft); color: var(--error); border: 1px solid var(--error-border); }

.chip.sla-ok     { background: rgba(44, 122, 58, 0.13);  color: var(--sla-ok); }
.chip.sla-warn   { background: rgba(180, 112, 0, 0.14);  color: var(--sla-warn); }
.chip.sla-breach { background: var(--error-soft); color: var(--error); border: 1px solid var(--error-border); }

/* -------------------------------------------------------------------------- */
/* Tables                                                                     */
/* -------------------------------------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-faint);
}
.data-table th {
  background: var(--bg-muted);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-muted); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------------------- */
/* Auth pages                                                                 */
/* -------------------------------------------------------------------------- */
.auth-shell {
  min-height: calc(100vh - 64px - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-7) var(--space-4);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  box-shadow: var(--shadow);
}
.auth-card h1 { margin-bottom: 6px; }
.auth-card .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: var(--space-6); }
.auth-card .alt-action { margin-top: var(--space-5); font-size: 13px; color: var(--text-muted); text-align: center; }

/* -------------------------------------------------------------------------- */
/* Footer                                                                     */
/* -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  background: var(--bg-panel);
  padding: var(--space-5) var(--space-6);
  margin-top: var(--space-9);
  color: var(--text-muted);
  font-size: 12px;
}
.site-footer .inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* -------------------------------------------------------------------------- */
/* Utilities                                                                  */
/* -------------------------------------------------------------------------- */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.stack-1 > * + * { margin-top: var(--space-1); }
.stack-2 > * + * { margin-top: var(--space-2); }
.stack-3 > * + * { margin-top: var(--space-3); }
.stack-4 > * + * { margin-top: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* Subtle banner used for v1 scope reminders (e.g. "Portal only - no email reply yet") */
.notice {
  padding: 10px 14px;
  background: rgba(0, 87, 182, 0.05);
  border: 1px solid rgba(0, 87, 182, 0.15);
  border-left: 3px solid var(--msb-navy);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-body);
  margin-bottom: var(--space-4);
}
.notice.accent {
  background: var(--error-soft);
  border-color: var(--error-border);
  border-left-color: var(--error);
}

/* -------------------------------------------------------------------------- */
/* Alerts - soft-bg + solid-text + matching border.                           */
/* Distinct from .notice (the neutral info strip with left-border accent).    */
/* Use for confirmations, errors, and warnings inside auth/form surfaces.     */
/* -------------------------------------------------------------------------- */
.alert {
  padding: 12px var(--space-4);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
}
.alert:last-child { margin-bottom: 0; }
.alert strong { font-weight: 600; }
.alert-info    { background: rgba(0, 87, 182, 0.06); color: var(--msb-navy); border-color: rgba(0, 87, 182, 0.15); }
.alert-warn    { background: var(--warning-soft);    color: var(--warning);  border-color: var(--warning-border); }
.alert-success { background: var(--success-soft);    color: var(--success);  border-color: var(--success-border); }
.alert-error   { background: var(--error-soft);      color: var(--error);    border-color: var(--error-border); }

/* -------------------------------------------------------------------------- */
/* Tabs - underlined section navigation.                                      */
/* Use for switching between distinct sub-views on the same page (e.g., MSB   */
/* Users vs Client Users). Visually distinct from .filter-chips, which filter */
/* the contents of a single list.                                             */
/* -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--space-5);
  gap: 0;
}
.tabs a {
  padding: var(--space-3) var(--space-5);
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tabs a:hover { color: var(--text-body); background: var(--bg-muted); }
.tabs a.active {
  color: var(--msb-navy);
  border-bottom-color: var(--msb-navy);
  font-weight: 600;
}

/* -------------------------------------------------------------------------- */
/* Admin console additions                                                    */
/* -------------------------------------------------------------------------- */

/* Definition lists used on detail pages */
.def-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3) var(--space-6);
  margin: 0;
}
.def-list > div { display: flex; flex-direction: column; gap: 2px; }
.def-list dt {
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.def-list dd { margin: 0; font-size: 14px; color: var(--text-strong); }
@media (max-width: 680px) { .def-list { grid-template-columns: 1fr; } }

/* Two-column layout for forms with side panels */
.admin-two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
@media (max-width: 920px) { .admin-two-col { grid-template-columns: 1fr; } }

/* Code-ish textarea for trigger phrases / JSON config */
textarea.mono-input {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  min-height: 160px;
  background: var(--bg-muted);
}

/* Tag chips for phrases */
.phrase-tag {
  display: inline-block;
  padding: 2px 10px;
  margin: 2px 4px 2px 0;
  background: var(--bg-sunken);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-body);
}

/* Versions sidebar */
.version-list { list-style: none; padding: 0; margin: 0; }
.version-list li {
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-panel);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.version-list li.current { border-color: var(--msb-navy); background: rgba(0, 87, 182, 0.04); }
.version-list .vnum { font-weight: 600; color: var(--text-strong); }
.version-list .vmeta { color: var(--text-muted); font-size: 12px; }

/* Inline help blocks on forms */
.field-help {
  background: var(--bg-muted);
  border-left: 3px solid var(--border-strong);
  padding: 10px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
  color: var(--text-muted);
  margin: -4px 0 var(--space-3) 0;
}

/* Test panel result blocks */
.test-result {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-panel);
  margin-top: var(--space-4);
}
.test-result-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-faint);
  background: var(--bg-muted);
  display: flex; justify-content: space-between; align-items: center;
}
.test-result-body { padding: 16px; }
.test-result-canned { font-size: 15px; color: var(--text-strong); white-space: pre-wrap; }
.test-result-actions {
  display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4);
}
.test-result-actions .btn { padding: 8px 14px; font-size: 13px; }

.trace-list { font-family: var(--font-mono); font-size: 12px; margin: 0; padding-left: 18px; }
.trace-list li { margin-bottom: 4px; color: var(--text-muted); }
.trace-list li.matched { color: var(--status-resolved); font-weight: 600; }
.trace-list li.inactive { opacity: 0.6; }

/* Pluggable action editor row */
.action-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}
.action-row select, .action-row input { font-size: 13px; }

/* Small inline status pill (used in tables for is_active etc.) */
.pill-on  { background: rgba(44, 122, 58, 0.13);  color: var(--sla-ok); padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.pill-off { background: rgba(107, 114, 128, 0.16); color: var(--status-closed); padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }

/* KPI tiles on admin dashboard */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.kpi {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.kpi .kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi .kpi-value { font-size: 28px; font-weight: 600; color: var(--text-strong); margin-top: 4px; }
.kpi .kpi-sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Section sub-heading */
.section-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
  margin: var(--space-4) 0 var(--space-2) 0;
}

/* Schema preview for action_types */
.schema-preview {
  background: var(--bg-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-x: auto;
  color: var(--text-body);
}

/* -------------------------------------------------------------------------- */
/* Client portal                                                              */
/* -------------------------------------------------------------------------- */

/* Category picker: large tap-target tiles, two columns above 720px */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.category-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.category-tile:hover {
  border-color: var(--msb-navy);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.category-tile .ct-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-strong);
}

.category-tile .ct-blurb {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.45;
}

.category-tile .ct-cta {
  margin-top: var(--space-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--msb-navy);
}

/* Submission form: clear visual progression of the sub-form */
.submit-form .form-section {
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-faint);
}
.submit-form .form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.contact-pref-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
@media (min-width: 640px) {
  .contact-pref-row { grid-template-columns: 1fr 1fr; }
}

/* Signature attestation: typed name treated as the signature */
.signature-block {
  background: var(--bg-muted);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: var(--space-3);
}
.signature-block .sig-attest {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.signature-block input.sig-name {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-style: italic;
  font-size: 18px;
  padding: 10px 12px;
}

/* Ticket detail header strip */
.ticket-header {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.ticket-header .row-1 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.ticket-header .reference {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}
.ticket-header h1 {
  font-size: 20px;
  margin: 4px 0 var(--space-2);
}
.ticket-header .meta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* Message thread
 * ---
 * max-height + overflow-y anchors the reply box to the bottom of the
 * viewport as the timeline grows. Timeline scrolls internally; the composer
 * below stays visible. padding-right leaves room for the scrollbar so message
 * bubbles don't shift horizontally when it appears.
 */
.message-thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  max-height: 60vh;
  overflow-y: auto;
  padding-right: var(--space-2);
}

.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 78%;
  padding: var(--space-3);
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
}

.message.from-client {
  align-self: flex-end;
  background: var(--bg-sunken);
  border-color: var(--border-strong);
}

.message.from-msb {
  align-self: flex-start;
  background: var(--bg-panel);
  border-left: 3px solid var(--msb-navy);
}

.message.from-system {
  align-self: center;
  max-width: 90%;
  background: var(--bg-muted);
  border-style: dashed;
  font-size: 13px;
  color: var(--text-muted);
}

.message .msg-meta {
  display: flex;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--text-muted);
}
.message .msg-meta .author { font-weight: 600; color: var(--text-strong); }
.message .msg-body {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-body);
}

/* Inline category-data callout on the ticket detail */
.category-summary {
  background: var(--bg-muted);
  border-left: 3px solid var(--msb-navy);
  padding: var(--space-3);
  border-radius: 0 8px 8px 0;
  margin-bottom: var(--space-3);
  font-size: 14px;
}
.category-summary dl {
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr;
  gap: 6px 16px;
  margin: 0;
}
.category-summary dt {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.category-summary dd { margin: 0; color: var(--text-strong); }

/* Filter chips */
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.filter-chips a {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-panel);
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  transition: background 120ms ease, color 120ms ease;
}
.filter-chips a:hover { color: var(--text-strong); }
.filter-chips a.active {
  background: var(--msb-navy);
  color: #ffffff;
  border-color: var(--msb-navy);
}

/* Reply box */
.reply-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: var(--space-4);
}
.reply-box h3 {
  margin: 0 0 var(--space-2);
  font-size: 15px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
}
.empty-state p { color: var(--text-muted); margin-bottom: var(--space-3); }

/* -------------------------------------------------------------------------- */
/* Agent console                                                              */
/* -------------------------------------------------------------------------- */

.queue-panel-body {
  height: 320px;
  overflow-y: auto;
}
.queue-panel-body .empty-state {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.queue-panel-body .empty-state p {
  margin-bottom: 0;
}

/* Dense queue table */
.queue-table {
  font-size: 13px;
}
.queue-table td { vertical-align: top; padding: 10px 12px; }
.queue-table .subject-cell {
  font-weight: 600;
  color: var(--text-strong);
}
.queue-table .subject-cell a {
  color: inherit;
  text-decoration: none;
}
.queue-table .subject-cell a:hover { color: var(--msb-navy); }
.queue-table .meta-row {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}
.queue-table .org-name { font-weight: 500; color: var(--text-body); }

/* Agent ticket detail: two-column with side rail */
.ticket-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-4);
}
@media (max-width: 1024px) {
  .ticket-layout { grid-template-columns: 1fr; }
}

/* Internal-note bubble: visually distinct so it cannot be mistaken for a
   client-visible reply */
.message.internal-note {
  align-self: stretch;
  background: rgba(180, 112, 0, 0.06);
  border: 1px dashed var(--status-awaiting);
  border-left-width: 3px;
}
.message.internal-note .internal-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--status-awaiting);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-right: 6px;
}

/* Audit log inline entries (status changes, assignments) interleaved with
   messages */
.event-marker {
  align-self: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-radius: 999px;
  padding: 4px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.event-marker .actor { font-weight: 600; color: var(--text-strong); }
.event-marker .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  display: inline-block;
}

/* Side rail: ticket-meta panel + actions */
.side-rail .panel { margin-bottom: var(--space-3); }
.side-rail .panel:last-child { margin-bottom: 0; }
.side-rail .field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 0;
  border-bottom: 1px solid var(--border-faint);
  font-size: 13px;
}
.side-rail .field-row:last-child { border-bottom: none; }
.side-rail .field-row .label {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.side-rail .field-row .value { color: var(--text-strong); font-weight: 500; }

/* Inline form rows for quick actions in the side rail */
.side-rail .inline-action-form {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}
.side-rail .inline-action-form select,
.side-rail .inline-action-form input {
  flex: 1;
  font-size: 13px;
  padding: 6px 8px;
}

/* Reply box - tabbed between public reply and internal note */
.reply-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--space-3);
}
.reply-tabs button {
  background: none;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.reply-tabs button:hover { color: var(--text-strong); }
.reply-tabs button.active {
  color: var(--msb-navy);
  border-bottom-color: var(--msb-navy);
}
.reply-tabs button.internal-tab.active {
  color: var(--status-awaiting);
  border-bottom-color: var(--status-awaiting);
}

/* Awaiting-client toggle row */
.toggle-awaiting {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* -------------------------------------------------------------------------- */
/* OTIS floating chat widget                                                  */
/* -------------------------------------------------------------------------- */

#otis-floating {
  z-index: 50;
}

.otis-panel {
  position: fixed;
  bottom: 148px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 51;
}
.otis-panel.open { display: flex; }

.otis-header {
  background: var(--msb-navy);
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.otis-header .otis-title { font-weight: 600; font-size: 15px; }
.otis-header .otis-sub { font-size: 12px; opacity: 0.75; margin-top: 2px; }
.otis-header .otis-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.otis-header .otis-close:hover { background: rgba(255, 255, 255, 0.08); }

.otis-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-muted);
}

.otis-msg {
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.otis-msg.user {
  align-self: flex-end;
  background: var(--msb-navy);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}
.otis-msg.assistant {
  align-self: flex-start;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 2px;
  color: var(--text-strong);
}
.otis-msg.system {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}
.otis-msg.error {
  align-self: stretch;
  background: var(--error-soft);
  border: 1px solid var(--error-border);
  color: var(--error);
  font-size: 13px;
}

.otis-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.otis-action-row .otis-action-btn {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-panel);
  border: 1px solid var(--msb-navy);
  color: var(--msb-navy);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}
.otis-action-row .otis-action-btn:hover {
  background: var(--msb-navy);
  color: #ffffff;
}
.otis-action-row .otis-action-btn[disabled] {
  opacity: 0.6;
  cursor: default;
  background: var(--bg-sunken);
  color: var(--text-muted);
  border-color: var(--border-strong);
}

.otis-typing {
  align-self: flex-start;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 12px;
}

.otis-composer {
  border-top: 1px solid var(--border-soft);
  padding: 12px;
  background: var(--bg-panel);
}
.otis-composer form { display: flex; gap: 8px; align-items: flex-end; }
.otis-composer textarea {
  flex: 1;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  min-height: 38px;
  max-height: 120px;
}
.otis-composer button {
  background: var(--msb-navy);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.otis-composer button:hover { background: var(--msb-navy-dark); }
.otis-composer button[disabled] { opacity: 0.5; cursor: default; }

/* State-action row (resolve/reopen) - sibling to the reply box, not nested */
.state-action-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-2);
}
.state-action-form { display: inline; }

/* Danger button — solid for destructive actions (hard delete, etc.) */
.btn.btn-danger {
  background: var(--error);
  border-color: var(--error);
  color: #ffffff;
}
.btn.btn-danger:hover {
  background: var(--error-dark);
  border-color: var(--error-dark);
  color: #ffffff;
}

/* Dimmed nav items - used on detail pages where queue filters are escape-hatch
   navigation rather than primary actions */
nav.top-nav a.dimmed,
.app-nav a.dimmed {
  opacity: 0.55;
}
nav.top-nav a.dimmed:hover,
.app-nav a.dimmed:hover {
  opacity: 1;
}

/* Clickable KPI cards on admin dashboard — the padding moves from the card
   onto the link itself so the link's own box IS the full card. Previously
   .kpi kept its padding and the <a> was just a content-sized block inside
   it, so hover only tinted the inner text, not the whole card. */
.kpi-card {
  padding: 0;
}
.kpi-card a.kpi-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
  box-sizing: border-box;
  padding: var(--space-5);
  border-radius: var(--radius);
}
.kpi-card a.kpi-link:hover {
  background: rgba(0, 87, 182, 0.06);
}

/* ---- OTIS review queue severity bands ---- */
.severity-section {
  padding: var(--space-3);
  border-radius: 8px;
  margin-bottom: var(--space-4);
}
.severity-section.severity-hot {
  background: var(--error-soft);
  border-left: 4px solid var(--error);
}
.severity-section.severity-review {
  background: var(--warning-soft);
  border-left: 4px solid var(--warning);
}
.severity-section.severity-soft {
  background: var(--bg-panel);
  border-left: 4px solid var(--border-strong);
}
.severity-heading {
  margin: 0 0 var(--space-1);
  font-size: 18px;
}
.severity-desc {
  margin: 0 0 var(--space-3);
  font-size: 13px;
  color: var(--text-muted);
}
.review-panel {
  background: rgba(255,255,255,0.6);
  margin-bottom: var(--space-3);
}
.chip.chip-hot {
  background: var(--error);
  color: #ffffff;
  border-color: var(--error);
}
.chip.chip-review {
  background: var(--warning);
  color: #ffffff;
  border-color: var(--warning);
}

/* ---- Session idle timer banner (top-right) ---- */
.msb-session-timer {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'Lato', system-ui, sans-serif;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  pointer-events: none;       /* never blocks the underlying UI */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.msb-session-timer-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}
.msb-session-timer-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  margin-top: 1px;
}

/* ============================================================================
   ATTACHMENTS
   Thumbnails for images, file cards for documents, and a full-screen
   lightbox for click-to-enlarge on images. Uses the same variable
   vocabulary as the rest of the sheet (--bg-*, --border-*, --text-*,
   --space-*, --radius-*, --msb-navy).
   ============================================================================ */

/* Attachment group container - appears inside message bubbles and above the
   first message for ticket-level attachments. */
.attachment-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.ticket-attachments-inline {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--space-3);
}

/* --- Image thumbnails --- */
.attachment-thumb {
  display: flex;
  flex-direction: column;
  width: 160px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text-body);
  background: var(--bg-panel);
}
.attachment-thumb:hover {
  border-color: var(--msb-navy);
}
.attachment-thumb img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: var(--bg-sunken);
}
.attachment-thumb-caption {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.3;
}
.attachment-thumb-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-thumb-size {
  color: var(--text-muted);
  font-size: 11px;
}

/* --- Non-image file cards --- */
.attachment-file {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-body);
  background: var(--bg-panel);
  min-width: 220px;
  max-width: 320px;
}
.attachment-file:hover {
  border-color: var(--msb-navy);
  background: var(--bg-muted);
}
.attachment-file-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}
.attachment-file-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.attachment-file-name {
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-file-size {
  color: var(--text-muted);
  font-size: 11px;
}
.attachment-file-download {
  color: var(--msb-navy);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

/* --- Lightbox --- */
.attachment-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: var(--space-6);
  flex-direction: column;
  gap: var(--space-3);
}
.attachment-lightbox[hidden] {
  display: none;
}
.attachment-lightbox-image {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.attachment-lightbox-caption {
  color: var(--text-on-navy);
  font-size: 14px;
  text-align: center;
}
.attachment-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-on-navy);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
}
.attachment-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.1);
}
/* ============================================================================
   COMPOSER ATTACHMENT WIDGET
   Live preview shown in the reply/create composer while attachments are
   uploading or awaiting Send. Distinct from .attachment-* classes which
   render committed attachments in the timeline.
   ============================================================================ */

/* Dropzone strip below the textarea */
[data-attachment-dropzone] {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-muted);
  font-size: 13px;
  color: var(--text-muted);
  transition: border-color 0.15s ease, background 0.15s ease;
}
[data-attachment-dropzone].is-dragover {
  border-color: var(--msb-navy);
  background: var(--bg-panel);
  color: var(--text-body);
}
[data-attachment-pick] {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-panel);
  color: var(--msb-navy);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
[data-attachment-pick]:hover {
  border-color: var(--msb-navy);
}

/* Preview list below the dropzone */
[data-attachment-preview] {
  display: none;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
[data-attachment-preview].has-items {
  display: flex;
}

.composer-attachment {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  font-size: 13px;
}
.composer-attachment.is-uploading {
  border-color: var(--msb-navy-soft);
  background: var(--bg-muted);
}
.composer-attachment.has-error {
  border-color: var(--error-border);
  background: var(--error-soft);
}

.composer-attachment-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  flex-shrink: 0;
}
.composer-attachment-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.composer-attachment-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.composer-attachment-name {
  font-weight: 500;
  color: var(--text-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-attachment-status {
  font-size: 12px;
  color: var(--text-muted);
}
.composer-attachment-status.is-ok {
  color: var(--success);
}
.composer-attachment-status.is-error {
  color: var(--error-dark);
}
.composer-attachment-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.composer-attachment-remove:hover {
  color: var(--error-dark);
  background: var(--bg-sunken);
}
/* ============================================================================
   ORIGIN CHIP - AGENT ON BEHALF
   Marker shown on the agent ticket header when origin='agent_on_behalf'.
   Uses a muted purple tint distinct from the status/priority palette so
   the eye can pick it out as "channel metadata" rather than state.
   ============================================================================ */

.chip.origin-on-behalf {
  background: #ede9fe;             /* soft violet */
  color: #5b21b6;                  /* darker violet for text */
  border: 1px solid #ddd6fe;
  font-weight: 500;
}

/* ============================================================================
   ON-BEHALF NOTICE
   Soft info panel shown on the CLIENT-side ticket detail when origin='
   agent_on_behalf'. Uses the same violet accent as the agent-side chip so
   there's a visual thread between the two views.
   ============================================================================ */

.on-behalf-notice {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: #f5f3ff;
  border-left: 3px solid #7c3aed;
  border-radius: var(--radius);
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================================================
   ORIGIN CHIP - INTERNAL
   Marker shown on the agent ticket header when origin='internal'. Black
   background + white text is the deliberate visual signal that this ticket
   is fundamentally different — it lives entirely inside MSB and no client
   will ever see it. Maximum contrast against the softer status/priority
   palette so agents cannot miss it while scanning.
   ============================================================================ */

.chip.origin-internal {
  background: #111827;             /* near-black */
  color: #ffffff;
  border: 1px solid #111827;
  font-weight: 500;
}

/* ============================================================================
   QUEUE TABS + SUB-FILTERS
   Primary tabs (Active / Internal only / Snoozed / Archive) render as an
   underline-style tab bar. Sub-filters (All / Mine / Unassigned, only under
   Active) render as pill-style chips below the tab bar. Both use existing
   design tokens for color and spacing so they blend into the queue view.
   ============================================================================ */

.queue-tabs {
  display: flex;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--space-3);
  padding: 0;
}

.queue-tab {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) 0;
  margin-bottom: -1px;             /* overlaps the border so active underline sits flush */
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.queue-tab:hover {
  color: var(--text-body);
  border-bottom-color: var(--border-strong);
}

.queue-tab.active {
  color: var(--msb-navy);
  border-bottom-color: var(--msb-navy);
  font-weight: 600;
}

.queue-subfilters {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.queue-subfilter-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: var(--space-1, 4px);
}

.queue-subfilter {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-body);
  border: 1px solid var(--border-soft);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.queue-subfilter:hover {
  background: var(--bg-sunken);
  border-color: var(--border-strong);
}

.queue-subfilter.active {
  background: var(--msb-navy);
  color: var(--text-on-navy);
  border-color: var(--msb-navy);
}

/* ============================================================================
   PORTAL BRAND FOOTER
   Small strip at the bottom of every client-facing page. Reads as product
   attribution: "Concierge Support Portal by MSB" next to the OTIS mark.
   Muted and centered so it does not compete with page content but leaves
   a clear signal that this is a distinct product, not a white-labeled
   generic helpdesk.
   ============================================================================ */

.portal-footer {
  text-align: center;
  padding: 32px 20px 20px;
  margin-top: var(--space-6, 32px);
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.portal-footer-mark {
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  opacity: 0.85;             /* soften so the mark reads as attribution not brand takeover */
}

.portal-footer-text {
  vertical-align: middle;
  font-weight: 500;
}
