/* ══════════════════════════════════════════════════════════════════
   19 — BRAND "PAPER + TERRA" (v4.9.0)
   The shared layer for the brand sweep: type roles, buttons, segmented
   controls, chips, cards, sheets and the ≥44px touch targets. Loads after
   every older slice so it wins ties without !important where it can.
   Tokens live in 00-tokens.css (--paper, --ink, --quiet, --line, --terra …).
══════════════════════════════════════════════════════════════════ */

/* ── Type ──────────────────────────────────────────────────────── */
body { font-family: var(--f-body); color: var(--text-primary); -webkit-font-smoothing: antialiased; }
.rl-hero h1 { font-family: var(--f-serif); font-weight: 400; color: var(--ink); }
.serif, .t-serif { font-family: var(--f-serif); font-weight: 400; letter-spacing: 0; }
.mono, .t-mono { font-family: var(--f-mono); }
.t-display-xl, .t-display-l, .t-display-m,
.rl-section-title, .exp-head-title, .beds-tb-title, .wn-headline, .sp-phead__h,
.sp-success__h, .sp-card__name, .rl-modal-header, .empty-title {
  font-family: var(--f-serif); font-weight: 400; letter-spacing: 0;
}
.rl-section-title { color: var(--ink); }
.settings-section h3, .week-header { color: var(--ink); }
a { color: var(--terra-text); }

/* Page heading used at the top of each tab (h1 in Young Serif + a mono line). */
.pg-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 16px; }
.pg-head__t { margin: 0; font-family: var(--f-serif); font-weight: 400; font-size: 32px; line-height: 1.1; color: var(--ink); }
.pg-head__sub { font-family: var(--f-mono); font-size: 13.5px; color: var(--quiet); margin-top: 4px; }
.pg-head__right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
@media (max-width: 768px) {
  .pg-head { margin: 0 0 12px; gap: 10px; }
  .pg-head__t { font-size: 28px; }
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn { border-radius: var(--r-btn); font-family: var(--f-body); letter-spacing: 0; min-height: 40px; padding: 0 16px; font-size: 14px; }
.btn.lg { min-height: 50px; padding: 0 22px; font-size: 16px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-xs { min-height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn-primary { background: var(--terra); color: #FFFFFF; }
.btn-primary:hover { background: #A03A22; }
.btn-quiet, .btn-muted { background: var(--bg-card); color: var(--ink); border: 1px solid var(--line); }
.btn-quiet:hover, .btn-muted:hover { background: var(--bg-subtle); border-color: var(--line); }
.btn-ghost { border-color: var(--line); }
.btn-secondary { background: var(--ink); color: var(--paper); }
.btn-secondary:hover { background: #3A3833; }
:root.dark .btn-secondary { background: var(--ink); color: #191816; }
:root.dark .btn-secondary:hover { background: #FFFFFF; }
.btn-green { background: var(--soil-tint); color: var(--soil-text); border: 1px solid var(--soil-line); }
.btn-green:hover { background: var(--soil-tint); border-color: var(--soil-text); }
.btn-rl-primary { border-radius: var(--r-btn); }
.btn-rl-secondary { border-radius: var(--r-btn); border-color: var(--line); color: var(--ink); }

/* Split button: one primary action + a ▾ menu (My Crops "+ Add crop"). */
.split-btn { display: inline-flex; position: relative; }
.split-btn > .btn:first-child { border-radius: var(--r-btn) 0 0 var(--r-btn); }
.split-btn > .btn + .btn { border-radius: 0 var(--r-btn) var(--r-btn) 0; border-left: 1px solid rgba(0,0,0,0.18); padding: 0 12px; }

/* Plain text action in terra ("Mark all done", "Review"). */
.linkbtn { border: 0; background: transparent; font: 600 14px var(--f-body); color: var(--terra-text); min-height: 36px; padding: 0 8px; cursor: pointer; border-radius: 8px; }
.linkbtn:hover { background: var(--terra-tint); }

/* ── Segmented control ─────────────────────────────────────────── */
.seg { background: var(--line-soft); border-radius: 8px; padding: 3px; }
.seg button { border-radius: 6px; font-family: var(--f-body); font-size: 14px; font-weight: 500; color: var(--ink-2); padding: 0 14px; min-height: 34px; }
.seg.sm button { font-size: 13.5px; padding: 0 12px; min-height: 32px; }
.seg button.active, .seg button[aria-pressed="true"] { background: var(--bg-card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.seg button:not(.active):hover { color: var(--ink); }
:root.dark .seg { background: var(--bg-subtle); }
:root.dark .seg button.active { background: var(--line); color: var(--ink); }

/* ── Chips (status chips, filter chips) ────────────────────────── */
.chip-s {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 38px; padding: 0 14px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink);
  font: 500 14px var(--f-body); white-space: nowrap; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.chip-s:hover { border-color: var(--quiet); }
.chip-s svg { flex: none; width: 18px; height: 18px; }
.chip-s .mono, .chip-s b { font-weight: 700; }
.chip-s.need { background: var(--need-tint); border-color: var(--need-line); color: var(--need-text); }
.chip-s.late { background: var(--late-tint); border-color: var(--late-line); color: var(--late-text); }
.chip-s.soil { background: var(--soil-tint); border-color: var(--soil-line); color: var(--soil-text); }
.chip-s.on, .chip-s[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chipf { border-radius: 99px; border-color: var(--line); font-size: 13px; min-height: 32px; padding: 0 12px; color: var(--ink-2); }
.chipf.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
:root.dark .chipf.active { background: var(--ink); color: #191816; border-color: var(--ink); }

/* ── Cards ─────────────────────────────────────────────────────── */
.rl-card { border: 1px solid var(--line); border-radius: var(--r-card); }
.rl-card-header { background: var(--bg-subtle); color: var(--ink); font-size: 11px; letter-spacing: 0.08em; border-bottom: 1px solid var(--line); }
.rl-details { border-color: var(--line); border-radius: var(--r-card); }
.rl-details > summary { background: var(--bg-subtle); color: var(--ink); }
.rl-details > summary:hover { background: var(--line-soft); }
.rl-modal { border-radius: 16px; }
.rl-table thead tr { background: var(--bg-subtle); }
.rl-table thead th { color: var(--ink); border-color: var(--line); font-family: var(--f-body); }
:root.dark .rl-table thead th { color: var(--ink); }
.rl-table tbody tr:nth-child(even) { background: var(--bg-subtle); }
.rl-table tbody tr:hover { background: var(--line-soft); }
.rl-footer { background: transparent; color: var(--quiet); border-top: 1px solid var(--line); }

/* ── Inputs ────────────────────────────────────────────────────── */
input[type=text], input[type=number], input[type=date], input[type=search], input[type=email], select, textarea {
  border-color: var(--line); border-radius: 8px; font-family: var(--f-body);
}

/* ── Sheet / popover shell (status chips open these) ───────────── */
.ysheet-scrim { position: fixed; inset: 0; background: rgba(34,33,30,0.28); z-index: 330; }
:root.dark .ysheet-scrim { background: rgba(0,0,0,0.5); }
.ysheet {
  position: fixed; z-index: 331; background: var(--bg-card); color: var(--text-body);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: min(80vh, 720px);
  left: 50%; top: 12vh; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); border-radius: 16px;
}
.ysheet__h { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line-soft); }
.ysheet__t { margin: 0; font: 400 22px/1.2 var(--f-serif); color: var(--ink); flex: 1; }
.ysheet__x { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; color: var(--quiet); display: flex; align-items: center; justify-content: center; }
.ysheet__x:hover { background: var(--bg-subtle); color: var(--ink); }
.ysheet__x:focus:not(:focus-visible) { outline: none; }
.ysheet__b { overflow-y: auto; padding: 14px 20px 20px; }
.ysheet__f { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--line-soft); }
@media (max-width: 768px) {
  .ysheet { left: 0; right: 0; bottom: 0; top: auto; transform: none; width: auto; border-radius: 18px 18px 0 0; max-height: 86vh; padding-bottom: env(safe-area-inset-bottom); }
}

/* ── Inline stroke icons (replace emoji used as UI icons) ──────── */
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 15px; height: 15px; vertical-align: -2px; }

/* ── Touch targets ≥44px (coarse pointers only; desktop keeps density) ── */
@media (pointer: coarse) {
  .btn, .btn-sm, .btn-xs, .btn-rl-primary, .btn-rl-secondary, .btn-dashed-add,
  .seg button, .chipf, .chip-s, .linkbtn, .np, .ttf-chip, .ttf-more, .sg-pill,
  .rl-modal-close, .pop-h .ph-action, .pop-today .pt-foot .pt-settings,
  .pop-notif .pn-foot button, .pop-avatar .pa-item, .set-rail-btn { min-height: 44px; }
  .btn-xs { min-width: 44px; }
  .lr-did, .lr-skip, .lr-resched, .lr-did-date, .cs-cr-actions button, .co-actions button { min-height: 44px; }
  .rl-modal-close { min-width: 44px; }
  .seg button, .seg.sm button { min-height: 44px; }
  .seg { padding: 2px; }
}

/* ── Tab badges (one number: _attentionTasks) ─────────────────── */
.tab-badge { background: var(--terra); color: #FFFFFF; font: 500 11.5px/1 var(--f-mono); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; margin-left: 0; }
