/* =============================================================================
 * CoryAI app shell styles
 *
 * Layout: vertical stack — scrollable #thread fills the screen above a fixed
 * #dock that holds the small orb + state label. Conversation bubbles live in
 * the thread; data cards render inside Cory's bubbles (no separate panel).
 *
 * Bubble palette is ported from brochure/index.html so the marketing site and
 * the product share a visual language.
 * ============================================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100dvh;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #fff;
}

/* =============================================================================
 * Thread — scrollable conversation log
 * ============================================================================= */

#thread {
  flex: 1 1 auto;
  min-height: 0; /* allow flex child to actually scroll */
  overflow-y: auto;
  overflow-x: hidden;
  /* The #topbar owns the safe-area-inset-top; small top padding here lets
     the topmost bubble dissolve under the bar's bottom-fade as it scrolls. */
  padding: 8px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

/* Empty-state hint shown when no bubbles exist yet */
#thread.empty {
  align-items: center;
  justify-content: center;
}
#thread.empty::before {
  content: 'Tap the orb to start';
  color: rgba(255, 255, 255, 0.25);
  font-size: 14px;
  letter-spacing: 0.05em;
}

/* =============================================================================
 * Bubbles — ported from brochure/index.html
 * ============================================================================= */

.bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
  word-wrap: break-word;
  animation: bubbleIn 0.22s cubic-bezier(0.2, 0, 0.2, 1) both;
}

.bubble-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.bubble-text {
  white-space: pre-wrap;
}

.bubble.you {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-right-radius: 5px;
}
.bubble.you .bubble-label { color: rgba(255, 255, 255, 0.4); }

.bubble.cory {
  align-self: flex-start;
  background: linear-gradient(135deg, rgba(19, 239, 147, 0.12), rgba(20, 154, 251, 0.10));
  border: 1px solid rgba(19, 239, 147, 0.28);
  border-bottom-left-radius: 5px;
}
.bubble.cory .bubble-label { color: rgba(19, 239, 147, 0.85); }

@keyframes bubbleIn {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* Thinking dots — placeholder while Cory generates a response */
.bubble.thinking {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}
.bubble.thinking .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(19, 239, 147, 0.7);
  animation: thinkingDot 1.2s infinite ease-in-out;
}
.bubble.thinking .dot:nth-child(2) { animation-delay: 0.15s; }
.bubble.thinking .dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes thinkingDot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-2px); }
}

/* =============================================================================
 * Sections — the four named areas + Chat wrapper
 *
 * Only the .active section is visible. Body is a flex column so the active
 * section takes all remaining space between topbar and nav-tabs.
 * ============================================================================= */

.section {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
}

.section.active {
  display: flex;
  flex-direction: column;
}

/* Chat section: just a flex wrapper for #thread */
#section-chat {
  overflow: hidden; /* thread handles its own scroll */
}

/* Reports / Estimates — scrollable vertically */
#section-reports,
#section-estimates {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* CRM — filter row is fixed, crm-list scrolls; position:relative anchors the
   absolutely-positioned detail drill-down panel. */
#section-crm {
  overflow: hidden;
  position: relative;
}

/* =============================================================================
 * Bottom nav bar — 5-column grid
 *
 * [ Reports ] [ Estimates ] [ ORB (elevated) ] [ CRM ] [ Chat ]
 * The orb column uses translateY(-13px) to float above the tab line.
 * ============================================================================= */

#nav-tabs {
  flex: 0 0 auto;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr auto 1fr 1fr;
  align-items: end;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0.88) 82%, transparent);
}

/* Coming Soon placeholder — shown in a section whose feature isn't live yet
   (e.g. Reports when feature-gated off, Estimates). The tab stays visible so the
   5-column grid — and the centered orb — never shifts. Centered in the flex
   column section. */
.coming-soon {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 40px 28px;
  color: rgba(255, 255, 255, 0.6);
}
.coming-soon .cs-badge {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #13ef93;
  background: rgba(19, 239, 147, 0.1);
  border: 1px solid rgba(19, 239, 147, 0.25);
  border-radius: 999px;
  padding: 5px 13px;
}
.coming-soon .cs-title { font-size: 23px; font-weight: 600; color: #fff; }
.coming-soon .cs-sub { font-size: 14px; max-width: 260px; line-height: 1.5; }

/* Orb center column — elevated above the tab bar line */
.nav-orb-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-13px);
  padding-bottom: 2px;
}

#nav-orb-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: transparent;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow:
    0 0 0 1px rgba(19, 239, 147, 0.2),
    0 0 0 6px rgba(19, 239, 147, 0.06),
    0 0 20px rgba(19, 239, 147, 0.2),
    0 3px 12px rgba(0, 0, 0, 0.55);
  transition: box-shadow 0.2s ease, transform 0.12s ease;
}
#nav-orb-btn:active { transform: scale(0.9); }
#nav-orb-btn.listening {
  animation: orbGlow 1.6s infinite ease-in-out;
}
@keyframes orbGlow {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(19, 239, 147, 0.2),
      0 0 0 6px rgba(19, 239, 147, 0.06),
      0 0 20px rgba(19, 239, 147, 0.2),
      0 3px 12px rgba(0, 0, 0, 0.55);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(19, 239, 147, 0.45),
      0 0 0 9px rgba(19, 239, 147, 0.1),
      0 0 38px rgba(19, 239, 147, 0.5),
      0 3px 12px rgba(0, 0, 0, 0.55);
  }
}

#orb-canvas {
  display: block;
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

#nav-status {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.28);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: center;
  margin-top: 4px;
  white-space: nowrap;
  min-height: 13px;
  line-height: 1;
  transition: color 0.4s ease;
  pointer-events: none;
  user-select: none;
}
#nav-status.active { color: rgba(255, 255, 255, 0.65); }

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 8px 4px 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.3);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
  min-height: 48px;
}
.nav-tab.active { color: rgba(19, 239, 147, 0.9); }
.nav-tab svg { transition: filter 0.15s ease; }
.nav-tab.active svg { filter: drop-shadow(0 0 4px rgba(19, 239, 147, 0.4)); }

.nav-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #13ef93;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.nav-tab.active .nav-dot { opacity: 1; }

/* =============================================================================
 * Persistent profile button — fixed top-right, above all sections
 * ============================================================================= */

#persistent-profile {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 6px);
  right: 8px;
  z-index: 20;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}
#persistent-profile:active { background: rgba(255, 255, 255, 0.07); }

/* =============================================================================
 * Top bar — context-sensitive; only the .active .tb-ctx is visible.
 *
 * Sits above the active section. The downward gradient lets bubbles/content
 * dissolve under the bar as they scroll up rather than hitting a hard edge.
 * ============================================================================= */

#topbar {
  flex: 0 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 6px;
  display: flex;
  align-items: center;
  min-height: 52px;
  position: relative;
  z-index: 10;
  background: linear-gradient(180deg, rgba(0, 0, 0, 1) 55%, rgba(0, 0, 0, 0.85) 80%, transparent);
}

/* Each context div spans full topbar width; only .active is shown */
.tb-ctx {
  display: none;
  width: 100%;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}
.tb-ctx.active { display: flex; }

.tb-title {
  font-size: 17px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.01em;
}

.tb-action {
  font-size: 15px;
  font-weight: 500;
  color: #13ef93;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: #13ef93;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 4px 8px 0;
  -webkit-tap-highlight-color: transparent;
}

.tb-draft-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.04em;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}
.icon-btn:hover, .icon-btn:focus {
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}
.icon-btn:active {
  background: rgba(255, 255, 255, 0.07);
}

.cory-icon {
  filter: drop-shadow(0 0 0.3px rgba(19, 239, 147, 0.7));
  transition: filter 0.15s ease;
}
.icon-btn:hover .cory-icon,
.icon-btn:focus .cory-icon {
  filter: drop-shadow(0 0 1.5px rgba(19, 239, 147, 0.7));
}

/* =============================================================================
 * Profile drawer — half-sheet that slides up over the orb shell.
 *
 * Mic + WS keep running underneath; the same settings the drawer exposes are
 * reachable by voice ("call me Don", "use a casual tone"). Hidden by default
 * (translateY(100%) + pointer-events:none); .open toggles both.
 * ============================================================================= */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.22s ease;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.profile-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 72dvh;
  max-height: 720px;
  background: #0a0a0a;
  border-top: 1px solid rgba(19, 239, 147, 0.22);
  border-radius: 18px 18px 0 0;
  z-index: 60;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.55);
  transform: translateY(100%);
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.2, 0, 0.2, 1);
}
.profile-drawer.open {
  transform: translateY(0);
  pointer-events: auto;
}

.drawer-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-radius: 2px;
  margin: 8px auto 12px;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  /* Pad the hit area without resizing the visual pill */
  position: relative;
}
.drawer-handle::after {
  content: '';
  position: absolute;
  inset: -12px -32px;
}
.drawer-handle:hover { background: rgba(255, 255, 255, 0.3); }

.drawer-header {
  padding: 0 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-shrink: 0;
}
.drawer-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}
.drawer-listening {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(19, 239, 147, 0.7);
  display: flex;
  align-items: center;
  gap: 6px;
}
.drawer-listening[hidden] { display: none; }
.drawer-listening::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(19, 239, 147, 0.85);
  animation: liveDot 1.4s infinite ease-in-out;
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 20px;
  -webkit-overflow-scrolling: touch;
}

.voice-hint {
  padding: 12px 14px;
  background: rgba(19, 239, 147, 0.06);
  border: 1px solid rgba(19, 239, 147, 0.18);
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 18px;
}
.voice-hint em {
  color: rgba(19, 239, 147, 0.9);
  font-style: normal;
  font-weight: 500;
}

.profile-section { margin-bottom: 18px; }
.profile-section:last-child { margin-bottom: 0; }

.section-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 4px;
  padding: 0 4px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  min-height: 44px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  font-family: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.profile-row:last-child { border-bottom: none; }
.profile-row.readonly { cursor: default; }
button.profile-row:hover,
button.profile-row:focus {
  background: rgba(255, 255, 255, 0.03);
  outline: none;
}

.profile-row-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}
.profile-row-value {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-row-value .chev {
  color: rgba(255, 255, 255, 0.3);
  font-size: 18px;
  line-height: 1;
  margin-left: 2px;
}
.profile-row.readonly .profile-row-value {
  color: rgba(255, 255, 255, 0.55);
}

.profile-signout {
  margin: 8px 20px 0;
  padding: 13px;
  background: transparent;
  border: 1px solid rgba(255, 100, 100, 0.28);
  color: rgba(255, 130, 130, 0.9);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
  min-height: 44px;
}
.profile-signout:hover,
.profile-signout:focus {
  background: rgba(255, 100, 100, 0.06);
  border-color: rgba(255, 100, 100, 0.45);
  outline: none;
}

/* =============================================================================
 * Drawer view modes — data-mode toggles which header / body / footer slot is
 * visible. "main" = settings list, "select" = radio picker, "edit" = text input.
 * ============================================================================= */

/* Header: back button hidden on main, picker title hidden on main */
.drawer-back {
  display: none;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  margin-right: 8px;
  -webkit-tap-highlight-color: transparent;
}
.drawer-back:hover, .drawer-back:focus {
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

/* Footer buttons — signout on main, save on edit */
.profile-save {
  margin: 8px 20px 0;
  padding: 13px;
  background: linear-gradient(90deg, #13ef93, #149afb);
  border: none;
  color: #000;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  min-height: 44px;
}
.profile-save:hover:not(:disabled) {
  transform: translateY(-1px);
}
.profile-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Default (mode=main): hide picker bits */
#drawer-title-picker,
#drawer-picker,
.profile-save {
  display: none;
}

/* Picker modes: hide main bits, show picker bits */
.profile-drawer[data-mode="select"] .drawer-back,
.profile-drawer[data-mode="edit"]   .drawer-back {
  display: block;
}
.profile-drawer[data-mode="select"] #drawer-title-picker,
.profile-drawer[data-mode="edit"]   #drawer-title-picker {
  display: block;
}
.profile-drawer[data-mode="select"] #drawer-picker,
.profile-drawer[data-mode="edit"]   #drawer-picker {
  display: block;
}
.profile-drawer[data-mode="select"] #drawer-title-main,
.profile-drawer[data-mode="edit"]   #drawer-title-main,
.profile-drawer[data-mode="select"] #drawer-main,
.profile-drawer[data-mode="edit"]   #drawer-main,
.profile-drawer[data-mode="select"] .profile-signout,
.profile-drawer[data-mode="edit"]   .profile-signout {
  display: none;
}

/* Save button only in edit mode */
.profile-drawer[data-mode="edit"] .profile-save { display: block; }

/* =============================================================================
 * Picker content — radio options + text/textarea editors
 * ============================================================================= */

.picker-error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 94, 108, 0.08);
  border: 1px solid rgba(255, 94, 108, 0.3);
  color: #ff8a92;
  font-size: 12px;
}

.option-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 8px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-height: 56px;
}
.option-row:last-child { border-bottom: none; }
.option-row:hover, .option-row:focus {
  background: rgba(255, 255, 255, 0.03);
  outline: none;
}
.option-row.saving { opacity: 0.5; cursor: progress; }

.option-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  margin-top: 2px;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.option-row.selected .option-check {
  border-color: rgba(19, 239, 147, 0.8);
  background: rgba(19, 239, 147, 0.85);
}
.option-row.selected .option-check::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.option-text { min-width: 0; flex: 1; }
.option-name {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}
.option-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
  line-height: 1.4;
}

/* Text + textarea editors */
.editor-field {
  display: block;
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-height: 44px;
  resize: none;
}
.editor-field:focus {
  border-color: rgba(19, 239, 147, 0.5);
  background: rgba(0, 0, 0, 0.6);
}
textarea.editor-field {
  min-height: 140px;
  line-height: 1.5;
}

.editor-caption {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.45;
  padding: 0 4px;
}

/* =============================================================================
 * Data cards — rendered INSIDE Cory's bubbles (no separate panel)
 *
 * The renderer functions in js/cards.js produce <div class="card">…</div>.
 * When that lives inside .bubble.cory we drop the box chrome (it'd look like
 * a card-in-a-card) and use a subtle top divider instead.
 * ============================================================================= */

.bubble.cory .card {
  margin-top: 10px;
  padding: 10px 0 0 0;
  border-top: 1px solid rgba(19, 239, 147, 0.18);
  font-size: 13px;
}

.card-type {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 6px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.25;
}

.card-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 6px;
}

.card-meta {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
}

.card-meta .key {
  color: rgba(255, 255, 255, 0.3);
  min-width: 52px;
  flex-shrink: 0;
}

.card-meta a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.25);
  text-underline-offset: 2px;
}
.card-meta a:active { color: #13ef93; }

.card-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.7);
  margin-top: 8px;
}

.list-header {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 8px;
}

.list-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.list-row:last-child { border-bottom: none; padding-bottom: 0; }

.list-row-name {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row-detail {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

.list-row-badge {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-row {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.activity-row:last-child { border-bottom: none; padding-bottom: 0; }

.activity-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 3px;
}

.activity-note {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}

.mention {
  color: #13ef93;
  font-weight: 500;
}

/* Status badge tints used by statusClass() in cards.js */
.badge-green {
  background: rgba(19, 239, 147, 0.14);
  color: rgba(19, 239, 147, 0.9);
}
.badge-amber {
  background: rgba(251, 191, 36, 0.14);
  color: rgba(251, 191, 36, 0.9);
}
.badge-red {
  background: rgba(239, 68, 68, 0.14);
  color: rgba(239, 68, 68, 0.9);
}

/* =============================================================================
 * Shared section components — used across Reports / Estimates / CRM
 * ============================================================================= */

/* Generic content view inside a section */
.view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  flex: 1;
}
.view.hidden { display: none; }

/* Voice hint chip — pulsing green dot + example text */
/* Global voice bar — fixed band below the topbar, present on every tab. */
#voice-bar {
  flex: 0 0 auto;
  z-index: 8;
  padding: 2px 12px 8px;
  background: #000;
}
#voice-bar .voice-chip {
  padding: 8px 12px;
}

.voice-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(19, 239, 147, 0.05);
  border: 1px solid rgba(19, 239, 147, 0.13);
  border-radius: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}
.vc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(19, 239, 147, 0.7);
  flex-shrink: 0;
  animation: vcPulse 2s infinite ease-in-out;
}
@keyframes vcPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.voice-chip em { color: rgba(19, 239, 147, 0.85); font-style: normal; }
.voice-chip.live {
  border-color: rgba(19, 239, 147, 0.3);
  background: rgba(19, 239, 147, 0.08);
  color: rgba(255, 255, 255, 0.75);
}

/* Global bar dot reflects orb state. Off (no live session): a dim, static grey
   dot. On (orb listening/thinking/speaking): a pulsing green dot. Driven by the
   .orb-on class toggled in main.js onStateChange. */
#voice-bar .vc-dot {
  animation: none;
  opacity: 1;
  background: rgba(255, 255, 255, 0.28);
}
#voice-chip.orb-on .vc-dot {
  background: rgba(19, 239, 147, 0.95);
  animation: vcPulse 1.3s infinite ease-in-out;
}

/* Section sub-labels ("Recent Reports", "Open", etc.) */
.sec-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  padding: 0 2px;
}

/* Status badges used across sections */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}
.badge-draft  { background: rgba(255, 255, 255, 0.08);  color: rgba(255, 255, 255, 0.55); }
.badge-sent   { background: rgba(20, 154, 251, 0.14);   color: rgba(20, 154, 251, 0.9);  }
.badge-done   { background: rgba(19, 239, 147, 0.12);   color: rgba(19, 239, 147, 0.9);  }
.badge-pending { background: rgba(251, 191, 36, 0.14);  color: rgba(251, 191, 36, 0.9);  }
.badge-declined { background: rgba(239, 68, 68, 0.12);  color: rgba(239, 68, 68, 0.85);  }

/* CTA gradient button */
.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  min-height: 50px;
  background: linear-gradient(90deg, #13ef93, #149afb);
  border: none;
  border-radius: 12px;
  color: #000;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}
.cta-btn:active { opacity: 0.85; }

.row-chev { color: rgba(255, 255, 255, 0.2); font-size: 20px; line-height: 1; }
.bottom-spacer { height: 8px; flex-shrink: 0; }

/* =============================================================================
 * Reports section
 * ============================================================================= */

.report-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.report-row:last-child { border-bottom: none; }
.report-row:active { opacity: 0.7; }

.report-thumb {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.report-thumb-bg {
  width: 100%;
  height: 100%;
}
.report-thumb-count {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}
.report-info { flex: 1; min-width: 0; }
.row-name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-meta { font-size: 12px; color: rgba(255, 255, 255, 0.4); margin-top: 1px; }

/* Job context header in builder */
.job-header {
  padding: 10px 14px;
  background: rgba(19, 239, 147, 0.05);
  border: 1px solid rgba(19, 239, 147, 0.13);
  border-radius: 10px;
  flex-shrink: 0;
}
.job-header-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 2px;
}
.job-header-name { font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, 0.92); }
.job-header-addr { font-size: 12px; color: rgba(255, 255, 255, 0.4); margin-top: 1px; }

/* Step indicator dots */
.steps {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}
.step-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}
.step-dot.active { background: #13ef93; box-shadow: 0 0 6px rgba(19, 239, 147, 0.5); }
.step-dot.done   { background: rgba(19, 239, 147, 0.35); }

/* Photo grid (2-col) */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.photo-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: border-color 0.12s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.photo-card:active { transform: scale(0.96); }
.photo-card.sel { border-color: #13ef93; }
.photo-card-bg { width: 100%; height: 100%; }
.photo-check-wrap {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.photo-card.sel .photo-check-wrap { background: #13ef93; border-color: #13ef93; }
.photo-check-icon { display: none; }
.photo-card.sel .photo-check-icon { display: block; }
.photo-lbl {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 18px 8px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.68));
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
}
.sel-counter {
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}
.sel-counter strong { color: #13ef93; font-weight: 600; }

/* Notes step */
.note-block {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.note-thumb {
  height: 110px;
  position: relative;
}
.note-thumb-lbl {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 10px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
}
.note-body { padding: 10px 12px; background: rgba(255, 255, 255, 0.025); }
.note-num {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 6px;
}
.note-ta {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  outline: none;
}
.note-ta:focus { border-color: rgba(19, 239, 147, 0.35); }
.note-ta::placeholder { color: rgba(255, 255, 255, 0.22); }
.overall-lbl { font-size: 12px; color: rgba(255, 255, 255, 0.38); margin-bottom: 6px; }

/* =============================================================================
 * Estimates section
 * ============================================================================= */

.est-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.est-row:last-child { border-bottom: none; }
.est-row:active { opacity: 0.7; }
.est-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.est-info { flex: 1; min-width: 0; }
.est-right { text-align: right; flex-shrink: 0; }
.est-amount { font-size: 16px; font-weight: 700; color: rgba(255, 255, 255, 0.92); white-space: nowrap; }
.est-placeholder {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.3);
  padding: 12px 0;
  text-align: center;
}

/* =============================================================================
 * CRM section
 * ============================================================================= */

/* Horizontal scrolling filter chip row */
.filter-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.filter-row::-webkit-scrollbar { display: none; }

.chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.04);
  -webkit-tap-highlight-color: transparent;
  transition: all 0.12s ease;
}
.chip.active {
  background: rgba(19, 239, 147, 0.12);
  border-color: rgba(19, 239, 147, 0.4);
  color: rgba(19, 239, 147, 0.9);
}
.chip:active { opacity: 0.7; }

/* Closed toggle — a chip-styled <button>; reset UA defaults. Uses `.on` (not
   `.active`) for its state so board-filter active-clearing doesn't reset it.
   Amber-tinted when on, to read distinctly from the green board-active chips. */
.chip-toggle {
  font-family: inherit;
  line-height: 1;
  margin: 0 2px 0 0;
}
.chip-toggle.on {
  background: rgba(239, 147, 19, 0.14);
  border-color: rgba(239, 147, 19, 0.45);
  color: rgba(239, 147, 19, 0.95);
}

/* CRM scrollable list */
.crm-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 16px 16px;
  -webkit-overflow-scrolling: touch;
}

.crm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.crm-row:last-child { border-bottom: none; }
.crm-row:active { background: rgba(255, 255, 255, 0.02); }

/* Avatar circle with the contact's initial */
.crm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #000;
}
.crm-info { flex: 1; min-width: 0; }
.crm-name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crm-right { text-align: right; flex-shrink: 0; }
.crm-status { font-size: 12px; color: rgba(255, 255, 255, 0.5); white-space: nowrap; }
.crm-board {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  margin-top: 2px;
}
.crm-empty {
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.3);
  padding: 32px 0;
}

/* CRM search bar — toggled open/closed by the topbar search icon */
.crm-search {
  display: none;
  flex-shrink: 0;
  padding: 10px 16px 0;
}
.crm-search.open { display: block; }
.crm-search input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 11px 13px;
  color: #fff;
  font-size: 15px;
  outline: none;
  -webkit-appearance: none;
}
.crm-search input:focus { border-color: rgba(19, 239, 147, 0.4); }
.crm-search input::placeholder { color: rgba(255, 255, 255, 0.3); }

/* =============================================================================
 * CRM contact detail — slide-in drill-down panel over the contact list
 * ============================================================================= */

.crm-detail {
  position: absolute;
  inset: 0;
  background: #050505;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.2, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  z-index: 5;
  pointer-events: none;
}
.crm-detail.open {
  transform: translateX(0);
  pointer-events: auto;
}

.crm-detail-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.crm-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: rgba(19, 239, 147, 0.9);
  font-size: 15px;
  cursor: pointer;
  padding: 8px 10px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.crm-back:active { opacity: 0.6; }
.crm-back-chev { font-size: 22px; line-height: 1; margin-top: -2px; }

.crm-detail-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 28px;
}

/* Hero: avatar + name + company + status */
.crm-d-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.crm-d-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: #000;
}
.crm-d-name { font-size: 20px; font-weight: 600; color: #fff; line-height: 1.2; }
.crm-d-company { font-size: 13px; color: rgba(255, 255, 255, 0.55); margin-top: 2px; }
.crm-d-badges { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.crm-d-board {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

/* Action buttons row (Call / Email / Ask Cory) */
.crm-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.crm-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.crm-action:active { opacity: 0.7; }
.crm-action.primary {
  background: linear-gradient(135deg, rgba(19, 239, 147, 0.16), rgba(20, 154, 251, 0.16));
  border-color: rgba(19, 239, 147, 0.35);
  color: #fff;
}

/* Detail sections (Contact / Jobs / Activity / Tasks) */
.crm-d-section { margin-bottom: 22px; }
.crm-d-section:last-child { margin-bottom: 0; }
.crm-d-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 8px;
}
.crm-d-field {
  display: flex;
  gap: 10px;
  font-size: 13px;
  padding: 5px 0;
}
.crm-d-field .k { color: rgba(255, 255, 255, 0.35); min-width: 64px; flex-shrink: 0; }
.crm-d-field .v { color: rgba(255, 255, 255, 0.85); word-break: break-word; }
.crm-d-field a.v {
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.25);
  text-underline-offset: 2px;
}
.crm-d-field a.v:active { color: #13ef93; }
.crm-d-empty { font-size: 13px; color: rgba(255, 255, 255, 0.3); }

/* Event link picker (event detail → "Link to a contact or job") */
.event-link-start { width: 100%; margin-top: 10px; }
.event-link { margin-top: 12px; }
.event-link-search {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
.event-link-search::placeholder { color: rgba(255, 255, 255, 0.35); }
.event-link-results { margin-top: 8px; }
.event-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.event-link-row:active { opacity: 0.7; }
.event-link-row.sel {
  background: rgba(19, 239, 147, 0.1);
  border-color: rgba(19, 239, 147, 0.4);
}
.event-link-kind {
  flex-shrink: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}
.event-link-confirm {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.event-link-confirm > span { display: block; font-size: 14px; color: #fff; margin-bottom: 10px; }
.event-link-confirm-btns { display: flex; gap: 8px; }
.event-link-confirm-btns .crm-action { margin: 0; }

/* =============================================================================
 * CRM create-job form (reuses the .crm-detail slide-in panel)
 * ============================================================================= */

.cf-title { font-size: 20px; font-weight: 600; color: #fff; margin-bottom: 18px; }
.cf-field { margin-bottom: 14px; }
.cf-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 6px;
}
.cf-label .req { color: rgba(19, 239, 147, 0.8); }
.cf-input, .cf-select {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 11px 13px;
  color: #fff;
  font-size: 15px;
  outline: none;
  -webkit-appearance: none;
}
.cf-input:focus, .cf-select:focus { border-color: rgba(19, 239, 147, 0.4); }
.cf-input::placeholder { color: rgba(255, 255, 255, 0.3); }
.cf-select { background-image: none; }
.cf-row { display: flex; gap: 8px; }
.cf-row .cf-field { flex: 1; }

/* Customer search-then-confirm suggestions */
.cf-suggest {
  margin-top: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}
.cf-suggest:empty { display: none; }
.cf-suggest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  min-height: 44px;
  box-sizing: border-box;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  -webkit-tap-highlight-color: transparent;
}
.cf-suggest-row:last-child { border-bottom: none; }
.cf-suggest-row:active { background: rgba(255, 255, 255, 0.06); }
.cf-suggest-row.new { color: rgba(19, 239, 147, 0.95); }
.cf-suggest-name { color: rgba(255, 255, 255, 0.9); font-size: 14px; }
.cf-suggest-sub { color: rgba(255, 255, 255, 0.4); font-size: 12px; }
.cf-suggest-tag {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #13ef93;
  flex-shrink: 0;
}
.cf-using {
  margin-top: 6px;
  font-size: 12px;
  color: #13ef93;
}
.cf-hint { margin-top: 4px; font-size: 12px; color: rgba(255, 255, 255, 0.35); }
.cf-error { margin-top: 10px; font-size: 13px; color: #ef6b6b; }

/* =============================================================================
 * Native CRM Schedule surface — Jobs/Schedule toggle, day dashboard, week strip,
 * agenda. "My day at a glance" (schedule-view.js).
 * ============================================================================= */

/* Jobs ↔ Schedule segmented toggle */
.crm-modes {
  display: flex;
  gap: 4px;
  margin: 10px 16px 2px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}
.crm-mode {
  flex: 1 1 0;
  padding: 7px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.12s ease;
}
.crm-mode.active {
  background: rgba(19, 239, 147, 0.12);
  color: rgba(19, 239, 147, 0.95);
  box-shadow: inset 0 0 0 1px rgba(19, 239, 147, 0.35);
}

.crm-schedule {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 16px 16px;
  -webkit-overflow-scrolling: touch;
}

/* Day dashboard — the at-a-glance header */
.sched-dash { padding: 10px 0 14px; }
.sched-dash-day { font-size: 20px; font-weight: 600; color: #fff; }
.sched-dash-stats { margin-top: 4px; font-size: 13px; color: rgba(19, 239, 147, 0.9); }

/* Rolling 7-day week strip */
.sched-week {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.sched-day {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 6px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.12s ease;
}
.sched-day.active {
  background: rgba(19, 239, 147, 0.12);
  border-color: rgba(19, 239, 147, 0.4);
  color: #fff;
}
.sched-day-wd { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
.sched-day-num { font-size: 16px; font-weight: 600; }
.sched-day-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.sched-day-dot.on { background: #13ef93; }
.sched-day.active .sched-day-dot.on { background: #fff; }

/* Agenda list */
.sched-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sched-row:last-child { border-bottom: none; }
.sched-row:active { background: rgba(255, 255, 255, 0.02); }
.sched-time {
  flex: 0 0 64px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  padding-top: 1px;
}
.sched-bar { flex: 0 0 3px; border-radius: 2px; background: rgba(19, 239, 147, 0.5); }
.sched-body { flex: 1 1 auto; min-width: 0; }
.sched-title { font-size: 14px; color: #fff; }
.sched-sub {
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Job-detail "Upcoming" appointment rows */
.crm-d-appt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.crm-d-appt:last-child { border-bottom: none; }
.crm-d-appt-when {
  flex: 0 0 96px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(19, 239, 147, 0.85);
}
.crm-d-appt-body { flex: 1 1 auto; min-width: 0; }
.crm-d-appt-title { font-size: 13px; color: rgba(255, 255, 255, 0.9); }
.crm-d-appt-loc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crm-d-appt { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.crm-d-appt:active { background: rgba(255, 255, 255, 0.02); }
.crm-d-appt-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
}
.crm-d-appt-add {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px 0;
  background: rgba(19, 239, 147, 0.08);
  border: 1px dashed rgba(19, 239, 147, 0.35);
  border-radius: 10px;
  color: rgba(19, 239, 147, 0.9);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Appointment form extras (reuses .cf-* from the create-job form) */
.cf-textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.4;
  font-family: inherit;
}
.cf-input[type="datetime-local"] { color-scheme: dark; }
.af-checkrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 14px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}
.af-checkrow input { width: 16px; height: 16px; accent-color: #13ef93; }
.af-joblock { font-size: 14px; color: #fff; padding: 8px 0; }
.af-viewjob {
  background: none;
  border: none;
  padding: 4px 0 8px;
  color: #13ef93;
  font-size: 13px;
  cursor: pointer;
}

/* =============================================================================
 * CompanyCam / Reports builder — project picker, photo picker, analyzer, editor
 * ============================================================================= */

/* Shared loading / empty / error states */
.rpt-loading {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
  padding: 20px 0;
  text-align: center;
}
.rpt-empty {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.3);
  padding: 24px 0;
  text-align: center;
}
.rpt-error {
  font-size: 13px;
  color: rgba(255, 94, 108, 0.85);
  padding: 16px 0;
}

/* Project list rows */
.project-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.project-row:last-child { border-bottom: none; }
.project-row:active { opacity: 0.7; }

.project-thumb {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-thumb-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, #152a1e, #0c1e30); }

/* Photo grid — real images instead of colored divs */
.photo-card-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Analyzing step */
.analyze-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 24px;
  background: rgba(19, 239, 147, 0.04);
  border: 1px solid rgba(19, 239, 147, 0.12);
  border-radius: 14px;
  text-align: center;
}
.analyze-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(19, 239, 147, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.analyze-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.4;
}
.analyze-progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.analyze-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}
.analyze-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #13ef93, #149afb);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.analyze-progress-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.04em;
}

/* Section editor */
.editor-section {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  overflow: hidden;
}
.editor-section + .editor-section { margin-top: 12px; }

.editor-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  background: rgba(19, 239, 147, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.editor-section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #13ef93, #149afb);
  flex-shrink: 0;
}
.editor-section-name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  flex: 1;
}
.editor-section-count {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.04em;
}

.editor-section-summary-wrap {
  padding: 12px 14px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.editor-field-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.28);
  margin-bottom: 6px;
}

.editor-ta {
  display: block;
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 9px 11px;
  color: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color 0.15s ease;
}
.editor-ta:focus { border-color: rgba(19, 239, 147, 0.35); }
.editor-ta::placeholder { color: rgba(255, 255, 255, 0.2); }
.editor-ta-sm { min-height: 52px; font-size: 12px; }

.editor-photos { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 10px; }

.editor-photo-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.editor-photo-thumb {
  width: 64px;
  height: 64px;
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}
.editor-photo-body { flex: 1; min-width: 0; }

/* JN link banner */
.jn-link-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: rgba(20, 154, 251, 0.08);
  border: 1px solid rgba(20, 154, 251, 0.25);
  border-radius: 10px;
  font-size: 13px;
}
.jn-link-banner.hidden { display: none; }
.jn-link-text {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.75);
  flex: 1;
  min-width: 0;
}
.jn-link-icon { color: rgba(20, 154, 251, 0.8); flex-shrink: 0; display: flex; }
.jn-link-actions { display: flex; gap: 8px; flex-shrink: 0; }
.jn-link-yes, .jn-link-no {
  padding: 6px 13px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  min-height: 32px;
  -webkit-tap-highlight-color: transparent;
}
.jn-link-yes {
  background: rgba(20, 154, 251, 0.85);
  color: #fff;
}
.jn-link-yes:active { opacity: 0.8; }
.jn-link-no {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.6);
}
.jn-link-no:active { opacity: 0.7; }

/* PDF ready banner */
.pdf-ready-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(19, 239, 147, 0.07);
  border: 1px solid rgba(19, 239, 147, 0.25);
  border-radius: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}
.pdf-ready-banner.hidden { display: none; }
.pdf-ready-banner a {
  color: #13ef93;
  font-weight: 600;
  text-decoration: none;
}
.pdf-ready-banner a:active { opacity: 0.8; }

/* Company logo upload in profile drawer */
.logo-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0 4px;
  cursor: pointer;
}
.logo-preview {
  width: 160px;
  height: 80px;
  border-radius: 10px;
  border: 2px dashed rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s ease;
  overflow: hidden;
}
.logo-preview-wrap:hover .logo-preview,
.logo-preview-wrap:focus .logo-preview {
  border-color: rgba(19, 239, 147, 0.35);
}
.logo-tap-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

/* =============================================================================
 * Conversation history sidebar (HX-01) — V3 slide-in from the left.
 * Backdrop z-index 70 / panel 80 sit above the profile drawer (60) so the two
 * never fight; they're never open at the same time, but layering above is safe.
 * ============================================================================= */

.history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  z-index: 70;
  transition: opacity 0.22s ease;
}
.history-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.history-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 86%;
  max-width: 340px;
  background: #0a0a0a;
  border-right: 1px solid rgba(19, 239, 147, 0.22);
  box-shadow: 20px 0 60px rgba(0, 0, 0, 0.6);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.2, 0, 0.2, 1);
  z-index: 80;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}
.history-sidebar.open {
  transform: translateX(0);
  pointer-events: auto;
}

.history-header {
  flex: 0 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 28px) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.history-title {
  font-size: 17px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}
.history-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  font-size: 22px;
  line-height: 1;
  border-radius: 8px;
}
.history-close:active { background: rgba(255, 255, 255, 0.05); color: #fff; }

.history-actions {
  flex: 0 0 auto;
  padding: 10px 10px 8px;
}
.history-new-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(19, 239, 147, 0.16), rgba(20, 154, 251, 0.14));
  border: 1px solid rgba(19, 239, 147, 0.32);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.history-new-btn:active {
  background: linear-gradient(135deg, rgba(19, 239, 147, 0.24), rgba(20, 154, 251, 0.20));
  border-color: rgba(19, 239, 147, 0.5);
}
.history-new-btn svg { color: rgba(19, 239, 147, 0.9); flex-shrink: 0; }

.history-search-wrap {
  flex: 0 0 auto;
  padding: 4px 10px 10px;
  position: relative;
}
.history-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 9px 12px 9px 34px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.history-search:focus {
  border-color: rgba(19, 239, 147, 0.4);
  background: rgba(0, 0, 0, 0.5);
}
.history-search::placeholder { color: rgba(255, 255, 255, 0.3); }
.history-search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.history-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 6px 20px;
}

.history-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  padding: 14px 10px 6px;
}

.history-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 8px;
  margin: 1px 2px;
  cursor: pointer;
  transition: background 0.12s ease;
  border: 1px solid transparent;
}
.history-row:active { background: rgba(255, 255, 255, 0.04); }
.history-row.active {
  background: linear-gradient(135deg, rgba(19, 239, 147, 0.12), rgba(20, 154, 251, 0.08));
  border-color: rgba(19, 239, 147, 0.25);
}

.history-row-title {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-row.active .history-row-title { color: rgba(255, 255, 255, 1); }

.history-row-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.03em;
}

/* Loading / empty / error states for the list body */
.history-state {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.5;
}
