/* ================================================================
   TY Nursery CRM — app.css
   Nav: #252525  |  Base accent: #42768d
   Palette derived from #42768d:
     --ty-dark   : #2a4e60  (darkened ~25% for headings/depth)
     --ty-mid    : #42768d  (base — buttons, borders, active states)
     --ty-light  : #5e96ae  (lightened ~15% for hovers)
     --ty-bright : #78b4cc  (lightened ~30% for highlights)
     --ty-pale   : #ddeef4  (very light tint for row hovers, bg)
     --ty-tint   : #eef6f9  (near-white tint for card headers)
================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Lato:ital,wght@0,300;0,400;0,700;0,900;1,400&display=swap');

:root {
  /* ── Core blue-steel palette derived from #42768d ── */
  --ty-nav:        #252525;   /* top nav background */
  --ty-dark:       #2a4e60;   /* darkened base — headings, depth */
  --ty-mid:        #42768d;   /* base accent — buttons, links, borders */
  --ty-light:      #5e96ae;   /* lightened +15% — hovers */
  --ty-bright:     #78b4cc;   /* lightened +30% — highlights, active underlines */
  --ty-pale:       #ddeef4;   /* very light tint — row hover, badges */
  --ty-tint:       #eef6f9;   /* near-white tint — card headers, table heads */

  /* ── Neutrals ── */
  --ty-orange:     #d4781a;   /* CTA / warning accent — unchanged */
  --ty-orange-hov: #b8620e;
  --ty-tan:        #f5f4f2;   /* page section backgrounds */
  --ty-tan-dark:   #e4e2dc;   /* dividers, borders */
  --ty-white:      #ffffff;
  --ty-text:       #1e1e1e;
  --ty-text-mid:   #4a4a4a;
  --ty-text-light: #888888;
  --ty-border:     #d0cec8;

  /* ── Shadows ── */
  --shadow-xs: 0 1px 3px rgba(0,0,0,.07);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.09);
  --shadow-md: 0 4px 18px rgba(0,0,0,.11);
  --shadow-lg: 0 10px 36px rgba(0,0,0,.15);

  /* ── Radii ── */
  --r-sm: 3px;
  --r-md: 5px;
  --r-lg: 8px;

  /* ── Typography ── */
  --font-head: 'Libre Baskerville', Georgia, serif;
  --font-body: 'Lato', Arial, sans-serif;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ty-text);
  background: #e6dfcc;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--ty-mid); text-decoration: none; }
a:hover { color: var(--ty-dark); text-decoration: underline; }
img { display: block; max-width: 100%; }

/* ── Top Nav ─────────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0;
  height: 64px;
  background: var(--ty-nav);
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 24px 0 28px;
  height: 100%;
  background: rgba(255,255,255,.04);
  text-decoration: none;
  border-right: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.topnav__leaf { font-size: 1.5rem; line-height: 1; }
.topnav__title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
}
.topnav__title em {
  color: var(--ty-bright);
  font-style: normal;
  font-weight: 400;
}

.nav__list {
  display: flex;
  list-style: none;
  gap: 0;
  flex: 1;
  height: 100%;
  padding-left: 8px;
}
.nav__link {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: none;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.nav__link:hover {
  color: #fff;
  background: rgba(255,255,255,.07);
  text-decoration: none;
}
.nav__link--active {
  color: #fff;
  border-bottom-color: var(--ty-bright);
  background: rgba(255,255,255,.06);
}

.topnav__user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  flex-shrink: 0;
  border-left: 1px solid rgba(255,255,255,.1);
  height: 100%;
}
.pill {
  font-family: var(--font-body);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 2px;
}
.pill--admin { background: var(--ty-orange); color: #fff; }
.pill--rep   { background: var(--ty-mid);    color: #fff; }

.topnav__name {
  font-size: .85rem;
  color: rgba(255,255,255,.78);
  font-weight: 400;
  text-decoration: none;
}
.topnav__name:hover { color: #fff; text-decoration: underline; }
.topnav__logout {
  font-family: var(--font-body);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.45);
  border: 1px solid rgba(255,255,255,.2);
  padding: 5px 13px;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: all .15s;
}
.topnav__logout:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}

/* ── Main wrapper ────────────────────────────────────────────── */
.main {
  flex: 1;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 36px 32px;
}

/* ── Flash messages ──────────────────────────────────────────── */
.flash {
  padding: 13px 18px;
  border-radius: var(--r-md);
  margin-bottom: 22px;
  font-size: .9rem;
  border-left: 4px solid;
}
.flash--success {
  background: #e2f0f5;
  color: #1a3d4f;
  border-color: var(--ty-mid);
}
.flash--error {
  background: #fceee6;
  color: #7a2800;
  border-color: var(--ty-orange);
}
.flash--info {
  background: var(--ty-tint);
  color: var(--ty-dark);
  border-color: var(--ty-light);
}

/* ── Page header ─────────────────────────────────────────────── */
.pg-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ty-tan-dark);
}
.pg-head__left h1 {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: none;
  color: var(--ty-dark);
  line-height: 1.1;
}
.pg-head__left p {
  font-size: .88rem;
  color: var(--ty-text-light);
  margin-top: 5px;
}
.pg-head__back {
  display: inline-block;
  font-size: .8rem;
  color: var(--ty-text-light);
  margin-bottom: 6px;
  text-decoration: none;
}
.pg-head__back:hover { color: var(--ty-mid); text-decoration: underline; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 22px;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn--primary {
  background: var(--ty-mid);
  color: #fff;
  border: 2px solid var(--ty-mid);
}
.btn--primary:hover {
  background: var(--ty-dark);
  border-color: var(--ty-dark);
  color: #fff;
  text-decoration: none;
}
.btn--orange {
  background: var(--ty-orange);
  color: #fff;
  border: 2px solid var(--ty-orange);
}
.btn--orange:hover {
  background: var(--ty-orange-hov);
  border-color: var(--ty-orange-hov);
  color: #fff;
  text-decoration: none;
}
.btn--ghost {
  background: transparent;
  color: var(--ty-mid);
  border: 2px solid var(--ty-mid);
}
.btn--ghost:hover {
  background: var(--ty-mid);
  color: #fff;
  text-decoration: none;
}
.btn--danger {
  background: #b83218;
  color: #fff;
  border: 2px solid #b83218;
}
.btn--danger:hover {
  background: #8c2410;
  border-color: #8c2410;
  color: #fff;
  text-decoration: none;
}
.btn--sm  { padding: 6px 14px; font-size: .72rem; }
.btn--xs  { padding: 4px 10px; font-size: .68rem; }
.btn-row  { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--ty-white);
  border: 1px solid var(--ty-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  /* overflow: hidden removed — allows absolutely-positioned children
     (e.g. autocomplete dropdowns) to escape the card boundary */
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 22px 13px;
  background: var(--ty-tint);
  border-bottom: 2px solid #cce0ea;
  border-radius: var(--r-lg) var(--r-lg) 0 0; /* clip top corners only */
}
.card__head h2 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: none;
  color: var(--ty-dark);
}
.card__body { padding: 22px; }

/* ── Stats ───────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--ty-white);
  border: 1px solid var(--ty-border);
  border-top: 3px solid var(--ty-mid);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
}
.stat-card__label {
  font-family: var(--font-body);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ty-text-light);
  margin-bottom: 8px;
}
.stat-card__value {
  font-family: var(--font-head);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ty-dark);
  line-height: 1;
}
.stat-card__sub {
  font-size: .78rem;
  color: var(--ty-text-light);
  margin-top: 5px;
}
.stat-card--accent {
  background: var(--ty-dark);
  border-color: var(--ty-dark);
  border-top-color: var(--ty-bright);
}
.stat-card--accent .stat-card__label { color: rgba(255,255,255,.55); }
.stat-card--accent .stat-card__value { color: #fff; }
.stat-card--accent .stat-card__sub   { color: rgba(255,255,255,.5); }

/* ── Data table ──────────────────────────────────────────────── */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.tbl thead th {
  text-align: left;
  padding: 11px 16px;
  font-family: var(--font-body);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ty-text-mid);
  background: var(--ty-tint);
  border-bottom: 2px solid #cce0ea;
}
.tbl tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--ty-tan-dark);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.row-link { cursor: pointer; transition: background .1s; }
.tbl tbody tr.row-link:hover { background: var(--ty-pale); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.badge--lead     { background: #fef0d0; color: #7a5000; border: 1px solid #f0d080; }
.badge--active   { background: var(--ty-pale); color: var(--ty-dark); border: 1px solid var(--ty-bright); }
.badge--inactive { background: #fde8e0; color: #7a2800; border: 1px solid #e8b098; }
.badge--admin    { background: #fde8d8; color: #7a3800; border: 1px solid #e8b888; }
.badge--rep      { background: var(--ty-pale); color: var(--ty-dark); border: 1px solid var(--ty-bright); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ty-text-mid);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--ty-border);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: .92rem;
  color: var(--ty-text);
  background: var(--ty-white);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--ty-mid);
  box-shadow: 0 0 0 3px rgba(66,118,141,.18);
}
.form-control:disabled { background: var(--ty-tint); cursor: default; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; line-height: 1.55; }

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

/* ── Customer detail layout ──────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 24px;
  align-items: start;
}
.detail-left { display: flex; flex-direction: column; gap: 22px; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 28px;
}
.info-item__label {
  font-family: var(--font-body);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ty-text-light);
  margin-bottom: 3px;
}
.info-item__value { font-size: .95rem; color: var(--ty-text); line-height: 1.4; }

/* Contact frequency dots */
.freq { display: flex; align-items: center; gap: 8px; font-size: .83rem; color: var(--ty-text-mid); }
.freq__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ty-border); flex-shrink: 0; }
.freq__dot--hot  { background: var(--ty-light); }
.freq__dot--warm { background: var(--ty-orange); }
.freq__dot--ok   { background: #cc3a1a; }

/* ── Notes thread ────────────────────────────────────────────── */
.thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 2px;
  margin-bottom: 18px;
}
.note {
  background: var(--ty-tint);
  border: 1px solid #cce0ea;
  border-radius: var(--r-md);
  padding: 12px 15px;
}
.note--admin {
  background: #f0f6f9;
  border-color: var(--ty-bright);
}
.note--reply {
  margin-left: 20px;
  border-left: 3px solid var(--ty-mid);
}
.note__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}
.note__author        { font-family: var(--font-body); font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ty-mid); }
.note__author--admin { color: var(--ty-orange); }
.note__time          { font-size: .7rem; color: var(--ty-text-light); flex-shrink: 0; }
.note__body          { font-size: .9rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--ty-text); }
.note__actions       { margin-top: 8px; }

.reply-toggle {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: .75rem;
  color: var(--ty-mid);
  cursor: pointer;
  padding: 0;
}
.reply-toggle:hover { text-decoration: underline; }
.reply-form         { display: none; margin-top: 10px; }
.reply-form.is-open { display: block; }

.compose { display: flex; flex-direction: column; gap: 9px; }
.compose label {
  font-family: var(--font-body);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ty-text-light);
}

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--ty-nav);
  background-image: linear-gradient(160deg, #1a1a1a 0%, #252525 55%, #2e3e47 100%);
}
.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--ty-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.login-box__header {
  background: var(--ty-dark);
  padding: 28px 36px 24px;
  text-align: center;
  border-bottom: 3px solid var(--ty-mid);
}
.login-box__icon  { font-size: 2rem; margin-bottom: 8px; }
.login-box__title {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: none;
  color: #fff;
  margin-bottom: 4px;
}
.login-box__sub {
  font-size: .75rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: var(--font-body);
}
.login-box__body  { padding: 28px 36px 32px; }
.login-box .form-group { text-align: left; }
.login-btn { width: 100%; padding: 11px; font-size: .85rem; margin-top: 4px; justify-content: center; }

/* ── Bar chart ───────────────────────────────────────────────── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 130px;
}
.bar-chart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}
.bar-chart__bar {
  width: 100%;
  background: var(--ty-mid);
  border-radius: 2px 2px 0 0;
  min-height: 4px;
}
.bar-chart__val { font-family: var(--font-body); font-size: .8rem; font-weight: 700; color: var(--ty-dark); }
.bar-chart__lbl { font-size: .68rem; color: var(--ty-text-light); white-space: nowrap; }

/* ── Utility ─────────────────────────────────────────────────── */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.text-muted  { color: var(--ty-text-light); }
.text-small  { font-size: .82rem; }
.fw-600      { font-weight: 600; }
.w-full      { width: 100%; }

.divider {
  border: none;
  border-top: 1px solid var(--ty-tan-dark);
  margin: 14px 0;
}

.empty-state {
  text-align: center;
  padding: 52px 24px;
  color: var(--ty-text-light);
}
.empty-state__icon { font-size: 2.4rem; margin-bottom: 12px; }
.empty-state p { font-size: .92rem; }

/* ── Site footer ─────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 16px;
  font-size: .72rem;
  color: var(--ty-text-light);
  border-top: 1px solid var(--ty-tan-dark);
  background: var(--ty-tint);
  font-family: var(--font-body);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE & MOBILE
   Breakpoints:
     1024px  tablet landscape
      768px  tablet portrait / large phone landscape
      540px  phone
════════════════════════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ─────────────────── */
.nav__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  margin-left: auto;
  margin-right: 12px;
}
.nav__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,.8);
  border-radius: 2px;
  transition: transform .25s, opacity .25s, width .25s;
  transform-origin: center;
}
/* Animated X when open */
.nav__hamburger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav__hamburger.is-open span:nth-child(2) {
  opacity: 0;
  width: 0;
}
.nav__hamburger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Tablet landscape (≤1024px) ───────────────────────────── */

/* Mobile nav elements — hidden by default, shown only inside media query */
.nav__drawer,
.nav__overlay,
.nav__hamburger { display: none; }

@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: 1fr; }

  /* Shrink nav links slightly */
  .nav__link { padding: 0 12px; font-size: .83rem; }
  .topnav__user { gap: 8px; padding: 0 16px; }
  .topnav__name { display: none; } /* hide name, keep role pill + signout */
}

/* ── Tablet portrait / large phone (≤768px) ───────────────── */
@media (max-width: 768px) {

  /* ── Nav: hamburger mode ─────────────────────────────────── */
  .topnav {
    height: 56px;
    padding: 0;
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    z-index: 500;
  }
  .topnav__brand {
    padding: 0 16px;
    border-right: none;
    flex: 1;
  }
  .topnav__leaf { font-size: 1.2rem; }
  .topnav__title { font-size: 1rem; }

  /* Show hamburger, hide desktop nav elements */
  .nav__hamburger { display: flex; }
  .nav__list      { display: none; }
  .topnav__user   { display: none; }

  /* Mobile slide-down nav drawer */
  .nav__drawer {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ty-nav);
    z-index: 499;
    overflow-y: auto;
    flex-direction: column;
  }
  .nav__drawer.is-open {
    display: flex;
  }
  .nav__drawer-links {
    list-style: none;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .nav__drawer-links a {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
  }
  .nav__drawer-links a:hover,
  .nav__drawer-links a.nav__link--active {
    background: rgba(255,255,255,.07);
    color: #fff;
    border-left-color: var(--ty-bright);
    text-decoration: none;
  }
  .nav__drawer-user {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .nav__drawer-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .nav__drawer-name {
    font-size: .95rem;
    color: rgba(255,255,255,.8);
    font-weight: 400;
  }
  .nav__drawer-links-bottom {
    list-style: none;
    margin-top: auto;
    padding: 8px 0 24px;
  }
  .nav__drawer-links-bottom a {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    font-size: .9rem;
    font-weight: 600;
    color: rgba(255,255,255,.55);
    text-decoration: none;
    transition: color .15s;
  }
  .nav__drawer-links-bottom a:hover {
    color: #fff;
    text-decoration: none;
  }
  /* Overlay backdrop */
  .nav__overlay {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0,0,0,.45);
    z-index: 498;
  }
  .nav__overlay.is-open { display: block; }

  /* ── Layout ──────────────────────────────────────────────── */
  .main { padding: 16px 14px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .pg-head { margin-bottom: 18px; }
  .info-grid { grid-template-columns: 1fr 1fr; gap: 12px 16px; }

  /* ── Tables: horizontal scroll ───────────────────────────── */
  .card { border-radius: var(--r-md); }
  .tbl-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tbl { min-width: 520px; }
  .tbl thead th,
  .tbl tbody td { padding: 10px 12px; }

  /* ── Buttons ─────────────────────────────────────────────── */
  .btn { padding: 8px 16px; font-size: .82rem; }
  .btn-row { gap: 8px; }

  /* ── Cards ───────────────────────────────────────────────── */
  .card__body { padding: 16px; }
  .card__head { padding: 13px 16px 11px; }

  /* ── Notes thread ────────────────────────────────────────── */
  .thread { max-height: 360px; }

  /* ── Stat cards ──────────────────────────────────────────── */
  .stat-card { padding: 16px 18px; }
  .stat-card__value { font-size: 2rem; }

  /* ── Outreach log radio group ────────────────────────────── */
  .radio-group { gap: 6px; }
  .radio-option { padding: 9px 12px; font-size: .85rem; }

  /* ── Plant pref table ────────────────────────────────────── */
  .plant-name-cell { min-width: 160px; }
}

/* ── Phone portrait (≤540px) ──────────────────────────────── */
@media (max-width: 540px) {
  .main { padding: 12px 10px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card__value { font-size: 1.8rem; }
  .pg-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .pg-head .btn { align-self: flex-start; }

  /* Stack info grid to single column on small phones */
  .info-grid { grid-template-columns: 1fr; }

  /* Full-width buttons on small screens */
  .btn-row { flex-direction: column; align-items: flex-start; }
  .btn-row .btn { width: 100%; justify-content: center; }

  /* Login box padding */
  .login-box__header { padding: 22px 24px 18px; }
  .login-box__body   { padding: 20px 24px 24px; }
  .login-box__title  { font-size: 1.35rem; }

  /* Plant pref table — tighter */
  .tbl thead th,
  .tbl tbody td { padding: 8px 10px; font-size: .8rem; }

  /* Outreach entry meta wrap */
  .outreach-entry__header { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* Flash messages */
  .flash { font-size: .85rem; padding: 10px 14px; }

  /* Form controls */
  .form-control { font-size: .88rem; padding: 8px 11px; }

  /* Checkbox group — 2 cols */
  .checkbox-group { grid-template-columns: 1fr 1fr; }
}


/* ── Sortable column headers ─────────────────────────────────── */
.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ty-text-mid);
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s;
}
.sort-link:hover {
  color: var(--ty-mid);
  text-decoration: none;
}
.sort-arrow {
  font-style: normal;
  font-size: .75em;
  line-height: 1;
}
.sort-arrow--idle { opacity: .3; }
.sort-arrow--asc,
.sort-arrow--desc { color: var(--ty-mid); opacity: 1; }

/* ── Clickable stat cards ─────────────────────────────────────── */
a.stat-card {
  display: block;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
a.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
a.stat-card.stat-card--accent:hover {
  background: var(--ty-white);
  border-color: var(--ty-mid);
  border-top-color: var(--ty-mid);
}
a.stat-card .stat-card__label,
a.stat-card .stat-card__value,
a.stat-card .stat-card__sub { color: inherit; }
a.stat-card.stat-card--accent .stat-card__label { color: rgba(255,255,255,.65); }
a.stat-card.stat-card--accent .stat-card__value { color: #fff; }
a.stat-card.stat-card--accent .stat-card__sub   { color: rgba(255,255,255,.6); }
a.stat-card:not(.stat-card--accent) .stat-card__sub { color: var(--ty-mid); }
a.stat-card.stat-card--accent:hover .stat-card__label { color: rgba(66,118,141,.8); }
a.stat-card.stat-card--accent:hover .stat-card__value { color: rgb(66,118,141); }
a.stat-card.stat-card--accent:hover .stat-card__sub   { color: rgba(66,118,141,.7); }

/* ── Outreach Log ─────────────────────────────────────────────── */
.outreach-form { display: flex; flex-direction: column; gap: 0; }

/* Radio button group */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--ty-border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--ty-text);
  transition: border-color .15s, background .15s;
  user-select: none;
}
.radio-option:hover {
  border-color: var(--ty-mid);
  background: var(--ty-tint);
}
.radio-option input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--ty-mid);
  flex-shrink: 0;
  cursor: pointer;
}
.radio-option input[type="radio"]:checked + .radio-icon + span,
.radio-option:has(input:checked) {
  color: var(--ty-dark);
  font-weight: 500;
}
.radio-option:has(input:checked) {
  border-color: var(--ty-mid);
  background: var(--ty-pale);
}
.radio-icon { font-size: 1.05rem; line-height: 1; }

/* File input */
.file-input {
  padding: 7px 10px;
  font-size: .85rem;
  cursor: pointer;
}
.file-chosen {
  font-style: italic;
}

/* Outreach history list */
.outreach-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.outreach-entry {
  border: 1px solid var(--ty-border);
  border-left: 4px solid var(--ty-mid);
  border-radius: var(--r-md);
  padding: 12px 15px;
  background: var(--ty-white);
}
.outreach-entry__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.outreach-entry__method {
  display: flex;
  align-items: center;
  gap: 7px;
}
.outreach-entry__icon  { font-size: 1.1rem; line-height: 1; }
.outreach-entry__label {
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ty-dark);
}
.outreach-entry__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.outreach-entry__who  { font-size: .78rem; font-weight: 600; color: var(--ty-mid); }
.outreach-entry__when { font-size: .72rem; color: var(--ty-text-light); }

.outreach-entry__notes {
  font-size: .88rem;
  color: var(--ty-text-mid);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 6px;
}
.outreach-entry__doc { margin-top: 6px; }
.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .82rem;
  color: var(--ty-mid);
  border: 1px solid var(--ty-mid);
  padding: 3px 10px;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: all .15s;
}
.doc-link:hover {
  background: var(--ty-mid);
  color: #fff;
  text-decoration: none;
}

/* Delete button for outreach entries */
.outreach-delete-btn {
  background: none;
  border: none;
  color: var(--ty-text-light);
  cursor: pointer;
  font-size: .8rem;
  padding: 2px 5px;
  border-radius: 3px;
  transition: color .15s, background .15s;
  line-height: 1;
}
.outreach-delete-btn:hover {
  color: #b83218;
  background: #fde8e0;
}

/* ── Form validation states ──────────────────────────────────── */
.input--error {
  border-color: #cc3a1a !important;
  background: #fff8f7;
}
.input--error:focus {
  border-color: #cc3a1a !important;
  box-shadow: 0 0 0 3px rgba(204,58,26,.15) !important;
}
.field-hint {
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ty-text-light);
}

/* ── Plant Library ────────────────────────────────────────────── */
.size-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.size-tag {
  display: inline-block;
  padding: 2px 9px;
  background: var(--ty-pale);
  color: var(--ty-dark);
  border: 1px solid var(--ty-bright);
  border-radius: 2px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  font-family: var(--font-body);
  white-space: nowrap;
}

/* Checkbox group (plant sizes) */
.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1.5px solid var(--ty-border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: .9rem;
  color: var(--ty-text);
  transition: border-color .15s, background .15s;
  user-select: none;
}
.checkbox-option:hover {
  border-color: var(--ty-mid);
  background: var(--ty-tint);
}
.checkbox-option input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--ty-mid);
  flex-shrink: 0;
  cursor: pointer;
}
.checkbox-option:has(input:checked) {
  border-color: var(--ty-mid);
  background: var(--ty-pale);
}

/* ── Plant name autocomplete dropdown ─────────────────────────── */
.plant-name-cell {
  position: relative;
  min-width: 220px;
  /* Ensure this cell creates a stacking context above sibling rows */
  z-index: 10;
}
.plant-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--ty-white);
  border: 1.5px solid var(--ty-mid);
  border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 220px;
  overflow-y: auto;
}
.plant-suggestions li {
  padding: 8px 12px;
  font-size: .88rem;
  color: var(--ty-text);
  cursor: pointer;
  transition: background .1s;
  line-height: 1.3;
}
.plant-suggestions li:hover,
.plant-suggestions li.is-active {
  background: var(--ty-pale);
  color: var(--ty-dark);
}
.plant-suggestions li strong {
  color: var(--ty-mid);
  font-weight: 700;
}

/* ── Customer Map ─────────────────────────────────────────────── */
.map-card .card__head { border-radius: var(--r-md) var(--r-md) 0 0; }

/* Leaflet popup styling */
.map-popup {
  font-family: var(--font-body);
  font-size: .88rem;
  line-height: 1.4;
  min-width: 180px;
}
.map-popup strong a {
  color: var(--ty-dark);
  text-decoration: none;
  font-size: .95rem;
}
.map-popup strong a:hover { text-decoration: underline; color: var(--ty-mid); }
.map-popup-contact { color: var(--ty-text-mid); margin-top: 3px; font-size: .82rem; }
.map-popup-addr    { color: var(--ty-text-light); font-size: .78rem; margin-top: 2px; }
.map-popup-status  {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: var(--font-body);
}
.map-popup-status--active   { background: var(--ty-pale); color: var(--ty-dark); border: 1px solid var(--ty-bright); }
.map-popup-status--lead     { background: #fef0d0; color: #7a5000; border: 1px solid #f0d080; }
.map-popup-status--inactive { background: #fde8e0; color: #7a2800; border: 1px solid #e8b098; }
.map-popup-link {
  display: block;
  margin-top: 8px;
  font-size: .8rem;
  color: var(--ty-mid);
  text-decoration: none;
  font-weight: 700;
}
.map-popup-link:hover { text-decoration: underline; }

/* Override Leaflet popup chrome to match brand */
.leaflet-popup-content-wrapper {
  border-radius: var(--r-md) !important;
  box-shadow: var(--shadow-md) !important;
  border: 1px solid var(--ty-border) !important;
  padding: 0 !important;
}
.leaflet-popup-content { margin: 14px 16px !important; }
.leaflet-popup-tip-container { margin-top: -1px; }

/* Map responsive */
@media (max-width: 768px) {
  #customer-map { height: 340px; }
}
@media (max-width: 540px) {
  #customer-map { height: 260px; }
}

/* ── Login alt links (forgot password / magic link) ──────────── */
.login-alt-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  font-size: .82rem;
}
.login-alt-links a {
  color: var(--ty-text-light);
  text-decoration: none;
  transition: color .15s;
}
.login-alt-links a:hover { color: var(--ty-mid); text-decoration: underline; }
.login-alt-divider { color: var(--ty-border); }

/* ── Auth mode tabs (forgot password page) ───────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--ty-tan-dark);
  margin-bottom: 4px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 700;
  color: var(--ty-text-light);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  letter-spacing: .02em;
}
.auth-tab:hover {
  color: var(--ty-mid);
  text-decoration: none;
}
.auth-tab--active {
  color: var(--ty-mid);
  border-bottom-color: var(--ty-mid);
}

/* ── Company location cards (edit form) ──────────────────────── */
.location-card {
  background: var(--ty-tint);
  border: 1px solid var(--ty-border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.location-card:last-child { margin-bottom: 0; }
.location-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
