/* ══════════════════════════════════════════════
   Tennis By Terry — Shared Design System
   Used by both admin and customer portal
══════════════════════════════════════════════ */

/* ── Brand tokens ── */
:root {
  --black:        #000000;
  --off-black:    #1A1A1A;
  --gray-700:     #444444;
  --gray-500:     #767672;
  --mid-gray:     #B8B8B3;
  --warm-sand:    #E8E3D9;
  --gray-100:     #EFEFED;
  --gray-50:      #F6F4F1;
  --white:        #FFFFFF;
  --olive:        #6F7F4F;
  --olive-faint:  #EEF1E8;
  --forest:       #3F4A34;
  --forest-deep:  #1a3a2a;
  --forest-mid:   #2d5a3f;
  --off-white:    #f2f1ec;
  --cream:        #f4f1ec;
  --green-light:  #8fbc8f;
  --forest-darkest: #0f2018;
  --yellow:       #D6E04B;
  --yellow-faint: #F8FAE0;
  --slate:        #5C6F7C;
  --slate-faint:  #EBF0F3;
  --teal:         #5F7F78;
  --teal-faint:   #EBF3F2;
  --border:       #e0e0d8;
  --muted:        #5e5e58;

  /* ── HIG Design Tokens ── */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --font-stat:    'Barlow Condensed', -apple-system, BlinkMacSystemFont, sans-serif;
  --p-bg-page:    #f2f1ec;
  --p-bg:         rgba(255, 255, 255, 0.7);
  --p-border:     transparent;
  --p-text:       #1a1a1a;
  --p-text-secondary: #5e5e58;
  --p-accent:     #2d5a3f;

  /* 8pt spacing grid */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* Portal-specific */
  --border-light:  #e8e8e4;
  --radius-card:   16px;
  --radius-pill:   20px;
  --tap-min:       44px;
  --muted-light:   #8a8a84;
  --amber:         #c4890a;
}

/* ── Font scoping ── */
.portal-app,
.portal-app input,
.portal-app select,
.portal-app textarea,
.portal-app button {
  font-family: var(--font-primary);
}

.admin-app,
.admin-app input,
.admin-app select,
.admin-app textarea,
.admin-app button {
  font-family: var(--font-primary);
}

/* ── HIG Component Classes ── */
.hig-card {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  border: none;
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}

.hig-card-metric {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  border: none;
  padding: var(--sp-4);
  text-align: center;
}

.hig-section-title {
  font-family: var(--font-primary);
  font-size: 22px;
  font-weight: 700;
  color: var(--p-text);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-3);
  margin-top: var(--sp-8);
}

.hig-section-title:first-child { margin-top: 0; }

.hig-btn {
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 600;
  padding: var(--sp-3) var(--sp-5);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}

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

.hig-btn-primary {
  background: var(--p-accent);
  color: #fff;
}

.hig-badge {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: var(--font-primary); background: var(--p-bg-page, #f2f1ec); color: var(--black); min-height: 100vh; font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; letter-spacing: 0.01em; }
/* ══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════ */
.card { background: rgba(255, 255, 255, 0.7); border: none; border-radius: 16px; margin-bottom: 12px; overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; gap: 14px; }
.card-header-accent { display: none; }
.card-header-accent.olive  { background: var(--olive); }
.card-header-accent.slate  { background: var(--slate); }
.card-header-accent.teal   { background: var(--teal); }
.card-header-accent.forest { background: var(--forest); }
.card-header-label { font-family: var(--font-primary); font-size: 12px; font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: var(--gray-500); }
.card-header-title { font-family: var(--font-primary); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; text-transform: none; color: var(--p-text, #1a1a1a); margin-top: 2px; }
.card-body { padding: 20px; }


/* ══════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════ */
.form-grid { display: grid; gap: 18px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-family: var(--font-primary); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-500); }
.field-label .required { color: var(--olive); margin-left: 2px; }
input, select, textarea { font-family: var(--font-primary); font-size: 15px; color: var(--off-black); background: var(--gray-50); border: 1px solid #e8e5df; border-radius: 10px; padding: 10px 12px; width: 100%; transition: border-color 0.15s, background 0.15s; -webkit-appearance: none; appearance: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--forest-mid); background: var(--white); }
input::placeholder, textarea::placeholder { color: var(--mid-gray); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23767672' stroke-width='1.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }
textarea { resize: vertical; min-height: 72px; }

.searchable-wrap { position: relative; }
.searchable-input { background: var(--gray-50); border: 1px solid #e8e5df; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: var(--font-primary); color: var(--black); width: 100%; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.searchable-input::placeholder { color: var(--mid-gray); }
.searchable-input:focus { outline: none; border-color: var(--forest-mid); background: var(--white); }
.dropdown-list { display: none; position: absolute; top: calc(100% + 2px); left: 0; right: 0; background: var(--white); border: 1px solid var(--mid-gray); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.06); max-height: 240px; overflow-y: auto; z-index: 200; }
.dropdown-list.open { display: block; }
.dropdown-search { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); position: sticky; top: 0; background: var(--white); }
.dropdown-search input { background: var(--gray-50); border: 1px solid var(--mid-gray); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.dropdown-search input:focus { border-color: var(--forest-mid); }
.dropdown-option { padding: 12px 14px; font-size: 15px; font-family: var(--font-primary); cursor: pointer; border-bottom: 1px solid var(--gray-100); transition: background 0.1s; color: var(--black); }
.dropdown-option:last-child { border-bottom: none; }
.dropdown-option:hover { background: var(--gray-50); }
.dropdown-option.selected { background: var(--gray-50); font-weight: 500; }
.dropdown-option-sub { font-size: 11px; color: var(--gray-500); margin-top: 1px; }
.dropdown-empty { padding: 14px 12px; font-family: var(--font-primary); font-size: 13px; color: var(--gray-500); text-align: center; letter-spacing: 0.02em; text-transform: none; }

.same-as-btn { font-family: var(--font-primary); font-size: 12px; font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: var(--olive); background: var(--olive-faint); border: none; padding: 3px 9px; cursor: pointer; margin-left: auto; display: block; margin-top: -2px; transition: background 0.15s; }
.same-as-btn:hover { background: #dde5cc; }

.section-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 18px; }
.section-divider-line { flex: 1; height: 1px; background: var(--gray-100); }
.section-divider-label { font-family: var(--font-primary); font-size: 12px; font-weight: 500; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap; }

.radio-group { display: flex; gap: 6px; flex-wrap: wrap; }
.radio-option { flex: 1; min-width: 80px; text-align: center; padding: 10px 10px; border: 1px solid var(--mid-gray); border-radius: 8px; font-family: var(--font-primary); font-size: 13px; font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: var(--gray-500); cursor: pointer; transition: all 0.15s; background: var(--gray-50); user-select: none; }
.radio-option:hover { border-color: var(--gray-700); color: var(--black); }
.radio-option.selected         { background: var(--forest-deep);   color: var(--cream); border-color: var(--forest-deep); }
.radio-option.selected-olive   { background: var(--olive);   color: var(--white); border-color: var(--olive); }
.radio-option.selected-slate   { background: var(--slate);   color: var(--white); border-color: var(--slate); }

.btn { font-family: var(--font-primary); font-size: 15px; font-weight: 600; letter-spacing: 0.01em; text-transform: none; padding: 14px 24px; border-radius: 12px; border: none; cursor: pointer; transition: background 0.15s; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { background: var(--forest-deep); color: var(--cream); width: 100%; justify-content: center; }
.btn-primary:hover { background: var(--forest-mid); }
.btn-primary:disabled { background: var(--mid-gray); cursor: not-allowed; }


/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(12px); background: var(--forest-deep); color: var(--cream); font-family: var(--font-primary); font-size: 14px; font-weight: 500; letter-spacing: 0.01em; text-transform: none; padding: 12px 24px; border-radius: 16px; opacity: 0; transition: all 0.2s ease; z-index: 999; white-space: nowrap; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--olive); }
.toast.error   { background: #9a2b20; }


/* ══════════════════════════════════════════════
   LOADING
══════════════════════════════════════════════ */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.92); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; z-index: 999; backdrop-filter: blur(4px); }
.spinner { width: 28px; height: 28px; border: 1.5px solid var(--mid-gray); border-top-color: var(--forest-deep); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-family: var(--font-primary); font-size: 13px; color: var(--gray-500); letter-spacing: 0.02em; text-transform: none; }

.error-banner { background: #fdf5f5; border: 1px solid #d8b8b5; padding: 12px 14px; font-size: 12px; color: #9a2b20; margin-bottom: 12px; display: none; }
.error-banner.show { display: block; }


/* ══════════════════════════════════════════════
   STATS PAGE — three hero sections
══════════════════════════════════════════════ */
.stats-section { margin-bottom: 16px; }
.stats-section-label {
  font-family: var(--font-primary);
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.02em; text-transform: none;
  color: var(--p-text, #1a1a1a);
  padding: 0 2px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.stats-section-label::after { display: none; }

/* Hero stat block — full width, inverted */
.stat-hero {
  display: flex;
  align-items: stretch;
  border: none;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 10px;
}
.stat-hero-cell {
  flex: 1;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--forest-deep) 0%, var(--forest-mid) 50%, var(--forest-deep) 100%);
  color: var(--cream);
  border-right: 1px solid rgba(255,255,255,0.15);
  position: relative;
}
.stat-hero-cell:last-child { border-right: none; }
.stat-hero-label { font-family: var(--font-primary); font-size: 12px; font-weight: 400; letter-spacing: 0.04em; text-transform: none; color: rgba(255,255,255,0.5); margin-bottom: 6px; }
.stat-hero-value { font-family: var(--font-stat); font-size: 34px; font-weight: 600; letter-spacing: -0.01em; line-height: 1; }
.stat-hero-value.money { color: #c8d8a0; }
.stat-hero-value.jobs  { color: var(--cream); }
.stat-hero-value.customers { color: #8fbc8f; }

/* Secondary stat row — light cards */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.stat-card { background: rgba(255, 255, 255, 0.7); border: none; padding: 18px; border-radius: 14px; }
.stat-label { font-family: var(--font-primary); font-size: 12px; font-weight: 500; color: var(--gray-500); text-transform: none; letter-spacing: 0.02em; margin-bottom: 6px; }
.stat-value { font-family: var(--font-stat); font-size: 28px; font-weight: 500; color: var(--off-black); letter-spacing: -0.01em; line-height: 1; }
.stat-value.money    { color: var(--forest-deep); }
.stat-value.jobs-num { color: var(--slate); }
.stat-sub { font-family: var(--font-primary); font-size: 13px; color: var(--gray-500); margin-top: 5px; }

/* Recent jobs */
.recent-job { padding: 14px 0; border-bottom: 1px solid var(--gray-100); display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.recent-job:last-child { border-bottom: none; }
.recent-job-name { font-family: var(--font-primary); font-size: 15px; font-weight: 500; }
.recent-job-sub  { font-family: var(--font-primary); font-size: 13px; color: var(--gray-500); margin-top: 3px; }
/* Right-column value — single unified treatment across all job rows */
.pay-highlight   { font-family: var(--font-stat); font-size: 16px; font-weight: 600; color: var(--slate); white-space: nowrap; letter-spacing: 0.02em; }
.pay-neutral     { font-family: var(--font-stat); font-size: 16px; font-weight: 600; color: var(--slate); white-space: nowrap; letter-spacing: 0.02em; }

/* ══════════════════════════════════════════════
   BOTTOM SHEET
══════════════════════════════════════════════ */
.bottom-sheet-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.bottom-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white, #fff);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 16px) + 16px);
  z-index: 2001;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}
.bottom-sheet-overlay.active .bottom-sheet {
  transform: translateY(0);
}
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: #d0d0cc;
  border-radius: 2px;
  margin: 0 auto 16px;
}
.bottom-sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 8px;
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 500;
  color: var(--p-text, #1a1a1a);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.bottom-sheet-item:active {
  background: #f5f5ef;
}
.sheet-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(45, 90, 63, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--p-accent, #2d5a3f);
  flex-shrink: 0;
}
.sheet-icon svg {
  width: 20px;
  height: 20px;
}

/* ══════════════════════════════════════════════
   SEGMENTED CONTROL
══════════════════════════════════════════════ */
.segmented-control {
  display: flex;
  background: #eeeee8;
  border-radius: 24px;
  padding: 3px;
  margin: 0 0 16px;
}
.segmented-control-item {
  flex: 1;
  text-align: center;
  padding: 7px 12px;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  color: #888880;
  border-radius: 22px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: transparent;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.segmented-control-item.active {
  background: #ffffff;
  color: var(--p-text, #1a1a1a);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

