/* Release 2.1 HIG layer (Kirby, kirby-premium/hig-system/spec.md; values from newli-ds.css).
   Loaded LAST. Type, weights, case, spacing and control sizes only: NO color changes (input border and
   --field-focus untouched). Delete this file + its <link> to drop the restyle. Phone = default, desktop >= 900px. */

/* ---- 1. Tokens (newli-ds.css non-color tokens) ---- */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-head: var(--font-ui); --font-body: var(--font-ui);
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700; /* HIG type pass (John, 27 Nov): Bold restored for titles + section headers */
  /* Kirby's HIG scale, phone (kirby-premium/hig-system/parts-tokens.css): size / line height / tracking */
  --fs-large-title: 34px; --lh-large-title: 41px; --tr-large-title: -0.022em;
  --fs-title-1: 28px; --lh-title-1: 34px; --tr-title-1: -0.02em;
  --fs-title-2: 22px; --lh-title-2: 28px; --tr-title-2: -0.018em;
  --fs-title-3: 20px; --lh-title-3: 25px; --tr-title-3: -0.016em;
  --fs-headline: 17px; --lh-headline: 22px; --tr-headline: -0.012em;
  --fs-body: 17px; --lh-body: 22px; --tr-body: -0.012em;
  --fs-callout: 16px; --lh-callout: 21px; --tr-callout: -0.008em;
  --fs-subhead: 15px; --lh-subhead: 20px; --tr-subhead: -0.004em;
  --fs-footnote: 13px; --lh-footnote: 18px; --tr-footnote: 0;
  --fs-caption: 12px; --lh-caption: 16px; --tr-caption: 0;
  --fs-caption-2: 11px; --lh-caption-2: 13px; --tr-caption-2: 0.01em;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;
  --hit: 44px; --ctl-h: 44px; --row-h: 52px; --section-h: 40px; --colhead-h: 32px; --pill-h: 20px; --pill-fs: 12px;
  /* table column header and meta cell roles */
  --hig-colhead: var(--fw-medium) 13px/18px var(--font-ui);
  --hig-meta: var(--fw-regular) 13px/18px var(--font-ui);
  --hig-pill: var(--fw-medium) 12px/20px var(--font-ui);

  /* ---- 2.1 type tokens (type.css) retuned to the HIG roles ---- */
  --type-family-text: var(--font-ui); --type-family-display: var(--font-ui);
  --type-track-caps: 0; --type-track-caps-table: 0;
  --type-overline: var(--hig-colhead);                                   /* column headers, picker group labels */
  --type-group: var(--fw-medium) var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  --type-section: var(--fw-semibold) 16px/40px var(--font-ui);           /* phone section bar, 40px */
  --type-row-title-touch: var(--fw-regular) 15px/44px var(--font-ui);    /* phone table title: 15px (John) */
  --type-cell-touch: var(--hig-meta);
  --type-cell-touch-strong: var(--fw-medium) 13px/18px var(--font-ui);
  --type-pill: var(--hig-pill); --type-pill-touch: var(--fw-medium) 12px/22px var(--font-ui);
  --type-initials: var(--fw-semibold) 10px/20px var(--font-ui);
  --type-initials-md: var(--fw-semibold) 10px/24px var(--font-ui);
  --type-initials-lg: var(--fw-semibold) 12px/32px var(--font-ui);
  --type-body-sm: var(--fw-regular) 13px/20px var(--font-ui);
  --type-caption: var(--fw-regular) var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  --type-control: var(--fw-medium) 13px/20px var(--font-ui);
  --type-chip: var(--fw-medium) 13px/28px var(--font-ui);
  --type-field-sm: var(--fw-regular) 13px/20px var(--font-ui);
  --type-field: var(--fw-regular) 14px/20px var(--font-ui);
  --type-field-touch: var(--fw-regular) 17px/22px var(--font-ui);         /* 17px inputs: no iOS zoom */
  --type-option-touch: var(--fw-regular) 17px/22px var(--font-ui);        /* 48px sheet rows */
  --type-control-touch: var(--fw-medium) 16px/21px var(--font-ui);
  --type-chip-touch: var(--fw-medium) 15px/42px var(--font-ui);
  --type-button: var(--fw-medium) 16px/21px var(--font-ui);
  --type-glyph: var(--fw-regular) 18px/1 var(--font-ui);
  --type-menu: var(--fw-regular) 14px/1 var(--font-ui);
  --type-menu-touch: var(--fw-regular) 17px/1 var(--font-ui);
  --type-menu-hint: var(--fw-regular) 12px/1 var(--font-ui);
  --type-sheet-title: var(--fw-bold) 17px/22px var(--font-ui);
  --type-toast: var(--fw-medium) 14px/20px var(--font-ui);
  --type-toast-action: var(--fw-medium) 14px/1 var(--font-ui);
}
@media (min-width: 900px) {
  :root {
    --fs-large-title: 28px; --lh-large-title: 34px;
    --fs-title-1: 22px; --lh-title-1: 28px;
    --fs-title-2: 18px; --lh-title-2: 24px;
    --fs-title-3: 16px; --lh-title-3: 22px;
    --fs-headline: 14px; --lh-headline: 20px; --tr-headline: -0.006em;
    --fs-body: 14px; --lh-body: 20px; --tr-body: -0.006em;
    --fs-callout: 13px; --lh-callout: 18px; --tr-callout: -0.002em;
    --fs-subhead: 13px; --lh-subhead: 18px; --tr-subhead: -0.002em;
    --fs-footnote: 12px; --lh-footnote: 16px;
    --fs-caption: 11px; --lh-caption: 14px; --tr-caption: 0.005em;
    --fs-caption-2: 11px; --lh-caption-2: 14px;
    --hit: 32px; --ctl-h: 32px; --row-h: 32px; --section-h: 32px; --colhead-h: 28px;
    --hig-colhead: var(--fw-medium) 12px/16px var(--font-ui);
    --type-group: var(--fw-medium) 12px/16px var(--font-ui);
    --type-caption: var(--fw-regular) 12px/16px var(--font-ui);
  }
}

/* ---- 2. One family, no caps. Weights 400/500/600, 700 for titles + section headers (HIG type pass).
   The old global `letter-spacing: normal !important` is gone so titles get HIG tight tracking: the legacy caps
   tracking (.04 to .1em in app.css) is zeroed here per selector, and each title role sets its own --tr-* token. ---- */
body, button, input, select, textarea { font-family: var(--font-ui); }
body { font-size: var(--fs-body); line-height: var(--lh-body); }
*, *::before, *::after { text-transform: none !important; }
h1, h2, h3, label.field > span, .field.drow > span, .topbar h1, .login-card h1, .tag-dev, .tabs button, .task .title,
.grid .thead, .section-head h2, .avatar, .detail-title, .plist-group, .ce-group, .ce-sheet-head h3 { letter-spacing: 0; }
@media (min-width: 900px) { .grid .thead { letter-spacing: 0; } }
b, strong, th, .due-hint.today { font-weight: var(--fw-semibold); }
h1, h2, h3 { font-family: var(--font-ui); font-weight: var(--fw-semibold); }

/* ---- 3. Headers, tabs, labels ---- */
.topbar h1 { font: var(--fw-semibold) var(--fs-headline)/var(--lh-headline) var(--font-ui); max-height: var(--lh-headline); }
.tabs button { font: var(--fw-medium) 16px/21px var(--font-ui); }
.section-head h2 { font: var(--fw-bold) 16px/21px var(--font-ui); color: var(--text); }
.section-head .count { font: var(--fw-regular) var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--text-2); }
.dblock h3 { font: var(--fw-semibold) var(--fs-subhead)/var(--lh-subhead) var(--font-ui); color: var(--text); }
.dblock h3 .count { font-weight: var(--fw-regular); color: var(--text-2); }
label.field > span, .field.drow > span { font: var(--fw-medium) var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--text-2); }
.ce-group { font: var(--type-group); color: var(--text-2); }
.ce-sheet-head h3 { font: var(--type-sheet-title); color: var(--text); }
.detail-title { font: var(--fw-semibold) var(--fs-title-2)/var(--lh-title-2) var(--font-ui); letter-spacing: var(--tr-title-2); }
.head-title-view, .sheet-head .head-title { font: var(--fw-semibold) var(--fs-headline)/var(--lh-headline) var(--font-ui); }

.badge, .tag-dev { font-weight: var(--fw-medium); }

/* ---- 4. Rows, cells, pills ---- */
.task .title { font-weight: var(--fw-regular); }
.grid .thead { font: var(--hig-colhead); color: var(--text-2); }
.grid .cell { font: var(--hig-meta); color: var(--text-2); }
.chip[class*=" t-"] { height: var(--pill-h); padding: 0 8px; border-radius: 10px; font: var(--hig-pill); }
/* Status and Priority: a dot plus a plain gray label (same dot colors) */
.grid .c-status .chip, .grid .c-priority .chip { display: inline-flex; align-items: center; gap: 0; height: auto; padding: 0; border: 0; border-radius: 0;
  background: none; color: var(--text-2); font: var(--hig-meta); box-shadow: none; }
.grid .c-status .chip::before, .grid .c-priority .chip::before { margin: 0 6px 0 0; }

/* ---- 5. Buttons, inputs, menus, toasts ---- */
.btn, .btn.danger-fill, .seg button, .pill, .mark-complete, .mark-complete.is-done { font-weight: var(--fw-medium); }
.btn.primary { font-weight: var(--fw-semibold); }                       /* HIG type pass: primary buttons Semibold */
a.btn, a.btn:hover, a.btn:focus { text-decoration: none; }
.text-btn { font-weight: var(--fw-medium); }
.input { font-size: var(--fs-body); }                                  /* 17px phone (no zoom), 14px desktop */
.ctx-item { font: var(--type-menu); }

/* ---- 6. Sign-in ---- */
.login-card .brand-logo { height: 32px; }
.login-card h1 { font: var(--fw-bold) var(--fs-title-1)/var(--lh-title-1) var(--font-ui); letter-spacing: var(--tr-title-1); }

/* ---- 7. Phone (< 900px): 17px body/inputs, 44px targets, 52px rows, 40px section bar, 15px table titles ---- */
@media (max-width: 899px) {
  .grid .task .title { font-size: 17px; line-height: 22px; }
  main.grid .pt-inner .task .title-line > .title { font: var(--type-row-title-touch); }
  .input, input.input, textarea.input, .quick-add :is(input, textarea), .sub-title, textarea.sub-title { font-size: 17px; }
  main.grid .pt-inner .section {
    background: linear-gradient(to bottom, var(--section-head) 0 40px, var(--hairline) 40px 41px, transparent 41px) 0 0 / 100% 41px no-repeat; }
  main.grid .pt-inner .section:not(.collapsed) {
    background: linear-gradient(to bottom, var(--section-head) 0 40px, var(--hairline) 40px 41px, transparent 41px) 0 0 / 100% 41px no-repeat,
      linear-gradient(var(--hairline), var(--hairline)) 0 100% / 100% 1px no-repeat; }
  main.grid .pt-inner .section-head { height: 41px; min-height: 41px; padding: 0 4px 0 8px; }
  main.grid .pt-inner .section-head h2 { font: var(--type-section); color: var(--text); }
  main.grid .pt-inner .section-head .collapse-btn, main.grid .pt-inner .section-head > .icon-btn:last-child { height: 40px; min-height: 40px; }
  main.grid .pt-inner > .thead { height: var(--colhead-h); min-height: var(--colhead-h); }
  main.grid .pt-inner > .thead > div, main.grid .pt-inner > .thead > .c-pin::before { font: var(--hig-colhead); color: var(--text-2); }
}
/* ---- 8. Desktop (>= 900px): 14px body, 32px rows, 13px section headers, 12px column headers ---- */
@media (min-width: 900px) {
  .tabs button { font-size: 14px; line-height: 20px; }
  .section-head h2 { font-size: 13px; line-height: 18px; }
  .grid .task .title { font-size: 14px; line-height: 20px; }
}

/* ---- 9. HIG type pass (John, 27 Nov 2026; Kirby's tokens). Bold Large Titles, sheet titles and section headers;
   Semibold project rows, primary buttons and the active tab. Selectors are specific enough to beat r3-r10. ---- */
/* Projects screen: Large Title (34/41 phone, 28/34 desktop) */
.list-head { margin: 12px 0 8px; gap: 12px; }
main .list-head h2 { margin: 0; min-width: 0; font: var(--fw-bold) var(--fs-large-title)/var(--lh-large-title) var(--font-ui);
  letter-spacing: var(--tr-large-title); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* "Starred" / "All projects": Bold section headers (Title 3 20/25 phone, Title 2 18/24 desktop), primary text */
main .plist-group { margin: 24px 0 4px; font: var(--fw-bold) var(--fs-title-3)/var(--lh-title-3) var(--font-ui); letter-spacing: var(--tr-title-3); color: var(--text); }
main .plist-group .count { font: var(--fw-regular) var(--fs-subhead)/var(--lh-subhead) var(--font-ui); letter-spacing: 0; color: var(--text-2); }
/* project rows: 17px Semibold title over a 13px subtitle */
main .plist .pname { font: var(--fw-semibold) 17px/22px var(--font-ui); letter-spacing: -0.012em; color: var(--text); }
main .plist .pmeta { font: var(--fw-regular) 13px/18px var(--font-ui); letter-spacing: 0; color: var(--text-2); }
/* tabs: Semibold when active */
.tabs button[aria-selected="true"] { font-weight: var(--fw-semibold); }
/* project page title: Bold (phone large title 28/34 stays; desktop header Title 3 16/22) */
.topbar h1 { font-weight: var(--fw-bold); letter-spacing: var(--tr-headline); }
/* modal / sheet titles: Bold Title 3 (20/25 phone, 16/22 desktop), primary text */
.sheet .sheet-head h2 { font: var(--fw-bold) var(--fs-title-3)/var(--lh-title-3) var(--font-ui); letter-spacing: var(--tr-title-3); color: var(--text); }
.sheet.notif-sheet .sheet-head h2, .notif-pop .notif-head h2 { font-weight: var(--fw-bold); }
.ce-sheet-head h3 { font: var(--type-sheet-title); letter-spacing: var(--tr-headline); color: var(--text); }
/* section headers: Bold */
main.grid .section-head h2, .dblock h3 { font-weight: var(--fw-bold); }
@media (max-width: 899px) {
  .topbar .topbar-id h1 { font-weight: var(--fw-bold); letter-spacing: var(--tr-title-1); }             /* 28/34 large project title */
  main.grid .pt-inner .section .section-head h2 { font-weight: var(--fw-bold); letter-spacing: -0.014em; } /* 19/24 in the 48px bar */
}
@media (min-width: 900px) {
  .topbar .topbar-id h1 { font-size: var(--fs-title-3); line-height: var(--lh-title-3); max-height: var(--lh-title-3); letter-spacing: var(--tr-title-3); }
  main.grid .section-head h2 { letter-spacing: var(--tr-headline); }
  main .plist-group { font-size: 18px; line-height: 24px; letter-spacing: -0.015em; }                  /* Kirby, 27 Nov: desktop 18/24 Bold */
}
