/* ==========================================================================
   ChampCourts Sales Dashboard — Mobile-First Stylesheet
   Brand: ENGINEERED FOR VICTORY
   Colors: Navy #1A365D | Gold #D4A012 | White #FFFFFF
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */

:root {
  /* Brand Colors */
  --color-navy:        #1A365D;
  --color-navy-dark:   #122540;
  --color-navy-mid:    #234880;
  --color-navy-light:  #2C5282;
  --color-gold:        #D4A012;
  --color-gold-dark:   #B8880E;
  --color-gold-light:  #ECC94B;
  --color-gold-pale:   #FEFCE8;

  /* Neutral Colors */
  --color-white:       #FFFFFF;
  --color-light-grey:  #F7FAFC;
  --color-grey-100:    #EDF2F7;
  --color-grey-200:    #E2E8F0;
  --color-grey-300:    #CBD5E0;
  --color-grey-400:    #A0AEC0;
  --color-grey-500:    #718096;
  --color-grey-600:    #4A5568;
  --color-dark-text:   #2D3748;
  --color-black:       #1A202C;

  /* Status Colors */
  --color-status-draft:       #718096;
  --color-status-draft-bg:    #EDF2F7;
  --color-status-generated:   #2B6CB0;
  --color-status-generated-bg:#EBF8FF;
  --color-status-shared:      #276749;
  --color-status-shared-bg:   #F0FFF4;
  --color-status-superseded:  #C05621;
  --color-status-superseded-bg:#FFFAF0;
  --color-status-cancelled:   #C53030;
  --color-status-cancelled-bg:#FFF5F5;

  /* Semantic Colors */
  --color-error:       #E53E3E;
  --color-error-bg:    #FFF5F5;
  --color-success:     #38A169;
  --color-success-bg:  #F0FFF4;
  --color-warning:     #D69E2E;
  --color-warning-bg:  #FFFFF0;
  --color-info:        #3182CE;
  --color-info-bg:     #EBF8FF;

  /* Highlight — default confidence fields */
  --color-highlight-bg:     #FFF9C4;
  --color-highlight-border: #F6E05E;
  --color-highlight-text:   #744210;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif,
               "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
               Courier, monospace;

  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px */
  --text-xl:   1.25rem;   /* 20px */
  --text-2xl:  1.5rem;    /* 24px */
  --text-3xl:  1.875rem;  /* 30px */

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  --leading-tight:  1.25;
  --leading-snug:   1.375;
  --leading-normal: 1.5;
  --leading-relaxed:1.625;

  /* Spacing */
  --space-1:  0.25rem;   /* 4px */
  --space-2:  0.5rem;    /* 8px */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */

  /* Border Radius */
  --radius-sm:   0.25rem;
  --radius-md:   0.375rem;
  --radius-lg:   0.5rem;
  --radius-xl:   0.75rem;
  --radius-2xl:  1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.1),
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.1),
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-card:0 2px 8px rgba(26, 54, 93, 0.08);
  --shadow-fab: 0 4px 16px rgba(212, 160, 18, 0.4);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   200ms ease;
  --transition-slow:   300ms ease;
  --transition-screen: 250ms ease-in-out;

  /* Layout */
  --header-height:     56px;
  --bottom-nav-height: 64px;
  --sidebar-width:     240px;
  --max-content-width: 1200px;
  --content-padding:   var(--space-4);

  /* Z-index scale */
  --z-base:    1;
  --z-dropdown:10;
  --z-sticky:  20;
  --z-header:  30;
  --z-bottom-nav: 40;
  --z-fab:     50;
  --z-modal:   60;
  --z-toast:   70;
  --z-spinner: 80;
}


/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-dark-text);
  background-color: var(--color-light-grey);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-navy-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-navy);
  text-decoration: underline;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

ul,
ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
  color: var(--color-black);
}


/* --------------------------------------------------------------------------
   3. App Shell & Layout
   -------------------------------------------------------------------------- */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Main scrollable content area — leaves room for header + bottom nav on mobile */
.app-main {
  flex: 1;
  padding-top: var(--header-height);
  padding-bottom: var(--bottom-nav-height);
  overflow-x: hidden;
}

.screen {
  display: none;
  min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
  padding: var(--content-padding);
  animation: screenFadeIn var(--transition-screen) forwards;
}

.screen.active {
  display: block;
}

@keyframes screenFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Login screen — no header/nav */
.screen--login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-8) var(--space-4);
  background: linear-gradient(160deg, var(--color-navy) 0%, var(--color-navy-mid) 60%, var(--color-navy-dark) 100%);
}

.screen--login.active {
  display: flex;
}

.page-content {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-4);
}

/* Responsive desktop padding */
@media (min-width: 768px) {
  .app-main {
    padding-bottom: 0;
  }

  .screen {
    min-height: calc(100vh - var(--header-height));
    padding: var(--space-6);
  }

  .page-content {
    padding: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .page-content {
    padding: var(--space-8);
  }
}


/* --------------------------------------------------------------------------
   4. Header Bar
   -------------------------------------------------------------------------- */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--color-navy);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  z-index: var(--z-header);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.header__logo-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.header__brand {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.header__brand-name {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-white);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header__brand-tagline {
  font-size: 0.625rem;
  color: var(--color-gold-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}

.header__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-white);
  /* Hidden on mobile when logo is shown */
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: transparent;
  transition: background-color var(--transition-fast);
}

.header__icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

.header__icon-btn:active {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Gold accent strip at bottom of header */
.app-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-gold) 0%, var(--color-gold-light) 50%, var(--color-gold) 100%);
}

/* Desktop: show sidebar instead of bottom nav */
@media (min-width: 768px) {
  .header__brand-tagline {
    display: block;
  }
}


/* --------------------------------------------------------------------------
   5. Bottom Navigation Bar (Mobile)
   -------------------------------------------------------------------------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: var(--color-white);
  border-top: 1px solid var(--color-grey-200);
  display: flex;
  align-items: stretch;
  z-index: var(--z-bottom-nav);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-1);
  color: var(--color-grey-500);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav__item:hover {
  color: var(--color-navy);
}

.bottom-nav__item.active {
  color: var(--color-navy);
}

.bottom-nav__item.active .bottom-nav__icon {
  color: var(--color-gold);
}

.bottom-nav__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.bottom-nav__label {
  font-size: 0.65rem;
  letter-spacing: 0.02em;
}

/* Active indicator dot */
.bottom-nav__item.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 32px;
  height: 2px;
  background-color: var(--color-gold);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Hide bottom nav on desktop */
@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}


/* --------------------------------------------------------------------------
   6. Desktop Sidebar Navigation
   -------------------------------------------------------------------------- */

.app-sidebar {
  display: none;
}

@media (min-width: 768px) {
  .app-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--color-white);
    border-right: 1px solid var(--color-grey-200);
    overflow-y: auto;
    z-index: var(--z-sticky);
    padding: var(--space-4) 0;
  }

  /* Push main content right when sidebar is shown */
  .app-main.has-sidebar {
    margin-left: var(--sidebar-width);
  }

  .sidebar__nav {
    flex: 1;
  }

  .sidebar__section-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-grey-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--space-4) var(--space-5) var(--space-2);
  }

  .sidebar__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    color: var(--color-grey-600);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    text-decoration: none;
    border-radius: 0;
    cursor: pointer;
    transition: background-color var(--transition-fast),
                color var(--transition-fast);
    border-left: 3px solid transparent;
  }

  .sidebar__item:hover {
    background-color: var(--color-light-grey);
    color: var(--color-navy);
    text-decoration: none;
  }

  .sidebar__item.active {
    background-color: var(--color-gold-pale);
    color: var(--color-navy);
    border-left-color: var(--color-gold);
    font-weight: var(--weight-semibold);
  }

  .sidebar__item-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: inherit;
  }

  .sidebar__divider {
    height: 1px;
    background-color: var(--color-grey-200);
    margin: var(--space-3) var(--space-4);
  }
}


/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */

.card {
  background-color: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-grey-200);
  overflow: hidden;
}

.card--flat {
  box-shadow: none;
  border: 1px solid var(--color-grey-200);
}

.card--elevated {
  box-shadow: var(--shadow-lg);
  border: none;
}

.card--navy {
  background-color: var(--color-navy);
  border-color: var(--color-navy-dark);
  color: var(--color-white);
}

.card--gold-accent {
  border-left: 4px solid var(--color-gold);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-grey-100);
}

.card__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-dark-text);
}

.card__subtitle {
  font-size: var(--text-sm);
  color: var(--color-grey-500);
  margin-top: var(--space-1);
}

.card__body {
  padding: var(--space-4) var(--space-5);
}

.card__footer {
  padding: var(--space-3) var(--space-5);
  background-color: var(--color-light-grey);
  border-top: 1px solid var(--color-grey-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Call / Estimate list item card */
.card--list-item {
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: box-shadow var(--transition-base),
              transform var(--transition-base);
}

.card--list-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card--list-item:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.card__list-inner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
}

.card__icon-wrap {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background-color: var(--color-light-grey);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-navy);
}

.card__icon-wrap--gold {
  background-color: var(--color-gold-pale);
  color: var(--color-gold-dark);
}

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

.card__primary-text {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-dark-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__secondary-text {
  font-size: var(--text-xs);
  color: var(--color-grey-500);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
}

.card__timestamp {
  font-size: var(--text-xs);
  color: var(--color-grey-400);
}


/* --------------------------------------------------------------------------
   8. Status Badges
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.5;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: currentColor;
  opacity: 0.8;
  flex-shrink: 0;
}

/* Draft — grey */
.badge--draft {
  color: var(--color-status-draft);
  background-color: var(--color-status-draft-bg);
}

/* Generated — blue */
.badge--generated {
  color: var(--color-status-generated);
  background-color: var(--color-status-generated-bg);
}

/* Shared — green */
.badge--shared {
  color: var(--color-status-shared);
  background-color: var(--color-status-shared-bg);
}

/* Superseded — orange */
.badge--superseded {
  color: var(--color-status-superseded);
  background-color: var(--color-status-superseded-bg);
}

/* Cancelled — red */
.badge--cancelled {
  color: var(--color-status-cancelled);
  background-color: var(--color-status-cancelled-bg);
}

/* Tag variant — no dot */
.badge--tag {
  background-color: var(--color-grey-100);
  color: var(--color-grey-600);
}

.badge--tag::before {
  display: none;
}

/* Court type tags */
.badge--basketball  { background-color: #FFF3E0; color: #E65100; }
.badge--badminton   { background-color: #E8F5E9; color: #1B5E20; }
.badge--volleyball  { background-color: #E3F2FD; color: #0D47A1; }
.badge--pickleball  { background-color: #F3E5F5; color: #4A148C; }

.badge--basketball::before,
.badge--badminton::before,
.badge--volleyball::before,
.badge--pickleball::before {
  display: none;
}

/* Product type tags */
.badge--acrylic { background-color: #E8EAF6; color: #283593; }
.badge--pp-tile { background-color: #FFF8E1; color: #F57F17; }
.badge--pcc     { background-color: #EFEBE9; color: #4E342E; }

.badge--acrylic::before,
.badge--pp-tile::before,
.badge--pcc::before {
  display: none;
}


/* --------------------------------------------------------------------------
   9. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

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

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary — Navy */
.btn--primary {
  background-color: var(--color-navy);
  color: var(--color-white);
  border-color: var(--color-navy);
}

.btn--primary:hover {
  background-color: var(--color-navy-dark);
  border-color: var(--color-navy-dark);
  box-shadow: 0 4px 12px rgba(26, 54, 93, 0.3);
}

/* Secondary — Gold */
.btn--secondary {
  background-color: var(--color-gold);
  color: var(--color-navy);
  border-color: var(--color-gold);
}

.btn--secondary:hover {
  background-color: var(--color-gold-dark);
  border-color: var(--color-gold-dark);
  box-shadow: 0 4px 12px rgba(212, 160, 18, 0.35);
}

/* Outline Navy */
.btn--outline {
  background-color: transparent;
  color: var(--color-navy);
  border-color: var(--color-navy);
}

.btn--outline:hover {
  background-color: var(--color-navy);
  color: var(--color-white);
}

/* Outline Gold */
.btn--outline-gold {
  background-color: transparent;
  color: var(--color-gold-dark);
  border-color: var(--color-gold);
}

.btn--outline-gold:hover {
  background-color: var(--color-gold);
  color: var(--color-navy);
}

/* Ghost */
.btn--ghost {
  background-color: transparent;
  color: var(--color-grey-600);
  border-color: transparent;
}

.btn--ghost:hover {
  background-color: var(--color-grey-100);
  color: var(--color-dark-text);
}

/* Danger */
.btn--danger {
  background-color: var(--color-error);
  color: var(--color-white);
  border-color: var(--color-error);
}

.btn--danger:hover {
  background-color: #C53030;
  border-color: #C53030;
}

/* Sizes */
.btn--sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn--full {
  width: 100%;
}

/* Icon-only button */
.btn--icon {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  aspect-ratio: 1;
}

/* Loading state */
.btn--loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn--loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.65s linear infinite;
}

.btn--primary.btn--loading::after  { border-color: rgba(255,255,255,0.6); border-right-color: transparent; }
.btn--secondary.btn--loading::after { border-color: rgba(26,54,93,0.6);   border-right-color: transparent; }

/* Button group */
.btn-group {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn-group--stretch .btn {
  flex: 1;
}


/* --------------------------------------------------------------------------
   10. Floating Action Button (FAB)
   -------------------------------------------------------------------------- */

.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-4));
  right: var(--space-5);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background-color: var(--color-gold);
  color: var(--color-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  z-index: var(--z-fab);
  cursor: pointer;
  border: none;
  transition: background-color var(--transition-fast),
              box-shadow var(--transition-fast),
              transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.fab:hover {
  background-color: var(--color-gold-dark);
  box-shadow: 0 6px 20px rgba(212, 160, 18, 0.5);
  transform: scale(1.05);
}

.fab:active {
  transform: scale(0.95);
}

.fab__icon {
  width: 24px;
  height: 24px;
}

/* Extended FAB with label */
.fab--extended {
  width: auto;
  border-radius: var(--radius-full);
  padding: 0 var(--space-5);
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

@media (min-width: 768px) {
  .fab {
    bottom: var(--space-8);
    right: var(--space-8);
  }
}


/* --------------------------------------------------------------------------
   11. Form Elements
   -------------------------------------------------------------------------- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-dark-text);
}

.form-label--required::after {
  content: " *";
  color: var(--color-error);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-grey-500);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Base input */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-grey-300);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  color: var(--color-dark-text);
  background-color: var(--color-white);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-grey-400);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-navy);
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.12);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--color-grey-100);
  color: var(--color-grey-500);
  cursor: not-allowed;
}

/* Error state */
.form-input--error,
.form-select--error,
.form-textarea--error {
  border-color: var(--color-error);
}

.form-input--error:focus,
.form-select--error:focus,
.form-textarea--error:focus {
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12);
}

/* Select arrow */
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23718096' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

/* Textarea */
.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Input with icon */
.form-input-wrap {
  position: relative;
}

.form-input-wrap .form-input {
  padding-left: var(--space-10);
}

.form-input-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-grey-400);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Default confidence highlight — yellow */
.field--default-confidence {
  background-color: var(--color-highlight-bg);
  border-color: var(--color-highlight-border);
  color: var(--color-highlight-text);
}

.field--default-confidence:focus {
  box-shadow: 0 0 0 3px rgba(246, 224, 94, 0.35);
  border-color: var(--color-gold);
}

/* Highlight wrapper (for labels + inputs together) */
.field-group--default-confidence {
  background-color: var(--color-highlight-bg);
  border: 1.5px solid var(--color-highlight-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
}

.field-group--default-confidence .form-label {
  color: var(--color-highlight-text);
}

.field-group--default-confidence .form-input,
.field-group--default-confidence .form-select {
  background-color: var(--color-white);
  border-color: var(--color-highlight-border);
}

/* Confidence tag */
.confidence-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-highlight-text);
  background-color: var(--color-highlight-border);
  padding: 1px var(--space-2);
  border-radius: var(--radius-full);
  font-weight: var(--weight-medium);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}

.form-check__input {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-grey-300);
  border-radius: var(--radius-sm);
  background-color: var(--color-white);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition-fast),
              background-color var(--transition-fast);
}

.form-check__input[type="radio"] {
  border-radius: var(--radius-full);
}

.form-check__input:checked {
  background-color: var(--color-navy);
  border-color: var(--color-navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l3 3 5-6' stroke='white' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px;
}

.form-check__input[type="radio"]:checked {
  background-image: none;
  box-shadow: inset 0 0 0 3px var(--color-white);
}

.form-check__label {
  font-size: var(--text-sm);
  color: var(--color-dark-text);
  line-height: var(--leading-snug);
}

/* Form section divider */
.form-section {
  margin-bottom: var(--space-8);
}

.form-section__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-gold);
  margin-bottom: var(--space-5);
}


/* --------------------------------------------------------------------------
   12. Tabs
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tabs__list {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 2px solid var(--color-grey-200);
  gap: 0;
  background-color: var(--color-white);
  /* Sticky below header */
  position: sticky;
  top: var(--header-height);
  z-index: var(--z-sticky);
}

.tabs__list::-webkit-scrollbar {
  display: none;
}

.tabs__tab {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-grey-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast),
              border-color var(--transition-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tabs__tab:hover {
  color: var(--color-dark-text);
}

.tabs__tab.active {
  color: var(--color-navy);
  border-bottom-color: var(--color-gold);
  font-weight: var(--weight-semibold);
}

.tabs__panel {
  display: none;
  padding-top: var(--space-4);
  animation: screenFadeIn var(--transition-base) forwards;
}

.tabs__panel.active {
  display: block;
}


/* --------------------------------------------------------------------------
   13. Table (Pricing & Line Items)
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-grey-200);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.table th {
  background-color: var(--color-navy);
  color: var(--color-white);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 2px solid var(--color-gold);
}

.table th:first-child {
  border-radius: var(--radius-lg) 0 0 0;
}

.table th:last-child {
  border-radius: 0 var(--radius-lg) 0 0;
  text-align: right;
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-grey-100);
  color: var(--color-dark-text);
  vertical-align: top;
}

.table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

.table tr:hover td {
  background-color: var(--color-light-grey);
}

/* Subtotal rows */
.table tr.row--subtotal td {
  background-color: var(--color-grey-100);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
}

/* Total row */
.table tr.row--total td {
  background-color: var(--color-navy);
  color: var(--color-white);
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  border-bottom: none;
}

/* GST row */
.table tr.row--gst td {
  background-color: var(--color-gold-pale);
  color: var(--color-dark-text);
  font-weight: var(--weight-medium);
}

/* Section header row */
.table tr.row--section-header td {
  background-color: var(--color-light-grey);
  color: var(--color-navy);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: var(--space-4);
}

/* Numeric alignment */
.table td.col--number,
.table th.col--number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table td.col--center,
.table th.col--center {
  text-align: center;
}

/* Editable cell */
.table td.cell--editable {
  padding: var(--space-1) var(--space-2);
}

.table td.cell--editable input {
  width: 100%;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-grey-300);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Highlight editable cell with default value */
.table td.cell--default-confidence input {
  background-color: var(--color-highlight-bg);
  border-color: var(--color-highlight-border);
  color: var(--color-highlight-text);
}


/* --------------------------------------------------------------------------
   14. Screen: Login
   -------------------------------------------------------------------------- */

.login-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--color-white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-8) var(--space-6);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.login-logo__image {
  width: 80px;
  height: 80px;
}

.login-logo__name {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-navy);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-logo__tagline {
  font-size: var(--text-xs);
  color: var(--color-gold-dark);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: -var(--space-2);
}

.login-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-dark-text);
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}


/* --------------------------------------------------------------------------
   15. Screen: Calls List
   -------------------------------------------------------------------------- */

.calls-list__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.calls-list__title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-dark-text);
}

.calls-list__filters {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-4);
}

.calls-list__filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  padding: var(--space-1) var(--space-3);
  border: 1.5px solid var(--color-grey-300);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-grey-600);
  background-color: var(--color-white);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--color-navy);
  color: var(--color-navy);
}

.filter-chip.active {
  background-color: var(--color-navy);
  border-color: var(--color-navy);
  color: var(--color-white);
}

.calls-list__empty {
  text-align: center;
  padding: var(--space-16) var(--space-4);
  color: var(--color-grey-400);
}

.calls-list__empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  opacity: 0.4;
}

.calls-list__empty-text {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}

.calls-list__empty-hint {
  font-size: var(--text-sm);
  margin-top: var(--space-2);
}


/* --------------------------------------------------------------------------
   16. Screen: Upload Recording
   -------------------------------------------------------------------------- */

.upload-zone {
  border: 2px dashed var(--color-grey-300);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast),
              background-color var(--transition-fast);
  background-color: var(--color-white);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--color-gold);
  background-color: var(--color-gold-pale);
}

.upload-zone__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  color: var(--color-grey-400);
}

.upload-zone.drag-over .upload-zone__icon {
  color: var(--color-gold-dark);
}

.upload-zone__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-dark-text);
  margin-bottom: var(--space-2);
}

.upload-zone__subtitle {
  font-size: var(--text-sm);
  color: var(--color-grey-500);
}

.upload-zone__formats {
  font-size: var(--text-xs);
  color: var(--color-grey-400);
  margin-top: var(--space-3);
}

/* File preview chip */
.file-chip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-light-grey);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-grey-200);
  margin-top: var(--space-4);
}

.file-chip__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: var(--color-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  flex-shrink: 0;
}

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

.file-chip__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-dark-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-chip__size {
  font-size: var(--text-xs);
  color: var(--color-grey-500);
}

.file-chip__remove {
  flex-shrink: 0;
  color: var(--color-grey-400);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.file-chip__remove:hover {
  color: var(--color-error);
}

/* Upload progress */
.upload-progress {
  margin-top: var(--space-4);
}

.upload-progress__label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-grey-600);
  margin-bottom: var(--space-2);
}

.upload-progress__bar {
  height: 6px;
  background-color: var(--color-grey-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.upload-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-navy), var(--color-gold));
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}


/* --------------------------------------------------------------------------
   17. Screen: Call Detail
   -------------------------------------------------------------------------- */

.call-detail__hero {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-mid) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  color: var(--color-white);
  margin-bottom: var(--space-4);
}

.call-detail__client {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-1);
}

.call-detail__meta {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.call-detail__meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Scorecard grid */
.scorecard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

@media (min-width: 480px) {
  .scorecard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .scorecard-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.score-tile {
  background-color: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  text-align: center;
}

.score-tile__value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-navy);
  line-height: 1;
}

.score-tile__label {
  font-size: var(--text-xs);
  color: var(--color-grey-500);
  margin-top: var(--space-1);
}

.score-tile--good  .score-tile__value { color: var(--color-success); }
.score-tile--warn  .score-tile__value { color: var(--color-warning); }
.score-tile--bad   .score-tile__value { color: var(--color-error); }

/* Transcript viewer */
.transcript-viewer {
  background-color: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  max-height: 320px;
  overflow-y: auto;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-dark-text);
  font-family: var(--font-mono);
}

.transcript-viewer__line {
  margin-bottom: var(--space-2);
}

.transcript-viewer__speaker {
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
}

/* Analysis sections */
.analysis-section {
  margin-bottom: var(--space-5);
}

.analysis-section__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-grey-500);
  margin-bottom: var(--space-2);
}

.analysis-section__content {
  font-size: var(--text-sm);
  color: var(--color-dark-text);
  line-height: var(--leading-relaxed);
}

/* Follow-up message box */
.followup-message {
  background-color: var(--color-light-grey);
  border-left: 4px solid var(--color-gold);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-dark-text);
  line-height: var(--leading-relaxed);
  white-space: pre-wrap;
}


/* --------------------------------------------------------------------------
   18. Screen: Requirements Review
   -------------------------------------------------------------------------- */

.requirements-review__intro {
  background-color: var(--color-info-bg);
  border-left: 4px solid var(--color-info);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
  color: var(--color-info);
}

.requirements-review__intro strong {
  display: block;
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

/* Highlight legend */
.highlight-legend {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  font-size: var(--text-xs);
  color: var(--color-grey-600);
  flex-wrap: wrap;
}

.highlight-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--color-highlight-bg);
  border: 1px solid var(--color-highlight-border);
  flex-shrink: 0;
}

/* Two-column form on desktop */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid .form-group--full {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .form-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* --------------------------------------------------------------------------
   19. Screen: Estimate Preview
   -------------------------------------------------------------------------- */

.estimate-preview__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.estimate-preview__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-dark-text);
}

.estimate-preview__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* PDF-like preview box */
.estimate-doc {
  background-color: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.estimate-doc__header {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-dark) 100%);
  padding: var(--space-6);
  color: var(--color-white);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.estimate-doc__company {
  flex: 1;
}

.estimate-doc__company-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-white);
}

.estimate-doc__company-tagline {
  font-size: var(--text-xs);
  color: var(--color-gold-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: var(--space-1);
}

.estimate-doc__company-contact {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.7);
  margin-top: var(--space-3);
  line-height: var(--leading-relaxed);
}

.estimate-doc__number {
  text-align: right;
}

.estimate-doc__number-label {
  font-size: var(--text-xs);
  color: var(--color-gold-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.estimate-doc__number-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-gold);
  margin-top: var(--space-1);
}

.estimate-doc__number-date {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.65);
  margin-top: var(--space-1);
}

/* Gold accent line */
.estimate-doc__accent {
  height: 4px;
  background: linear-gradient(90deg, var(--color-gold) 0%, var(--color-gold-light) 50%, var(--color-gold) 100%);
}

.estimate-doc__body {
  padding: var(--space-6);
}

.estimate-doc__client-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-grey-200);
}

.estimate-doc__section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-gold-dark);
  margin-bottom: var(--space-2);
}

.estimate-doc__client-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-dark-text);
}

.estimate-doc__client-details {
  font-size: var(--text-sm);
  color: var(--color-grey-600);
  line-height: var(--leading-relaxed);
  margin-top: var(--space-1);
}

.estimate-doc__footer {
  background-color: var(--color-light-grey);
  border-top: 1px solid var(--color-grey-200);
  padding: var(--space-5) var(--space-6);
}

.estimate-doc__payment-terms {
  font-size: var(--text-xs);
  color: var(--color-grey-600);
  line-height: var(--leading-relaxed);
}

.estimate-doc__payment-terms strong {
  color: var(--color-dark-text);
  font-weight: var(--weight-semibold);
}


/* --------------------------------------------------------------------------
   20. Screen: Estimates List
   -------------------------------------------------------------------------- */

.estimates-list__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

@media (min-width: 640px) {
  .estimates-list__stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-tile {
  background-color: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.stat-tile__value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-navy);
  line-height: 1;
}

.stat-tile__label {
  font-size: var(--text-xs);
  color: var(--color-grey-500);
  margin-top: var(--space-1);
}

.stat-tile--gold .stat-tile__value {
  color: var(--color-gold-dark);
}

.stat-tile--green .stat-tile__value {
  color: var(--color-success);
}


/* --------------------------------------------------------------------------
   21. Screen: Manual Estimate
   -------------------------------------------------------------------------- */

.manual-estimate__header {
  margin-bottom: var(--space-6);
}

.manual-estimate__title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-dark-text);
  margin-bottom: var(--space-1);
}

.manual-estimate__subtitle {
  font-size: var(--text-sm);
  color: var(--color-grey-500);
}

/* Court builder row */
.court-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--color-light-grey);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-grey-200);
  margin-bottom: var(--space-3);
}

@media (min-width: 640px) {
  .court-row {
    grid-template-columns: 2fr 1fr 1fr auto;
    align-items: end;
  }
}

.court-row__remove {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.court-row__remove-btn {
  color: var(--color-error);
  opacity: 0.7;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: opacity var(--transition-fast),
              background-color var(--transition-fast);
}

.court-row__remove-btn:hover {
  opacity: 1;
  background-color: var(--color-error-bg);
}

/* Add court button */
.add-court-btn {
  width: 100%;
  padding: var(--space-3);
  border: 2px dashed var(--color-grey-300);
  border-radius: var(--radius-lg);
  color: var(--color-grey-500);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  background-color: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.add-court-btn:hover {
  border-color: var(--color-gold);
  color: var(--color-gold-dark);
  background-color: var(--color-gold-pale);
}


/* --------------------------------------------------------------------------
   22. Loading Spinner
   -------------------------------------------------------------------------- */

/* Overlay spinner (full screen) */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(26, 54, 93, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-spinner);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 150ms ease;
}

.spinner-overlay__box {
  background-color: var(--color-white);
  border-radius: var(--radius-2xl);
  padding: var(--space-8) var(--space-10);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  box-shadow: var(--shadow-xl);
  text-align: center;
  max-width: 280px;
}

.spinner-overlay__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-dark-text);
}

.spinner-overlay__sub {
  font-size: var(--text-xs);
  color: var(--color-grey-500);
  margin-top: -var(--space-2);
}

/* Spinner ring */
.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-grey-200);
  border-top-color: var(--color-navy);
  border-right-color: var(--color-gold);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.spinner--sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner--lg {
  width: 56px;
  height: 56px;
  border-width: 4px;
}

/* Inline skeleton loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-grey-100) 25%,
    var(--color-grey-200) 50%,
    var(--color-grey-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton--text {
  height: 1em;
  border-radius: var(--radius-sm);
}

.skeleton--circle {
  border-radius: var(--radius-full);
}

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

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Pipeline step indicator */
.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  max-width: 340px;
  margin: var(--space-4) auto 0;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-grey-500);
}

.pipeline-step__dot {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-grey-300);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pipeline-step--done {
  color: var(--color-dark-text);
}

.pipeline-step--done .pipeline-step__dot {
  background-color: var(--color-success);
  border-color: var(--color-success);
}

.pipeline-step--active {
  color: var(--color-navy);
  font-weight: var(--weight-semibold);
}

.pipeline-step--active .pipeline-step__dot {
  border-color: var(--color-navy);
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}


/* --------------------------------------------------------------------------
   23. Toast Notifications
   -------------------------------------------------------------------------- */

.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-4));
  right: var(--space-4);
  left: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

@media (min-width: 480px) {
  .toast-container {
    left: auto;
    width: 360px;
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  background-color: var(--color-white);
  border: 1px solid var(--color-grey-200);
  pointer-events: all;
  animation: toastSlideIn var(--transition-slow) ease forwards;
  border-left: 4px solid var(--color-grey-400);
}

.toast.exiting {
  animation: toastSlideOut var(--transition-slow) ease forwards;
}

.toast--success {
  border-left-color: var(--color-success);
}

.toast--error {
  border-left-color: var(--color-error);
}

.toast--warning {
  border-left-color: var(--color-warning);
}

.toast--info {
  border-left-color: var(--color-info);
}

.toast__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast--success .toast__icon { color: var(--color-success); }
.toast--error   .toast__icon { color: var(--color-error); }
.toast--warning .toast__icon { color: var(--color-warning); }
.toast--info    .toast__icon { color: var(--color-info); }

.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-dark-text);
}

.toast__message {
  font-size: var(--text-xs);
  color: var(--color-grey-600);
  margin-top: 2px;
  line-height: var(--leading-snug);
}

.toast__close {
  flex-shrink: 0;
  color: var(--color-grey-400);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
  align-self: flex-start;
}

.toast__close:hover {
  color: var(--color-dark-text);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
    max-height: 200px;
  }
  to {
    opacity: 0;
    transform: translateX(100%);
    max-height: 0;
    margin: 0;
    padding: 0;
  }
}


/* --------------------------------------------------------------------------
   24. Utility Classes
   -------------------------------------------------------------------------- */

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Text */
.text-xs    { font-size: var(--text-xs); }
.text-sm    { font-size: var(--text-sm); }
.text-base  { font-size: var(--text-base); }
.text-lg    { font-size: var(--text-lg); }
.text-xl    { font-size: var(--text-xl); }
.text-2xl   { font-size: var(--text-2xl); }

.text-navy  { color: var(--color-navy); }
.text-gold  { color: var(--color-gold-dark); }
.text-muted { color: var(--color-grey-500); }
.text-error { color: var(--color-error); }
.text-success { color: var(--color-success); }

.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-left   { text-align: left; }

.tabular-nums { font-variant-numeric: tabular-nums; }

/* Display */
.d-flex         { display: flex; }
.d-grid         { display: grid; }
.d-none         { display: none; }
.d-block        { display: block; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1         { flex: 1; }
.gap-2          { gap: var(--space-2); }
.gap-3          { gap: var(--space-3); }
.gap-4          { gap: var(--space-4); }
.flex-wrap      { flex-wrap: wrap; }

/* Truncate */
.truncate {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Divider */
.divider {
  height: 1px;
  background-color: var(--color-grey-200);
  margin: var(--space-5) 0;
}

.divider--gold {
  background-color: var(--color-gold);
  height: 2px;
}

/* Section header with gold rule */
.section-header {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-dark-text);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.section-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--color-grey-200);
}

/* Info box */
.info-box {
  background-color: var(--color-info-bg);
  border: 1px solid rgba(49, 130, 206, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-dark-text);
  display: flex;
  gap: var(--space-3);
}

.info-box--warning {
  background-color: var(--color-warning-bg);
  border-color: rgba(214, 158, 46, 0.25);
}

.info-box--success {
  background-color: var(--color-success-bg);
  border-color: rgba(56, 161, 105, 0.25);
}

.info-box--error {
  background-color: var(--color-error-bg);
  border-color: rgba(229, 62, 62, 0.25);
}

.info-box__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--color-info);
}

.info-box--warning .info-box__icon  { color: var(--color-warning); }
.info-box--success .info-box__icon  { color: var(--color-success); }
.info-box--error   .info-box__icon  { color: var(--color-error); }

/* Indian rupee amount display */
.amount {
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
}

.amount--large {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-navy);
}

.amount--gold {
  color: var(--color-gold-dark);
}

/* Highlight: default confidence fields */
.highlight--default {
  background-color: var(--color-highlight-bg);
  border: 1.5px solid var(--color-highlight-border);
  color: var(--color-highlight-text);
  border-radius: var(--radius-md);
  padding: 1px var(--space-2);
}

/* Back button (mobile) */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-grey-600);
  margin-bottom: var(--space-4);
  padding: var(--space-2) 0;
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.back-btn:hover {
  color: var(--color-navy);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  gap: var(--space-3);
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  color: var(--color-grey-300);
}

.empty-state__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-dark-text);
}

.empty-state__description {
  font-size: var(--text-sm);
  color: var(--color-grey-500);
  max-width: 280px;
  line-height: var(--leading-relaxed);
}

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

/* Focus visible ring */
:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}


/* --------------------------------------------------------------------------
   25. Responsive Grid Helpers
   -------------------------------------------------------------------------- */

.grid-cols-1 { display: grid; grid-template-columns: repeat(1, 1fr); gap: var(--space-4); }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

  .md\:d-none    { display: none; }
  .md\:d-block   { display: block; }
  .md\:d-flex    { display: flex; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}


/* --------------------------------------------------------------------------
   26. Print Styles
   -------------------------------------------------------------------------- */

@media print {
  .app-header,
  .bottom-nav,
  .app-sidebar,
  .fab,
  .toast-container,
  .spinner-overlay,
  .tabs__list,
  .estimate-preview__toolbar,
  .estimate-preview__actions {
    display: none !important;
  }

  .app-main {
    padding-top: 0;
    padding-bottom: 0;
    margin-left: 0;
  }

  .screen {
    display: block !important;
    padding: 0;
  }

  .estimate-doc {
    box-shadow: none;
    border: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  @page {
    margin: 1cm 1.5cm;
    size: A4;
  }
}
