/* ===================================================
   Smova 3 — Stitch MD3 Design System
   Vanilla CSS — no Tailwind, no preprocessor
   =================================================== */

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* --- Custom Properties --- */
:root {
  /* MD3 Stitch palette */
  --color-primary: #230900;
  --color-primary-container: #441900;
  --color-on-primary: #ffffff;
  --color-on-primary-container: #e76600;
  --color-surface: #f8f9ff;
  --color-surface-dim: #ccdbf3;
  --color-surface-bright: #f8f9ff;
  --color-surface-tint: #9d4300;
  --color-surface-container: #e6eeff;
  --color-surface-container-low: #eff4ff;
  --color-surface-container-lowest: #ffffff;
  --color-surface-container-high: #dce9ff;
  --color-surface-container-highest: #d5e3fc;
  --color-on-surface: #0d1c2e;
  --color-on-surface-variant: #45474d;
  --color-outline: #75777d;
  --color-outline-variant: #c5c6cd;
  --color-secondary: #515f74;
  --color-secondary-container: #d5e3fd;
  --color-on-secondary-container: #57657b;
  --color-on-secondary-fixed-variant: #3a485c;
  --color-tertiary-fixed: #89f5e7;
  --color-on-tertiary-container: #239e91;
  --color-primary-fixed: #ffdbca;
  --color-on-primary-fixed: #341100;
  --color-on-primary-fixed-variant: #783200;
  --color-primary-fixed-dim: #ffb690;
  --color-inverse-surface: #233144;
  --color-inverse-on-surface: #eaf1ff;
  --color-error: #ba1a1a;
  --color-error-bg: #ffdad6;
  --color-on-error-container: #93000a;
  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-white: #ffffff;

  /* Status palette */
  --status-new-lead: #64748b;
  --status-new-lead-bg: #f1f5f9;
  --status-new-lead-border: #94a3b8;
  --status-contacted: #2563eb;
  --status-contacted-bg: #eff6ff;
  --status-contacted-border: #60a5fa;
  --status-meeting-booked: #7c3aed;
  --status-meeting-booked-bg: #f5f3ff;
  --status-meeting-booked-border: #a78bfa;
  --status-offer-sent: #d97706;
  --status-offer-sent-bg: #fffbeb;
  --status-offer-sent-border: #fbbf24;
  --status-won: #16a34a;
  --status-won-bg: #f0fdf4;
  --status-won-border: #4ade80;
  --status-lost: #9ca3af;
  --status-lost-bg: #f9fafb;
  --status-lost-border: #d1d5db;

  /* Typography */
  --font-headline: 'Manrope', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Layout */
  --sidebar-width: 256px;
  --mobile-nav-height: 64px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}


/* --- Scrollbar styling --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-surface-container-highest); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-secondary-container); }


/* --- Base --- */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--color-surface);
  color: var(--color-on-surface);
  line-height: 1.5;
  min-height: 100vh;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}


/* ===================================================
   Layout: sidebar + content + mobile nav
   =================================================== */

.sidebar {
  display: none;
}

.content-area {
  padding: 16px;
  padding-bottom: calc(var(--mobile-nav-height) + 24px);
  min-height: 100vh;
}

.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--color-white);
  border-top: 1px solid rgba(197, 198, 205, 0.3);
  height: var(--mobile-nav-height);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 50;
    background: #f1f5f9;
    border-right: 1px solid rgba(148, 163, 184, 0.15);
    padding: 20px 12px;
    box-shadow: var(--shadow-xl);
  }

  .content-area {
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    padding-bottom: 40px;
  }

  .mobile-nav {
    display: none;
  }
}


/* --- Sidebar internals --- */
.sidebar__logo {
  padding: 4px 12px;
  margin-bottom: 32px;

  & h1 {
    font-family: var(--font-headline);
    font-weight: 800;
    font-size: 24px;
    color: #0f172a;
    letter-spacing: -0.5px;
  }

  & p {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    margin-top: 2px;
  }
}

.sidebar__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  transition: all 0.2s ease;

  & .material-symbols-outlined {
    font-size: 22px;
  }

  &:hover {
    background: #e2e8f0;
    color: #0f172a;
  }

  &.active {
    background: var(--color-white);
    color: var(--color-on-primary-container);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
  }
}

.sidebar__bottom {
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
  margin-top: 8px;
}

.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-body);
  transition: all 0.2s ease;

  & .material-symbols-outlined { font-size: 22px; }

  &:hover {
    color: #0f172a;
    background: #e2e8f0;
  }
}


/* --- Mobile nav internals --- */
.mobile-nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: #94a3b8;
  transition: color 0.15s ease;

  & .material-symbols-outlined {
    font-size: 22px;
  }

  & span:last-child {
    font-size: 10px;
    font-weight: 600;
    margin-top: 2px;
    line-height: 1.1;
    max-width: 56px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &.active {
    color: var(--color-on-primary-container);

    & .material-symbols-outlined {
      font-variation-settings: 'FILL' 1;
    }
  }
}


/* ===================================================
   Flash messages
   =================================================== */

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.flash--alert {
  background: var(--color-error-bg);
  color: var(--color-on-error-container);
  border: 1px solid rgba(186, 26, 26, 0.2);
}

.flash--notice {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(22, 163, 74, 0.2);
}


/* ===================================================
   Page header
   =================================================== */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;

  & h1 {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 20px;
    color: var(--color-on-surface);
    letter-spacing: -0.3px;
  }
}

@media (min-width: 1024px) {
  .page-header h1 {
    font-size: 24px;
  }
}


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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-headline);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
  line-height: 1.4;
  white-space: nowrap;

  & .material-symbols-outlined { font-size: 18px; }
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-container) 100%);
  color: var(--color-on-primary);
  box-shadow: 0 2px 8px rgba(35, 9, 0, 0.2);

  &:hover {
    box-shadow: 0 4px 16px rgba(68, 25, 0, 0.25);
    transform: translateY(-1px);
  }

  &:active {
    transform: scale(0.98);
  }
}

.btn--secondary {
  background: var(--color-white);
  color: var(--color-on-surface);
  border: 1px solid var(--color-outline-variant);

  &:hover {
    background: #f8fafc;
    border-color: var(--color-outline);
  }
}

.btn--ghost {
  background: transparent;
  color: var(--color-outline);
  padding: 8px 10px;

  &:hover {
    background: var(--color-surface-container);
    color: var(--color-on-surface);
  }
}

.btn--sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn--icon {
  padding: 8px;
  border-radius: 50%;
}

.btn--danger {
  background: var(--color-error);
  color: var(--color-on-primary);
}

/* Action buttons row (call/email/create) */
.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn--action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-headline);
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid var(--color-outline-variant);
  background: var(--color-white);
  color: var(--color-on-surface);
  cursor: pointer;

  & .material-symbols-outlined { font-size: 18px; }

  &:hover {
    background: #f8fafc;
    border-color: var(--color-outline);
    box-shadow: var(--shadow-sm);
  }

  &.btn--action-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-container) 100%);
    color: var(--color-on-primary);
    border-color: transparent;

    &:hover {
      box-shadow: 0 4px 12px rgba(68, 25, 0, 0.2);
    }
  }
}


/* ===================================================
   Period / filter pills
   =================================================== */

.period-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.period-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--color-on-surface-variant);
  background: var(--color-white);
  border: 1px solid var(--color-outline-variant);
  transition: all 0.15s ease;

  &:hover {
    border-color: var(--color-outline);
    background: #f8fafc;
  }

  &.active {
    background: var(--color-on-surface);
    color: var(--color-white);
    border-color: var(--color-on-surface);
  }
}


/* ===================================================
   Kanban board
   =================================================== */

.kanban {
  display: none;
}

@media (min-width: 1024px) {
  /* Wrapper div holds kanban + drop zones as flex column */
  [data-controller~="kanban"] {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
  }

  .kanban {
    display: flex;
    gap: 16px;
    min-width: 0;
    flex: 1;
    min-height: 0;
  }
}

.kanban__column {
  flex: 1 1 0;
  min-width: 220px;
  display: flex;
  flex-direction: column;
}

/* Collapsible column — Fizzy-inspired */
.kanban__column--collapsible {
  position: relative;
  transition: flex 0.3s ease, min-width 0.3s ease;
}

.kanban__column--collapsible .kanban__expander {
  display: none;
}

.kanban__column--collapsible.is-collapsed {
  flex: 0 0 44px;
  min-width: 44px;
  max-width: 44px;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-surface-container-low);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-outline-variant);
}

.kanban__column-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.kanban__column--collapsible.is-collapsed .kanban__column-body {
  display: none;
}

.kanban__column--collapsible.is-collapsed .kanban__expander {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 4px;
  width: 100%;
  height: 100%;
  min-height: 200px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-on-surface-variant);
}

.kanban__expander-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface-container-highest);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-body);
}

.kanban__expander-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Collapsed expander as drop target */
.kanban__expander.drag-over {
  outline: 2px dashed var(--color-on-primary-container);
  outline-offset: -2px;
  background: rgba(231, 102, 0, 0.08);
}

.kanban__column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;

  & h3 {
    font-family: var(--font-headline);
    font-size: 14px;
    font-weight: 700;
    color: var(--color-on-surface);
    display: flex;
    align-items: center;
    gap: 8px;
  }
}

.kanban__column-indicator {
  width: 3px;
  height: 20px;
  border-radius: var(--radius-full);
}

/* Column indicator colors by status */
.kanban__column[data-status="new_lead"] .kanban__column-indicator       { background: var(--status-new-lead-border); }
.kanban__column[data-status="contacted"] .kanban__column-indicator      { background: var(--status-contacted-border); }
.kanban__column[data-status="meeting_booked"] .kanban__column-indicator { background: var(--status-meeting-booked-border); }
.kanban__column[data-status="offer_sent"] .kanban__column-indicator     { background: var(--status-offer-sent-border); }

.kanban__column-count {
  font-size: 12px;
  font-weight: 700;
  background: var(--color-surface-container-high);
  color: var(--color-on-secondary-container);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kanban__cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  flex: 1;
  overflow-y: auto;
  padding: 2px;
  border-radius: var(--radius-md);
  transition: background 0.2s ease, border-color 0.2s ease;
}

/* Column drag-over highlight */
.kanban__cards.drag-over {
  background: var(--color-surface-container-low);
  outline: 2px dashed var(--color-outline-variant);
  outline-offset: -2px;
}

/* --- Drop zones (won / lost) --- */

.kanban__drop-zones {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 0;
  background: rgba(248, 249, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 40;
  margin-top: auto;
}

.kanban__drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 24px;
  border: 2px dashed var(--color-outline-variant);
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  color: var(--color-on-surface-variant);
  transition: all 0.2s ease;
  cursor: pointer;
}

.kanban__drop-zone:hover {
  border-color: var(--color-outline);
  background: var(--color-surface-container-low);
}

.kanban__drop-zone--won {
  border-color: var(--status-won-border);
}

.kanban__drop-zone--won:hover,
.kanban__drop-zone--won.drag-over {
  border-color: var(--status-won);
  background: var(--status-won-bg);
}

.kanban__drop-zone--lost {
  border-color: var(--status-lost-border);
}

.kanban__drop-zone--lost:hover,
.kanban__drop-zone--lost.drag-over {
  border-color: var(--status-lost);
  background: var(--status-lost-bg);
}

.kanban__drop-zone.drag-over {
  transform: scale(1.01);
}

.drop-zone__content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drop-zone__icon {
  font-size: 20px;
}

.kanban__drop-zone--won .drop-zone__icon {
  color: var(--status-won);
}

.kanban__drop-zone--lost .drop-zone__icon {
  color: var(--status-lost);
}

.drop-zone__label {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 14px;
}

.drop-zone__count {
  font-size: 12px;
  font-weight: 700;
  background: var(--color-surface-container-high);
  color: var(--color-on-secondary-container);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.drop-zone__hint {
  font-size: 11px;
  color: var(--color-outline);
}


/* ===================================================
   Lead card (kanban + mobile)
   =================================================== */

.lead-card {
  display: block;
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--color-on-surface);
  border-left: 4px solid transparent;
  transition: box-shadow 0.2s ease, transform 0.15s ease, opacity 0.15s ease;
  cursor: pointer;

  &:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }
}

/* Native HTML5 drag states */
.lead-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  box-shadow: none;
}

.lead-card[data-status="new_lead"]       { border-left-color: var(--status-new-lead); }
.lead-card[data-status="contacted"]      { border-left-color: var(--status-contacted); }
.lead-card[data-status="meeting_booked"] { border-left-color: var(--status-meeting-booked); }
.lead-card[data-status="offer_sent"]     { border-left-color: var(--status-offer-sent); }
.lead-card[data-status="won"]            { border-left-color: var(--status-won); }
.lead-card[data-status="lost"]           { border-left-color: var(--status-lost); }

.lead-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.lead-card__name {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}

.lead-card__date {
  font-size: 10px;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
  margin-left: 8px;
}

.lead-card__meta {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

.lead-card__tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.lead-card__tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.lead-card__tag--area {
  background: var(--color-surface-container);
  color: var(--color-on-secondary-container);
}

.lead-card__tag--material {
  background: var(--color-primary-fixed);
  color: var(--color-on-primary-fixed-variant);
}

.lead-card__estimate {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-on-primary-container);
  margin-top: 8px;
}

/* --- Archive list --- */

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 720px;
}

/* --- Mobile lead list --- */
.lead-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 1024px) {
  .lead-list {
    display: none;
  }
}

.lead-list .lead-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lead-list .lead-card__content {
  flex: 1;
  min-width: 0;
}

.lead-list .lead-card__status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lead-list .lead-card__arrow {
  color: var(--color-outline-variant);
  flex-shrink: 0;
}

/* Status dot colors */
.lead-card__status-dot[data-status="new_lead"]       { background: var(--status-new-lead); }
.lead-card__status-dot[data-status="contacted"]      { background: var(--status-contacted); }
.lead-card__status-dot[data-status="meeting_booked"] { background: var(--status-meeting-booked); }
.lead-card__status-dot[data-status="offer_sent"]     { background: var(--status-offer-sent); }
.lead-card__status-dot[data-status="won"]            { background: var(--status-won); }
.lead-card__status-dot[data-status="lost"]           { background: var(--status-lost); }


/* ===================================================
   Status badge
   =================================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.status-badge--new_lead       { background: var(--status-new-lead-bg); color: var(--status-new-lead); }
.status-badge--contacted      { background: var(--status-contacted-bg); color: var(--status-contacted); }
.status-badge--meeting_booked { background: var(--status-meeting-booked-bg); color: var(--status-meeting-booked); }
.status-badge--offer_sent     { background: var(--status-offer-sent-bg); color: var(--status-offer-sent); }
.status-badge--won            { background: var(--status-won-bg); color: var(--status-won); }
.status-badge--lost           { background: var(--status-lost-bg); color: var(--status-lost); }


/* ===================================================
   Lead detail / show page
   =================================================== */

.lead-detail {
  max-width: 960px;
}

.lead-detail__back {
  margin-bottom: 16px;
}

.lead-detail__hero {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(197, 198, 205, 0.15);
  margin-bottom: 24px;
}

.lead-detail__hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.lead-detail__hero-info {

  & h1 {
    font-family: var(--font-headline);
    font-weight: 800;
    font-size: 24px;
    color: var(--color-on-surface);
    letter-spacing: -0.3px;
    margin-bottom: 8px;
  }
}

.lead-detail__icon-boxes {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.lead-detail__icon-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--color-on-surface);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;

  & .material-symbols-outlined {
    font-size: 18px;
    color: var(--color-on-primary-container);
  }

  &:hover {
    background: var(--color-surface-container);
  }
}

.lead-detail__status-form {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(197, 198, 205, 0.2);
}

.lead-detail__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .lead-detail__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.detail-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(197, 198, 205, 0.1);

  & h3 {
    font-family: var(--font-headline);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;

    & .material-symbols-outlined {
      font-size: 18px;
      color: var(--color-on-primary-container);
    }
  }
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(197, 198, 205, 0.15);
  gap: 12px;

  &:last-child { border-bottom: none; }

  & dt {
    font-size: 13px;
    color: var(--color-outline);
    flex-shrink: 0;
  }

  & dd {
    font-size: 14px;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
  }
}

.detail-link {
  color: var(--color-on-primary-container);
  text-decoration: none;
  font-weight: 500;

  &:hover { text-decoration: underline; }
}


/* ===================================================
   Status change form
   =================================================== */

.status-select {
  appearance: none;
  background: var(--color-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2375777d' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-sm);
  padding: 8px 30px 8px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--color-on-surface);
  cursor: pointer;
  transition: border-color 0.15s ease;

  &:hover { border-color: var(--color-outline); }
  &:focus {
    outline: none;
    border-color: var(--color-on-primary-container);
    box-shadow: 0 0 0 3px rgba(231, 102, 0, 0.1);
  }
}


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

.form-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  max-width: 600px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label, .form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-on-surface-variant);
  margin-bottom: 6px;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-sm);
  color: var(--color-on-surface);
  font-size: 15px;
  font-family: var(--font-body);
  transition: border-color 0.15s ease;
  outline: none;

  &:focus {
    border-color: var(--color-on-primary-container);
    box-shadow: 0 0 0 3px rgba(231, 102, 0, 0.1);
  }

  &::placeholder { color: var(--color-outline); }
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

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

.form-errors {
  background: var(--color-error-bg);
  border: 1px solid rgba(186, 26, 26, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--color-on-error-container);

  & ul { margin-left: 16px; margin-top: 4px; }
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}


/* ===================================================
   Estimates list on lead detail
   =================================================== */

.estimates-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.estimate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--color-on-surface);
  transition: background 0.15s ease;

  &:hover { background: var(--color-surface-container-low); }
}

.estimate-row__info {
  & .nr { font-weight: 600; font-size: 14px; }
  & .date { font-size: 12px; color: var(--color-outline); }
}

.estimate-row__amount {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-on-primary-container);
}


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

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-outline);

  & .material-symbols-outlined {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
  }

  & p {
    font-size: 14px;
  }
}


/* ===================================================
   Form data grid (key-value from webhook)
   =================================================== */

.form-data-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;

  & .form-data-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(197, 198, 205, 0.15);
    gap: 8px;

    &:last-child { border-bottom: none; }

    & .key {
      font-size: 13px;
      color: var(--color-outline);
    }

    & .value {
      font-size: 14px;
      font-weight: 500;
      text-align: right;
      word-break: break-word;
    }
  }
}


/* ===================================================
   Turbo stream animation
   =================================================== */

.lead-card[data-turbo-temporary] {
  animation: fadeIn 0.2s ease;
}

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


/* ===================================================
   Notes section
   =================================================== */

.notes-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-on-surface-variant);
  white-space: pre-wrap;
}


/* ===================================================
   Utilities
   =================================================== */

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

.text-muted { color: var(--color-outline); }
.text-sm { font-size: 13px; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.font-semibold { font-weight: 600; }


/* ===================================================
   Estimates — Index
   =================================================== */

/* Estimate status badges */
.status-badge--estimate-draft    { background: var(--status-new-lead-bg); color: var(--status-new-lead); }
.status-badge--estimate-sent     { background: var(--status-contacted-bg); color: var(--status-contacted); }
.status-badge--estimate-accepted { background: var(--status-won-bg); color: var(--status-won); }
.status-badge--estimate-rejected { background: var(--status-lost-bg); color: var(--status-lost); }
.status-badge--estimate-auto     { background: var(--status-meeting-booked-bg); color: var(--status-meeting-booked); }

/* Desktop table */
.estimates-table-wrapper {
  display: none;
  overflow-x: auto;
}

@media (min-width: 768px) {
  .estimates-table-wrapper { display: block; }
  .estimate-card-list { display: none !important; }
}

.estimates-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(197, 198, 205, 0.1);
}

.estimates-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-on-surface-variant);
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(197, 198, 205, 0.2);
}

.estimates-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(197, 198, 205, 0.1);
}

.estimates-table tr:last-child td { border-bottom: none; }

.estimates-table tr:hover td { background: #fafbff; }

.estimates-table .estimate-nr {
  font-weight: 600;
  white-space: nowrap;
}

/* Avatar initials */
.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface-container);
  color: var(--color-on-secondary-container);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-headline);
  flex-shrink: 0;
  margin-right: 10px;
}

.estimate-customer-cell {
  display: flex;
  align-items: center;
}

.estimate-actions {
  display: flex;
  gap: 4px;
}

/* Mobile card list */
.estimate-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.estimate-card {
  display: block;
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--color-on-surface);
  transition: box-shadow 0.2s ease;
  border: 1px solid rgba(197, 198, 205, 0.1);
}

.estimate-card:hover { box-shadow: var(--shadow-md); }

.estimate-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.estimate-card__nr {
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-headline);
}

.estimate-card__customer {
  font-size: 14px;
  margin-bottom: 8px;
}

.estimate-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.estimate-card__amount {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-on-primary-container);
}


/* ===================================================
   Estimates — Editor Form
   =================================================== */

.estimate-form {
  max-width: 1100px;
}

.estimate-section {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border: 1px solid rgba(197, 198, 205, 0.1);
}

.estimate-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.estimate-section__title {
  font-family: var(--font-headline);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-on-surface);
  margin-bottom: 16px;
}

.estimate-section__header .estimate-section__title {
  margin-bottom: 0;
}

.estimate-header-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}


/* --- Categories --- */

.categories-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-card {
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--color-surface);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.category-name-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--color-white);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--color-on-surface);
  outline: none;
  transition: border-color 0.15s ease;
}

.category-name-input:focus {
  border-color: var(--color-on-primary-container);
  box-shadow: 0 0 0 3px rgba(231, 102, 0, 0.1);
}

.btn-icon-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-outline);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-danger .material-symbols-outlined { font-size: 20px; }

.btn-icon-danger:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
}


/* --- Line Items --- */

.line-items-section {
  margin-bottom: 12px;
}

.line-items-header {
  display: none;
}

@media (min-width: 768px) {
  .line-items-header { display: block; }
}

.line-items-header-grid {
  display: grid;
  grid-template-columns: 2fr 80px 70px 100px 100px 36px;
  gap: 8px;
  padding: 6px 8px;
}

.line-items-header-cell {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-outline);
}

.line-items-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.line-item-row {
  position: relative;
}

.line-item-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px;
  background: var(--color-white);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-sm);
}

@media (min-width: 768px) {
  .line-item-grid {
    grid-template-columns: 2fr 80px 70px 100px 100px 36px;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
  }

  .line-item-grid-cell[data-label]::before {
    display: none;
  }
}

/* Mobile: show labels */
.line-item-grid-cell {
  position: relative;
}

@media (max-width: 767px) {
  .line-item-grid-cell[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-outline);
    margin-bottom: 2px;
  }
}

.line-item-grid-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--color-outline-variant);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--color-on-surface);
  background: var(--color-white);
  outline: none;
  transition: border-color 0.15s ease;
}

.line-item-grid-input:focus {
  border-color: var(--color-on-primary-container);
  box-shadow: 0 0 0 2px rgba(231, 102, 0, 0.08);
}

.line-item-grid-input-number {
  text-align: right;
}

.line-item-grid-total {
  font-weight: 600;
  font-size: 14px;
  text-align: right;
  padding: 6px 8px;
  color: var(--color-on-surface);
  white-space: nowrap;
}

.line-item-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-outline);
  cursor: pointer;
  transition: all 0.15s ease;
  justify-self: end;
}

.line-item-remove-btn .material-symbols-outlined { font-size: 18px; }

.line-item-remove-btn:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.line-item-add-row {
  margin-top: 8px;
}

.btn-add-line-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px dashed var(--color-outline-variant);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-outline);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-add-line-item .material-symbols-outlined { font-size: 16px; }

.btn-add-line-item:hover {
  border-color: var(--color-on-primary-container);
  color: var(--color-on-primary-container);
  background: rgba(231, 102, 0, 0.04);
}


/* --- Category footer --- */

.category-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-outline-variant);
}

.category-subtotal-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-outline);
}

.category-subtotal-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-on-surface);
}


/* --- Summary --- */

.estimate-summary {
  max-width: 320px;
  margin-left: auto;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.summary-label {
  color: var(--color-outline);
}

.summary-value {
  font-weight: 600;
  color: var(--color-on-surface);
}

.summary-separator {
  border-top: 1px solid var(--color-outline-variant);
  margin: 8px 0;
}

.summary-row--total {
  font-size: 16px;
}

.summary-row--total .summary-label {
  font-weight: 600;
  color: var(--color-on-surface);
}

.summary-row--total .summary-value {
  font-size: 18px;
  color: var(--color-on-primary-container);
}


/* --- Autocomplete dropdown --- */

.autocomplete-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-white);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 2px;
}

.autocomplete-results-visible {
  display: block;
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.autocomplete-item:hover,
.autocomplete-item-selected {
  background: var(--color-surface-container-low);
}

.autocomplete-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-on-surface);
}

.autocomplete-item-details {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-outline);
  margin-top: 2px;
}

.autocomplete-item-price {
  font-weight: 600;
  color: var(--color-on-primary-container);
}


/* ===================================================
   Estimates — Preview
   =================================================== */

.estimate-preview {
  max-width: 900px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(197, 198, 205, 0.1);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--color-on-primary-container);
  flex-wrap: wrap;
  gap: 20px;
}

.preview-header__company h2 {
  font-family: var(--font-headline);
  font-size: 18px;
  font-weight: 700;
}

.preview-header__company p {
  font-size: 13px;
  color: var(--color-outline);
}

.preview-header__estimate h1 {
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 700;
  text-align: right;
}

.preview-header__estimate p {
  font-size: 13px;
  color: var(--color-outline);
  text-align: right;
}

.preview-customer {
  margin-bottom: 24px;
}

.preview-customer h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-on-primary-container);
  margin-bottom: 8px;
}

.preview-customer p {
  font-size: 14px;
  line-height: 1.6;
}

.preview-notes {
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--color-on-surface-variant);
}

.preview-category {
  margin-bottom: 24px;
}

.preview-category__title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-on-surface);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-on-primary-container);
}

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

.preview-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-outline);
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-outline-variant);
}

.preview-table td {
  padding: 8px;
  font-size: 13px;
  border-bottom: 1px solid rgba(197, 198, 205, 0.15);
}

.preview-table tfoot td {
  font-weight: 600;
  border-top: 1px solid var(--color-outline-variant);
  border-bottom: none;
}

.preview-table__nr { width: 30px; }

.preview-summary {
  max-width: 280px;
  margin-left: auto;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid var(--color-on-surface);
}

.preview-summary__row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}

.preview-summary__row--total {
  border-top: 1px solid var(--color-outline-variant);
  padding-top: 8px;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
}


/* ===================================================
   Resources + Pricing Items
   =================================================== */

/* Shared data table (resources, pricing items) */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(197, 198, 205, 0.1);
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-on-surface-variant);
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(197, 198, 205, 0.2);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(197, 198, 205, 0.1);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: #fafbff; }

.row-inactive { opacity: 0.5; }

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* Desktop table wrapper */
.resources-table-wrapper {
  display: none;
  overflow-x: auto;
}

@media (min-width: 768px) {
  .resources-table-wrapper { display: block; }
  .resource-card-list { display: none !important; }
}


/* Type badges */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.type-badge--material {
  background: #fef3c7;
  color: #92400e;
}

.type-badge--labor {
  background: #dbeafe;
  color: #1e40af;
}

.type-badge--transport {
  background: #e0e7ff;
  color: #3730a3;
}

.type-badge--equipment {
  background: #f3e8ff;
  color: #6b21a8;
}

.type-badge--stage {
  background: var(--color-surface-container-low);
  color: var(--color-on-surface-variant);
}

/* Type icon inside badge */
.type-badge .material-symbols-outlined {
  font-size: 14px;
}


/* Status dots */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot--active {
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.status-dot--inactive {
  background: var(--color-outline-variant);
}


/* Mobile resource/pricing cards */
.resource-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resource-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(197, 198, 205, 0.1);
}

.resource-card--inactive { opacity: 0.5; }

.resource-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.resource-card__name {
  font-weight: 600;
  font-size: 15px;
}

.resource-card__details {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--color-outline);
  margin-bottom: 8px;
}

.resource-card__cost {
  font-weight: 600;
  color: var(--color-on-primary-container);
}

.resource-card__actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid rgba(197, 198, 205, 0.15);
}


/* Component detail row (pricing items table) */
.component-detail-row td {
  padding: 0 14px 12px !important;
  border-bottom: 2px solid rgba(197, 198, 205, 0.15) !important;
}

.component-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.component-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-full);
  font-size: 12px;
}

.component-chip__name {
  font-weight: 500;
  color: var(--color-on-surface);
}

.component-chip__qty {
  color: var(--color-outline);
}

.component-chip__cost {
  font-weight: 600;
  color: var(--color-on-primary-container);
}


/* Component form row (pricing item edit) */
.component-form-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.component-form-row .form-row { flex: 1; }
.component-form-row .form-group { margin-bottom: 0; }


/* Form section title */
.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-outline-variant);
}


/* Form hint */
.form-hint {
  display: block;
  font-size: 12px;
  color: var(--color-outline);
  margin-top: 4px;
}


/* Form checkbox */
.form-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--color-on-primary-container);
  vertical-align: middle;
  margin-right: 6px;
}


/* ===================================================
   Email Templates
   =================================================== */

.template-new-section {
  margin-bottom: 20px;
}

.template-accordion {
  cursor: pointer;
}

.template-accordion summary {
  list-style: none;
}

.template-accordion summary::-webkit-details-marker {
  display: none;
}

.template-variables-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--color-surface-container-low);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-on-surface-variant);
  margin-bottom: 20px;
}

.template-variables-info .material-symbols-outlined {
  font-size: 18px;
  color: var(--color-outline);
}

.template-variables-info code {
  padding: 2px 8px;
  background: var(--color-white);
  border: 1px solid var(--color-outline-variant);
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(197, 198, 205, 0.1);
}

.template-card--inactive {
  opacity: 0.6;
}

.template-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

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

.template-card__stage h3 {
  font-size: 16px;
  font-weight: 600;
}

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

.template-card__delay {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--color-outline);
}

.template-card__delay .material-symbols-outlined {
  font-size: 16px;
}

.template-card__subject {
  font-size: 14px;
  color: var(--color-on-surface-variant);
  margin-bottom: 12px;
}

.template-card__edit {
  border-top: 1px solid rgba(197, 198, 205, 0.15);
  padding-top: 12px;
}

.template-card__edit summary {
  list-style: none;
  cursor: pointer;
}

.template-card__edit summary::-webkit-details-marker {
  display: none;
}

.template-card__form {
  margin-top: 16px;
}

.template-card__form .form-group {
  margin-bottom: 14px;
}


/* ===================================================
   Settings
   =================================================== */

.settings-form {
  max-width: 700px;
}

.settings-section {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border: 1px solid rgba(197, 198, 205, 0.1);
}

.settings-section h2 {
  font-family: var(--font-headline);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-on-surface);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-section h2 .material-symbols-outlined {
  font-size: 20px;
  color: var(--color-on-primary-container);
}


/* ===================================================
   Toggle switch
   =================================================== */

.toggle-switch-form {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
}

.toggle-switch-btn {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.toggle-switch__track {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--color-outline-variant);
  border-radius: var(--radius-full);
  transition: background 0.2s ease;
}

.toggle-switch--active .toggle-switch__track {
  background: var(--color-success);
}

.toggle-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--color-white);
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease;
}

.toggle-switch--active .toggle-switch__thumb {
  transform: translateX(18px);
}


/* ===================================================
   Danger zone card (lead detail)
   =================================================== */

.detail-card--danger {
  border: 1px solid rgba(186, 26, 26, 0.2);
  background: rgba(255, 218, 214, 0.15);
  margin-top: 24px;
}

.detail-card--danger h3 {
  color: var(--color-error);
}

.detail-card--danger h3 .material-symbols-outlined {
  color: var(--color-error);
}


/* ===================================================
   Service tag on lead cards
   =================================================== */

.lead-card__tag--service {
  background: var(--color-tertiary-fixed);
  color: var(--color-on-tertiary-container);
}

/* Tag icons inline */
.lead-card__tag .material-symbols-outlined {
  vertical-align: -2px;
}


/* ===================================================
   Estimate row improvements (lead detail)
   =================================================== */

.estimate-row__info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.estimate-row__info .nr {
  font-weight: 600;
  font-size: 14px;
}

.estimate-row__info .date {
  font-size: 12px;
  color: var(--color-outline);
}


/* ===================================================
   Print styles
   =================================================== */

@media print {
  .sidebar, .mobile-nav, .page-header, .flash { display: none !important; }
  .content-area { margin-left: 0; padding: 0; }
  .estimate-preview { box-shadow: none; padding: 0; }
}

/* Lexxy WYSIWYG editor */
.lexxy-wrapper {
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-md);
  min-height: 200px;
  padding: 0;
  background: var(--color-white);
}

.lexxy-wrapper:focus-within {
  border-color: var(--color-on-primary-container);
  box-shadow: 0 0 0 2px rgba(231, 102, 0, 0.1);
}
