/* ==========================================================================
   MAYserives — Standard Design System (single source of truth)
   --------------------------------------------------------------------------
   Every color in the app is driven by the tokens below. Components never
   hard-code hex values, so the light and dark themes stay in sync and there
   are no contrast bugs (e.g. light text on a white card).
   ========================================================================== */

:root {
  /* ---- Brand (ONE identity used everywhere) ---- */
  --brand: #6366f1;            /* indigo-500 */
  --brand-strong: #4f46e5;     /* indigo-600 */
  --brand-soft: #eef2ff;       /* tinted surface for pills/badges */
  --brand-softer: rgba(99, 102, 241, 0.08);
  --brand-contrast: #ffffff;   /* text/icon color on brand fills */
  --brand-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  /* ---- Surfaces (light theme defaults) ---- */
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* ---- Text ---- */
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* ---- Status ---- */
  --success: #16a34a;
  --success-soft: #dcfce7;
  --success-contrast: #14532d;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --warning-contrast: #78350f;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --danger-contrast: #7f1d1d;
  --info: #2563eb;
  --info-soft: #dbeafe;

  /* ---- Radius & elevation ---- */
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);

  /* ---- Type ---- */
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  /* Backwards-compatible aliases — legacy token names used across pages.
     They all point at the canonical tokens above so old markup keeps working. */
  --page-bg: var(--bg);
  --surface-bg: var(--surface);
  --surface-raised: var(--surface-2);
  --card-border: var(--border);
  --card-shadow: var(--shadow);
  --accent: var(--brand);
  --accent-hover: var(--brand-strong);
  --accent-soft: var(--brand-soft);
  --input-bg: var(--surface);
  --input-border: var(--border-strong);
  --button-secondary-bg: var(--surface-2);
  --button-secondary-border: var(--border-strong);
  --teams-purple: var(--brand);
  --teams-purple-dark: var(--brand-strong);
  --teams-purple-light: #818cf8;
  --teams-purple-soft: var(--brand-soft);
  --shadow-glow: 0 4px 20px rgba(99, 102, 241, 0.25);

  color-scheme: light dark;
  font-family: var(--font);
  scroll-behavior: smooth;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Dark theme — applied automatically when the OS prefers dark, unless the
   user has explicitly chosen light via [data-theme="light"]. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --surface: #0f172a;
    --surface-2: #1e293b;
    --surface-3: #162033;
    --border: #233044;
    --border-strong: #334155;

    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --brand-soft: rgba(99, 102, 241, 0.18);
    --brand-softer: rgba(99, 102, 241, 0.12);

    --success-soft: rgba(22, 163, 74, 0.18);
    --success-contrast: #86efac;
    --warning-soft: rgba(217, 119, 6, 0.18);
    --warning-contrast: #fcd34d;
    --danger-soft: rgba(220, 38, 38, 0.18);
    --danger-contrast: #fca5a5;
    --info-soft: rgba(37, 99, 235, 0.18);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.55);
  }
}

/* Manual dark override (theme toggle) takes precedence over OS setting. */
[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #0f172a;
  --surface-2: #1e293b;
  --surface-3: #162033;
  --border: #233044;
  --border-strong: #334155;

  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --brand-soft: rgba(99, 102, 241, 0.18);
  --brand-softer: rgba(99, 102, 241, 0.12);

  --success-soft: rgba(22, 163, 74, 0.18);
  --success-contrast: #86efac;
  --warning-soft: rgba(217, 119, 6, 0.18);
  --warning-contrast: #fcd34d;
  --danger-soft: rgba(220, 38, 38, 0.18);
  --danger-contrast: #fca5a5;
  --info-soft: rgba(37, 99, 235, 0.18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.55);
}

*, *::before, *::after {
  box-sizing: border-box;
  max-width: 100%;
}

html, body {
  min-height: 100%;
  height: 100%;
  overflow-x: hidden;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

button, input, select, textarea {
  font: inherit;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page-shell {
  max-width: 1260px;
  margin: 0 auto;
  padding: 24px 28px 60px;
}

.chat-page-shell {
  max-width: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  height: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.chat-page-shell .dashboard-panel {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  min-height: 0;
  height: auto;
}

.chat-page-shell #chat-shell {
  min-height: calc(100vh - 180px);
}

.chat-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 180px);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chat-left-panel {
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
}

.chat-search-wrapper {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.chat-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.chat-contacts-panel {
  padding: 8px;
  overflow-y: auto;
}

.chat-panel {
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-contrast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.chat-contact-name {
  font-weight: 700;
  color: var(--text);
}

.chat-contact-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--surface);
}

.chat-input {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}

.chat-message-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 44px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-user-id {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.message {
  display: flex;
  margin-bottom: 10px;
}

.message--mine {
  justify-content: flex-end;
}

.message--their {
  justify-content: flex-start;
}

.message__bubble {
  max-width: 560px;
  padding: 10px 14px;
  color: var(--text);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
  word-break: break-word;
}

.message--mine .message__bubble {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--text);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}

.message__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.message__stamp {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Header / Topbar
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-contrast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.brand-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-top: -2px;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--button-secondary-border, var(--border-strong));
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  cursor: pointer;
  margin-left: auto;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.topnav a {
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
}

.topnav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.topnav--active {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 600;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.button-primary {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
}

.button-primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  text-decoration: none;
}

.button-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}

.button-secondary:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.button-danger {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

.button-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  text-decoration: none;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4 {
  color: var(--text);
  letter-spacing: -0.02em;
  margin-top: 0;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.section-header h3 {
  margin: 0;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero-panel {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.hero-panel h1 {
  font-size: 1.6rem;
  margin: 8px 0 8px;
  line-height: 1.2;
}

.hero-panel p {
  color: var(--text-secondary);
  margin: 0 0 18px;
}

.hero-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.hero-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.hero-form input {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.hero-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.hero-thumb {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.hero-thumb h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.hero-thumb p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ==========================================================================
   Cards and Lists
   ========================================================================== */

.service-grid,
.dashboard-list,
.category-grid {
  display: grid;
  gap: 16px;
}

.service-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.service-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 14px;
  display: block;
  background: var(--surface-3);
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  display: block;
}

.category-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.category-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.work-sample-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 14px;
  display: block;
  background: var(--surface-3);
}

.card-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
    Backend Forms
   ========================================================================== */

.backend-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 20px;
}

.backend-form-card,
.dashboard-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.panel-header {
  margin-bottom: 14px;
}

.panel-header h3 {
  margin: 6px 0 0;
  font-size: 1.25rem;
}

.dashboard-form {
  display: grid;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Status / Notification pills
   ========================================================================== */

.tag-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 600;
  font-size: 0.78rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.status-dot.online { background: var(--success); }
.status-dot.away { background: var(--warning); }
.status-dot.busy { background: var(--danger); }
.status-dot.offline { background: var(--text-muted); }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  margin-top: 24px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty-state {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ==========================================================================
   Provider / backend pages
   ========================================================================== */

.provider-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.request-list {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
}

.request-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.request-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  margin-bottom: 10px;
}

.request-title {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}

.request-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.request-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Notifications
   ========================================================================== */

.notification-list {
  max-height: 300px;
  overflow-y: auto;
}

.notification-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
}

.notification-card.unread {
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
}

.notification-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.notification-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.notification-body {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.notification-meta {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.notification-pill {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--brand-strong);
}

/* ==========================================================================
   Chat message bubbles
   ========================================================================== */

.message {
  display: flex;
  margin-bottom: 10px;
}

.message--mine .message__bubble {
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  color: var(--text);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}

.message--their .message__bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
}

.message__bubble {
  max-width: 560px;
  padding: 10px 14px;
  color: var(--text);
}

.message__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.message__stamp {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Chat attachments / message states
   ========================================================================== */

.msg-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 6px;
}

.msg-status--read {
  color: var(--brand);
}

.msg-status--delivered {
  color: var(--text-secondary);
}

.chat-attachment {
  margin-top: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.chat-attachment--image img {
  width: 100%;
  display: block;
  max-height: 240px;
  object-fit: cover;
}

.chat-attachment--audio audio {
  width: 100%;
  margin-top: 6px;
}

.file-preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.file-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.file-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.file-download-link {
  display: inline-block;
  padding: 8px 12px;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  border-top: 1px solid var(--border);
}

.file-download-link:hover {
  text-decoration: underline;
}

.location-map-link {
  margin-top: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.location-title {
  font-weight: 700;
  color: var(--text);
}

.location-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.location-sender {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.location-note {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.location-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  display: inline-block;
  margin-top: 6px;
}

.location-live .location-badge {
  background: var(--success-soft);
  color: var(--success-contrast);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 920px) {
  .hero-panel { grid-template-columns: 1fr; }
  .backend-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .service-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .topnav { display: none; }
  .chat-shell { grid-template-columns: 1fr; height: auto; }
  .hero-form { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Helper states used by pages
   ========================================================================== */

.active-request-card {
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  color: var(--brand-strong);
}

/* ==========================================================================
   Additional helper classes used by pages
   ========================================================================== */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field-group input {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.summary-card strong {
  display: block;
  font-size: 1.15rem;
  color: var(--text);
}

.payment-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.categories-manager {
  display: grid;
  gap: 12px;
}

.categories-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.categories-label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.categories-actions {
  display: flex;
  gap: 8px;
}

.categories-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.categories-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.categories-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-badge {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.category-badge input {
  margin: 0;
}

.signup-hero {
  margin-top: 24px;
}

.signup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}

.signup-copy h2 {
  margin: 6px 0 10px;
}

.signup-copy ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text-secondary);
}

.signup-form {
  display: grid;
  gap: 10px;
}

.signup-form input {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}

.project-image {
  height: 120px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: var(--surface-2);
}

.project-emoji {
  font-size: 40px;
}

.project-card-content h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.project-card-content p {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.section-subtitle {
  color: var(--text-secondary);
  margin: 4px 0 0;
}

.symptoms-section,
.demand-section {
  margin-top: 28px;
}

.symptoms-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.symptoms-grid,
.demand-grid {
  display: grid;
  gap: 12px;
}

.symptom-card,
.demand-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: start;
  box-shadow: var(--shadow);
}

.symptom-icon-wrapper {
  color: var(--brand);
}

.symptom-icon {
  width: 28px;
  height: 28px;
}

.symptom-content h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.symptom-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.demand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.visual-placeholder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow);
}

.visual-placeholder svg {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.footer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chat-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.chat-action-button {
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: var(--radius);
}

.chat-location-status,
.chat-record-status {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.chat-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.emoji-picker {
  display: none;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Standard UI: toasts, theme toggle, modal (driven by may-ui.js)
   ========================================================================== */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s ease;
}

.theme-toggle:hover {
  background: var(--surface-3);
}

.mayui-toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  max-width: min(360px, calc(100vw - 32px));
}

.mayui-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 0.92rem;
  animation: mayui-toast-in 0.18s ease;
}

.mayui-toast--success { border-left-color: var(--success); }
.mayui-toast--error { border-left-color: var(--danger); }
.mayui-toast--warning { border-left-color: var(--warning); }
.mayui-toast--info { border-left-color: var(--info); }

.mayui-toast__icon { font-size: 18px; line-height: 1.2; }
.mayui-toast__body { flex: 1; }
.mayui-toast__title { font-weight: 700; }
.mayui-toast__msg { color: var(--text-secondary); margin-top: 2px; }
.mayui-toast__close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px; line-height: 1;
}

@keyframes mayui-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mayui-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9998;
  animation: mayui-fade 0.15s ease;
}

.mayui-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(480px, 100%);
  max-height: 90vh;
  overflow: auto;
  color: var(--text);
}

.mayui-modal__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1.05rem;
}

.mayui-modal__body { padding: 20px; }
.mayui-modal__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes mayui-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dashboard-chat-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.chat-panel {
  padding: 20px;
}

.chat-dashboard-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.chat-sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 10px;
  max-height: 520px;
}

.chat-contacts-list {
  overflow-y: auto;
  max-height: 460px;
}

.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.chat-thread {
  background: var(--surface);
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  max-height: 420px;
}

.chat-input-bar {
  margin-top: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.chat-input-bar textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.chat-input-bar button {
  height: 42px;
}

@media (max-width: 860px) {
  .chat-dashboard-layout {
    grid-template-columns: 1fr;
  }
}

.chat-panel .panel-header {
  position: relative;
}

#notif-settings-menu {
  position: absolute;
}

/* Stripe card element styling */
.stripe-card-element {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  min-height: 42px;
  display: flex;
  align-items: center;
}

.stripe-card-element.StripeElement--focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
  outline: none;
}

.stripe-card-element.StripeElement--invalid {
  border-color: var(--danger);
}

.stripe-error-message {
  font-size: 13px;
}

/* AI Chatbox styles */
#ai-chatbox-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family: 'Inter', sans-serif;
}

.ai-chatbox-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--brand-gradient);
  color: var(--brand-contrast);
  font-size: 28px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.ai-chatbox-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.ai-chatbox {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 340px;
  max-width: calc(100vw - 40px);
  height: 500px;
  max-height: calc(100vh - 120px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.ai-chatbox.open {
  display: flex;
}

.ai-chatbox-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--brand-gradient);
  color: var(--brand-contrast);
}

.ai-chatbox-header .ai-chatbot-avatar {
  font-size: 24px;
}

.ai-chatbox-title {
  flex: 1;
}

.ai-chatbox-title span {
  display: block;
  font-weight: 600;
  font-size: 15px;
}

.ai-chatbox-title small {
  display: block;
  font-size: 12px;
  opacity: 0.9;
}

.ai-chatbox-close {
  background: none;
  border: none;
  color: var(--brand-contrast);
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.ai-chatbox-close:hover {
  opacity: 1;
}

.ai-chatbox-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-2);
}

.ai-chat-message {
  display: flex;
  gap: 8px;
  max-width: 85%;
  word-wrap: break-word;
}

.ai-chat-message.bot {
  align-self: flex-start;
}

.ai-chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-chatbot-avatar, .ai-user-avatar {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-3);
}

.ai-user-avatar {
  background: var(--brand-soft);
}

.ai-chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 100%;
}

.ai-chat-message.bot .ai-chat-bubble {
  background: var(--surface);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border);
}

.ai-chat-message.user .ai-chat-bubble {
  background: var(--brand-soft);
  border-bottom-right-radius: 6px;
  color: var(--text);
}

.ai-chat-bubble.typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
}

.ai-chat-bubble.typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: ai-typing 1.4s ease-in-out infinite both;
}

.ai-chat-bubble.typing span:nth-child(1) { animation-delay: -0.32s; }
.ai-chat-bubble.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes ai-typing {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.ai-chatbox-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.ai-chatbox-input textarea {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  resize: none;
  max-height: 100px;
  min-height: 38px;
}

.ai-chatbox-input button {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--brand-contrast);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.ai-chatbox-input button:hover:not(:disabled) {
  background: var(--brand-strong);
}

.ai-chatbox-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .ai-chatbox {
    bottom: 80px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 100px);
  }

  .ai-chatbox-toggle {
    bottom: 80px;
    width: 56px;
    height: 56px;
    font-size: 24px;
  }
}
