/* ══════════════════════════════════════════════════════════
   COMPONENTS.CSS — Shared component styles
   Extracted from inline styles for maintainability.
   All classes prefixed with c- to avoid conflicts.
   ══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   P31 — PORTAL SHELL CONTRACT
   Cross-portal shell tokens and shared structural classes.
   These define the single system-wide standard for:
   - Safe-area spacing
   - Portal wrapper layout
   - Header structure (logo + title + actions)
   - Section body padding
   - Sticky header behavior
   - Tab-row overflow
   - Bottom nav clearance
   - Back button placement
   Audit date: 2026-03-29
   ══════════════════════════════════════════════════════════ */

/* ── P31 Shell Tokens (CSS Custom Properties) ─────────── */
:root {
  /* Safe-area insets — fallback to 0px when env() unsupported */
  --shell-safe-top:    env(safe-area-inset-top, 0px);
  --shell-safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Top padding inside portal wrappers (above header) */
  --shell-top-pad:     8px;
  /* Side padding for mobile portals */
  --shell-side-pad:    16px;
  /* Bottom clearance for bottom nav bar */
  --shell-bottom-nav:  100px;

  /* Portal header */
  --shell-header-gap:     10px;
  --shell-header-mb:      12px;
  --shell-header-pb:      10px;

  /* Portal logo badge */
  --shell-logo-size:       36px;
  --shell-logo-radius:     9px;
  --shell-logo-font:       16px;

  /* Portal title */
  --shell-title-size:      14px;
  --shell-title-spacing:   2px;
  --shell-subtitle-size:   9px;

  /* Section spacing (between major content blocks) */
  --shell-section-gap:     10px;

  /* Tab row */
  --shell-tab-gap:         6px;
  --shell-tab-mb:          10px;

  /* Sticky header z-index */
  --shell-sticky-z:        50;
}

/* ── P31 Portal App Wrapper ───────────────────────────── */
/* Base: applied to all portal root containers.
   Sets min-height, background (with gradient to match body), and hides by default. */
.c-portal-app {
  display: none;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(77,201,246,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(251,146,60,0.04) 0%, transparent 60%);
}

/* ── P31 Portal Content Wrapper ───────────────────────── */
/* Centered column with safe-area padding.
   Used inside each portal app as the main content area. */
.c-portal-content {
  max-width: 780px;
  margin: 0 auto;
  padding:
    calc(var(--shell-top-pad) + var(--shell-safe-top))
    var(--shell-side-pad)
    calc(var(--shell-bottom-nav) + var(--shell-safe-bottom));
}

/* Admin portal override — admin uses sidebar layout, not centered column */
.c-portal-content--admin {
  max-width: 1100px;
  padding-bottom: 80px; /* no bottom nav on desktop */
}

/* ── P31 Portal Header ────────────────────────────────── */
/* Flex row: [logo] [title block] [spacer] [action buttons]
   Consistent across all portals. Color set via portal-specific accent. */
.c-portal-header {
  display: flex;
  align-items: center;
  gap: var(--shell-header-gap);
  margin-bottom: var(--shell-header-mb);
  padding-bottom: var(--shell-header-pb);
  border-bottom: 1px solid var(--border);
}

/* Logo badge — gradient square with icon/emoji */
.c-portal-logo {
  width: var(--shell-logo-size);
  height: var(--shell-logo-size);
  border-radius: var(--shell-logo-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--shell-logo-font);
  flex-shrink: 0;
}

/* Portal title text */
.c-portal-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--shell-title-size);
  letter-spacing: var(--shell-title-spacing);
}

/* Portal subtitle (date label, etc.) */
.c-portal-subtitle {
  font-size: var(--shell-subtitle-size);
  color: var(--muted);
  letter-spacing: 1px;
}

/* Actions block — pushed to the right via margin-left:auto */
.c-portal-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── P31 Portal Secondary Screen ──────────────────────── */
/* For multi-screen portals (closer worklist, installs, stock, etc.)
   that share the same safe-area + centered layout.
   NOTE: visibility is managed by JS (style.display), not this class.
   The inline style="display:none" in HTML sets initial hidden state;
   JS sets display='' to show (which falls through to this block rule). */
.c-portal-screen {
  max-width: 780px;
  margin: 0 auto;
  padding:
    calc(var(--shell-top-pad) + var(--shell-safe-top))
    var(--shell-side-pad)
    calc(var(--shell-bottom-nav) + var(--shell-safe-bottom));
}

/* ── P31 Sticky Section Header ────────────────────────── */
/* For any section header that should stick when scrolling.
   Works inside both portal content areas and detail panels. */
.c-shell-sticky {
  position: sticky;
  top: 0;
  z-index: var(--shell-sticky-z);
  background: var(--bg);
}

/* ── P31 Tab Row ──────────────────────────────────────── */
/* Horizontal scrollable tab bar with hidden scrollbar.
   Consistent overflow handling across all portals. */
.c-shell-tabs {
  display: flex;
  gap: var(--shell-tab-gap);
  margin-bottom: var(--shell-tab-mb);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.c-shell-tabs::-webkit-scrollbar {
  display: none;
}

/* Tab row with fade edge hints on mobile */
@media (max-width: 768px) {
  .c-shell-tabs--fade {
    mask-image: linear-gradient(to right, transparent 0px, black 8px, black calc(100% - 8px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0px, black 8px, black calc(100% - 8px), transparent 100%);
  }
}

/* ── PillCore — Shared pill / tab component classes ───── */
/* Two variants: tabs (equal-width nav) and filters (fit-content toggles).
   Colors driven by inline style from PillCore.js; layout by these classes. */

.c-pill-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.c-pill-row--tabs {
  margin-bottom: 12px;
}
.c-pill-row--filters {
  margin-bottom: 8px;
}

.c-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Share Tech Mono', monospace;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  text-transform: uppercase;
  touch-action: manipulation;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

/* Tab variant — section navigation, equal width */
.c-pill--tab {
  flex: 1;
  min-width: 0;
  padding: 8px 14px;
  font-size: 11px;
}

/* Filter pill variant — toggle filters, fit content */
.c-pill--filter {
  padding: 5px 12px;
  font-size: 10px;
}

/* Mobile: wrap to second row, never crush text */
@media (max-width: 768px) {
  .c-pill--tab {
    flex: none;
    padding: 7px 10px;
    font-size: 10px;
  }
  .c-pill--filter {
    padding: 4px 10px;
    font-size: 9px;
  }
}

/* ── P31 Back Button ──────────────────────────────────── */
/* Left-aligned back/close button for detail views and sub-screens.
   Always in the top-left for thumb reachability on mobile. */
.c-shell-back {
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px; /* Apple HIG touch target */
  -webkit-tap-highlight-color: transparent;
}
.c-shell-back:active {
  background: rgba(255,255,255,0.05);
}

/* ── P31 Action Bar (fixed bottom) ────────────────────── */
/* Bottom action bar with safe-area clearance.
   Use for persistent page-level actions above the nav. */
.c-shell-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px var(--shell-side-pad);
  padding-bottom: calc(12px + var(--shell-safe-bottom));
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 50000;
}

/* ── P31 Responsive Overrides ─────────────────────────── */
@media (max-width: 480px) {
  :root {
    --shell-top-pad:     6px;
    --shell-side-pad:    12px;
    --shell-logo-size:   32px;
    --shell-logo-radius: 8px;
    --shell-logo-font:   14px;
    --shell-title-size:  13px;
    --shell-header-gap:  8px;
    --shell-header-mb:   10px;
    --shell-header-pb:   8px;
  }
}

/* ══════════════════════════════════════════════════════════
   END P31 SHELL CONTRACT
   ══════════════════════════════════════════════════════════ */

/* ── Overlays & Sheets ──────────────────────────────────── */
.c-overlay {
  position: fixed;
  inset: 0;
  z-index: 60000;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  overscroll-behavior: contain;
}
.c-overlay-high {
  position: fixed;
  inset: 0;
  z-index: 70000;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  overscroll-behavior: contain;
}
.c-overlay-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 65000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  padding-top: env(safe-area-inset-top);
}

.c-sheet {
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom) + 60px);
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.c-sheet-short {
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom) + 60px);
  max-height: 80vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.c-sheet-full {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── Panel Components (P41b — shared container contract) ── */
/* Structure: .c-panel-overlay > .c-panel-card > (.c-panel-header + .c-panel-body)
   Mobile: card fills viewport (fullscreen feel).
   Desktop (≥768px): dark backdrop + centered constrained card with border-radius.
   Card size set via .c-panel-card--narrow/medium/wide.
   Consumers override z-index inline on .c-panel-overlay for layering needs. */

.c-panel-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.c-panel-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--bg);
}
@media (min-width: 768px) {
  .c-panel-overlay {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: flex-start;
    padding: 5vh 24px;
    overflow-y: auto;
  }
  .c-panel-card {
    flex: none;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    width: 100%;
  }
  .c-panel-card--narrow { max-width: 560px; }
  .c-panel-card--medium { max-width: 780px; }
  .c-panel-card--wide   { max-width: 920px; }
}
.c-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--shell-side-pad, 16px);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
}
.c-panel-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.c-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c-panel-subtitle {
  font-size: 9px;
  color: var(--muted);
  margin-top: 1px;
}
.c-panel-action {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid var(--accent);
  background: none;
  color: var(--accent);
  border-radius: 6px;
  font-family: Share Tech Mono, monospace;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
}
.c-panel-action--primary {
  border: none;
  background: linear-gradient(135deg, var(--accent), #0099cc);
  color: #000;
}
.c-panel-body {
  padding: 16px;
  flex: 1;
}

/* ── Buttons ────────────────────────────────────────────── */
.c-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

.c-btn-accent {
  background: rgba(168,85,247,0.12);
  color: #a855f7;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.c-btn-primary {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
}
.c-btn-primary.green {
  background: rgba(52,211,153,0.15);
  color: #34d399;
}
.c-btn-primary.amber {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
}
.c-btn-primary.purple {
  background: rgba(168,85,247,0.15);
  color: #a855f7;
}
.c-btn-primary.cyan {
  background: rgba(77,201,246,0.12);
  color: var(--accent);
}

.c-btn-ghost {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 10px;
  padding: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.15s;
}

.c-btn-tinted {
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: opacity 0.15s;
}

.c-btn-action {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.c-btn-action:hover {
  background: rgba(255,255,255,0.05);
}

/* ── Panels & Cards ─────────────────────────────────────── */
.c-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}

.c-info-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.c-info-box:hover {
  background: var(--panel2);
}

.c-status-box {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

/* ── P44: Global iOS Zoom Prevention ───────────────────── */
/* iOS Safari zooms the viewport when any input with          */
/* font-size < 16px receives focus. This rule ensures ALL     */
/* inputs, selects, and textareas meet the 16px minimum.      */
/* This is the PERMANENT structural fix — individual inline   */
/* font-size fixes are no longer needed for zoom prevention.  */
@supports (-webkit-touch-callout: none) {
  input, select, textarea {
    font-size: max(16px, 1em) !important;
  }
}

/* ── P44: Global Touch Responsiveness ──────────────────── */
/* iOS Safari adds a 300ms tap delay for double-tap-to-zoom.  */
/* This removes it on ALL interactive elements system-wide.   */
button, [onclick], [role="button"], .c-panel-back, .c-close-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── Form Elements ──────────────────────────────────────── */
.c-input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.c-input:focus {
  border-color: rgba(168,85,247,0.4);
}

.c-textarea {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.15s;
}
.c-textarea:focus {
  border-color: rgba(168,85,247,0.4);
}

.c-select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

/* ── Timeline ───────────────────────────────────────────── */
.c-timeline-container {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.c-timeline-hour-col {
  flex-shrink: 0;
  position: relative;
  width: 38px;
}

.c-hour-label {
  position: absolute;
  right: 4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--muted);
}

.c-hour-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.c-half-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(255,255,255,0.03);
}

.c-now-indicator {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--red);
  z-index: 10;
  pointer-events: none;
}

.c-now-dot {
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

/* ── Appointment Blocks ─────────────────────────────────── */
.c-appt-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  z-index: 5;
  overflow: hidden;
}

.c-appt-block-week {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 6px;
  padding: 3px 5px;
  cursor: pointer;
  z-index: 5;
  overflow: hidden;
}

/* ── Badges ─────────────────────────────────────────────── */
.c-badge {
  font-size: 9px;
  border-radius: 10px;
  padding: 3px 8px;
  font-weight: 600;
  display: inline-block;
}

/* ── Text Utilities ─────────────────────────────────────── */
.c-mono {
  font-family: 'Share Tech Mono', monospace;
}
.c-mono-label {
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.c-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.c-heading-sm {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.c-text-meta {
  font-size: 11px;
  color: var(--muted);
}
.c-text-xs {
  font-size: 9px;
  color: var(--muted);
}

.c-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Layout Helpers ─────────────────────────────────────── */
.c-flex {
  display: flex;
}
.c-flex-col {
  display: flex;
  flex-direction: column;
}
.c-flex-center {
  display: flex;
  align-items: center;
}
.c-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.c-flex-1 {
  flex: 1;
}
.c-flex-shrink-0 {
  flex-shrink: 0;
}
.c-gap-4 { gap: 4px; }
.c-gap-6 { gap: 6px; }
.c-gap-8 { gap: 8px; }
.c-gap-10 { gap: 10px; }
.c-gap-12 { gap: 12px; }

.c-mb-4 { margin-bottom: 4px; }
.c-mb-6 { margin-bottom: 6px; }
.c-mb-8 { margin-bottom: 8px; }
.c-mb-10 { margin-bottom: 10px; }
.c-mb-12 { margin-bottom: 12px; }
.c-mb-16 { margin-bottom: 16px; }

.c-mt-6 { margin-top: 6px; }
.c-mt-8 { margin-top: 8px; }
.c-mt-10 { margin-top: 10px; }
.c-mt-12 { margin-top: 12px; }
.c-mt-16 { margin-top: 16px; }

.c-container {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

/* ── Drag & Drop ────────────────────────────────────────── */
.c-ghost-drag {
  position: fixed;
  z-index: 99999;
  opacity: 0.85;
  pointer-events: none;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(168,85,247,0.5);
  border: 2px solid #a855f7;
}

.c-dragging {
  opacity: 0.3;
}

.c-resize-handle {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  cursor: ns-resize;
  margin-bottom: 2px;
}

/* ── Banner/Notification ────────────────────────────────── */
.c-banner-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 55000;
  background: linear-gradient(135deg, #a855f7, #6d28d9);
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ── Action Bar (fixed bottom) ──────────────────────────── */
.c-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 2;
}

/* ── Drop Zone ──────────────────────────────────────────── */
.c-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.c-drop-zone:hover {
  border-color: var(--accent);
}

/* ── Week View Columns ──────────────────────────────────── */
.c-week-col {
  flex: 1;
  position: relative;
  border-left: 1px solid rgba(255,255,255,0.04);
  min-width: 0;
}
.c-week-header {
  text-align: center;
  padding: 6px 2px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.c-week-header.today {
  color: var(--accent);
  font-weight: bold;
}

/* ── Admin-specific Components ─────────────────────────── */

/* Overlay variant: centered (for modals that use justify-content:center) */
.c-overlay-center {
  position: fixed;
  inset: 0;
  z-index: 60000;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overscroll-behavior: contain;
}

/* Admin modal sheet (narrower, more padding) */
.c-admin-sheet {
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 20px 16px 32px;
  max-height: 85vh;
  overflow-y: auto;
}
.c-admin-sheet-wide {
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 520px;
  padding: 20px 16px 32px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Admin dashboard stat card */
.c-admin-dash-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

/* Admin section label */
.c-admin-section-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* Admin stat value (large number) */
.c-admin-stat-value {
  font-family: 'Share Tech Mono', monospace;
  font-weight: 700;
}
.c-admin-stat-label {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.3px;
  margin-top: 2px;
}

/* Admin modal header row */
.c-admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* Admin modal title */
.c-admin-modal-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
}

/* Admin quick-action button card (settings/dashboard) */
.c-admin-action-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
}
.c-admin-action-card.disabled {
  border-style: dashed;
  cursor: default;
  opacity: 0.5;
}

/* Admin alert row */
.c-admin-alert {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Admin list row (team, pipeline items) */
.c-admin-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* Admin form label */
.c-admin-field-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: block;
}

/* Admin form input (larger for modals) */
.c-admin-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  box-sizing: border-box;
}

/* Admin mono input (smaller, for URLs etc) */
.c-admin-input-mono {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  padding: 8px 10px;
  outline: none;
  font-family: 'Share Tech Mono', monospace;
}

/* Admin pipeline/list card with left border accent */
.c-admin-pipeline-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Inventory Components ──────────────────────────────── */

/* 2-column stat grid used in inventory / forecast */
.c-inv-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

/* Inventory item row (truck / warehouse / cost rows) */
.c-inv-item-row {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Small +/- adjust button */
.c-inv-adjust-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

/* Mono quantity readout */
.c-inv-qty {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

/* Cost / price input in equipment cost rows */
.c-inv-cost-input {
  width: 80px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  padding: 6px 8px;
  text-align: right;
  outline: none;
}

/* Item name in inventory rows */
.c-inv-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Dollar sign prefix label */
.c-inv-dollar {
  color: var(--muted);
  font-size: 12px;
}

/* ── Inventory Remove Button ───────────────────────────── */
.c-inv-remove-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.c-inv-remove-btn:hover {
  color: var(--red);
  border-color: var(--red);
  background: rgba(248,113,113,0.1);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .c-sheet {
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom) + 60px);
  }
}

/* ══════════════════════════════════════════════════════════
   UI-H1: Mobile/Desktop Hardening Pass
   Additive CSS — zero overrides to existing desktop styles.
   ══════════════════════════════════════════════════════════ */

/* ── T1-1: Body scroll lock when overlays open ────────── */
/* Applied via JS: document.body.classList.add('overlay-open') */
body.overlay-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ── T1-3: Touch feedback for hover-only interactions ─── */
/* Provide :active/:focus feedback matching existing :hover */
.c-btn-action:active,
.c-btn-action:focus-visible {
  background: rgba(255,255,255,0.08);
}
.c-drop-zone:active,
.c-drop-zone:focus-visible {
  border-color: var(--accent);
}
/* Global tap feedback for buttons without specific :active */
button:active,
[role="button"]:active {
  opacity: 0.85;
}

/* ── T2-4: Eliminate 300ms tap delay on older browsers ── */
button, a, [role="button"], select, input[type="checkbox"], input[type="radio"] {
  touch-action: manipulation;
}

/* ── Mobile-specific hardening (768px and below) ──────── */
@media (max-width: 768px) {

  /* T1-2: Touch targets — minimum 44px for interactive elements */
  .c-inv-adjust-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  .c-close-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* T1-5: Admin mobile nav — readable font size */
  .admin-mobile-nav button {
    font-size: 11px;
    padding: 10px 4px;
  }

  /* T1-6: Minimum text sizes on mobile */
  label {
    font-size: 12px !important;
  }
  .c-badge {
    font-size: 10px;
  }
  .c-text-xs {
    font-size: 10px;
  }
  .c-text-meta {
    font-size: 11px;
  }
  .c-week-header {
    font-size: 10px;
  }

  /* T1-7: Report period buttons — wrap to 2 rows on mobile */
  .report-period-bar {
    flex-wrap: wrap;
  }
  .report-period-btn {
    flex: 0 1 calc(33.33% - 4px);
  }

  /* T2-3: Week calendar — remove forced horizontal scroll */
  .week-cols {
    min-width: 0 !important;
  }

  /* T2-5: Inventory/pipeline delete buttons — larger tap area */
  button[title="Remove"],
  button[title="Delete"] {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* INV-1I: Remove button mobile touch target */
  .c-inv-remove-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
}

/* ── Narrower phones (480px and below) ────────────────── */
@media (max-width: 480px) {
  .qty-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .report-period-btn {
    font-size: 9px;
    padding: 6px 2px;
  }
}

/* ══════════════════════════════════════════════════════════
   P24 — Mobile Fix Pack (Confirmed Issues Only)
   Production-safe UI hardening. No redesigns.
   No workflow/business logic changes. CSS-first approach.
   ══════════════════════════════════════════════════════════ */

/* ── P24-1: Executive KPI grid → 2-col on mobile ──────── */
@media (max-width: 600px) {
  .p24-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .p24-entity-split-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── P24-2: Commission ledger mobile scroll ─────── */
.p24-comm-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 600px) {
  .p24-comm-scroll {
    margin: 0 -12px;
    padding: 0 12px;
  }
  .p24-comm-scroll > div {
    min-width: 640px;
  }
  .p24-comm-filter-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ── P24-3: Quick Deal close button touch target ───────── */
#cqdPanel button[onclick*="closeCloserQuickDeal"] {
  min-width: 44px !important;
  min-height: 44px !important;
  font-size: 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ── P24-4/5/10/11/12: Shared section header treatment ── */
@media (max-width: 600px) {
  .admin-main-header {
    flex-wrap: wrap;
  }
  .admin-main-header .c-text-meta {
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
    font-size: 9px;
    line-height: 1.3;
  }
  .admin-main-title {
    font-size: 14px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 80px);
  }
}

/* ── P24-7: Customer FUNDED badge overlap fix ──────────── */
@media (max-width: 480px) {
  .p24-cust-name-row {
    flex-wrap: wrap;
    gap: 2px;
  }
}

/* ── P24-8: Inventory subtab horizontal scroll ─────────── */
.p24-inv-tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.p24-inv-tabs::-webkit-scrollbar {
  display: none;
}
@media (max-width: 600px) {
  .p24-inv-tabs button {
    flex: 0 0 auto !important;
    min-width: 72px;
    padding: 8px 10px !important;
    white-space: nowrap;
  }
}

/* ══════════════════════════════════════════════════════════
   P6.2 — Visual Polish & Hierarchy System
   Card hierarchy, button system, scanability
   ══════════════════════════════════════════════════════════ */

/* ── Card Hierarchy ─────────────────────────────────────── */
.c-card-primary {
  background: var(--panel);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.c-card-secondary {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.c-card-muted {
  background: rgba(34,40,54,0.5);
  border: 1px solid rgba(58,69,88,0.5);
  border-radius: 8px;
  padding: 10px;
}

/* ── Button Hierarchy ───────────────────────────────────── */
.c-btn-hero {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}
.c-btn-hero.green {
  background: linear-gradient(135deg, #00e676, #00c853);
  color: #000;
  box-shadow: 0 2px 12px rgba(0,230,118,0.3);
}
.c-btn-hero.purple {
  background: linear-gradient(135deg, #a855f7, #6d28d9);
  color: #fff;
  box-shadow: 0 2px 12px rgba(168,85,247,0.3);
}
.c-btn-hero.cyan {
  background: linear-gradient(135deg, var(--accent), #0088aa);
  color: #000;
  box-shadow: 0 2px 12px rgba(0,212,255,0.3);
}
.c-btn-hero.red {
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: #fff;
  box-shadow: 0 2px 12px rgba(248,113,113,0.3);
}
.c-btn-hero:active {
  transform: scale(0.98);
  filter: brightness(0.9);
}
.c-btn-secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}
.c-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.c-btn-secondary:active {
  background: var(--accent-dim);
}

/* ── Section Headers ────────────────────────────────────── */
.c-section-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
  margin-top: 20px;
}
.c-section-title:first-child {
  margin-top: 0;
}

/* ── Micro Summary Bar ──────────────────────────────────── */
.c-summary-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
}
.c-summary-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
}
.c-summary-stat .num {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  font-weight: bold;
}
.c-summary-stat .label {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Status Indicator Dot ───────────────────────────────── */
.c-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.c-status-dot.green { background: var(--green); }
.c-status-dot.red { background: var(--red); }
.c-status-dot.yellow { background: var(--yellow); }
.c-status-dot.orange { background: var(--orange); }
.c-status-dot.accent { background: var(--accent); }
.c-status-dot.purple { background: #a855f7; }
.c-status-dot.muted { background: var(--muted); }

/* ── Phase 3: Sticky detail panel headers ──────────────── */
.c-detail-sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}

/* ── Phase 3: Mobile tab overflow indicators ───────────── */
@media (max-width: 768px) {
  #adminMobileNav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #adminMobileNav::-webkit-scrollbar { display: none; }
  /* Fade edge hints for scrollable tabs */
  #adminMobileNav {
    mask-image: linear-gradient(to right, transparent 0px, black 8px, black calc(100% - 8px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0px, black 8px, black calc(100% - 8px), transparent 100%);
  }
}

/* ── P36: Agent Dropdown ───────────────────────────────── */
/* Three-column control row: [Month] [Dropdown] [Week] */
.c-cal-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 8px;
}

.c-agent-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  min-height: 36px;
  border: 1px solid;
  border-radius: 8px;
  background: var(--panel);
  font-size: 12px;
  font-family: 'Share Tech Mono', monospace;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.c-agent-dd-btn:active { background: rgba(255,255,255,0.06); }
.c-agent-dd-arrow { font-size: 10px; opacity: 0.7; }
.c-agent-dd-count {
  font-size: 10px;
  font-weight: 700;
  background: var(--dd-accent, var(--accent));
  color: #000;
  -webkit-text-fill-color: #000;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 2px;
}

.c-agent-dd-float {
  position: fixed;
  z-index: 60000;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  max-height: 400px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.c-agent-dd-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: 'Share Tech Mono', monospace;
  margin-bottom: 8px;
  box-sizing: border-box;
  outline: none;
}
.c-agent-dd-search:focus { border-color: var(--accent); }

.c-agent-dd-list {
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.c-agent-dd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Share Tech Mono', monospace;
  transition: background 0.1s;
}
.c-agent-dd-row:active { background: rgba(255,255,255,0.08); }
@media (hover: hover) {
  .c-agent-dd-row:hover { background: rgba(255,255,255,0.05); }
}

/* ── P36: View Toggle (Segmented Control) ──────────────── */
.c-view-toggle {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.c-view-toggle-btn {
  flex: 1;
  padding: 0;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-family: 'Share Tech Mono', monospace;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.c-view-toggle-btn.active {
  background: var(--toggle-accent, var(--accent));
  color: #000;
}
.c-view-toggle-btn:not(.active):active {
  background: rgba(255,255,255,0.06);
}

/* Mobile: agent dropdown goes full-width */
@media (max-width: 768px) {
  .c-agent-dd-btn { width: 100%; justify-content: center; }
  .c-agent-dd-row { min-height: 52px; }
}

/* ── Improved Spacing ───────────────────────────────────── */
.c-mb-20 { margin-bottom: 20px; }
.c-mb-24 { margin-bottom: 24px; }
.c-mt-20 { margin-top: 20px; }
.c-mt-24 { margin-top: 24px; }
.c-p-14 { padding: 14px; }
.c-p-16 { padding: 16px; }
.c-gap-14 { gap: 14px; }
.c-gap-16 { gap: 16px; }

/* ── P51: Frequency/Protocol Pills ────────────────────── */
.c-freq-pill {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'Share Tech Mono', monospace;
  display: inline-block;
  vertical-align: middle;
  line-height: 1.4;
  flex-shrink: 0;
}

/* ── Google Maps InfoWindow — strip default white chrome ── */
.gm-style-iw-a { /* outer anchor — kill the arrow/tail */  }
.gm-style .gm-style-iw-c {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  max-width: none !important;
}
.gm-style .gm-style-iw-d {
  overflow: visible !important;
  max-height: none !important;
}
.gm-style .gm-style-iw-tc,
.gm-style .gm-style-iw-tc::after {
  background: transparent !important;
  box-shadow: none !important;
}
/* Hide Google's default close button — custom one inside card */
.gm-style .gm-style-iw-c button.gm-ui-hover-effect {
  display: none !important;
}

/* ── CC Heatmap Cells ────────────────────────────── */
.cc-heat-slot { transition: transform 0.12s, box-shadow 0.12s; }
.cc-heat-slot:hover { transform: scale(1.04); box-shadow: 0 0 12px rgba(59,130,246,0.25); }
.cc-heat-high { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.25); }
.cc-heat-high > div:first-child { color: #22c55e; }
.cc-heat-med  { background: rgba(245,158,11,0.10); border: 1px solid rgba(245,158,11,0.2); }
.cc-heat-med > div:first-child  { color: #f59e0b; }
.cc-heat-low  { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.15); }
.cc-heat-low > div:first-child  { color: #ef4444; }
.cc-heat-none { background: rgba(51,65,85,0.3); border: 1px solid rgba(51,65,85,0.5); }
.cc-heat-none > div:first-child { color: #334155; }
