:root {
  --ev-black: #0a0a0a;
  --ev-charcoal: #000000;
  --ev-gray: #000000;
  --ev-light: #f5f5f5;
  --ev-white: #ffffff;
  --ev-red: #1B3A5C;
  /* Borders — shared across the app (darker than legacy #ddd / #eee / #ccc) */
  --ev-border: #aeaea4;
  --ev-border-subtle: #c9c9c0;
  --ev-border-strong: #8f8f86;
  /* Change Orders / editorial design tokens */
  --co-navy: #1B3A5C;
  --co-amber: #92600a;
  --co-green: #2e7d32;
  --co-red: #b91c1c;
  --co-border: #e8e4df;
  --co-label: #000000;
  --co-surface: #fafaf9;
  --co-text: #000000;
  --co-text-secondary: #000000;
}

/* 125% root = 20px default (was 16px) — scales all rem-based type ~2 steps up */
html {
  font-size: 125%;
  font-family: 'Cormorant Garamond', Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--co-text);
  background: #ffffff;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: 'Cormorant Garamond', Georgia, serif; color: #000; }

/* Editorial labels — small-caps section titles */
label:not(.co-field),
.section-label,
.log-history-title,
.eod-question label,
.quick-log-label,
.notes-top-fields label,
.meta-field label,
.event-form-header {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--co-label);
}

/* Header */
.header {
  background: var(--ev-black);
  color: var(--ev-white);
  padding: 1rem 1.25rem;
  position: relative;
}

.header-row .header-signout,
.header .header-signout {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--ev-white);
  opacity: 0.9;
  font-size: 0.9rem;
  text-decoration: none;
}

.header.header-with-nav .header-signout {
  position: static;
  top: auto;
  right: auto;
}

.header .header-signout:hover {
  opacity: 1;
  text-decoration: underline;
}

.header-brand {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-align: center;
}

.brand-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.brand-sub {
  font-size: 0.85rem;
  opacity: 0.85;
  letter-spacing: 0.04em;
}

/* Main */
.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

.page-title {
  text-align: center;
  font-size: 1.5rem;
  margin: 0 0 1.5rem;
  color: var(--co-navy);
  letter-spacing: 0.06em;
}

.page-subtitle {
  text-align: center;
  font-size: 0.95rem;
  margin: -0.75rem 0 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--co-label);
}

.comm-hub-nav {
  text-align: center;
  margin: 0.25rem 0 1.5rem;
}

.notes-page > .page-title:first-of-type {
  margin-bottom: 0.5rem;
}

.comm-hub-nav-link {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ev-gray);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.comm-hub-nav-link:hover,
.comm-hub-nav-link:focus-visible {
  color: var(--ev-charcoal);
}

.comm-hub-nav-current {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ev-gray);
}

/* Links that look like buttons */
/* Password field + show/hide (agent sign-in, customer portal) */
.password-with-toggle {
  position: relative;
  display: block;
  margin-top: 0.4rem;
}

.password-with-toggle input[type='password'],
.password-with-toggle input[type='text'] {
  display: block;
  width: 100%;
  padding-right: 4.25rem;
  box-sizing: border-box;
}

.password-toggle-btn {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--ev-red);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  line-height: 1.2;
}

.password-toggle-btn:hover {
  text-decoration: underline;
}

.btn-link {
  display: inline-block;
  text-decoration: none;
}

.top-nav {
  display: flex;
  justify-content: center;
  margin: -0.75rem 0 1.25rem;
}

/* Home — wide, horizontal layout */
.page-home .header-home .header-brand {
  max-width: 1280px;
}

.main-home {
  max-width: 1280px;
}

.home-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--ev-border-subtle);
}

.home-hero-text {
  flex: 1 1 16rem;
}

.home-page-title {
  text-align: left;
  margin: 0 0 0.25rem;
  font-size: 2rem;
}

.home-tagline {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ev-gray);
}

.home-mission {
  margin: 0.65rem 0 0;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--ev-charcoal);
  font-style: italic;
  max-width: 36rem;
}

.home-hero-note {
  flex: 0 1 22rem;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ev-gray);
  text-align: right;
}

.home-hero-note a {
  color: var(--ev-red);
}

.home-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.home-grid > .card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.9rem 1rem;
}

.home-grid .card-title {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.home-grid .card-subtitle {
  font-size: 0.88rem;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-grid .card-featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem 1.5rem;
  align-items: center;
  padding: 1rem 1.25rem;
}

.home-grid .card-featured[hidden] {
  display: none !important;
}

.home-grid .card-featured-body {
  min-width: 0;
}

.home-grid .card-featured .card-subtitle {
  -webkit-line-clamp: 2;
  margin-bottom: 0;
}

.home-grid .card-featured .card-actions {
  margin: 0;
  flex-shrink: 0;
}

@media (min-width: 900px) {
  .home-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .home-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .home-grid .card-featured {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 640px) {
  .home-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-page-title {
    font-size: 1.6rem;
  }

  .home-hero-note {
    text-align: left;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .home-grid .card-featured {
    grid-template-columns: 1fr;
  }
}

.card,
.quick-log-card,
.end-of-day-section,
.log-history-section,
.co-contract-summary,
.event-form {
  background: var(--co-surface);
  border: 1px solid var(--co-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.form-feedback {
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ev-charcoal);
  background: #f0faf8;
  border: 1px solid #c5e6e0;
  border-radius: 8px;
}

.form-feedback[hidden] {
  display: none;
}

.card-featured {
  border-color: #e5e5e5;
  box-shadow: none;
}

.card-muted {
  background: #f5f5f5;
}

.card-title {
  font-size: 0.9375rem;
  margin-bottom: 0.35rem;
}

.card-subtitle {
  color: var(--ev-gray);
  line-height: 1.5;
  margin-bottom: 0.9rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

/* Upload section */
.upload-section h2 { font-size: 1.5rem; margin: 0 0 1rem; }

.upload-section .field {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.upload-section input[type="text"],
.upload-section input[type="email"],
.upload-section input[type="date"],
.upload-section textarea,
.upload-section select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--ev-border);
  border-radius: 8px;
  font-size: 1rem;
}

.upload-section textarea {
  resize: vertical;
  min-height: 120px;
}

.upload-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.cadence-voice-capture-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cadence-voice-capture-btn-icon {
  flex-shrink: 0;
}

.cadence-voice-capture-btn-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 2.5rem;
}

.cadence-voice-capture-btn--active {
  background: #fff5f5;
  border-color: #b22222;
  color: #b22222;
  animation: cadence-voice-capture-pulse 1.2s ease-in-out infinite;
}

.cadence-voice-capture-btn--busy {
  opacity: 0.85;
  cursor: wait;
}

@keyframes cadence-voice-capture-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(178, 34, 34, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(178, 34, 34, 0);
  }
}

.cadence-voice-capture-retry-btn {
  margin: -0.5rem 0 1rem;
}

@media (max-width: 640px) {
  .cadence-voice-capture-btn {
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
    min-height: 2.75rem;
    font-size: 0.95rem;
    padding: 0.65rem 1rem;
  }

  .cadence-voice-capture-btn--active {
    font-size: 1rem;
  }
}

.notes-hub-actions,
.notes-generate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 0.75rem 0 0;
}

.notes-save-record-status {
  margin: 0.35rem 0 0;
  max-width: 36rem;
}

.notes-save-record-status.is-ok {
  color: #166534;
}

.notes-save-record-status.is-error {
  color: #b91c1c;
}

.notes-hub-actions #saveRecordBtn.is-loading {
  position: relative;
  padding-right: 2.1rem;
  opacity: 0.85;
  cursor: wait;
}

.notes-hub-actions #saveRecordBtn.is-loading::after {
  content: '';
  position: absolute;
  right: 0.65rem;
  top: 50%;
  width: 0.85rem;
  height: 0.85rem;
  margin-top: -0.425rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: notesSaveRecordSpin 0.65s linear infinite;
}

@keyframes notesSaveRecordSpin {
  to {
    transform: rotate(360deg);
  }
}

.notes-hub-actions .btn.is-loading,
.notes-generate-actions .btn.is-loading {
  opacity: 0.85;
  cursor: wait;
}

/* Client Intelligence — desktop notes capture layout */
@media (min-width: 769px) {
  .main-agent-wide.notes-page .notes-capture-block {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 0;
  }

  .main-agent-wide.notes-page .notes-capture-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #f8f7f5;
    border: 1px solid #e8e4df;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    box-sizing: border-box;
  }

  .main-agent-wide.notes-page .notes-capture-toolbar-label {
    flex-shrink: 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #000;
    line-height: 1;
  }

  .main-agent-wide.notes-page .notes-capture-toolbar .upload-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    flex: 1 1 auto;
  }

  .main-agent-wide.notes-page .notes-capture-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 34px;
    min-height: 34px;
    padding: 0 10px;
    margin: 0;
    border: 1px solid #e8e4df;
    border-radius: 6px;
    background: #ffffff;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 12px;
    font-weight: 500;
    color: #000;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  }

  .main-agent-wide.notes-page .notes-capture-tool-btn:hover {
    border-color: #8b1a2b;
    color: #8b1a2b;
    background: #ffffff;
  }

  .main-agent-wide.notes-page .cadence-voice-capture-btn.cadence-voice-capture-btn--active {
    border-color: #8b1a2b;
    color: #8b1a2b;
    background: #fff8f8;
  }

  .main-agent-wide.notes-page .notes-capture-tool-icon {
    font-size: 13px;
    line-height: 1;
  }

  .main-agent-wide.notes-page .notes-capture-field {
    margin: 0;
  }

  .main-agent-wide.notes-page .notes-capture-field textarea {
    margin-top: 0;
    min-height: 220px;
    border: 1px solid #e8e4df;
    border-top: none;
    border-radius: 0 0 8px 8px;
    resize: vertical;
  }

  .main-agent-wide.notes-page .notes-capture-field textarea:focus {
    outline: none;
    border-color: #e8e4df;
    box-shadow: inset 0 0 0 1px #8b1a2b;
  }

  .main-agent-wide.notes-page .notes-capture-block .progress {
    margin-top: 8px;
  }

  .main-agent-wide.notes-page .notes-capture-block .upload-status {
    margin: 4px 0 0;
  }

  .main-agent-wide.notes-page .notes-capture-block .cadence-voice-capture-retry-btn {
    margin: 4px 0 0;
    align-self: flex-start;
  }

  .main-agent-wide.notes-page .notes-capture-block .notes-hub-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 16px 0 24px;
    padding: 16px 0 0;
    border-top: 1px solid #e8e4df;
  }

  .main-agent-wide.notes-page .notes-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    min-height: 42px;
    margin: 0;
    border-radius: 6px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  }

  .main-agent-wide.notes-page .notes-action-btn--save {
    padding: 0 24px;
    border: 1.5px solid #e8e4df;
    background: #ffffff;
    color: #000;
  }

  .main-agent-wide.notes-page .notes-action-btn--save:hover {
    background: #f8f7f5;
    border-color: #d8d4cf;
    color: #000;
  }

  .main-agent-wide.notes-page .notes-action-btn--summarize {
    padding: 0 24px;
    border: 1.5px solid #8b1a2b;
    background: #ffffff;
    color: #8b1a2b;
  }

  .main-agent-wide.notes-page .notes-action-btn--summarize:hover {
    background: #8b1a2b;
    color: #ffffff;
  }

  .main-agent-wide.notes-page .notes-action-btn--email {
    padding: 0 24px;
    border: 1.5px solid #8b1a2b;
    background: #ffffff;
    color: #8b1a2b;
  }

  .main-agent-wide.notes-page .notes-action-btn--email:hover {
    background: #8b1a2b;
    color: #ffffff;
  }

  .main-agent-wide.notes-page .notes-action-btn--email:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
}

.btn {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 6px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-outline {
  background: transparent;
  color: var(--co-navy);
  border: 1px solid var(--co-navy);
}

.btn-outline:hover {
  background: rgba(27, 58, 92, 0.05);
}

.btn-primary {
  background: var(--co-navy);
  color: #ffffff;
  border: 1px solid var(--co-navy);
}

.btn-primary:hover {
  background: #142d4a;
  border-color: #142d4a;
}

.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

input:not([type='checkbox']):not([type='radio']):not([type='file']),
textarea,
select {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  border: 1px solid var(--co-border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  background: #ffffff;
  color: var(--co-text);
  transition: border-color 0.15s ease;
}

input:not([type='checkbox']):not([type='radio']):not([type='file']):focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--co-navy);
  box-shadow: 0 0 0 2px rgba(27, 58, 92, 0.08);
}

input::placeholder,
textarea::placeholder {
  color: #000;
  opacity: 0.55;
}

.progress {
  height: 4px;
  background: var(--ev-border-subtle);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 100%;
  background: var(--ev-black);
  transition: width 0.2s;
}

.upload-status { font-size: 0.9rem; color: var(--ev-gray); margin: 0 0 1rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Customer history (past emails) */
.customer-history {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--ev-light);
  border-radius: 8px;
  border: 1px solid var(--ev-border);
}

.customer-history h3 {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
  color: var(--ev-charcoal);
}

.customer-history-intro {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--ev-gray);
  line-height: 1.4;
}

.customer-history-search-wrap {
  margin: 0 0 0.65rem;
}

.customer-history-search {
  position: relative;
  display: block;
  width: 100%;
  max-width: 420px;
}

.customer-history-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 2.15rem 0.55rem 2.15rem;
  border: 1px solid var(--ev-border-subtle);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ev-charcoal);
  background: var(--ev-white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.customer-history-search-input::placeholder {
  color: #000;
}

.customer-history-search-input:hover {
  border-color: var(--ev-border);
}

.customer-history-search-input:focus {
  outline: none;
  border-color: var(--ev-charcoal);
  box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.08);
}

.customer-history-search-input::-webkit-search-cancel-button,
.customer-history-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.customer-history-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ev-gray);
  pointer-events: none;
}

.customer-history-search-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ev-gray);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}

.customer-history-search-clear:hover,
.customer-history-search-clear:focus-visible {
  color: var(--ev-charcoal);
  background: rgba(0, 0, 0, 0.05);
  outline: none;
}

.customer-history-search-mark {
  background: rgba(178, 34, 34, 0.14);
  color: inherit;
  font-weight: 600;
  padding: 0 0.06em;
  border-radius: 2px;
}

.customer-history-empty {
  font-size: 0.9rem;
  color: var(--ev-gray);
  margin: 0;
  font-style: italic;
}

.customer-history-table-wrap {
  max-height: min(420px, 55vh);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--ev-border-subtle);
  border-radius: 6px;
  background: var(--ev-white);
}

.customer-history-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.4;
}

.customer-history-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ev-light);
  box-shadow: 0 1px 0 var(--ev-border-subtle);
}

.customer-history-table th {
  padding: 0.35rem 0.65rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ev-gray);
  border-bottom: 1px solid var(--ev-border);
  line-height: 1.25;
  vertical-align: middle;
}

.customer-history-col-date {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  white-space: nowrap;
}

.customer-history-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ev-gray);
  cursor: pointer;
}

.customer-history-sort-btn:hover,
.customer-history-sort-btn:focus-visible {
  color: var(--ev-red);
  outline: none;
}

.customer-history-sort-btn:focus-visible {
  text-decoration: underline;
}

.customer-history-sort-indicator {
  font-size: 0.75rem;
  line-height: 1;
}

.customer-history-col-topics {
  width: auto;
  overflow: hidden;
}

.customer-history-col-actions {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  text-transform: none;
  letter-spacing: normal;
  padding-right: 0.65rem;
}

.customer-history-table th.customer-history-col-actions,
.customer-history-table th:last-child {
  text-align: center;
}

.customer-history-actions-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ev-gray);
  line-height: 1.25;
}

.customer-history-row {
  cursor: pointer;
  transition: background 0.12s;
}

.customer-history-row:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.customer-history-row--highlight {
  animation: customer-history-row-highlight 1.4s ease-out;
}

@keyframes customer-history-row-highlight {
  0% {
    opacity: 0.65;
    background-color: rgba(139, 26, 47, 0.14);
  }
  40% {
    opacity: 1;
    background-color: rgba(139, 26, 47, 0.08);
  }
  100% {
    opacity: 1;
    background-color: transparent;
  }
}

.customer-history-row:hover,
.customer-history-row:focus-visible {
  background: rgba(178, 34, 34, 0.06);
  outline: none;
}

.customer-history-row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--ev-red);
}

.customer-history-table td {
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid var(--ev-border-subtle);
  vertical-align: middle;
  overflow: hidden;
}

.customer-history-row:last-child td {
  border-bottom: none;
}

.customer-history-date-cell {
  width: 180px;
  max-width: 180px;
  white-space: nowrap;
  font-size: 0.85rem;
  padding-right: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-history-col-topics,
.customer-history-topics-cell {
  padding-left: 1rem;
}

.customer-history-date-primary {
  font-weight: 500;
  color: var(--ev-red);
}

.customer-history-date-sep {
  font-weight: 400;
  color: var(--ev-gray);
}

.customer-history-date-time {
  font-weight: 400;
  color: var(--ev-gray);
}

.customer-history-topics-cell {
  color: var(--ev-charcoal);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

.customer-history-actions-cell {
  width: 180px;
  max-width: 180px;
  text-align: center;
  white-space: nowrap;
  padding-left: 0.35rem;
  padding-right: 0.65rem;
  overflow: hidden;
}

.customer-history-actions-cell .btn-sm {
  padding: 0.2rem 0.35rem;
  font-size: 0.72rem;
  margin-left: 0.15rem;
}

.customer-history-actions-primary {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
}

.customer-history-actions-primary .btn-sm {
  margin-left: 0.15rem;
}

.customer-history-actions-primary .btn-sm:first-child {
  margin-left: 0;
}

.customer-history-delete-btn {
  color: #a63d4a;
  border-color: transparent;
  background: transparent;
}

.customer-history-delete-btn:hover:not(:disabled),
.customer-history-delete-btn:focus-visible:not(:disabled) {
  color: var(--ev-red);
  background: rgba(139, 26, 47, 0.06);
  border-color: rgba(139, 26, 47, 0.2);
}

.customer-history-actions-cell--confirm {
  white-space: normal;
  line-height: 1.35;
  overflow: visible;
}

.customer-history-delete-prompt {
  display: block;
  font-size: 0.75rem;
  color: var(--ev-gray);
  margin-bottom: 0.35rem;
}

.customer-history-delete-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.customer-history-delete-confirm-yes,
.customer-history-delete-confirm-cancel {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--ev-border-subtle);
  background: var(--ev-white);
  cursor: pointer;
}

.customer-history-delete-confirm-yes {
  color: #a63d4a;
  border-color: rgba(139, 26, 47, 0.25);
}

.customer-history-delete-confirm-yes:hover,
.customer-history-delete-confirm-yes:focus-visible {
  background: rgba(139, 26, 47, 0.06);
}

.customer-history-delete-confirm-cancel {
  color: var(--ev-gray);
}

.customer-history-delete-error {
  display: block;
  font-size: 0.72rem;
  color: var(--ev-red);
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.customer-history-delete-status {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--ev-green, #228b22);
  transition: opacity 0.4s ease;
}

.customer-history-delete-status.is-fading {
  opacity: 0;
}

@media (max-width: 640px) {
  .customer-history-search {
    max-width: none;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--ev-white);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  max-height: min(90vh, 720px);
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-content-wide {
  max-width: min(640px, 100%);
}

.modal-content h3 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.modal-meta {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--ev-gray);
}

.modal-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.note-source-label {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ev-charcoal);
}

.note-source-label:first-of-type {
  margin-top: 0;
}

.note-source-pre {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--ev-light);
  border: 1px solid var(--ev-border-subtle);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-source-empty {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ev-gray);
  font-style: italic;
}

.note-source-actions {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.45;
}

.note-source-summary-list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.5;
  color: var(--ev-charcoal);
}

.note-source-summary-list li + li {
  margin-top: 0.35rem;
}

.note-source-summary-editable {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--ev-light);
  border: 1px solid var(--ev-border-subtle);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ev-charcoal);
  min-height: 3rem;
}

.note-source-summary-editable:focus {
  outline: none;
  border-color: var(--ev-charcoal);
  box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.08);
}

.customer-history-actions-cell .btn-sm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.summary-content[contenteditable='true'] {
  outline: 1px dashed var(--ev-border-subtle);
  outline-offset: 4px;
  border-radius: 4px;
  cursor: text;
}

/* Error */
.error {
  color: #b22222;
  padding: 0.75rem 1rem;
  background: #fff5f5;
  border-radius: 8px;
  margin: 0 0 1rem;
}

.error:empty { display: none; }

/* Summary */
.summary-view { margin-bottom: 2rem; }

.panel-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-header h2,
.summary-view .panel-header h2 {
  font-size: 1.35rem;
  margin: 0;
}

.notes-save-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  padding: 1rem 1.25rem;
  background: var(--ev-light);
  border: 1px solid var(--ev-border);
  border-radius: 8px;
}

.notes-save-bar[hidden] {
  display: none;
}

.notes-save-bar-hint {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ev-gray);
}

.notes-save-bar-hint.is-warning {
  color: #92400e;
}

.notes-save-bar .btn-primary:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.notes-save-bar .panel-save-status.is-error {
  flex: 1 1 100%;
}

.notes-save-bar .panel-save-status {
  font-size: 0.92rem;
}

.notes-save-bar .panel-save-status.is-ok {
  color: #166534;
}

.notes-generate-save-status {
  margin: 0.65rem 0 0;
  max-width: 36rem;
}

.notes-generate-save-status.is-ok {
  color: #166534;
}

.notes-generate-save-status.is-error {
  color: #b91c1c;
}

.notes-save-intro {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ev-charcoal);
  background: var(--ev-light);
  border: 1px solid var(--ev-border);
  border-radius: 8px;
}

.notes-save-intro[hidden] {
  display: none;
}

.notes-save-intro.is-ok {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.notes-save-intro.is-warning {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.panel-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.panel-save-status {
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--ev-gray);
  transition: opacity 0.4s ease;
}

.panel-save-status[hidden] {
  display: none;
}

.panel-save-status.is-ok {
  color: #166534;
}

.panel-save-status.is-error {
  color: #b91c1c;
}

.panel-save-status.is-fading {
  opacity: 0;
}

.summary-view h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }

.summary-content {
  padding: 1rem;
  background: var(--ev-light);
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.6;
}

.action-list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.7;
}

.action-list li { margin-bottom: 0.35rem; }

/* Email template */
.email-template {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ev-border-subtle);
}

.notes-page .email-template {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.notes-page .notes-results-grid {
  width: 100%;
  max-width: none;
}

.email-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.email-header h2 { font-size: 1.35rem; margin: 0; }

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

.email-actions .btn-outline.btn-sm:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.panel-header-actions .btn-outline.btn-sm:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.note-source-modal-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.note-source-modal-head h3 {
  margin: 0 0 0.25rem;
}

.note-source-modal-head .modal-meta {
  margin: 0;
}

/* Client Intelligence — Meeting History notes modal */
#noteSourceModal.note-source-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 5000;
  overflow: hidden;
}

#noteSourceModal .note-source-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 680px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  overflow-y: hidden;
  flex: 0 1 auto;
  box-sizing: border-box;
  background: var(--ev-white);
}

#noteSourceModal .note-source-modal-top {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    'title actions'
    'meta meta';
  gap: 0.25rem 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--ev-border-subtle);
  background: var(--ev-white);
}

#noteSourceModal .note-source-modal-header-bar {
  display: contents;
}

#noteSourceModal .note-source-modal-title {
  grid-area: title;
  margin: 0;
  min-width: 0;
  align-self: start;
}

#noteSourceModal .note-source-modal-subheader {
  grid-area: meta;
  margin: 0;
  padding: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ev-gray);
}

#noteSourceModal .note-source-modal-header-end {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.5rem 0.75rem;
  flex-shrink: 0;
  align-self: start;
}

#noteSourceModal .meeting-notes-create-email-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  border: 1.5px solid #8b1a2b;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: #8b1a2b;
  white-space: nowrap;
}

#noteSourceModal .meeting-notes-create-email-btn:hover:not(:disabled),
#noteSourceModal .meeting-notes-create-email-btn:focus-visible {
  background: rgba(139, 26, 43, 0.06);
  outline: 2px solid #8b1a2b;
  outline-offset: 1px;
}

#noteSourceModal .meeting-notes-create-email-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#noteSourceModal .note-source-modal-header-end .panel-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 359px) {
  #noteSourceModal .note-source-modal-header-end .panel-header-actions {
    flex-direction: column;
    align-items: flex-end;
  }
}

#noteSourceModal .note-source-modal-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: var(--ev-light);
  color: var(--ev-charcoal);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

#noteSourceModal .note-source-modal-close:hover,
#noteSourceModal .note-source-modal-close:focus-visible {
  background: var(--ev-border-subtle);
  outline: 2px solid var(--ev-charcoal);
  outline-offset: 1px;
}

#noteSourceModal .note-source-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  -webkit-overflow-scrolling: touch;
}

#noteSourceModal .note-source-modal-footer {
  flex: 0 0 auto;
  margin-top: 0;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--ev-border-subtle);
  background: var(--ev-white);
}

@media (max-width: 720px) {
  #noteSourceModal.note-source-modal-overlay {
    padding: max(12px, 2.5vw);
  }

  #noteSourceModal .note-source-modal {
    width: 95%;
    max-width: 95%;
  }
}

/* Client Intelligence — Meeting History follow-up email modal (mobile) */
#meetingEmailModal.meeting-email-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  box-sizing: border-box;
  padding: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 5000;
  overflow: hidden;
}

#meetingEmailModal .meeting-email-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100dvh;
  margin: 0;
  border-radius: 0;
  background: var(--ev-white);
  box-shadow: none;
}

#meetingEmailModal .meeting-email-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.85rem 1rem 1rem;
}

#meetingEmailModal .meeting-email-modal-preview {
  margin-top: 0.35rem;
}

#meetingEmailModal .meeting-email-modal-footer {
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--ev-border-subtle);
  background: var(--ev-white);
}

#meetingEmailModal .meeting-email-modal-footer .btn {
  width: 100%;
  min-height: 48px;
}

#meetingEmailModal .meeting-email-modal-footer .panel-save-status {
  max-width: none;
  text-align: center;
}

@media (min-width: 769px) {
  #meetingEmailModal.meeting-email-modal-overlay {
    align-items: center;
    padding: 24px;
  }

  #meetingEmailModal .meeting-email-modal {
    width: min(720px, 95vw);
    max-width: min(720px, 95vw);
    height: auto;
    max-height: 90dvh;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  }
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

.email-preview {
  padding: 1.5rem;
  background: var(--ev-white);
  border: 1px solid var(--ev-border);
  border-radius: 8px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--ev-charcoal);
  box-sizing: border-box;
}

.notes-page .email-preview {
  max-width: none;
  width: 100%;
}

.notes-page.notes-has-results .email-template {
  margin-top: 2rem;
}

.email-edit-hint {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--ev-gray);
}

.email-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.email-save-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ev-gray);
}

.ev-brand {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ev-red);
}

.ev-divider { height: 1px; background: var(--ev-border-strong); margin: 1rem 0; }

.email-body {
  margin: 1rem 0;
}

.notes-page .email-body {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  min-height: 14rem;
  padding: 0.75rem 1rem;
  background: var(--ev-light);
  border: 1px dashed var(--ev-border);
  border-radius: 6px;
  outline: none;
  cursor: text;
}

.notes-page .email-body p {
  margin: 0 0 1em;
}

.notes-page .email-body p:last-child {
  margin-bottom: 0;
}

.notes-page .email-body:focus {
  border-color: var(--ev-red);
  background: var(--ev-white);
  box-shadow: 0 0 0 2px rgba(178, 34, 34, 0.12);
}

.notes-page .ev-signature[contenteditable='true'] {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  min-height: 5rem;
  padding: 0.65rem 1rem;
  background: var(--ev-light);
  border: 1px dashed var(--ev-border);
  border-radius: 6px;
  outline: none;
  cursor: text;
}

.notes-page .ev-signature[contenteditable='true']:focus {
  border-color: var(--ev-red);
  background: var(--ev-white);
  box-shadow: 0 0 0 2px rgba(178, 34, 34, 0.12);
}

.notes-page .ev-footer[contenteditable='true'] {
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  outline: none;
  cursor: text;
}

.notes-page .ev-footer[contenteditable='true']:focus {
  background: var(--ev-light);
  box-shadow: 0 0 0 2px rgba(178, 34, 34, 0.1);
}

.ev-signature { margin-top: 1.5rem; }
.ev-signature p { margin: 0.2rem 0; }

.ev-footer {
  font-size: 0.75rem;
  color: var(--ev-gray);
  letter-spacing: 0.02em;
}

/* Under contract — add custom tasks */
.under-contract-add-custom {
  margin-bottom: 1.25rem;
}
.under-contract-add-custom-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}
.under-contract-add-custom-intro {
  margin: 0 0 1rem;
}
.under-contract-add-custom-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}
.under-contract-add-custom-field {
  flex: 1 1 220px;
  min-width: 0;
}
.under-contract-add-custom-field input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--ev-border);
  border-radius: 8px;
  font-size: 1rem;
}
.checklist-task-with-date .checklist-task-main {
  flex-wrap: wrap;
}
.checklist-task-with-date .uc-remove-task-btn {
  margin-left: auto;
  flex-shrink: 0;
}

/* Under contract — weekly email settings */
.under-contract-weekly-email {
  margin-bottom: 1.25rem;
}
.uc-weekly-email-intro {
  margin: 0 0 0.75rem;
}
.uc-weekly-email-warning {
  margin: 0 0 0.75rem;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}
.uc-weekly-email-warning[hidden] {
  display: none !important;
}
.uc-weekly-email-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.uc-weekly-email-toggle-label {
  font-weight: 500;
  font-size: 1rem;
}
.uc-weekly-email-checkbox {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}
.uc-weekly-email-recipients {
  margin-top: 0.75rem;
}
.uc-weekly-email-recipients input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--ev-border);
  border-radius: 8px;
  font-size: 1rem;
}
.uc-weekly-email-hint {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--ev-gray);
}
.uc-weekly-email-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}
.uc-notification-settings-status {
  font-size: 0.95rem;
  color: var(--ev-gray);
}

@media (min-width: 768px) {
  .main { padding: 2rem 2rem 4rem; }
}

/* Enterprise polish — status, tables, typography caps */
.status-positive {
  background: #f0f7f0;
  color: #2e7d32;
  border: 1px solid #2e7d32;
}
.status-negative {
  background: #fdf0f0;
  color: #c62828;
  border: 1px solid #c62828;
}
.status-neutral {
  background: #f5f5f5;
  color: #000;
  border: 1px solid #999;
}
.enterprise-table thead th {
  background: #f5f5f5;
  border-bottom: 2px solid #e5e5e5;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #000;
  padding: 12px 16px;
}
.enterprise-table tbody td {
  padding: 12px 16px;
  height: 44px;
  border-bottom: 1px solid #f0f0f0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  vertical-align: middle;
}
.enterprise-table tbody tr:hover {
  background: #fafafa;
}
.enterprise-table tbody tr.row-health-red {
  border-left: 3px solid #c62828;
}
.enterprise-table tbody tr.row-health-watch {
  border-left: 3px solid #999;
}
.rank-num {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: #000;
}
.rank-num.rank-top {
  font-weight: 700;
  color: #000;
}

/* ═══════════════════════════════════════════════════════════════
   Cadence Mobile — global design system (portrait phone ≤768px)
   Visual/UX only — scoped to mobile; desktop unchanged
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --cadence-red: #1B3A5C;
    --cadence-red-hover: #142d4a;
    --cadence-red-glow: rgba(27, 58, 92, 0.25);
    --cadence-bg: #F8F7F5;
    --cadence-surface: #FFFFFF;
    --cadence-border: #E8E4DF;
    --cadence-text: #1A1614;
    --cadence-text-secondary: #000000;
    --cadence-text-tertiary: #000000;
    --cadence-nav-bg: #1A1614;
    --cadence-success: #2D7A4F;
    --cadence-error: #C0392B;
    --cadence-press: #F0EDEA;
    --cadence-shadow: 0 2px 12px rgba(26, 22, 20, 0.08);
    --cadence-shadow-elevated: 0 4px 24px rgba(26, 22, 20, 0.12);
    --cadence-tap-transition: transform 80ms ease, background 80ms ease, opacity 80ms ease;
  }

  html {
    font-size: 100%;
  }

  body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 16px;
    line-height: 1.6;
    background: #ffffff;
    color: var(--co-text);
    -webkit-tap-highlight-color: transparent;
  }

  h1, h2, h3,
  .page-title,
  .card-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    color: var(--cadence-text);
  }

  /* Page headers */
  .main {
    max-width: 100%;
    padding: 1.25rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .page-title {
    font-size: 28px;
    line-height: 1.2;
    text-align: center;
    margin: 24px 0 8px;
  }

  .page-subtitle,
  .home-tagline {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    color: var(--cadence-text-secondary);
    margin: 0 0 20px;
    line-height: 1.5;
  }

  .page-back-link,
  #trailsidePageBackBtn {
    display: none !important;
  }

  /* Section headers */
  .card > h2,
  .upload-section h2,
  .checklist-section h2,
  .checklist-group-header,
  .customer-list > h2,
  .dashboard-section > h2,
  .section-label {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cadence-text-secondary);
    margin: 0 0 8px;
    border: none;
    background: none;
    padding: 0;
  }

  /* Buttons */
  .btn,
  button.btn,
  a.btn {
    min-height: 52px;
    padding: 0 1.25rem;
    border-radius: 6px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.2;
    transition: var(--cadence-tap-transition);
    -webkit-tap-highlight-color: transparent;
  }

  .btn:active:not(:disabled) {
    transform: scale(0.97);
  }

  .btn-primary,
  .btn.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--co-navy);
    color: #ffffff;
    border: 1px solid var(--co-navy);
  }

  .btn-primary:hover,
  .btn-primary:focus-visible {
    background: #142d4a;
    border-color: #142d4a;
    opacity: 1;
  }

  .btn-primary:active:not(:disabled) {
    background: #142d4a;
  }

  .btn-outline,
  .btn.btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: transparent;
    border: 1px solid var(--co-navy);
    color: var(--co-navy);
  }

  .btn-outline:hover,
  .btn-outline:focus-visible {
    background: rgba(27, 58, 92, 0.05);
  }

  .btn-destructive,
  .btn.btn-destructive {
    background: transparent;
    border: 1.5px solid var(--cadence-error);
    color: var(--cadence-error);
  }

  .btn-sm {
    min-height: 44px;
    font-size: 12px;
    padding: 0 1rem;
  }

  .btn-link.btn {
    width: auto;
    min-height: 44px;
  }

  .card-actions {
    flex-direction: column;
    gap: 0.65rem;
  }

  .card-actions .btn {
    width: 100%;
  }

  /* Form inputs */
  label.field,
  .field {
    font-family: 'Cormorant Garamond', Georgia, serif;
  }

  label.field > span:first-child,
  label.field > .field-label-row:first-child,
  .field > span:first-child:not(.field-label-row) {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cadence-text-secondary);
    margin-bottom: 6px;
  }

  input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='hidden']),
  textarea,
  select,
  .search-input {
    min-height: 52px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 16px;
    line-height: 1.4;
    border: 1.5px solid var(--cadence-border);
    border-radius: 8px;
    background: var(--cadence-surface);
    color: var(--cadence-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }

  textarea {
    min-height: 120px;
    padding: 0.875rem 1rem;
    resize: vertical;
  }

  .co-form-panel select:not(#coFormCostCode),
  #coFormCostCode {
    min-height: 2.5rem;
    max-height: 2.75rem;
    height: auto;
    overflow: hidden;
    appearance: auto;
    -webkit-appearance: menulist;
    -moz-appearance: menulist-button;
  }

  input:not([type='checkbox']):not([type='radio']):not([type='file']):focus,
  textarea:focus,
  select:focus,
  .search-input:focus {
    outline: none;
    border-color: var(--cadence-red);
    box-shadow: 0 0 0 3px var(--cadence-red-glow);
  }

  input::placeholder,
  textarea::placeholder,
  .search-input::placeholder {
    color: var(--cadence-text-tertiary);
  }

  /* Cards */
  .card {
    background: var(--cadence-surface);
    border: 1px solid var(--cadence-border);
    border-radius: 12px;
    box-shadow: var(--cadence-shadow);
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .card-title {
    font-size: 18px;
    margin-bottom: 4px;
  }

  .card-subtitle {
    font-size: 14px;
    color: var(--cadence-text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
  }

  /* List rows / tables as touch lists */
  .customer-table-wrap {
    margin: 0 -1rem;
    border-top: 1px solid var(--cadence-border);
    border-bottom: 1px solid var(--cadence-border);
  }

  .customer-table {
    width: 100%;
    border-collapse: collapse;
  }

  .customer-table thead {
    display: none;
  }

  .customer-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 64px;
    padding: 14px 36px 14px 16px;
    border-bottom: 1px solid var(--cadence-border);
    position: relative;
    transition: background 80ms ease;
  }

  .customer-table tbody tr:active {
    background: var(--cadence-press);
    transform: scale(0.995);
  }

  .customer-table tbody tr:last-child {
    border-bottom: none;
  }

  .customer-table td {
    display: block;
    padding: 0;
    border: none;
    font-size: 13px;
    color: var(--cadence-text-secondary);
    line-height: 1.4;
  }

  .customer-table td:first-child,
  .customer-table .customer-name {
    width: 100%;
    font-size: 16px;
    font-weight: 600;
    color: var(--cadence-text);
    margin-bottom: 2px;
  }

  .customer-table tbody tr::after {
    content: '›';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--cadence-text-tertiary);
    pointer-events: none;
  }

  .customer-table td::after {
    display: none;
  }

  .customer-table .th-actions,
  .customer-table td.th-actions,
  .customer-table td:last-child:not(:first-child) {
    display: none;
  }

  .empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--cadence-text-secondary);
    font-size: 15px;
    line-height: 1.5;
  }

  /* Progress bars */
  .progress,
  .checklist-progress {
    height: 3px;
    background: var(--cadence-border);
    border-radius: 2px;
    margin: 0 0 1rem;
  }

  .progress-bar,
  .checklist-progress .progress-bar {
    background: var(--cadence-red);
    border-radius: 2px;
  }

  /* Checklist items */
  .checklist-task {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 56px;
    padding: 12px 0;
    border-bottom: 1px solid var(--cadence-border);
    transition: background 80ms ease;
  }

  .checklist-task:active {
    background: var(--cadence-press);
  }

  .checklist-task input[type='checkbox'] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin: 10px 0 0;
    accent-color: var(--cadence-red);
    cursor: pointer;
  }

  .checklist-task.done .task-label {
    text-decoration: line-through;
    color: var(--cadence-text-tertiary);
  }

  .checklist-task .task-label {
    font-size: 15px;
    line-height: 1.5;
    flex: 1;
  }

  .checklist-group {
    margin-bottom: 1.25rem;
  }

  .checklist-group-header {
    padding: 8px 0;
  }

  /* Status / toast messages */
  .form-feedback:not([hidden]),
  .error:not([hidden]) {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    max-width: calc(100vw - 32px);
    margin: 0;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    border: none;
    box-shadow: var(--cadence-shadow-elevated);
    animation: cadence-toast-in 200ms ease-out;
  }

  .form-feedback:not([hidden]) {
    background: var(--cadence-text);
    color: #ffffff;
  }

  .error:not([hidden]) {
    background: var(--cadence-error);
    color: #ffffff;
  }

  @keyframes cadence-toast-in {
    from {
      opacity: 0;
      transform: translateX(-50%) translateY(12px);
    }
    to {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
  }

  /* Skeleton loading shimmer */
  .customer-table tbody tr.is-loading,
  .customer-table tbody tr[data-skeleton='1'] {
    pointer-events: none;
  }

  .customer-table tbody tr.is-loading td,
  .customer-table tbody tr[data-skeleton='1'] td {
    color: transparent;
    background: linear-gradient(90deg, #EDEAE6 25%, #F5F3F0 50%, #EDEAE6 75%);
    background-size: 200% 100%;
    animation: cadence-shimmer 1.2s ease-in-out infinite;
    border-radius: 4px;
    min-height: 14px;
    margin: 4px 0;
    width: 80%;
  }

  @keyframes cadence-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  /* Checkbox check animation */
  .checklist-task input[type='checkbox']:checked {
    animation: cadence-check-pop 200ms ease;
  }

  @keyframes cadence-check-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
  }

  /* Icon buttons */
  button.icon-btn,
  .icon-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--cadence-tap-transition);
  }

  button.icon-btn:active,
  .icon-btn:active {
    transform: scale(0.97);
    background: var(--cadence-press);
  }

  /* Home / dashboard mobile */
  .page-home .main-home {
    padding-top: 0.5rem;
  }

  .home-hero {
    margin-bottom: 1rem;
  }

  .home-hero-text {
    background: var(--cadence-surface);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    box-shadow: var(--cadence-shadow);
    margin-bottom: 1.25rem;
  }

  .home-page-title {
    font-size: 22px;
    text-align: left;
    margin: 0 0 4px;
  }

  .home-tagline {
    text-align: left;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: 14px;
    font-weight: 400;
    color: var(--cadence-text-tertiary);
  }

  .home-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .home-grid .card {
    margin-bottom: 0;
  }

  .home-grid .card-featured {
    border-color: var(--cadence-red);
    box-shadow: var(--cadence-shadow-elevated);
  }

  /* Page fade-in */
  main {
    animation: cadence-page-in 150ms ease;
  }

  @keyframes cadence-page-in {
    from { opacity: 0.92; }
    to { opacity: 1; }
  }

  /* Dropdown slide */
  .trailside-nav-dropdown {
    animation: cadence-dropdown-in 200ms ease-out;
  }

  @keyframes cadence-dropdown-in {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Safe area on header */
  .header {
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
  }

  /* Listings / checklist pages */
  .main-checklist,
  .main-showing-feedback,
  .main-appointments,
  .main-soft-staging,
  .main-under-contract {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .main-checklist .checklist-setup,
  .main-checklist .checklist-section {
    margin-bottom: 1.25rem;
  }

  .main-checklist .checklist-fields .field select,
  .main-checklist .checklist-fields .field input,
  .main-checklist .workspace-select-field select {
    min-height: 52px;
    font-size: 16px;
  }

  .checklist-setup-actions {
    flex-direction: column;
    gap: 0.65rem;
  }

  .checklist-setup-actions .btn {
    width: 100%;
  }

  /* Agent inbox / activity rows */
  .inbox-task-row,
  .agent-inbox-row {
    min-height: 64px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--cadence-border);
    transition: background 80ms ease;
  }

  .inbox-task-row:active,
  .agent-inbox-row:active {
    background: var(--cadence-press);
  }
}

/* Change Orders */
.co-panel {
  background: var(--co-surface);
  border: 1px solid var(--co-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.co-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.co-panel-header--actions-only {
  justify-content: flex-end;
}

.co-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--co-label);
  margin: 0;
}

.co-contract-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--cadence-border, #e8e4df);
  border-radius: 6px;
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
  color: #374151;
}

.co-contract-pending {
  color: #92600a;
}

.co-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.co-filter-btn {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--cadence-border, #e8e4df);
  border-radius: 20px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  color: #000;
}

.co-filter-btn.is-active {
  background: #1B3A5C;
  border-color: #1B3A5C;
  color: #fff;
}

.co-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.co-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto auto 9.5rem;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--cadence-border, #e8e4df);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.co-row:hover {
  background: #f8fafc;
  border-color: #1B3A5C;
}

.co-row-number {
  font-weight: 700;
  color: #1B3A5C;
  font-size: 0.82rem;
}

.co-row-title {
  font-size: 0.85rem;
  color: #000;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.co-row-amount {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.co-row-created {
  font-size: 0.72rem;
  color: var(--co-navy);
  white-space: nowrap;
  line-height: 1.35;
}

.co-amount-positive {
  color: #2e7d32;
}

.co-amount-negative {
  color: #b91c1c;
}

.co-status-badge,
.log-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.co-status-draft {
  background: #f3f4f6;
  color: #000;
}

.co-status-submitted {
  background: #eff6ff;
  color: #1d4ed8;
}

.co-status-approved,
.co-status-executed {
  background: #f0fdf4;
  color: var(--co-green);
}

.co-status-rejected {
  background: #fef2f2;
  color: var(--co-red);
}

.co-empty {
  color: #000;
  font-size: 0.85rem;
  padding: 1.5rem 0;
  text-align: center;
}

.co-detail-panel,
.co-form-panel {
  border: 1px solid var(--cadence-border, #e8e4df);
  border-radius: 6px;
  padding: 1rem;
  background: #fafbfc;
}

.co-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.co-detail-number {
  font-size: 1.25rem;
  color: #1B3A5C;
  margin: 0 0 0.35rem;
}

.co-detail-amount {
  font-size: 1.5rem;
  font-weight: 800;
}

.co-detail-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.co-detail-fields label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000;
  margin-bottom: 0.2rem;
}

.co-detail-fields p {
  font-size: 0.88rem;
  color: #000;
  margin: 0;
  white-space: pre-wrap;
}

.co-detail-full {
  grid-column: 1 / -1;
}

.co-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}

.co-timeline-step {
  padding: 0.5rem;
  border: 1px solid var(--cadence-border, #e8e4df);
  border-radius: 4px;
  background: #fff;
  opacity: 0.55;
}

.co-timeline-step-complete {
  opacity: 1;
  border-color: #1B3A5C;
}

.co-timeline-step-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1B3A5C;
}

.co-timeline-step-date {
  font-size: 0.72rem;
  color: #000;
  margin-top: 0.25rem;
}

.co-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.co-rejection-reason {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.co-awaiting {
  font-size: 0.85rem;
  color: #1565c0;
  margin: 0;
}

.co-form-title {
  font-size: 1rem;
  color: #1B3A5C;
  margin: 0 0 1rem;
}

.co-field {
  display: block;
  margin-bottom: 0.75rem;
}

.co-field span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #000;
  margin-bottom: 0.3rem;
}

.co-field input:not([type="checkbox"]):not([type="radio"]),
.co-field textarea,
.co-field select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--cadence-border, #e8e4df);
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
}

/* Cost code — standard collapsed dropdown, not a listbox */
.co-form-panel select:not(#coFormCostCode),
#coFormCostCode {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  min-height: 2.5rem;
  max-height: 2.75rem;
  overflow: hidden;
  appearance: auto;
  -webkit-appearance: menulist;
  -moz-appearance: menulist-button;
  cursor: pointer;
}

.co-cost-code-field select {
  display: block;
  width: 100%;
}

.co-amount-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.co-amount-prefix {
  font-size: 0.9rem;
  color: #000;
}

.co-amount-preview {
  display: block;
  margin-top: 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.co-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .co-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .co-timeline {
    grid-template-columns: 1fr 1fr;
  }

  .co-detail-fields {
    grid-template-columns: 1fr;
  }

  .rfi-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .rfi-timeline {
    grid-template-columns: 1fr 1fr;
  }
}

/* RFIs */
.rfi-panel {
  margin-bottom: 1rem;
}

.rfi-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--co-border);
  border-radius: 6px;
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
  color: #374151;
}

.rfi-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.rfi-filter-btn {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--co-border);
  border-radius: 20px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  color: #000;
}

.rfi-filter-btn.is-active {
  background: var(--co-navy);
  border-color: var(--co-navy);
  color: #fff;
}

.rfi-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rfi-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto auto 9.5rem 6.5rem;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--co-border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.rfi-row:hover {
  background: #f8fafc;
  border-color: var(--co-navy);
}

.rfi-row-number {
  font-weight: 700;
  color: var(--co-navy);
  font-size: 0.82rem;
}

.rfi-row-title {
  font-size: 0.85rem;
  color: #000;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rfi-row-court {
  font-size: 0.78rem;
  color: #000;
  white-space: nowrap;
}

.rfi-row-created {
  font-size: 0.72rem;
  color: var(--co-navy);
  white-space: nowrap;
  line-height: 1.35;
}

.rfi-row-meta {
  font-size: 0.72rem;
  color: #000;
  white-space: nowrap;
}
.rfi-row--pending {
  border-color: #92600a;
}
.rfi-row-number--pending {
  color: #92600a;
  font-style: italic;
}
.rfi-pending-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  color: #fff;
  background: #92600a;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.rfi-detail-panel--pending .rfi-pending-badge {
  margin-left: 0;
}

.rfi-detail-panel,
.rfi-form-panel {
  border: 1px solid var(--co-border);
  border-radius: 6px;
  padding: 1rem;
  background: #fafbfc;
}

.rfi-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}

.rfi-timeline-step {
  padding: 0.5rem;
  border: 1px solid var(--co-border);
  border-radius: 4px;
  background: #fff;
  opacity: 0.55;
}

.rfi-timeline-step-complete {
  opacity: 1;
  border-color: var(--co-navy);
}

.rfi-timeline-step-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--co-navy);
}

.rfi-timeline-step-date {
  font-size: 0.72rem;
  color: #000;
  margin-top: 0.25rem;
}

.rfi-ball-in-court {
  margin: 0.75rem 0 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 14px;
}

.rfi-ball-in-court--waiting {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  color: #92600a;
  animation: rfi-pulse 2s ease-in-out infinite;
}

.rfi-ball-in-court--super {
  background: #eff6ff;
  border: 1px solid var(--co-navy);
  color: var(--co-navy);
}

.rfi-ball-in-court--closed {
  background: #f0fdf4;
  border: 1px solid var(--co-green);
  color: var(--co-green);
}

@keyframes rfi-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.rfi-response-block {
  background: #fff;
  border-left: 4px solid var(--co-amber);
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  border-radius: 0 6px 6px 0;
}

.rfi-response-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000;
  margin-bottom: 0.35rem;
}

.rfi-response-text {
  font-size: 0.9rem;
  color: #000;
  white-space: pre-wrap;
  line-height: 1.5;
}

.rfi-response-meta {
  font-size: 0.72rem;
  color: #000;
  margin-top: 0.5rem;
}

.rfi-link-co-section {
  margin: 1rem 0;
}

.rfi-link-co-section label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000;
  margin-bottom: 0.35rem;
}

.rfi-linked-co-note {
  font-size: 0.82rem;
  color: #374151;
  margin-top: 0.35rem;
}

.rfi-status-draft {
  background: #f3f4f6;
  color: #000;
}

.rfi-status-open {
  background: #eff6ff;
  color: #1d4ed8;
}

.rfi-status-answered {
  background: #fffbeb;
  color: #b45309;
}

.rfi-status-closed {
  background: #f0fdf4;
  color: var(--co-green);
}

.rfi-urgency-normal {
  background: #f3f4f6;
  color: #000;
}

.rfi-urgency-urgent {
  background: #fffbeb;
  color: #b45309;
}

.rfi-urgency-critical {
  background: #fef2f2;
  color: var(--co-red);
}

.rfi-urgency-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rfi-urgency-pill {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--co-border);
  border-radius: 20px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: #000;
}

.rfi-urgency-pill.is-active.rfi-urgency-pill-normal {
  background: #f3f4f6;
  border-color: #000;
  color: #374151;
}

.rfi-urgency-pill.is-active.rfi-urgency-pill-urgent {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
}

.rfi-urgency-pill.is-active.rfi-urgency-pill-critical {
  background: #fef2f2;
  border-color: var(--co-red);
  color: var(--co-red);
}

/* ═══════════════════════════════════════════════════════════════
   Editorial design system — site-wide refinements
   ═══════════════════════════════════════════════════════════════ */

.log-history-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Cormorant Garamond', Georgia, serif;
}

.log-history-row {
  border-bottom: 1px solid var(--co-border);
}

.log-history-row:hover {
  background: var(--co-surface);
}

.log-history-date {
  font-size: 13px;
  font-weight: 600;
  color: #000;
  letter-spacing: 0.03em;
}

.log-history-action-cell .btn {
  font-size: 11px;
  padding: 0.25rem 0.6rem;
}

.construction-site-log-tab {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--co-label);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.construction-site-log-tab.is-active {
  color: var(--co-navy);
  border-bottom-color: var(--co-navy);
}

.main-nav,
.notes-nav,
nav {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--co-border);
}

.trailside-main-nav,
#main-nav {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  letter-spacing: 0.06em;
}

/* Tenant construction — override scoped legacy styles */
body.tenant-construction .construction-site-log-tab {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--co-label);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 0.5rem 1rem;
}

body.tenant-construction .construction-site-log-tab.is-active {
  color: var(--co-navy);
  border-bottom-color: var(--co-navy);
  font-weight: 600;
}

body.tenant-construction .log-history-section,
body.tenant-construction .quick-log-card,
body.tenant-construction .end-of-day-section,
body.tenant-construction .event-form {
  background: var(--co-surface);
  border: 1px solid var(--co-border);
  border-radius: 10px;
}

body.tenant-construction .site-log-page-container .log-history-section,
body.tenant-construction .notes-page .log-history-section {
  background: transparent;
  border: none;
  border-top: 1px solid var(--co-border);
  border-radius: 0;
  padding-left: 0;
  padding-right: 0;
  margin-bottom: 0;
}

body.tenant-construction .log-history-title,
body.tenant-construction .event-form-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #000;
}

body.tenant-construction .end-of-day-toggle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #fff;
}

body.tenant-construction .log-history-table tbody tr,
body.tenant-construction .log-history-row {
  border-bottom: 1px solid var(--co-border);
}

body.tenant-construction .log-history-table tbody tr:hover,
body.tenant-construction .log-history-row:hover {
  background: var(--co-surface);
}

body.tenant-construction .log-history-date {
  font-size: 13px;
  font-weight: 600;
  color: #000;
  letter-spacing: 0.03em;
}

body.tenant-construction .log-history-table thead th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #000;
  border-bottom: 1px solid var(--co-border);
}

body.tenant-construction .log-history-table tbody td {
  color: #000;
}

body.tenant-construction .log-history-time,
body.tenant-construction .log-history-count,
body.tenant-construction .log-history-notes-cell,
body.tenant-construction .log-history-agent-cell {
  color: #000;
}

body.tenant-construction .event-field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--co-label);
}

body.tenant-construction .event-field input,
body.tenant-construction .event-field select,
body.tenant-construction .event-field textarea {
  border: 1px solid var(--co-border);
  border-radius: 6px;
  font-size: 15px;
  padding: 0.6rem 0.75rem;
}

/* Change order response landing page */
body.co-response-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--co-surface);
}

body.co-response-page .co-response-card {
  background: #ffffff;
  border: 1px solid var(--co-border);
  border-radius: 10px;
  max-width: 480px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(27, 58, 92, 0.08);
}

body.co-response-page .co-response-header {
  background: var(--co-navy);
  color: #ffffff;
  padding: 24px 28px;
}

body.co-response-page .co-response-header h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

body.co-response-page .co-response-header p {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  margin: 4px 0 0;
}

body.co-response-page .co-response-body {
  padding: 32px 28px;
  text-align: center;
}

body.co-response-page .co-response-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--co-border);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--co-label);
  text-align: center;
}

body.co-response-page .co-number {
  font-weight: 700;
  color: var(--co-navy);
}

body.co-response-page .error {
  color: var(--co-red);
}

/* Admin / auth cards */
.admin-card label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--co-label);
}

.admin-card input,
.admin-card select {
  border: 1px solid var(--co-border);
  border-radius: 6px;
}

.admin-card input:focus,
.admin-card select:focus {
  border-color: var(--co-navy);
  box-shadow: 0 0 0 2px rgba(27, 58, 92, 0.08);
}

.admin-card {
  border: 1px solid var(--co-border);
  background: var(--co-surface);
  border-radius: 10px;
}

.admin-links a,
.admin-forgot a,
.admin-mfa-link {
  color: var(--co-navy);
}

.admin-mfa-hint {
  margin: 0.5rem 0 1rem;
}

.co-audio-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.co-audio-btn {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border: 1px solid var(--co-navy);
  border-radius: 4px;
  background: transparent;
  color: var(--co-navy);
  cursor: pointer;
  white-space: nowrap;
}

.co-audio-btn.is-recording {
  background: #fef2f2;
  color: var(--co-red);
  border-color: var(--co-red);
  animation: co-pulse 1.2s ease-in-out infinite;
}

.co-audio-status {
  font-size: 12px;
  color: var(--co-label);
  font-style: italic;
}

@keyframes co-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Smart Log */
.smart-log-panel { padding: 0.5rem 0 1rem; }
.smart-log-tagline { font-size: 0.88rem; color: #000; margin: 0 0 1.25rem; }
.smart-log-record-area {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 220px; border: 1px solid var(--co-border); border-radius: 12px;
  background: var(--co-surface); padding: 2rem 1rem; margin-bottom: 1rem;
}
.smart-log-record-btn {
  width: 120px; height: 120px; border-radius: 50%; border: none;
  background: var(--co-navy); color: #fff; font-size: 2.5rem; cursor: pointer;
}
.smart-log-record-btn--recording {
  background: #dc2626;
  animation: record-pulse 1.5s ease-in-out infinite;
}
@keyframes record-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
  50% { box-shadow: 0 0 0 16px rgba(220,38,38,0); }
}
.smart-log-record-label { margin-top: 0.75rem; font-weight: 600; color: var(--co-navy); }
.smart-log-timer { font-family: ui-monospace, monospace; font-size: 1.5rem; color: #dc2626; }
.smart-log-waveform { display: flex; align-items: flex-end; gap: 4px; height: 36px; margin-bottom: 0.75rem; }
.smart-log-waveform-bar {
  width: 4px; border-radius: 2px; background: var(--co-navy);
  animation: waveform 0.8s ease-in-out infinite alternate;
}
.smart-log-waveform-bar:nth-child(2) { animation-delay: 0.1s; }
.smart-log-waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.smart-log-waveform-bar:nth-child(4) { animation-delay: 0.3s; }
.smart-log-waveform-bar:nth-child(5) { animation-delay: 0.4s; }
@keyframes waveform { from { height: 8px; } to { height: 32px; } }
.smart-log-record-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.smart-log-gps-indicator { font-size: 0.78rem; color: #000; }
.smart-log-gps-verification {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.4;
}
.smart-log-gps-verification--verified {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.smart-log-gps-verification--missing {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.smart-log-gps-accuracy { opacity: 0.85; }
.qc-sheet-gps { margin: 0 0 0.85rem; font-size: 0.82rem; }
.qc-sheet-notes-readonly {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #111827;
  white-space: pre-wrap;
}
.smart-log-text-fallback textarea {
  width: 100%; min-height: 120px; margin-bottom: 0.5rem; padding: 0.65rem;
  border: 1px solid var(--co-border); border-radius: 6px; resize: vertical;
}
.smart-log-processing-header {
  font-size: 20px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--co-navy);
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.smart-log-processing-star {
  display: inline-block;
  animation: smart-log-spin 2s linear infinite;
  font-size: 18px;
  color: var(--co-navy);
}
@keyframes smart-log-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.smart-log-processing-dots span {
  animation: smart-log-dot-fade 1.4s ease-in-out infinite;
  opacity: 0;
}
.smart-log-processing-dots span:nth-child(1) { animation-delay: 0s; }
.smart-log-processing-dots span:nth-child(2) { animation-delay: 0.3s; }
.smart-log-processing-dots span:nth-child(3) { animation-delay: 0.6s; }
@keyframes smart-log-dot-fade {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}
.smart-log-processing-steps { max-width: 360px; margin: 0 auto 2rem; }
.smart-log-step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--co-border);
  color: var(--co-label);
  font-size: 15px;
  transition: color 0.3s ease;
}
.smart-log-step.step-active {
  color: var(--co-navy);
  font-weight: 600;
}
.smart-log-step.step-complete {
  color: var(--co-green);
}
.smart-log-step.step-complete .step-label {
  color: var(--co-green);
}
.step-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--co-border);
  border-top-color: var(--co-navy);
  border-radius: 50%;
  animation: smart-log-spin 0.7s linear infinite;
}
.smart-log-step.step-complete .step-status {
  color: var(--co-green);
  font-size: 16px;
}
.smart-log-review-section { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--co-border); }
.smart-log-review-heading {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--co-label); margin: 0 0 0.65rem;
}
.smart-log-transcript {
  border-left: 4px solid var(--co-navy); padding: 0.75rem 1rem;
  background: #f8fafc; white-space: pre-wrap; color: #000;
}
.smart-log-trade-card {
  border: 1px solid #e8e4df; border-radius: 8px;
  padding: 0.75rem 1rem; margin-bottom: 0.5rem; background: #fff;
  font-family: 'Cormorant Garamond', Georgia, serif;
}
.smart-log-trade-card--blocked { border-color: #f59e0b; background: #fffbeb; }
.smart-log-trade-card--delayed { border-color: #93c5fd; background: #f8fafc; }
.smart-log-trade-card-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem;
}
.smart-log-trade-card-type {
  font-weight: 700; letter-spacing: 0.06em; color: var(--co-navy);
}
.smart-log-trade-pill {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
}
.smart-log-trade-pill--noshow {
  background: #fef3c7; color: #92400e; border: 1px solid #f59e0b;
}
.smart-log-trade-pill--status {
  background: #eff6ff; color: var(--co-navy); border: 1px solid #e8e4df;
}
.smart-log-safety-pill {
  display: inline-block; padding: 0.35rem 0.75rem; border-radius: 20px;
  font-size: 0.82rem; font-weight: 600; font-family: 'Cormorant Garamond', Georgia, serif;
}
.smart-log-safety-pill--incident {
  background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5;
}
.smart-log-safety-pill--clear {
  background: #f0fdf4; color: #166534; border: 1px solid #86efac;
}
.smart-log-safety-note {
  margin: 0.5rem 0 0; font-size: 0.88rem; color: var(--co-text-secondary);
}
.smart-log-milestone-list, .smart-log-callout-list { display: flex; flex-direction: column; gap: 0.5rem; }
.smart-log-milestone-card, .smart-log-callout-card {
  border: 1px solid #e8e4df; border-radius: 8px; padding: 0.65rem 0.85rem;
  background: #faf9f7; font-family: 'Cormorant Garamond', Georgia, serif;
}
.smart-log-milestone-trade, .smart-log-callout-topic {
  font-weight: 700; color: var(--co-navy); letter-spacing: 0.04em;
}
.smart-log-milestone-date {
  margin-left: 0.5rem; font-size: 0.85rem; color: #92400e; font-weight: 600;
}
.smart-log-milestone-note, .smart-log-callout-detail {
  margin: 0.35rem 0 0; font-size: 0.9rem; color: var(--co-text-secondary);
}
.smart-log-co-pill {
  display: inline-block; margin-bottom: 0.5rem; padding: 0.2rem 0.55rem;
  border-radius: 20px; font-size: 0.72rem; font-weight: 600;
  background: #fffbeb; color: #92400e; border: 1px solid #f59e0b;
}
.smart-log-parse-warning {
  margin-bottom: 1rem; padding: 0.75rem 1rem; border-radius: 8px;
  background: #fffbeb; border: 1px solid #f59e0b; color: #92400e;
  font-size: 0.9rem; line-height: 1.45;
}
.smart-log-estimated { color: #b45309; font-size: 0.72rem; font-weight: 600; cursor: help; }
.smart-log-event-pill {
  display: inline-block; padding: 0.3rem 0.65rem; border-radius: 20px;
  background: #eff6ff; color: var(--co-navy); font-size: 0.78rem; font-weight: 600;
}
.smart-log-action-card { border-radius: 8px; padding: 1rem; margin-bottom: 0.75rem; }
.smart-log-action-card--rfi { background: #fffbeb; border: 1px solid #f59e0b; }
.smart-log-action-card--co { background: #f0fdf4; border: 1px solid #86efac; }
.smart-log-action-card--done h4 { color: var(--co-green); margin: 0 0 0.5rem; }
.smart-log-action-success { font-size: 0.88rem; color: var(--co-text-secondary); margin: 0 0 0.75rem; }
.smart-log-record-id {
  font-size: 0.75rem; color: #000; text-align: center; margin-top: 1rem;
}
.smart-log-history-section {
  position: relative;
  margin-top: 2rem;
  border-top: 1px solid var(--co-border);
  padding-top: 1.25rem;
}
.smart-log-history-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--co-label);
  margin-bottom: 0.75rem;
}
.smart-log-history-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 14px;
}
.smart-log-history-table thead th {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--co-label);
  border-bottom: 1px solid var(--co-border);
  padding: 6px 10px;
  text-align: left;
}
.smart-log-history-table tbody tr {
  border-bottom: 1px solid var(--co-border);
}
.smart-log-history-table tbody tr:hover {
  background: var(--co-surface);
}
.smart-log-history-table td {
  padding: 10px;
  vertical-align: top;
}
.smart-log-history-date {
  white-space: nowrap;
  color: var(--co-navy);
  font-weight: 600;
}
.smart-log-history-time {
  font-weight: 400;
  color: var(--co-label);
  font-size: 12px;
}
.smart-log-history-preview {
  color: var(--co-text-secondary);
  max-width: 320px;
}
.smart-log-history-count {
  text-align: center;
  color: var(--co-text);
}
.smart-log-history-flag {
  font-size: 12px;
  white-space: nowrap;
}
.smart-log-history-empty {
  color: var(--co-label);
  font-style: italic;
  font-size: 14px;
}
.smart-log-history-row {
  cursor: pointer;
}
.smart-log-history-row.is-expanded {
  background: var(--co-surface);
}
.smart-log-history-row.is-expanded td {
  border-bottom: none;
}
.smart-log-history-action-row td {
  padding: 0;
}
.smart-log-history-action-panel {
  background: var(--co-surface);
  border: 1px solid var(--co-border);
  border-radius: 8px;
  margin: 0 0 8px 0;
  padding: 16px 20px;
}
.smart-log-history-action-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--co-border);
}
.smart-log-history-action-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.smart-log-history-action-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--co-label);
  margin-bottom: 8px;
}
.smart-log-history-transcript {
  font-size: 13px;
  color: var(--co-text-secondary);
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
  font-style: italic;
}
.smart-log-history-trade-row {
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--co-border);
}
.smart-log-history-trade-row:last-child {
  border-bottom: none;
}
.smart-log-history-trade-notes {
  color: var(--co-text-secondary);
  font-size: 13px;
}
.smart-log-history-event-row {
  font-size: 14px;
  padding: 5px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.smart-log-event-type-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--co-surface);
  border: 1px solid var(--co-border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.smart-log-action-card-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.smart-log-action-card-body,
.smart-log-action-card-reason {
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}
.smart-log-action-card-actions {
  margin-top: 0.65rem;
}
.smart-log-actioned-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--co-green);
}
.smart-log-history-status-created {
  color: var(--co-green);
}
.smart-log-history-status-action {
  color: #92600a;
}
.smart-log-history-status-pending,
.smart-log-history-status-syncing {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.smart-log-history-status-failed {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.smart-log-history-row--queued {
  cursor: default;
  background: #fffbeb;
}
.smart-log-history-row--queued:hover {
  background: #fffbeb;
}
.smart-log-history-queue-error {
  font-size: 12px;
  color: #b91c1c;
  margin-top: 0.35rem;
  line-height: 1.4;
}
.smart-log-history-section.is-history-busy .smart-log-history-table {
  opacity: 0.45;
  pointer-events: none;
}
.smart-log-history-busy {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 251, 235, 0.82);
  color: #92400e;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  padding: 1rem;
}
.smart-log-history-busy[hidden] {
  display: none !important;
}
.smart-log-history-retry-feedback {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
  text-align: center;
}
.smart-log-history-retry-feedback--success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}
.smart-log-history-retry-feedback--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.smart-log-history-retry-feedback--info {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #93c5fd;
}
.smart-log-offline-queued-card {
  text-align: center;
  padding: 2rem 1.25rem;
  margin: 1rem 0;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 8px;
}
.smart-log-offline-queued-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  font-size: 1.25rem;
  line-height: 2.5rem;
  font-weight: 700;
}
.smart-log-offline-queued-title {
  font-size: 1.1rem;
  color: var(--co-navy);
  margin: 0 0 0.5rem;
}
.smart-log-offline-queued-text {
  font-size: 0.9rem;
  color: #92400e;
  margin: 0 0 1rem;
  line-height: 1.5;
}
.smart-log-photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem; margin-top: 0.75rem;
}
.smart-log-photo-card { border: 1px solid var(--co-border); border-radius: 6px; overflow: hidden; position: relative; }
.smart-log-photo-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.smart-log-photo-timestamp {
  font-size: 0.65rem; color: #fff; background: rgba(0,0,0,0.55);
  position: absolute; top: 6px; left: 6px; padding: 2px 6px; border-radius: 4px;
}
.smart-log-photo-caption { font-size: 0.72rem; padding: 0.35rem 0.5rem; margin: 0; }
.tab-dot--smart { color: var(--co-navy); }
.photo-gallery-date-divider {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--co-label);
  margin: 1rem 0 0.65rem; border-bottom: 1px solid var(--co-border);
}
.photo-gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem;
}
.photo-gallery-card {
  border: 1px solid var(--co-border); border-radius: 8px; overflow: hidden;
  background: #fff; cursor: pointer;
}
.photo-gallery-card img { width: 100%; height: 140px; object-fit: cover; display: block; }
.photo-gallery-caption { font-size: 0.78rem; padding: 0.5rem 0.65rem 0.25rem; margin: 0; }
.photo-gallery-meta { font-size: 0.68rem; padding: 0 0.65rem 0.5rem; margin: 0; color: #000; }
.photo-gallery-toolbar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem;
}
.photo-gallery-upload-status { font-size: 0.78rem; color: #92600a; }
.photo-gallery-card { position: relative; }
.photo-gallery-card--pending { border-color: #92600a; }
.photo-gallery-pending-badge,
.smart-log-photo-pending-badge {
  position: absolute; top: 6px; right: 6px; font-size: 0.62rem; font-weight: 600;
  color: #fff; background: #92600a; padding: 2px 6px; border-radius: 4px;
}
.photo-gallery-sync-error { font-size: 0.68rem; padding: 0 0.65rem 0.5rem; margin: 0; color: #b91c1c; }
.smart-log-photo-caption--empty { color: #666; font-style: italic; }
.photo-lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.photo-lightbox { position: relative; max-width: 90vw; text-align: center; }
.photo-lightbox-img { max-width: 100%; max-height: 75vh; object-fit: contain; }
.photo-lightbox-close {
  position: absolute; top: -2rem; right: 0; background: transparent; border: none;
  color: #fff; font-size: 2rem; cursor: pointer;
}
.photo-lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  font-size: 2rem; width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
}
.photo-lightbox-prev { left: -3rem; }
.photo-lightbox-next { right: -3rem; }
.photo-lightbox-caption { color: #fff; margin-top: 0.75rem; }

/* Nav notifications (construction) */
.header-session {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.nav-notifications {
  position: relative;
}
.nav-bell-btn {
  position: relative;
  background: transparent;
  border: 1px solid var(--co-border, #e8e4df);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.nav-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.nav-notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, 92vw);
  max-height: 420px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--co-border, #e8e4df);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
}
.nav-notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--co-border, #e8e4df);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--co-label, #000);
}
.nav-notification-clear-all {
  background: transparent;
  border: none;
  color: var(--co-navy, #1b3a5c);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}
.nav-notification-item {
  position: relative;
  padding: 0.75rem 2rem 0.75rem 0.85rem;
  border-bottom: 1px solid var(--co-border, #e8e4df);
}
.nav-notification-type-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  margin-bottom: 0.35rem;
}
.nav-notification-type--agent {
  background: #eff6ff;
  color: #1d4ed8;
}
.nav-notification-type--weekly_risk {
  background: #fef2f2;
  color: #b91c1c;
}
.nav-notification-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--co-navy, #1b3a5c);
  margin-bottom: 0.25rem;
}
.nav-notification-body {
  font-size: 0.78rem;
  color: #374151;
  white-space: pre-wrap;
  line-height: 1.45;
}
.nav-notification-meta {
  font-size: 0.68rem;
  color: #000;
  margin-top: 0.35rem;
}
.nav-notification-dismiss {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: #000;
  cursor: pointer;
  font-size: 0.85rem;
}
.nav-notification-empty {
  padding: 1rem 0.85rem;
  color: #000;
  font-size: 0.82rem;
  margin: 0;
}
.nav-notification-action-link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--co-navy, #1b3a5c);
}

.smart-log-history-preview-full {
  display: none;
}

@media (max-width: 768px) {
  /* Smart Log History — stack summary rows as cards on mobile */
  .smart-log-history-table {
    display: block;
    width: 100%;
    overflow-x: hidden;
  }

  .smart-log-history-table thead {
    display: none;
  }

  .smart-log-history-table tbody {
    display: block;
    width: 100%;
  }

  .smart-log-history-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.35rem 0.65rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem;
    margin-bottom: 0.65rem;
    border: 1px solid var(--co-border);
    border-radius: 8px;
    background: #fff;
  }

  .smart-log-history-table tbody tr.smart-log-history-row {
    border-bottom: none;
  }

  .smart-log-history-row td {
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 0;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    text-align: left;
  }

  .smart-log-history-date {
    flex: 1 1 auto;
    order: 1;
    white-space: normal;
  }

  .smart-log-history-date br {
    display: none;
  }

  .smart-log-history-time {
    display: inline;
  }

  .smart-log-history-time::before {
    content: ' · ';
  }

  .smart-log-history-preview {
    flex: 1 1 100%;
    order: 2;
    max-width: none;
    margin-top: 0.15rem;
    line-height: 1.45;
  }

  .smart-log-history-preview-short {
    display: none;
  }

  .smart-log-history-preview-full {
    display: block;
  }

  .smart-log-history-count,
  .smart-log-history-flag {
    flex: 0 1 auto;
    order: 3;
    font-size: 12px;
    white-space: normal;
  }

  .smart-log-history-flag {
    order: 1;
  }

  .smart-log-history-count:nth-child(3)::before {
    content: 'Trades: ';
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--co-label);
  }

  .smart-log-history-count:nth-child(4)::before {
    content: 'Events: ';
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--co-label);
  }

  .smart-log-history-flag:nth-child(5)::before {
    content: 'RFI: ';
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--co-label);
  }

  .smart-log-history-flag:nth-child(6)::before {
    content: 'Change Order: ';
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--co-label);
  }

  .smart-log-history-action-row {
    display: block;
    width: 100%;
    margin-bottom: 0.65rem;
  }

  .smart-log-history-action-row td {
    display: block;
    width: 100%;
    padding: 0;
  }

  .smart-log-history-action-panel {
    margin: 0;
  }

  /* Notifications dropdown — fixed below header, viewport width on mobile */
  .header.header-with-nav,
  .tenant-construction .header,
  .header-row,
  .header-session,
  .nav-notifications {
    overflow: visible;
  }

  .nav-notification-panel {
    position: fixed;
    top: calc(var(--trailside-header-offset, 56px) + 8px);
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - var(--trailside-header-offset, 56px) - 1.25rem);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 1200;
  }

  .nav-notification-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
  }
}
