/* Vendored from skills/pinpoint-ui/templates/pinpoint.css — the base for House Style's interface.
   Refresh with: cp skills/pinpoint-ui/templates/pinpoint.css apps/house-style/web/pinpoint.css (keep this header). */
/* Pinpoint UI — drop-in tokens, components and rules for any web project.
   Defaults follow Apple's system palette and metrics. To brand it, change the four --accent* tokens.
   Class names are generic; map them to your components or rename them:
     .card .card-head .stack  .field .field-group  .btn .btn.sm .btn.primary .btn.tinted  .icon-btn
     .seg .tabs .chips .chip  .toolbar .grid-2  .form-actions .dialog-foot .page-actions  .lone
     .list .list-row  .switch  .sheet-layer .sheet .sheet-scrim  .topbar
   Load it after your base styles. Every value comes from DESIGN.md. */

:root{
  color-scheme:light dark;
  /* spacing — 4-pt grid on an 8-pt rhythm */
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-5:20px; --space-6:24px; --space-7:32px; --space-8:48px;
  --gap:16px; --row:8px; --btn-gap:12px; --pad:20px; --gutter:24px;
  /* controls */
  --field-h:44px; --btn-h:44px; --btn-sm:36px; --row-h:44px;
  /* colour roles (Apple system palette, light) */
  --bg:#F2F2F7; --surface:#FFFFFF; --surface-2:#FFFFFF; --fill:rgba(120,120,128,.12);
  --line:rgba(60,60,67,.18); --line-soft:rgba(60,60,67,.10);
  --text:#1C1C1E; --text-2:rgba(60,60,67,.80); --muted:rgba(60,60,67,.62); --placeholder:rgba(60,60,67,.45);
  --positive:#248A3D; --negative:#D70015; --warning:#C93400;
  /* the one accent — replace with the brand */
  --accent:#007AFF; --accent-strong:#0062CC; --accent-text:#0062CC; --accent-tint:rgba(0,122,255,.10);
  --focus:0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  /* type */
  --font:-apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --fs-title:28px; --fs-figure:28px; --fs-h2:20px; --fs-h3:16px; --fs-body:14px; --fs-sub:13px; --fs-caption:12px; --fs-label:11px;
  /* shape — concentric */
  --r-sm:8px; --r:10px; --r-lg:16px; --r-xl:20px; --r-sheet:24px; --r-pill:999px;
  /* elevation */
  --shadow-card:0 1px 2px rgba(0,0,0,.04), 0 8px 24px -12px rgba(0,0,0,.12);
  --shadow-pop:0 8px 28px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.06);
  --shadow-xs:0 1px 2px rgba(0,0,0,.08);
  /* motion */
  --ease-out:cubic-bezier(0.23,1,0.32,1); --ease-drawer:cubic-bezier(0.32,0.72,0,1); --ease-exit:cubic-bezier(.4,0,1,1);
  --dur-press:120ms; --dur-pop:150ms; --dur-ui:200ms; --dur-panel:240ms; --dur-swap:250ms;
}
@media (prefers-color-scheme:dark){ :root:not([data-theme=light]){
  --bg:#000000; --surface:#1C1C1E; --surface-2:#2C2C2E; --fill:rgba(120,120,128,.24);
  --line:rgba(84,84,88,.60); --line-soft:rgba(84,84,88,.35);
  --text:#FFFFFF; --text-2:rgba(235,235,245,.80); --muted:rgba(235,235,245,.62); --placeholder:rgba(235,235,245,.40);
  --positive:#30D158; --negative:#FF453A; --warning:#FF9F0A;
  --accent:#0A84FF; --accent-strong:#0A84FF; --accent-text:#4DA3FF; --accent-tint:rgba(10,132,255,.20);
  --shadow-card:inset 0 0 0 1px var(--line-soft); } }
:root[data-theme=dark]{
  --bg:#000000; --surface:#1C1C1E; --surface-2:#2C2C2E; --fill:rgba(120,120,128,.24);
  --line:rgba(84,84,88,.60); --line-soft:rgba(84,84,88,.35);
  --text:#FFFFFF; --text-2:rgba(235,235,245,.80); --muted:rgba(235,235,245,.62); --placeholder:rgba(235,235,245,.40);
  --positive:#30D158; --negative:#FF453A; --warning:#FF9F0A;
  --accent:#0A84FF; --accent-strong:#0A84FF; --accent-text:#4DA3FF; --accent-tint:rgba(10,132,255,.20);
  --shadow-card:inset 0 0 0 1px var(--line-soft); }
@media (max-width:900px){ :root{ --field-h:48px; --btn-h:48px; --btn-sm:44px; --fs-title:24px; --fs-figure:26px; --fs-h3:17px; --fs-body:16px; --fs-sub:15px; --fs-caption:13px; --fs-label:12px; --pad:16px; --gutter:16px; } }

/* ── base ─────────────────────────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;}
body{margin:0; background:var(--bg); color:var(--text); font:var(--fs-body)/1.45 var(--font); -webkit-font-smoothing:antialiased;}
.num, td, .figure{font-variant-numeric:tabular-nums;}
h1{font-size:var(--fs-title); font-weight:700; letter-spacing:-.02em; line-height:1.15; margin:0;}
h2{font-size:var(--fs-h2); font-weight:600; letter-spacing:-.01em; margin:0;}
h3{font-size:var(--fs-h3); font-weight:600; margin:0;}
.sub{color:var(--muted); font-size:var(--fs-sub); margin:4px 0 0;}
.label{font-size:var(--fs-label); font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted);}

/* one rhythm */
.page{padding:var(--gutter); max-width:1200px; margin:0 auto;}
.stack > * + *{margin-top:var(--gap);}
.row-cards{display:grid; gap:var(--gap); grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); align-items:stretch;}
.card{background:var(--surface); border-radius:var(--r-lg); box-shadow:var(--shadow-card); padding:var(--pad); display:flex; flex-direction:column; min-width:0;}
.card-head{margin-bottom:12px;}
.card-head:has(+ .field, + form){margin-bottom:24px;}
.card .note{margin-top:auto; padding-top:8px; color:var(--muted); font-size:var(--fs-caption);}
.figure{font-size:var(--fs-figure); font-weight:700; letter-spacing:-.01em; line-height:1.1; margin-top:8px;}

/* ── controls: one height ─────────────────────────────────────────────── */
.field{display:flex; flex-direction:column; gap:var(--row); min-width:0;}
.field > span{font-size:var(--fs-sub); font-weight:500; color:var(--text-2);}
.field > input:not([type=checkbox]):not([type=radio]):not([type=file]), .field > select, .field-group input{
  height:var(--field-h); width:100%; padding:0 14px; border:1px solid var(--line); border-radius:var(--r);
  background:var(--surface); color:var(--text); font:inherit; transition:border-color var(--dur-press), box-shadow var(--dur-press);}
.field > input::placeholder{color:var(--placeholder);}
.field > select{appearance:none; padding-right:40px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238E8E93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") !important;
  background-repeat:no-repeat !important; background-position:right 14px center !important;}
.field > input:focus-visible, .field > select:focus-visible, .field-group input:focus-visible{outline:0; border-color:var(--accent); box-shadow:var(--focus);}
@media (hover:hover){ .field > input:hover:not(:focus), .field > select:hover:not(:focus){border-color:color-mix(in srgb, var(--text) 30%, transparent);} }
@media (max-width:600px){ .field > input, .field > select, .field-group input{font-size:16px;} } /* iOS won't zoom */

.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:var(--btn-h); padding:0 18px; white-space:nowrap;
  border:1px solid var(--line); border-radius:var(--r); background:var(--surface); color:var(--text); font:600 var(--fs-body) var(--font); cursor:pointer;
  transition:background-color var(--dur-press), border-color var(--dur-press), transform var(--dur-press) var(--ease-out); touch-action:manipulation;}
.btn:active{transform:scale(.98);}
.btn.sm{min-height:var(--btn-sm); padding:0 14px;}
.btn.primary{background:var(--accent-strong); border-color:transparent; color:#fff;}
.btn.tinted{background:var(--accent-tint); border-color:transparent; color:var(--accent-text);}
.btn:focus-visible{outline:0; box-shadow:var(--focus);}
@media (hover:hover){ .btn:hover{background:var(--fill);} .btn.primary:hover{background:color-mix(in srgb, var(--accent-strong) 90%, black);} .btn.tinted:hover{background:color-mix(in srgb, var(--accent-tint) 70%, var(--accent) 12%);} }
.icon-btn{width:var(--field-h); height:var(--field-h); flex:none; display:grid; place-items:center; border:1px solid var(--line); border-radius:var(--r); background:var(--surface); color:var(--text-2); cursor:pointer;}

/* segmented control and tabs: one shape (track 16 with 6px padding → pills 10, concentric) */
.seg, .tabs{display:flex; gap:4px; padding:6px; background:var(--fill); border-radius:var(--r-lg); width:max-content; max-width:100%; overflow-x:auto; scrollbar-width:none;}
.seg > button, .tabs > button{min-height:36px; padding:0 14px; border:0; border-radius:var(--r); background:transparent; color:var(--text-2); font:600 var(--fs-sub) var(--font); white-space:nowrap; cursor:pointer; transition:background-color var(--dur-press), color var(--dur-press);}
.seg > [aria-pressed=true], .seg > .on, .tabs > [aria-selected=true]{background:var(--surface); color:var(--accent-text); box-shadow:var(--shadow-xs);}

/* switch: fixed shape, never stretched */
.switch{position:relative; flex:none; width:51px; height:31px; min-height:0 !important; border:0; border-radius:var(--r-pill); background:var(--fill); cursor:pointer; transition:background-color var(--dur-ui);}
.switch::before{content:""; position:absolute; left:2px; top:50%; width:27px; height:27px; border-radius:50%; background:#fff; box-shadow:0 2px 4px rgba(0,0,0,.2); transform:translate(0,-50%); transition:transform var(--dur-ui) var(--ease-out);}
.switch[aria-checked=true]{background:#34C759;}
.switch[aria-checked=true]::before{transform:translate(20px,-50%);}
.switch::after{content:""; position:absolute; inset:-8px;} /* tap area */

/* lists like Settings */
.list{background:var(--surface); border-radius:var(--r-lg); box-shadow:var(--shadow-card); overflow:hidden;}
.list-row{display:flex; align-items:center; gap:12px; min-height:var(--row-h); padding:10px 16px; position:relative;}
.list-row + .list-row::before{content:""; position:absolute; top:0; right:0; left:var(--sep-inset, 16px); border-top:1px solid var(--line-soft);}
.list-row .value{margin-left:auto; color:var(--text-2);}
.list-row .tile{width:30px; height:30px; border-radius:var(--r-sm); display:grid; place-items:center; background:var(--accent-tint); color:var(--accent-text); flex:none;}
.list-row:has(.tile){--sep-inset:58px;}

/* top bar with material */
.topbar{position:sticky; top:0; z-index:50; display:flex; align-items:center; gap:12px; min-height:56px; padding:8px var(--gutter);
  background:color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter:saturate(180%) blur(20px); -webkit-backdrop-filter:saturate(180%) blur(20px); border-bottom:1px solid var(--line-soft);}

/* grouped controls (‹ date ›): label on the group's edge, main box takes the rest */
.field-group{display:flex; flex-direction:column; gap:var(--row);}
.field-group > .row{display:flex; gap:8px; align-items:stretch;}
.field-group > .row > input{flex:1 1 auto; min-width:0;}

/* ── phones: everything shares its line or reaches both edges ─────────── */
@media (max-width:600px){
  .seg, .tabs{width:100%;}
  .seg > button, .tabs > button{flex:1 0 0; min-width:max-content;}
  .chips{display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:8px;}
  .chip{flex:1 1 auto;}

  .form-actions{display:flex; flex-direction:column-reverse; gap:var(--btn-gap);}
  .form-actions > .btn{width:100%;}

  .dialog-foot, .page-actions{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,2fr); gap:var(--btn-gap);}
  .dialog-foot > *, .page-actions > *{width:100%; min-width:0; margin:0;}
  .dialog-foot > button:only-of-type, .page-actions > button:only-of-type{grid-column:1/-1;}
  .dialog-foot:has(> button:nth-of-type(3)), .page-actions:has(> button:nth-of-type(3)){grid-template-columns:repeat(2,minmax(0,1fr));}
  .dialog-foot:has(> button:nth-of-type(3)) > button:last-of-type, .page-actions:has(> button:nth-of-type(3)) > button:last-of-type{grid-column:1/-1; order:-1;}
  .dialog-foot > :not(button), .page-actions > :not(button){grid-column:1/-1; order:-2; display:flex; justify-content:space-between; align-items:baseline;}

  .lone, .card-head > .btn, .card > .btn{width:100%;}

  .toolbar{display:flex; flex-wrap:wrap; gap:12px;}
  .toolbar > *{flex:1 1 100%; min-width:0;}
  .toolbar > .field{flex:1 1 calc(50% - 6px);}
  .toolbar > .field:has(> input[type=search], > input[type=text]){flex-basis:100%;}

  .grid-2{grid-template-columns:repeat(2,minmax(0,1fr));}
  .grid-2 > :last-child:nth-child(odd){grid-column:1/-1;}
}
@media (min-width:601px){ .form-actions, .dialog-foot, .page-actions{display:flex; justify-content:flex-end; gap:var(--btn-gap);} }
.grid-2{display:grid; gap:16px; grid-template-columns:repeat(2,minmax(0,1fr));}
.toolbar{display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px;}

/* busy buttons keep their width and say they're working */
.btn[aria-busy=true]{pointer-events:none; opacity:.8;}
.btn[aria-busy=true]::before{content:""; width:14px; height:14px; border-radius:50%; border:2px solid currentColor; border-right-color:transparent; animation:pp-spin .7s linear infinite;}
@keyframes pp-spin{to{transform:rotate(360deg);}}

/* sticky hover off on touch */
@media (hover:none){ .btn:hover{background:var(--surface);} .btn.primary:hover{background:var(--accent-strong);} .btn.tinted:hover{background:var(--accent-tint);} }

/* ── bottom sheet: slides in on the drawer curve, out in 200ms ────────── */
.sheet-scrim{position:fixed; inset:0; z-index:199; background:rgba(0,0,0,.32); transition:opacity var(--dur-panel);}
@starting-style{ .sheet-scrim{opacity:0;} }
.sheet{position:fixed; left:0; right:0; bottom:0; z-index:200; max-height:82dvh; overflow:auto; overscroll-behavior:contain;
  background:var(--surface); border-radius:var(--r-sheet) var(--r-sheet) 0 0; padding:10px 16px calc(16px + env(safe-area-inset-bottom,0px));
  transition:transform var(--dur-panel) var(--ease-drawer);}
@starting-style{ .sheet{transform:translateY(100%);} }
.sheet::before{content:""; display:block; width:36px; height:5px; margin:0 auto 12px; border-radius:3px; background:var(--line);}
.sheet button{touch-action:manipulation; -webkit-tap-highlight-color:transparent;}
.sheet-layer.out{pointer-events:none;}
.sheet-layer.out .sheet{transform:translateY(100%); transition:transform 200ms var(--ease-exit);}
.sheet-layer.out .sheet-scrim{opacity:0; transition:opacity 200ms ease-in;}
@media (min-width:901px){ .sheet{left:50%; right:auto; bottom:auto; top:50%; width:min(440px, calc(100vw - 32px)); border-radius:var(--r-xl); transform:translate(-50%,-50%); box-shadow:var(--shadow-pop);}
  @starting-style{ .sheet{transform:translate(-50%,-48%) scale(.96); opacity:0;} }
  .sheet::before{display:none;} .sheet-layer.out .sheet{transform:translate(-50%,-50%) scale(.97); opacity:0; transition:opacity 150ms, transform 150ms;} }

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

/* ── Phones: tables too wide for the screen become stacked lists (with templates/fit-tables.js) ──
   First column = row title; other columns = "label … value"; actions top-right; "—" lines hidden. */
@media (max-width:600px){
  table.wk-stack{display:block; width:100%;}
  table.wk-stack thead{display:none;}
  table.wk-stack tbody{display:block;}
  table.wk-stack tr{display:grid; grid-template-columns:minmax(0,1fr) auto; column-gap:12px; row-gap:6px; align-items:center; padding:14px 16px; border-bottom:1px solid var(--line-soft);}
  table.wk-stack td{display:block; grid-column:1 / -1; padding:0; border:0; text-align:right; position:relative; font-size:var(--fs-sub); overflow-wrap:anywhere;}
  table.wk-stack td:first-child{grid-column:1; grid-row:1; text-align:left; font-weight:600; font-size:var(--fs-body);}
  table.wk-stack td:not(:first-child)[data-label]:not([data-label=""]){padding-left:50%; min-height:20px;}
  table.wk-stack td:not(:first-child)[data-label]:not([data-label=""])::before{content:attr(data-label); position:absolute; left:0; top:0; width:48%; text-align:left; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  table.wk-stack td[data-label=""]:not(:first-child){grid-column:2; grid-row:1; justify-self:end;}
  table.wk-stack td[data-blank]:not(:first-child):not([data-label=""]){display:none;}
}
