/*
 * Nadav newsroom app: components (stage A). Needs tokens.css first.
 * Class names follow prototype/index.html so its markup carries over. Changes vs the prototype are marked "Δ".
 * RTL: the document is dir="rtl"; use logical properties (inline-start = right).
 */

/* ============ base ============ */
html { height: 100%; box-sizing: border-box; background: var(--bg); }
*, *::before, *::after { box-sizing: inherit; }
body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: var(--t-md);
  line-height: var(--lh); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.gut { padding-left: max(var(--gutter), var(--safe-l)); padding-right: max(var(--gutter), var(--safe-r)); }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }   /* @handles, URLs, times */
[hidden] { display: none !important; }   /* the hidden attribute always wins over component display rules */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Δ hit area: any control whose visual is < 44px gets an invisible 44px target */
.hit { position: relative; }
.hit::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, var(--tap)); height: max(100%, var(--tap));
  transform: translate(-50%, -50%); }

/* ============ app shell ============ */
/* phone: header / main / tabs. desktop ≥960: header over rail | list | detail */
.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "head" "main" "tabs"; }
.pane { grid-area: main; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.pane-detail { display: none; background: var(--bg); z-index: 3; container-type: inline-size; flex-direction: column; }
.app.has-detail .pane-detail { display: flex; animation: push-in var(--dur-2) ease-out; }
.app.has-detail .tabs, .app.has-detail .fab { display: none; }
@keyframes push-in { from { transform: translateX(-28px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- top bar ---- */
.top { grid-area: head; display: flex; align-items: center; gap: var(--sp-4); padding-block: calc(var(--sp-4) + var(--safe-t)) var(--sp-4);
  border-bottom: 1px solid var(--line); background: var(--bg); min-width: 0; }
.brand { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; flex: 1; }
.brand-av { width: 36px; height: 36px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--mint); }
.brand-name { font-weight: var(--w-xbold); font-size: var(--t-lg); line-height: var(--lh-tight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-tools { display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--fg-2); background: var(--surface-2); flex: none; position: relative; }
.icon-btn::after { content: ""; position: absolute; inset: -3px; }               /* Δ 44px target */
.icon-btn:hover { color: var(--fg); background: var(--surface-3); }
.icon-btn svg.i { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 6px; inset-inline-end: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 2px var(--surface-2); }
/* Δ "who am I": the prototype's demo switcher becomes a read-only chip (real login, decision 5) */
.me { display: inline-flex; align-items: center; gap: var(--sp-2); height: 38px; padding-inline: 4px 12px; border-radius: var(--r-pill);
  background: var(--surface-2); font-size: var(--t-sm); font-weight: var(--w-semi); color: var(--fg-2); }

/* ---- tabs (phone) / rail (desktop) ---- */
.tabs { grid-area: tabs; display: flex; height: calc(var(--tabh) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--bg); border-top: 1px solid var(--line); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: var(--w-semi);
  color: var(--muted); position: relative; text-decoration: none; min-height: var(--tap); }
.tab:hover { color: var(--fg-2); }
.tab[aria-current="page"] { color: var(--mint); }
.badge { position: absolute; top: 6px; inset-inline-start: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--mint);
  color: var(--mint-ink); font-size: 11px; font-weight: var(--w-xbold); display: grid; place-items: center; font-style: normal; font-variant-numeric: tabular-nums; line-height: 1; }
.badge.warn { background: var(--bad); color: var(--bad-ink); }  /* Δ failed jobs counted on the work tab */

/* ---- floating + ---- */
.fab { position: fixed; z-index: var(--z-fab); left: max(16px, calc(var(--safe-l) + 16px)); bottom: calc(var(--tabh) + 16px + var(--safe-b));
  width: var(--fab); height: var(--fab); border-radius: 50%; background: var(--mint); color: var(--mint-ink); display: grid; place-items: center; box-shadow: var(--shadow-fab); }
.fab:hover { background: var(--mint-press); }
.fab svg.i { width: 28px; height: 28px; stroke-width: 2.4; }

/* ============ list views ============ */
.view { padding-block: var(--sp-8) 104px; max-width: var(--read); margin-inline: auto; }
.vh { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-5); margin-bottom: var(--sp-6); }
.vh h1 { margin: 0; font-size: var(--t-2xl); font-weight: var(--w-xbold); line-height: var(--lh-tight); letter-spacing: -.01em; }
.sub { margin: var(--sp-1) 0 0; color: var(--muted); font-size: var(--t-sm); }
.h2 { font-size: var(--t-sm); font-weight: var(--w-bold); color: var(--fg-2); margin: var(--sp-10) 0 var(--sp-4); display: flex; gap: var(--sp-3); align-items: center; }
.h2 span { color: var(--muted); font-weight: var(--w-med); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-7); border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line-2); font-weight: var(--w-semi); font-size: var(--t-sm); white-space: nowrap; text-decoration: none; }  /* Δ 42 → 44 */
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--mint); color: var(--mint-ink); border-color: transparent; font-weight: var(--w-bold); }
.btn.primary:hover { background: var(--mint-press); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 0 var(--sp-5); border-radius: var(--r-sm); position: relative; }
.btn.sm::after { content: ""; position: absolute; inset: -6px 0; }               /* Δ 44px target: 32 px padding box + 12 */
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn svg.i { width: 18px; height: 18px; }

/* ---- filter chips ---- */
.filters { display: flex; gap: var(--sp-3); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--sp-6); padding-block: 5px; }  /* Δ room for the hit area */
.filters::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: var(--sp-2); height: 34px; padding: 0 var(--sp-5); border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line-ctl); font-size: var(--t-sm); font-weight: var(--w-semi); color: var(--fg-2); position: relative; }  /* Δ border: line-2 → line-ctl */
.fchip::after { content: ""; position: absolute; inset: -6px -2px; }            /* Δ 44px target: 32 px padding box + 12 */
.fchip span { font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.fchip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.fchip[aria-pressed="true"] span { color: var(--bg); opacity: .65; }

/* ---- lead card (list row) ---- */
.lead-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.lead-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: var(--sp-5); width: 100%; padding: var(--sp-6); border-radius: var(--r-xl);
  background: var(--surface); border: 1px solid var(--line); transition: border-color var(--dur-1), background var(--dur-1); text-decoration: none; color: inherit; }
.lead-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.lead-card.sel { border-color: var(--mint-line); background: var(--surface-2); }
.lead-card.fresh { border-color: var(--mint); box-shadow: var(--ring-sel); animation: arrive .5s ease-out; }
.lead-card.expired { opacity: .62; }                                             /* Δ window passed: sinks to the bottom, dimmed */
@keyframes arrive { from { transform: translateY(-8px); opacity: 0; } }
.lc-body { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.lc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--sp-2); font-size: 12.5px; color: var(--muted); }
.cat { color: var(--fg-2); font-weight: var(--w-semi); }
.lc-title { font-weight: var(--w-bold); font-size: var(--t-md); line-height: 1.35; text-wrap: pretty; }
.lc-angle { font-size: var(--t-sm); color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin-top: var(--sp-1); font-size: 12.5px; color: var(--muted); }
.lc-foot .by { margin-inline-start: auto; }
.upd { color: var(--mint); font-weight: var(--w-semi); }
.by { display: inline-flex; align-items: center; gap: 5px; }

/* ---- score tile ---- */
.score { width: 54px; height: 54px; border-radius: var(--r-lg); display: flex; align-items: baseline; justify-content: center; padding-top: 10px;
  background: var(--surface-3); color: var(--fg-2); font-variant-numeric: tabular-nums; direction: ltr; }
.score b { font-size: 24px; font-weight: var(--w-xbold); line-height: 1; }
.score i { font-style: normal; font-size: var(--t-xs); opacity: .65; margin-left: 1px; }
.s-hi { background: var(--mint-soft); color: var(--mint); }      /* 7–10 */
.s-mid { background: var(--warn-soft); color: var(--warn); }     /* 4–6 */
.s-lo { color: var(--fg-2); }                                    /* 0–3. Δ muted → fg-2: muted on surface-3 is only 4.5:1 */
.s-pend { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-ctl); color: var(--muted); }  /* "?" waiting for research */
.score-big { width: 74px; height: 74px; border-radius: 20px; padding-top: 15px; }
.score-big b { font-size: 36px; font-weight: var(--w-black); }
.score-big i { font-size: 14px; }

/* ---- status pill + tags ---- */
.status { --c: var(--muted); display: inline-flex; align-items: center; gap: var(--sp-2); height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  background: var(--surface-3); font-size: var(--t-xs); font-weight: var(--w-semi); color: var(--fg-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.st-new { --c: var(--st-new); } .st-research { --c: var(--st-research); } .st-design { --c: var(--st-design); }
.st-ready { --c: var(--st-ready); } .st-published { --c: var(--st-published); } .st-rejected { --c: var(--st-rejected); } .st-failed { --c: var(--st-failed); }
/* Δ window tag (Q23): "היום בלבד" / "השבוע" / "פג תוקף" */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: var(--w-bold); white-space: nowrap; }
.tag.today { background: var(--warn-soft); color: var(--warn); }
.tag.week { background: var(--info-soft); color: var(--info); }
.tag.expired { background: var(--surface-3); color: var(--fg-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.tag.paused { background: var(--surface-3); color: var(--fg-2); }               /* "⏸ לא נחקר: התקציב נגמר" */

/* ---- avatars ---- */
.av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; object-fit: cover; }
.av.sm { width: 30px; height: 30px; } .av.xs { width: 20px; height: 20px; } .av.xxs { width: 18px; height: 18px; }
.av-team { background: var(--violet-soft); color: var(--violet); font-weight: var(--w-xbold); font-size: 14px; box-shadow: inset 0 0 0 1px rgba(201, 174, 255, .4); line-height: 1; }
.av.xs.av-team, .av.xxs.av-team { font-size: 10px; }
.av-bot { background: var(--mint-soft); color: var(--mint); box-shadow: inset 0 0 0 1px var(--mint-line); }
.av-bot svg.i { width: 62%; height: 62%; }

/* ---- empty states ---- */
.empty { padding: 28px var(--sp-7); text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-xl); font-size: var(--t-sm); }
.empty b { display: block; color: var(--fg-2); margin-bottom: var(--sp-1); font-size: var(--t-md); }
.empty-detail { margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-4); padding: 40px 24px; color: var(--muted); max-width: 380px; }
.empty-detail img { width: 84px; height: 84px; border-radius: 50%; box-shadow: 0 0 0 3px var(--mint-soft); }
.empty-detail h2 { margin: var(--sp-2) 0 0; color: var(--fg); font-size: var(--t-xl); font-weight: var(--w-xbold); }
.empty-detail p { margin: 0; font-size: var(--t-sm); line-height: 1.65; }
.archive-link { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--tap); margin-top: var(--sp-7); color: var(--muted); font-size: var(--t-sm); font-weight: var(--w-semi); }

/* ============ detail screens ============ */
.d-head { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--sp-4); min-height: 54px; padding-block: var(--sp-3);
  background: var(--bg); border-bottom: 1px solid var(--line); }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); text-decoration: none; padding-inline: 0 var(--sp-4); color: var(--mint); font-weight: var(--w-semi); }  /* Δ 38 → 44 */
.d-title { font-weight: var(--w-xbold); font-size: var(--t-lg); }
.grow { flex: 1; }
.d-body { flex: 1 0 auto; padding-block: var(--sp-7) 28px; width: 100%; max-width: var(--read); margin-inline: auto; }

/* ---- lead card (detail) ---- */
.lead { display: flex; flex-direction: column; gap: var(--sp-9); }
.qnote { display: flex; align-items: center; gap: var(--sp-4); justify-content: space-between; flex-wrap: wrap; padding: var(--sp-4) var(--sp-6); border-radius: var(--r-md);
  background: var(--info-soft); color: var(--info); font-size: var(--t-sm); font-weight: var(--w-semi); }
.qnote a, .qnote button { color: var(--info); text-decoration: underline; font-weight: var(--w-bold); min-height: var(--tap); display: inline-flex; align-items: center; }
.vswitch { display: flex; flex-direction: column; gap: var(--sp-2); }
.vs-row { display: flex; gap: var(--sp-1); padding: var(--sp-1); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.vs-row button { flex: 1; min-height: 38px; border-radius: 9px; font-size: var(--t-sm); font-weight: var(--w-semi); color: var(--muted); font-variant-numeric: tabular-nums; position: relative; }
.vs-row button::after { content: ""; position: absolute; inset: -3px 0; }       /* Δ 44px target */
.vs-row button[aria-pressed="true"] { background: var(--surface-3); color: var(--fg); }
.vs-note { font-size: 12.5px; color: var(--muted); }
.lead-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-6); align-items: center; }
.lh-line { font-weight: var(--w-bold); font-size: var(--t-md); line-height: 1.4; }
.lh-src { color: var(--muted); font-size: var(--t-sm); margin-top: 3px; line-height: 1.5; }
.lh-why { margin-top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-1); font-size: 12.5px; color: var(--fg-2); }   /* Δ score breakdown + "למדתי" */
.lh-why .cap { color: var(--warn); }
.lh-why .learn { color: var(--violet); }
.sec h3 { margin: 0 0 var(--sp-3); font-size: var(--t-sm); font-weight: var(--w-bold); color: var(--fg-2); }
.prose p { margin: 0 0 var(--sp-5); line-height: var(--lh-prose); max-width: 65ch; }
.prose p:last-child { margin: 0; }
.prose a { color: var(--mint); }
.angle { margin: 0; border-inline-start: 3px solid var(--mint); padding-inline-start: var(--sp-5); color: var(--mint); font-weight: var(--w-semi); font-size: var(--t-lg); line-height: 1.55; }
.sample { margin: 0; font-weight: var(--w-black); font-size: 22px; line-height: 1.25; text-wrap: balance; }
.think { margin: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.think div { padding: var(--sp-5) var(--sp-6); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.think dt { font-weight: var(--w-bold); font-size: var(--t-sm); margin-bottom: var(--sp-1); }
.think dd { margin: 0; line-height: 1.7; color: var(--fg-2); font-size: var(--t-sm); }
.links { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.link { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-5); border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px solid var(--line-2); text-decoration: none; font-size: var(--t-sm); font-weight: var(--w-semi); }  /* Δ 36 → 44 */
.link:hover { background: var(--surface-3); }
.link.mint { color: var(--mint); border-color: var(--mint-line); }
.lead-shot { max-width: 100%; max-height: 300px; border-radius: var(--r-md); border: 1px solid var(--line); align-self: flex-start; }
.skel { display: flex; flex-direction: column; gap: var(--sp-3); }
.skel i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
.skel i:nth-child(2) { width: 86%; } .skel i:nth-child(3) { width: 64%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- action bar (sticky bottom of a detail screen) ---- */
.actionbar { position: sticky; bottom: 0; z-index: var(--z-sticky); padding-block: var(--sp-4) calc(var(--sp-4) + var(--safe-b)); background: var(--bg); border-top: 1px solid var(--line); }
.ab-in { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); max-width: 728px; margin-inline: auto; }
.ab-in button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; border-radius: var(--r-md); background: var(--surface-2);
  font-size: 12.5px; font-weight: var(--w-semi); color: var(--fg-2); text-align: center; line-height: 1.2; padding: var(--sp-1); }
.ab-in button:hover { background: var(--surface-3); color: var(--fg); }
.ab-ic { font-size: 18px; line-height: 1; }
.ab-in .primary { background: var(--mint); color: var(--mint-ink); }
.ab-in .primary:hover { background: var(--mint-press); color: var(--mint-ink); }
.ab-in button:disabled { opacity: .4; cursor: not-allowed; }

/* ============ notes thread (per lead and per post, decision 6) ============ */
.thread { margin-top: var(--sp-11); padding-top: 20px; border-top: 1px solid var(--line); }
.th-h { margin: 0 0 var(--sp-6); font-size: var(--t-md); font-weight: var(--w-xbold); display: flex; gap: var(--sp-3); align-items: center; }
.th-h span { font-size: var(--t-xs); color: var(--muted); font-weight: var(--w-semi); }
.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-6); }
.msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.m-col { min-width: 0; }
.m-who { display: flex; gap: var(--sp-3); align-items: baseline; font-size: 12.5px; margin-bottom: 3px; }
.m-who b { font-weight: var(--w-bold); }
.m-who time, .act time { color: var(--muted); font-variant-numeric: tabular-nums; }
.bubble { padding: 9px var(--sp-5); border-radius: var(--r-lg); border-start-start-radius: var(--r-xs); background: var(--surface-2); line-height: 1.65; white-space: pre-wrap;
  overflow-wrap: anywhere; font-size: var(--t-sm); }
.bubble a { color: var(--mint); }
.msg.bot .bubble { background: var(--mint-soft); box-shadow: inset 0 0 0 1px rgba(100, 247, 203, .16); }
.msg.fail .bubble { background: var(--bad-soft); box-shadow: inset 0 0 0 1px rgba(255, 126, 112, .3); }     /* Δ jobFailed */
.m-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }                          /* Δ buttons under a bot message */
.saved { display: inline-flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--violet-soft); color: var(--violet); font-size: var(--t-xs); font-weight: var(--w-bold); }  /* Δ "📌 נשמר להמשך" (decision 29) */
.mcard { display: flex; flex-direction: column; gap: 3px; padding: var(--sp-4) var(--sp-5); border-radius: var(--r-lg); border-start-start-radius: var(--r-xs);
  background: var(--surface); border: 1px solid var(--mint-line); font-size: var(--t-sm); }
.mcard span { color: var(--fg-2); }
.mini { align-self: flex-start; margin-top: var(--sp-1); color: var(--mint); font-weight: var(--w-bold); font-size: 12.5px; min-height: 32px; display: inline-flex; align-items: center; position: relative; }
.mini::after { content: ""; position: absolute; inset: -6px -4px; }
.act { display: flex; align-items: center; gap: var(--sp-3); font-size: 12.5px; color: var(--muted); }
.act b { color: var(--fg-2); font-weight: var(--w-semi); }
.act span { min-width: 0; }
.act time { margin-inline-start: auto; white-space: nowrap; }
.composer { margin-top: var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-2); }
.composer label { display: flex; align-items: center; gap: var(--sp-2); font-size: 12.5px; color: var(--muted); }
.row { display: flex; gap: var(--sp-3); align-items: flex-end; }
.kbd-hint { font-size: 11.5px; color: var(--muted); }

/* ---- form fields ---- */
textarea, input[type="text"], input[type="url"], input[type="search"] { display: block; width: 100%; min-width: 0; min-height: var(--tap); background: var(--surface);
  border: 1px solid var(--line-ctl); border-radius: var(--r-md); padding: var(--sp-4) var(--sp-5); font-size: var(--t-input); line-height: 1.5; color: var(--fg); resize: vertical; }  /* Δ border line-2 → line-ctl */
textarea:focus, input:focus { outline: none; border-color: var(--mint); box-shadow: var(--ring-sel); }
::placeholder { color: var(--muted); opacity: 1; }

/* ============ feedback ============ */
.toast { position: fixed; z-index: var(--z-toast); left: 50%; transform: translateX(-50%); bottom: calc(var(--tabh) + 88px + var(--safe-b)); width: max-content; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: var(--sp-6); padding: 11px var(--sp-7); border-radius: var(--r-lg); background: var(--fg); color: var(--bg); font-size: var(--t-sm);
  font-weight: var(--w-semi); line-height: 1.45; box-shadow: var(--shadow); }
.toast button { color: var(--bg); font-weight: var(--w-xbold); text-decoration: underline; flex: none; min-height: var(--tap); }

/* ============ desktop ≥ 960 ============ */
@media (min-width: 960px) {
  .app { grid-template-columns: var(--rail) minmax(340px, var(--list-w)) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "head head head" "rail list detail"; }
  .tabs, .app.has-detail .tabs { grid-area: rail; display: flex; flex-direction: column; height: auto; gap: var(--sp-1); padding: var(--sp-6) var(--sp-3) 100px; border-top: 0; border-inline-end: 1px solid var(--line); }
  .tab { flex: none; height: 66px; border-radius: var(--r-lg); }
  .tab:hover { background: var(--surface-2); }
  .tab[aria-current="page"] { background: var(--mint-soft); }
  .pane-list { grid-area: list; border-inline-end: 1px solid var(--line); }
  .pane-detail, .app.has-detail .pane-detail { grid-area: detail; display: flex; animation: none; }
  .app.has-detail .fab { display: grid; }
  .fab { left: auto; right: max(19px, calc(var(--safe-r) + 19px)); bottom: calc(22px + var(--safe-b)); }
  .back { display: none; }
  .view { padding-block: var(--sp-9) 40px; }
  .toast { bottom: calc(28px + var(--safe-b)); }
  .lead-card .lc-angle { -webkit-line-clamp: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
