/* ==========================================================================
   AgroFlow — design system
   Tokens lifted from the approved prototype. Mobile first: the base layer is
   the phone layout, and the only breakpoint widens the column for desktop.
   ========================================================================== */

:root {
  /* Ink */
  --ink: #1A110A;      --ink-80: #2E2018;   --ink-60: #5C4A3A;
  --ink-40: #8A7A6C;   --ink-20: #C8BFB4;

  /* Surfaces */
  --cream: #EDE8D6;    --paper: #F6F4EC;

  /* Brand */
  --terra: #C4623A;    --terra-dark: #9E4A28;  --terra-bg: #F7EAE3;

  /* Semantic */
  --pos: #15803D;      --pos-bg: #DCFCE7;   --pos-text: #14532D;
  --warn: #B45309;     --warn-bg: #FEF3C7;  --warn-text: #78350F;
  --info: #1D4ED8;     --info-bg: #DBEAFE;  --info-text: #1E3A8A;
  --danger: #B91C1C;   --danger-bg: #FEE2E2;

  /* Grade identity */
  --c-premium: var(--terra);
  --c-choice: #2D7A6A;
  --c-soferim: #C48A28;
  --c-standard: #8A7A6C;

  /* Lines */
  --border: #C4BFB2;   --border-lt: #E4DDD6;

  /* Space */
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px;
  --pad: 1.05rem;
  --tap: 44px;                       /* minimum touch target */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Heebo', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

#app {
  max-width: 480px;
  margin-inline: auto;
  min-height: 100dvh;
  background: var(--paper);
  position: relative;
}

@media (min-width: 900px) {
  body { background: var(--ink); }
  #app { max-width: 520px; box-shadow: 0 0 80px rgba(0,0,0,.4); }
}

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

:focus-visible {
  outline: 2.5px solid var(--terra);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Boot
   -------------------------------------------------------------------------- */
.boot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .75rem; min-height: 100dvh; color: var(--ink-40);
}
.boot-mark { font-size: 2.4rem; }
.boot-text { font-size: .9rem; letter-spacing: .02em; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.hdr {
  background: var(--ink);
  color: var(--cream);
  padding: calc(env(safe-area-inset-top) + 1rem) var(--pad) 0;
  position: sticky; top: 0; z-index: 20;
}
.hdr-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.hdr-name { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.hdr-sub { font-size: .78rem; color: var(--ink-20); margin-top: .15rem; }

.hdr-signout {
  min-height: 36px; padding: 0 .7rem; border-radius: var(--r-sm);
  font-size: .78rem; color: var(--ink-20);
  border: 1px solid rgba(237,232,214,.22);
}
.hdr-signout:hover { color: var(--cream); border-color: rgba(237,232,214,.5); }

/* Admin-only grower picker. Never rendered for role=grower — it would
   expose the full client list. */
.grower-select {
  width: 100%; margin-top: .7rem; min-height: var(--tap);
  background: rgba(237,232,214,.09); color: var(--cream);
  border: 1px solid rgba(237,232,214,.25); border-radius: var(--r-sm);
  padding: 0 .7rem; font-size: .9rem; font-family: inherit;
}
.grower-select option { color: var(--ink); background: var(--paper); }

/* Searchable picker — replaces the select above ~20 growers */
.picker { position: relative; margin-top: .7rem; }
.picker-input {
  width: 100%; min-height: var(--tap);
  background: rgba(237,232,214,.09); color: var(--cream);
  border: 1px solid rgba(237,232,214,.25); border-radius: var(--r-sm);
  padding: 0 .7rem; font: inherit; font-size: .9rem;
}
.picker-input::placeholder { color: rgba(237,232,214,.5); }
.picker-input::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }

.picker-results {
  position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 40;
  max-height: 52vh; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.picker-item {
  width: 100%; min-height: var(--tap);
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: 0 .8rem; font-size: .88rem; text-align: start;
  border-bottom: 1px solid var(--border-lt);
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover, .picker-item:focus-visible { background: var(--terra-bg); }
.picker-id { font-size: .74rem; color: var(--ink-40); flex: none; }
.picker-empty { padding: .8rem; font-size: .8rem; color: var(--ink-40); text-align: center; }

.mode-bar { display: flex; gap: .4rem; margin-top: .9rem; }
.mode-btn {
  flex: 1; min-height: var(--tap);
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  font-size: .88rem; font-weight: 500; color: var(--ink-20);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: background .18s, color .18s;
}
.mode-btn.active { background: var(--paper); color: var(--ink); font-weight: 700; }

/* --------------------------------------------------------------------------
   Simple mode — swipeable cards
   -------------------------------------------------------------------------- */
.deck { padding: 1.1rem var(--pad) 0; }
.deck-view { overflow: hidden; border-radius: var(--r-lg); touch-action: pan-y; }
.deck-track { display: flex; transition: transform .32s cubic-bezier(.4,0,.2,1); }

.i-card {
  flex: 0 0 100%;
  min-height: 340px;
  padding: 1.5rem 1.3rem;
  display: flex; flex-direction: column;
  color: #fff;
  user-select: none;
}
.c-terra { background: linear-gradient(160deg, var(--terra) 0%, var(--terra-dark) 100%); }
.c-green { background: linear-gradient(160deg, #1B8A4B 0%, #0F5C31 100%); }
.c-amber { background: linear-gradient(160deg, #C98A16 0%, #92610A 100%); }
.c-ink   { background: linear-gradient(160deg, #3A2A1E 0%, #1A110A 100%); }

.i-badge {
  align-self: flex-start; font-size: .74rem; font-weight: 700;
  padding: .32rem .65rem; border-radius: 999px;
  background: rgba(255,255,255,.19); letter-spacing: .01em;
}
.i-label { margin-top: 1.4rem; font-size: .92rem; opacity: .88; }
.i-big {
  font-size: clamp(2.1rem, 11vw, 2.9rem); font-weight: 900;
  letter-spacing: -.03em; line-height: 1.08; margin-top: .25rem;
}
.i-sub { font-size: .82rem; opacity: .8; margin-top: .4rem; }
.i-minibar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.22); margin-top: 1rem; overflow: hidden; }
.i-minibar-fill { height: 100%; background: #fff; border-radius: 3px; transition: width .5s ease; }
.i-note { font-size: .78rem; opacity: .72; margin-top: .6rem; }
.i-spacer { flex: 1; }
.i-cta {
  margin-top: 1rem; min-height: var(--tap);
  background: rgba(255,255,255,.17); border-radius: var(--r-sm);
  font-size: .86rem; font-weight: 500; color: #fff;
}
.i-cta:hover { background: rgba(255,255,255,.27); }
.i-infobox {
  margin-top: 1rem; padding: .8rem .9rem;
  background: rgba(255,255,255,.13); border-radius: var(--r-md);
}

.deck-nav { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1rem 0 .3rem; }
.nav-arr {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  font-size: 1.5rem; color: var(--ink-60); background: var(--cream);
  display: flex; align-items: center; justify-content: center;
}
.nav-arr:disabled { opacity: .3; cursor: default; }
.nav-dots { display: flex; gap: .45rem; }
.nav-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ink-20);
  transition: background .2s, width .2s;
}
.nav-dot.active { background: var(--terra); width: 22px; border-radius: 4px; }
.deck-lbl { text-align: center; font-size: .76rem; color: var(--ink-40); padding-bottom: 1.4rem; }

/* --------------------------------------------------------------------------
   Advanced mode
   -------------------------------------------------------------------------- */
.tabs {
  display: flex; gap: .3rem; padding: .8rem var(--pad) 0;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  white-space: nowrap; min-height: 38px; padding: 0 .85rem;
  border-radius: 999px; font-size: .84rem; font-weight: 500;
  color: var(--ink-60); background: var(--cream);
}
.tab.active { background: var(--ink); color: var(--paper); font-weight: 700; }

.panel { padding: 0 var(--pad) 3rem; }

.sec-lbl {
  display: block; font-size: .72rem; font-weight: 700; letter-spacing: .07em;
  color: var(--ink-40); margin: 1.5rem 0 .6rem;
}

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.kpi {
  padding: .9rem .85rem; border-radius: var(--r-md);
  border: 1px solid var(--border-lt); background: #fff;
  border-inline-start: 3px solid var(--ink-20);
}
.kpi.t { border-inline-start-color: var(--terra); }
.kpi.g { border-inline-start-color: var(--pos); }
.kpi.a { border-inline-start-color: var(--warn); }
.kpi.x { border-inline-start-color: var(--c-choice); }
.kpi-lbl { font-size: .73rem; color: var(--ink-40); }
.kpi-val { font-size: 1.28rem; font-weight: 800; letter-spacing: -.02em; margin-top: .15rem; }
.kpi-sub { font-size: .7rem; color: var(--ink-40); margin-top: .1rem; }

.card {
  background: #fff; border: 1px solid var(--border-lt);
  border-radius: var(--r-md); padding: 1rem;
}

.prog-head { display: flex; justify-content: space-between; align-items: baseline; }
.prog-title { font-size: .88rem; font-weight: 700; }
.prog-meta { font-size: .73rem; color: var(--ink-40); }
.p-track { height: 10px; border-radius: 5px; background: var(--cream); margin: .7rem 0 .5rem; overflow: hidden; }
.p-fill { height: 100%; background: linear-gradient(90deg, var(--pos), #22A75C); border-radius: 5px; transition: width .6s ease; }
.prog-foot { display: flex; justify-content: space-between; font-size: .76rem; }
.prog-paid { color: var(--pos-text); font-weight: 600; }
.prog-rem { color: var(--ink-40); }

/* Segmented control */
.seg { display: flex; gap: .3rem; background: var(--cream); padding: .25rem; border-radius: var(--r-sm); }
.seg-btn {
  flex: 1; min-height: 36px; border-radius: 6px;
  font-size: .82rem; font-weight: 500; color: var(--ink-60);
}
.seg-btn.active { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.09); }

/* Grade cards */
.grade-card {
  background: #fff; border: 1px solid var(--border-lt);
  border-radius: var(--r-md); margin-bottom: .65rem; overflow: hidden;
}
.grade-top {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: .85rem .95rem; min-height: var(--tap); text-align: start;
}
.grade-id { display: flex; align-items: center; gap: .5rem; }
.grade-pip { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.grade-name { font-size: .95rem; font-weight: 700; }
.grade-right { display: flex; align-items: center; gap: .5rem; }
.grade-tot { font-size: .98rem; font-weight: 800; letter-spacing: -.02em; }
.chev { font-size: .8rem; color: var(--ink-40); transition: transform .2s; }
.grade-card.open .chev { transform: rotate(180deg); }
.grade-meta { padding: 0 .95rem .6rem; font-size: .74rem; color: var(--ink-40); }

.grade-body { display: none; padding: 0 .95rem .8rem; }
.grade-card.open .grade-body { display: block; }

.size-head, .size-row {
  display: grid; grid-template-columns: 1.25fr 1fr .85fr 1.05fr;
  gap: .3rem; align-items: center;
}
.size-head {
  font-size: .68rem; color: var(--ink-40); font-weight: 600;
  padding: .45rem 0; border-bottom: 1px solid var(--border-lt);
}
.size-row { padding: .55rem 0; border-bottom: 1px solid var(--border-lt); font-size: .82rem; }
.size-row:last-child { border-bottom: none; }
.size-name { font-weight: 600; }
.size-qty, .size-price { color: var(--ink-60); font-size: .78rem; }
.size-val { font-weight: 700; text-align: start; }

/* Payment ledger */
.pmt-row {
  display: grid; grid-template-columns: 1.05fr 1.5fr .8fr;
  gap: .4rem; align-items: center;
  padding: .7rem .8rem; background: #fff;
  border: 1px solid var(--border-lt); border-bottom: none;
  font-size: .82rem;
}
.pmt-row:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.pmt-row:last-of-type { border-bottom: 1px solid var(--border-lt); }
.pmt-am { font-weight: 700; letter-spacing: -.01em; }
.pmt-am.neg { color: var(--danger); }
.pmt-am.zero { color: var(--ink-20); font-weight: 500; }
.pmt-ds { color: var(--ink-60); font-size: .78rem; }
.pmt-dt { color: var(--ink-40); font-size: .74rem; text-align: start; }
.pmt-foot {
  padding: .8rem; background: var(--ink); color: var(--cream);
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-size: .86rem; font-weight: 700;
  display: flex; justify-content: space-between;
}

/* Forecast */
.fc-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem 0; border-bottom: 1px solid var(--border-lt);
}
.fc-row:last-child { border-bottom: none; }
.fc-name { font-size: .85rem; color: var(--ink-60); }
.fc-val { font-size: .98rem; font-weight: 700; letter-spacing: -.02em; }
.fc-val.final { color: var(--warn); }
.grand-row { display: flex; justify-content: space-between; align-items: baseline; }
.grand-lbl { font-size: .82rem; color: var(--ink-60); }
.grand-val { font-size: 1.3rem; font-weight: 900; letter-spacing: -.02em; }

/* --------------------------------------------------------------------------
   States
   -------------------------------------------------------------------------- */
.skel {
  background: linear-gradient(90deg, var(--cream) 25%, #E4DFD0 50%, var(--cream) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty, .errbox {
  text-align: center; padding: 2.5rem 1.2rem; color: var(--ink-40);
  font-size: .88rem;
}
.errbox { color: var(--danger); }
.errbox button {
  display: block; margin: 1rem auto 0; min-height: var(--tap); padding: 0 1.4rem;
  background: var(--ink); color: var(--paper); border-radius: var(--r-sm); font-weight: 600;
}

.note {
  text-align: center; font-size: .7rem; color: var(--ink-40);
  padding: 1.4rem var(--pad) calc(env(safe-area-inset-bottom) + 1.4rem);
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem;
  padding: 2rem var(--pad); text-align: center;
}
.login-mark { font-size: 2.6rem; }
.login h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.login p { font-size: .87rem; color: var(--ink-60); max-width: 30ch; }
.login form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: .6rem; margin-top: .6rem; }
.login input {
  min-height: var(--tap); padding: 0 .9rem; font: inherit; font-size: .95rem;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: #fff; color: var(--ink); text-align: start;
  direction: ltr;
}
.login button[type=submit] {
  min-height: var(--tap); background: var(--ink); color: var(--paper);
  border-radius: var(--r-sm); font-weight: 700; font-size: .95rem;
}
.login button[type=submit]:disabled { opacity: .5; cursor: default; }
.login-msg { font-size: .84rem; margin-top: .3rem; }
.login-msg.ok { color: var(--pos-text); }
.login-msg.err { color: var(--danger); }

/* ==========================================================================
   Admin
   ========================================================================== */

.admin-body #app { max-width: 780px; }
@media (min-width: 900px) { .admin-body #app { max-width: 820px; } }

.admin-panel { padding-bottom: 4rem; }

.hdr-signout { display: inline-flex; align-items: center; text-decoration: none; }

/* Drop zone */
.drop {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 2.4rem 1.2rem;
  text-align: center;
  background: #fff;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.drop:hover, .drop.over { border-color: var(--terra); background: var(--terra-bg); }
.drop-icon { font-size: 2rem; }
.drop-title { font-size: 1rem; font-weight: 700; margin-top: .5rem; }
.drop-sub { font-size: .82rem; color: var(--ink-40); margin-top: .2rem; }

.hint {
  font-size: .78rem; color: var(--ink-40);
  margin-top: .8rem; line-height: 1.6;
}

/* Alerts */
.alert {
  border-radius: var(--r-md);
  padding: .9rem 1rem;
  margin-top: .8rem;
  border: 1px solid var(--border-lt);
  background: #fff;
  border-inline-start: 3px solid var(--ink-20);
}
.alert.ok   { background: var(--pos-bg);  border-inline-start-color: var(--pos);   color: var(--pos-text); }
.alert.warn { background: var(--warn-bg); border-inline-start-color: var(--warn);  color: var(--warn-text); }
.alert.err  { background: var(--danger-bg); border-inline-start-color: var(--danger); color: var(--danger); }
.alert.info { background: var(--info-bg); border-inline-start-color: var(--info);  color: var(--info-text); }
.alert-title { font-size: .9rem; font-weight: 700; }
.alert-body { font-size: .82rem; margin-top: .3rem; line-height: 1.6; opacity: .9; }
.alert ul { margin: .5rem 0 0; padding-inline-start: 1.1rem; font-size: .8rem; line-height: 1.7; }
.alert-more { font-size: .78rem; margin-top: .4rem; opacity: .8; }

/* Table */
.table-wrap {
  border: 1px solid var(--border-lt);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #fff;
}
.dtable { width: 100%; border-collapse: collapse; font-size: .83rem; }
.dtable th {
  text-align: start; font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  color: var(--ink-40); padding: .6rem .8rem; background: var(--cream);
  position: sticky; top: 0;
}
.dtable td { padding: .6rem .8rem; border-top: 1px solid var(--border-lt); }
.dtable tr:hover td { background: var(--paper); }
.tid { display: block; font-size: .68rem; color: var(--ink-40); }
.dtable .up   { color: var(--pos-text); }
.dtable .down { color: var(--danger); font-weight: 700; }
.dtable .neu  { color: var(--ink-40); }

/* Buttons */
.actions { display: flex; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.btn {
  min-height: var(--tap); padding: 0 1.3rem;
  border-radius: var(--r-sm); font-size: .9rem; font-weight: 600;
}
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--ink-80); }
.btn.ghost { background: var(--cream); color: var(--ink-60); }
.btn.ghost:hover { background: var(--border-lt); }
.btn:disabled { opacity: .55; cursor: default; }

/* Progress */
.progress {
  height: 8px; border-radius: 4px; background: var(--cream);
  margin-top: 1rem; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--terra), var(--terra-dark));
  transition: width .2s ease;
}

/* Pills */
.pill {
  display: inline-block; padding: .2rem .55rem; border-radius: 999px;
  font-size: .7rem; font-weight: 600; background: var(--cream); color: var(--ink-60);
}
.pill.live { background: var(--pos-bg); color: var(--pos-text); }
.pill.act  { background: var(--ink); color: var(--paper); cursor: pointer; min-height: 28px; }
.pill.act:disabled { opacity: .5; }

/* Done */
.done { text-align: center; padding: 2.6rem 1rem 1rem; }
.done-mark {
  width: 62px; height: 62px; margin: 0 auto; border-radius: 50%;
  background: var(--pos-bg); color: var(--pos);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; font-weight: 700;
}
.done-title { font-size: 1.25rem; font-weight: 800; margin-top: .8rem; }
.done-sub { font-size: .86rem; color: var(--ink-60); margin-top: .3rem; }

/* ==========================================================================
   Brand
   ========================================================================== */

:root {
  --ink-900: #1A110A; --ink-800: #2A1A10; --ink-700: #3A2A18;
  --ink-500: #7A6A58; --ink-200: #D8D0BC;
  --terra-900: #5C2210; --terra-700: #8A3C1E;
  --terra-500: #A04A28; --terra-400: #C4623A; --terra-200: #E08A64;

  --font-display: 'Archivo', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-he: 'Heebo', system-ui, sans-serif;
}

/* Mark + wordmark lockup. Latin, so it stays LTR inside an RTL document. */
.af-lockup {
  display: inline-flex; align-items: center;
  direction: ltr; unicode-bidi: isolate;
}
.af-word {
  font-family: var(--font-display);
  font-weight: 800; letter-spacing: -.035em; line-height: 1;
  white-space: nowrap;
}

/* Mono eyebrow — technical chrome, per the type system */
.af-eyebrow {
  font-family: var(--font-mono);
  font-size: .7rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase;
  direction: ltr; unicode-bidi: isolate;
}

/* ==========================================================================
   Login — ink ground, single terra accent
   ========================================================================== */

.auth {
  position: relative;
  min-height: 100dvh;
  background: var(--ink-900);
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 2.2rem) 1.5rem
           calc(env(safe-area-inset-bottom) + 1.5rem);
  overflow: hidden;
}

/* Field rows echoed as a faint horizon behind the content. Ink-on-ink, so it
   reads as texture rather than a second accent. */
.auth::before {
  content: ''; position: absolute; inset-inline: 0; top: 0; height: 46%;
  background:
    linear-gradient(180deg, var(--ink-800) 0%, transparent 100%),
    repeating-linear-gradient(180deg,
      rgba(237,232,214,.028) 0 1px, transparent 1px 13px);
  pointer-events: none;
}

.auth > * { position: relative; }

.auth-head { display: flex; justify-content: center; }

.auth-rule {
  height: 1px; margin: 2.4rem 0 1.6rem;
  background: linear-gradient(90deg,
    transparent, rgba(237,232,214,.22) 22%, rgba(237,232,214,.22) 78%, transparent);
}

.auth-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.auth-eyebrow { color: var(--terra-400); margin-bottom: 1rem; }

.auth-title {
  font-family: var(--font-he);
  font-size: clamp(1.7rem, 8.5vw, 2.3rem);
  font-weight: 800; line-height: 1.16; letter-spacing: -.02em;
  color: var(--cream);
}

.auth-sub {
  font-family: var(--font-he);
  font-size: 1rem; font-weight: 400; color: var(--ink-200);
  margin-top: .5rem;
}
.auth-sub::before {
  content: ''; display: block;
  width: 34px; height: 2px; background: var(--terra-400);
  margin-bottom: .8rem; border-radius: 1px;
}

.auth-lede {
  font-size: .9rem; line-height: 1.7; color: var(--ink-500);
  margin-top: 1.5rem; max-width: 30ch;
}

.auth-form { margin-top: 1.6rem; display: flex; flex-direction: column; gap: .7rem; }

/* Hard-edged input, per the component grammar */
.auth-input {
  width: 100%; min-height: 54px; padding: 0 1rem;
  font: 400 1rem/1 var(--font-mono);
  direction: ltr; text-align: start;
  color: var(--cream);
  background: rgba(237,232,214,.045);
  border: 1px solid rgba(237,232,214,.2);
  border-radius: 6px;
  transition: border-color .16s, background .16s;
}
.auth-input::placeholder { color: var(--ink-500); }
.auth-input:focus {
  outline: none;
  border-color: var(--terra-400);
  background: rgba(237,232,214,.07);
  box-shadow: 0 0 0 3px rgba(196,98,58,.16);
}

/* Pill CTA — the screen's accent moment */
.auth-btn {
  min-height: 54px; border-radius: 999px;
  font-family: var(--font-he); font-size: 1rem; font-weight: 700;
  color: var(--cream); background: var(--terra-400);
  transition: background .16s, transform .1s;
}
.auth-btn:hover:not(:disabled) { background: var(--terra-500); }
.auth-btn:active:not(:disabled) { transform: translateY(1px); }
.auth-btn:disabled { opacity: .45; cursor: default; }

.auth-msg {
  font-size: .86rem; line-height: 1.6; margin-top: .5rem;
  padding: .75rem .9rem; border-radius: 8px;
  border-inline-start: 2px solid transparent;
}
.auth-msg:empty { display: none; }
.auth-msg.ok {
  color: #9FE0B8; background: rgba(21,128,61,.14); border-inline-start-color: #15803D;
}
.auth-msg.err {
  color: #F0A898; background: rgba(185,28,28,.14); border-inline-start-color: #B91C1C;
}

.auth-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding-top: 1.8rem;
  border-top: 1px solid rgba(237,232,214,.1);
  color: var(--ink-500);
}
.auth-foot .af-eyebrow { font-size: .62rem; letter-spacing: .14em; }

/* Header lockup on the dashboard */
.hdr-brand { display: flex; align-items: center; gap: .55rem; }
.hdr-divider {
  width: 1px; height: 22px; background: rgba(237,232,214,.2); flex: none;
}

/* Badge with the mark inline. Colour rule: on a terra card the mark is ink. */
.i-badge {
  display: inline-flex; align-items: center; gap: .38rem;
}

/* Secondary auth route — present but quiet. The magic link stays primary. */
.auth-alt {
  align-self: flex-start;
  margin-top: .9rem;
  padding: .4rem 0;
  font-family: var(--font-he); font-size: .82rem;
  color: var(--ink-500);
  border-bottom: 1px solid rgba(237,232,214,.18);
  transition: color .16s, border-color .16s;
}
.auth-alt:hover { color: var(--ink-200); border-bottom-color: var(--terra-400); }
