/* packOS design system layer for Prospect Studio.
   Loaded after styles.css. Refines shared primitives (type, buttons, fields, panels,
   tables, status pills, focus, toast) using the --pk-* brand tokens. Scoped with
   :where() so module-specific rules keep their precedence. */
:root{
  --ps-ink2:#414d57;
  --ps-hover:color-mix(in srgb,var(--pk-card2) 55%,var(--pk-card));
  --ps-field-line:color-mix(in srgb,var(--pk-muted) 70%,var(--pk-card));
  --ps-shadow:0 1px 2px rgba(16,24,32,.05);
  --ps-pop:0 16px 40px rgba(16,24,32,.16),0 2px 6px rgba(16,24,32,.08);
  --ps-ok-ink:var(--pk-accent);
  --ps-ok-bg:var(--pk-fillTint10);
  --ps-warn-ink:#7a4d00;
  --ps-warn-bg:color-mix(in srgb,var(--pk-warnFill) 18%,var(--pk-card));
  --ps-bad-ink:var(--pk-errText);
  --ps-bad-bg:color-mix(in srgb,var(--pk-errFill) 14%,var(--pk-card));
  --ps-neutral-bg:var(--pk-card2);
  --ps-info-ink:#1a58a0;
  --ps-info-bg:#e6eefa;
  /* Primary hover: a darker teal, not near-black (audit item 5). 6.9:1 against white text. */
  --ps-accent-hover:color-mix(in srgb,var(--pk-accent) 82%,#000);
}
body{font-feature-settings:"tnum";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
:where(.layout,#modal,.auth) :is(h1,h2,h3){text-wrap:balance}
:where(.layout,#modal) p{text-wrap:pretty}

/* Focus: one visible ring for every keyboard-reachable control. */
:where(.layout,#modal,#toast,.auth) :is(a,button,input,select,textarea,summary,[tabindex]):focus-visible{outline:2px solid var(--pk-accent);outline-offset:2px}

/* Buttons */
:where(.layout,#modal,.auth) button{border-radius:8px;border-color:var(--pk-line2);font-weight:600;transition:background-color .12s ease,border-color .12s ease}
:where(.layout,#modal,.auth) button:hover{border-color:var(--ps-field-line);background:var(--ps-hover)}
:where(.layout,#modal,.auth) button.primary{background:var(--pk-accent);border-color:var(--pk-accent);color:#fff}
/* styles.css darkens the hover text to fillInk; keep it white on the darker teal. */
:where(.layout,#modal,.auth) button.primary:hover{background:var(--ps-accent-hover);border-color:var(--ps-accent-hover);color:#fff}
/* A disabled primary reads as unavailable: neutral fill and muted text instead of pale teal with white text. */
:where(.layout,#modal,.auth) button.primary:disabled:not([aria-busy="true"]){background:var(--pk-card2);border-color:var(--pk-line2);color:var(--pk-muted);opacity:1}
:where(.layout,#modal,.auth) button:disabled:not([aria-busy="true"]){cursor:not-allowed}
/* Phones: every control is at least a 44px tap target. Zero specificity, so a screen that sizes a
   control on purpose keeps its own rule. */
@media(max-width:760px){:where(.layout,#modal,.auth) :is(button,select,input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=hidden]),summary){min-height:44px}}

/* Fields: borders meet 3:1 against the card; native controls use the brand accent. */
:where(.layout,#modal,.auth){accent-color:var(--pk-accent)}
:where(.layout,#modal,.auth) :is(input:not([type=checkbox],[type=radio],[type=range],[type=color]),select,textarea){border-color:var(--ps-field-line);border-radius:8px}
:where(.layout,#modal,.auth) input::placeholder{color:var(--pk-muted)}

/* Surfaces */
:where(.layout,#modal) .panel{border-color:var(--pk-line);border-radius:12px;box-shadow:var(--ps-shadow)}
:where(.layout,#modal) .stat{border-color:var(--pk-line);border-radius:12px;box-shadow:var(--ps-shadow)}
:where(.layout) .stat .value{font-size:28px;font-weight:650;letter-spacing:-.02em}
:where(.layout,#modal) .callout{border-radius:10px;font-size:13px}

/* Type: page titles read as names; small text stays at 12px or larger. */
:where(.layout) .hero h1{font-size:32px;font-weight:700;letter-spacing:-.025em}
:where(.layout,#modal) .small{font-size:12px}
:where(.layout,#modal) .eyebrow{letter-spacing:.04em}

/* Tables: sentence-case headers, brand hairlines, quiet hover. */
:where(.layout,#modal) th{font-size:12px;font-weight:600;letter-spacing:.02em;text-transform:none;color:var(--pk-muted);background:var(--pk-card);border-bottom:1px solid var(--pk-line)}
:where(.layout,#modal) td{border-top-color:var(--pk-line)}

/* Legacy .pill: a neutral tag (an owner name, a count). Status pills now also carry .ui-chip below; these tone
   rules only cover a toned pill a screen has not migrated yet, with the same shape grammar. */
:is(#app,#modal) .pill:not(.ui-chip){display:inline-flex;align-items:center;gap:6px;border-radius:6px;padding:3px 8px;font-size:12px;background:var(--ps-neutral-bg);color:var(--ps-ink2)}
:is(#app,#modal) :is(.pill.A,.pill.accepted,.pill.done,.pill.qualified,.pill.approved_internal):not(.ui-chip){background:var(--ps-ok-bg);color:var(--ps-ok-ink)}
:is(#app,#modal) :is(.pill.B,.pill.queued,.pill.running,.pill.needs_changes,.pill.stale,.pill.held,.pill.decision_needed):not(.ui-chip){background:var(--ps-warn-bg);color:var(--ps-warn-ink)}
:is(#app,#modal) :is(.pill.failed,.pill.needs_review,.pill.Excluded,.pill.excluded):not(.ui-chip){background:var(--ps-bad-bg);color:var(--ps-bad-ink)}
:is(#app,#modal) :is(.pill.A,.pill.accepted,.pill.done,.pill.qualified,.pill.approved_internal,.pill.B,.pill.queued,.pill.running,.pill.needs_changes,.pill.stale,.pill.held,.pill.decision_needed,.pill.failed,.pill.needs_review,.pill.Excluded,.pill.excluded):not(.ui-chip)::before{content:"";flex:none;width:6px;height:6px;border-radius:50%;background:currentColor}
:is(#app,#modal) :is(.pill.B,.pill.queued,.pill.running,.pill.needs_changes,.pill.stale,.pill.held,.pill.decision_needed):not(.ui-chip)::before{background:transparent;box-shadow:inset 0 0 0 1.5px currentColor}
:is(#app,#modal) :is(.pill.failed,.pill.needs_review,.pill.Excluded,.pill.excluded):not(.ui-chip)::before{border-radius:2px;transform:rotate(45deg)}

/* Status chip: the one status component (design artboards' .chip). 22px, 6px radius, soft fill, and a shape
   beside a word so state never relies on hue: filled dot = done, ring = waiting, diamond = blocked, dash = neutral.
   Old per-screen classes (sr-status, lt-status, ...) stay on the element as aliases for tests and scripts.
   Specificity stays at one class (two with a modifier) so screens can still position a chip. */
:where(.layout,#modal,.gs-palette) .ui-chip{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-height:22px;max-width:100%;padding:2px 8px;border:0;border-radius:6px;font-size:12px;font-weight:600;line-height:18px;letter-spacing:0;text-transform:none;white-space:nowrap;vertical-align:middle;flex:none;justify-self:start;background:var(--ps-neutral-bg);color:var(--ps-ink2)}
:where(.layout,#modal,.gs-palette) .ui-chip::before{content:"";flex:none;box-sizing:border-box;width:6px;height:6px;border-radius:50%;background:currentColor}
:where(.layout,#modal,.gs-palette) .ui-chip.is-done{background:var(--ps-ok-bg);color:var(--ps-ok-ink)}
:where(.layout,#modal,.gs-palette) .ui-chip.is-info{background:var(--ps-info-bg);color:var(--ps-info-ink)}
:where(.layout,#modal,.gs-palette) .ui-chip.is-wait{background:var(--ps-neutral-bg);color:var(--ps-ink2)}
:where(.layout,#modal,.gs-palette) .ui-chip.is-warn{background:var(--ps-warn-bg);color:var(--ps-warn-ink)}
:where(.layout,#modal,.gs-palette) :is(.ui-chip.is-wait,.ui-chip.is-warn)::before{background:transparent;box-shadow:inset 0 0 0 1.5px currentColor}
:where(.layout,#modal,.gs-palette) .ui-chip.is-blocked{background:var(--ps-bad-bg);color:var(--ps-bad-ink)}
:where(.layout,#modal,.gs-palette) .ui-chip.is-blocked::before{border-radius:2px;transform:rotate(45deg)}
:where(.layout,#modal,.gs-palette) .ui-chip.is-neutral{background:var(--ps-neutral-bg);color:var(--ps-ink2)}
:where(.layout,#modal,.gs-palette) .ui-chip.is-neutral::before{width:8px;height:2px;border-radius:2px}
/* A chip that carries a longer sentence (a gate reason, a schedule problem) may wrap inside narrow cells. */
:where(.layout,#modal,.gs-palette) .ui-chip.is-wrap{flex:0 1 auto;white-space:normal;text-align:left}
:where(.layout,#modal,.gs-palette) .ui-chip.is-wrap::before{margin-top:6px;align-self:flex-start}

/* Panel/card: one surface with an optional header row (title, one-line purpose, actions on the right). */
:where(.layout,#modal) .ui-panel{box-sizing:border-box;background:var(--pk-card);border:1px solid var(--pk-line);border-radius:12px;box-shadow:var(--ps-shadow);color:var(--pk-ink)}
:where(.layout,#modal) .ui-panel-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:16px 20px;border-bottom:1px solid var(--pk-line)}
:where(.layout,#modal) .ui-panel-head :is(h2,h3){margin:0;font-size:16px;font-weight:650;letter-spacing:0}
:where(.layout,#modal) .ui-panel-head p{margin:2px 0 0;font-size:13px;color:var(--ps-ink2)}
:where(.layout,#modal) .ui-panel-body{padding:16px 20px}

/* Empty state: says why, and offers the next step (design "States" artboard). */
:where(.layout,#modal) .ui-empty{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:10px;padding:32px 24px;text-align:center;color:var(--pk-ink)}
:where(.layout,#modal) .ui-empty-mark{display:grid;place-items:center;flex:none;box-sizing:border-box;width:44px;height:44px;border-radius:12px;border:1.5px dashed var(--pk-line2);color:var(--pk-accent)}
/* The tile holds a ring: nothing is waiting here yet (the shape grammar of the status chip). */
:where(.layout,#modal) .ui-empty-mark:empty::before{content:"";width:14px;height:14px;border-radius:50%;box-shadow:inset 0 0 0 2px currentColor}
:where(.layout,#modal) .ui-empty-title{margin:0;font-size:16px;font-weight:650;letter-spacing:0}
:where(.layout,#modal) .ui-empty-body{margin:0;max-width:44ch;font-size:13px;line-height:1.5;color:var(--ps-ink2)}
:where(.layout,#modal) .ui-empty-action{margin-top:6px}
:where(.layout,#modal) td>.ui-empty{padding:20px 12px}
:where(.layout,#modal) .ui-empty>.ui-chip{margin-bottom:2px}

/* Info tip (infoTipHTML/bindInfoTips in capture-ui.mjs): one small round ⓘ beside a title; the explanation opens on
   demand instead of sitting on the page as a paragraph. The popover is fixed-positioned by script inside the viewport;
   at 760px and below it is a full-width block under its button and the button is a 44px target. The tip ignores the
   pointer, so it never stops a click on a control it overlaps. */
:where(.layout,#modal) .ui-info{display:inline-flex;align-items:center;vertical-align:middle;flex:none}
:where(.layout,#modal) .ui-info-btn{display:inline-grid;place-items:center;box-sizing:border-box;width:24px;height:24px;min-height:0;margin:0;padding:0;border:0;border-radius:50%;background:transparent;color:var(--pk-muted);cursor:pointer}
:where(.layout,#modal) .ui-info-btn:hover{background:var(--pk-card2);color:var(--pk-ink)}
:where(.layout,#modal) .ui-info-btn[aria-expanded="true"]{background:var(--ps-ok-bg);color:var(--ps-ok-ink)}
:where(.layout,#modal) .ui-info-i{display:grid;place-items:center;box-sizing:border-box;width:16px;height:16px;border:1.5px solid currentColor;border-radius:50%;font:italic 700 10.5px/1 Georgia,"Times New Roman",serif}
:where(.layout,#modal) .ui-info-pop{position:fixed;z-index:60;pointer-events:none;box-sizing:border-box;width:max-content;max-width:min(340px,calc(100vw - 16px));padding:10px 12px;border:1px solid var(--pk-line);border-radius:10px;background:var(--pk-card);box-shadow:var(--ps-pop);color:var(--pk-ink);font-size:13px;font-weight:400;font-style:normal;line-height:1.5;letter-spacing:0;text-align:left;text-transform:none;white-space:normal;overflow-wrap:anywhere}
:where(.layout,#modal) .ui-info-pop[hidden]{display:none}
@media(max-width:760px){
 :where(.layout,#modal) .ui-info-btn{width:44px;height:44px;margin:-10px}
 :where(.layout,#modal) .ui-info-pop{max-width:none}
}

/* Visually hidden text that screen readers still announce. */
.ui-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}

/* Numerals: mono only for domains, emails and table counts (never inside a sentence). */
:where(.layout,#modal) .ui-num{font-family:var(--pk-mono);font-variant-numeric:tabular-nums;font-feature-settings:normal}

/* Form labels: sentence case, 12.5px, semibold, everywhere in the app. The legacy uppercase 10px rule in
   styles.css (.facts label, .field-label, .form-grid label) stays for any standalone page that still uses it. */
:where(.layout,#modal) :is(.facts label,.field-label,.form-grid label){font-size:13px;font-weight:600;letter-spacing:0;text-transform:none;color:var(--ps-ink2)}

/* Navigation (classic shell): the selected item sits on the sunk surface with a teal icon, not a coloured edge bar.
   The rep workspace shell keeps its own nav styling in rep-experience.css. Layout lives in styles.css "App shell". */
body:not([data-rep-workspace="true"]) #app .nav .nav-link.active{background:var(--pk-card2);color:var(--pk-ink);box-shadow:none;font-weight:600}
body:not([data-rep-workspace="true"]) #app .nav .nav-link.active .nav-icon{color:var(--pk-accent)}
/* Visually hidden text that screen readers still announce (nav count descriptions). */
:where(.layout) .nav-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* Toast: brand ink surface. Errors stay until dismissed (see toast() in app.mjs). */
#toast{background:var(--pk-ink);color:#fff;border-radius:10px;box-shadow:var(--ps-pop);align-items:center;gap:12px}
#toast.error{background:var(--pk-ink)}
#toast.error::before{content:"";flex:none;width:8px;height:8px;border-radius:2px;transform:rotate(45deg);background:var(--pk-errFill)}
#toast .toast-dismiss{display:grid;place-items:center;flex:none;width:28px;height:28px;margin:-4px -8px -4px 0;padding:0;border:0;border-radius:6px;background:transparent;color:inherit}
#toast .toast-dismiss:hover{background:rgba(255,255,255,.12)}

@media(prefers-reduced-motion:reduce){:where(.layout,#modal,.auth) button{transition:none}}
/* An empty state's mark can carry the destination's icon instead of the plain ring. */
:where(.layout,#modal) .ui-empty-icon{border-style:solid;border-color:transparent;background:var(--pk-fillTint10)}
