:root {
  color-scheme: light;
  --page:#f5f5f7;
  --surface:#fff;
  --ink:#161c2a;
  --muted:#526074;
  --line:#e1e5ec;
  --accent:#0066cc;
  --accent-wash:#eaf3ff;
  --ease:cubic-bezier(.2,.75,.25,1);
  --motion-quick:160ms;
  --motion-dialog:220ms;
  --control-fill:#f2f2f5;
  --control-border:#d8d9df;
  --control-radius:11px;
  --raised-radius:18px;
  --elevation:0 12px 32px #0002;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color:var(--ink);
  background:var(--page);
  font-variant-numeric:tabular-nums;
}
* { box-sizing:border-box }
body,h1,h2,h3,p { margin:0 }
a { color:inherit; text-underline-offset:.2em }
button,input,select { font:inherit; color:inherit }
button,a { touch-action:manipulation }
button { cursor:pointer }
:focus-visible { outline:2px solid var(--accent); outline-offset:3px }
::selection { background:#dce6ff; color:var(--ink) }
h1 { font-size:2.6rem; line-height:1.13; letter-spacing:-.04em; overflow-wrap:anywhere }
h2 { font-size:1.12rem; line-height:1.3; letter-spacing:-.025em }
.sr-only,.skip:not(:focus) { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap }
.skip { position:fixed; top:10px; left:10px; z-index:4; padding:10px; background:white }
.sidebar { position:fixed; inset:0 auto 0 0; display:flex; flex-direction:column; width:232px; padding:25px 16px 18px; overflow:auto; border-right:1px solid var(--line); background:var(--surface) }
.brand { display:flex; align-items:center; gap:11px; padding:0 8px; text-decoration:none; font-size:1.13rem; font-weight:770; letter-spacing:-.035em }
.brand-mark { display:grid; place-items:center; width:40px; height:40px; flex:none; background:var(--accent); border-radius:11px; color:#fff }
.brand-mark svg { width:27px; height:27px }
#navigation { display:grid; gap:4px; margin:35px 0 20px }
.nav-link { display:flex; align-items:center; gap:11px; min-height:44px; padding:8px 11px; border-radius:var(--control-radius); color:var(--muted); font-size:.91rem; font-weight:650; text-decoration:none }
.nav-link svg { width:18px; height:18px; flex:none }
.nav-link[aria-current] { background:var(--accent-wash); color:var(--accent) }
.menu-toggle { display:none !important }
.workspace { margin-left:232px }
main { max-width:1510px; margin:auto; padding:35px 36px 48px }
main:focus { outline:none }
.page-head { display:flex; justify-content:space-between; align-items:center; gap:18px; margin:0 0 27px }
.page-head p { margin-top:7px; color:var(--muted) }
.button { display:inline-flex; justify-content:center; align-items:center; gap:7px; min-height:44px; padding:8px 15px; border-radius:var(--control-radius); border:1px solid transparent; background:var(--control-fill); text-decoration:none; white-space:nowrap; font-size:.94rem; font-weight:650; transition:background-color .16s var(--ease),transform .16s var(--ease) }
.primary { background:var(--accent); border-color:var(--accent); color:white }
.button:active,.icon-button:active { filter:brightness(.93); transform:scale(.98) }
.button svg,.icon-button svg { width:17px; height:17px; flex:none }
.button svg path,.icon-button svg path { stroke:currentColor; stroke-width:1.7; stroke-linecap:round; fill:none }
.icon-button { display:inline-grid; place-items:center; width:44px; height:44px; flex:none; border:0; border-radius:50%; background:var(--control-fill); color:var(--muted); }
.icon-button[hidden] { display:none }
.metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); margin:0 0 22px; background:var(--surface); border:1px solid var(--line); border-radius:var(--raised-radius) }
.metrics div { padding:17px 20px; min-width:0 }
.metrics div+div { border-left:1px solid var(--line) }
.metrics dt { color:var(--muted); font-size:.85rem; font-weight:620 }
.metrics dd { margin:3px 0 0; font-size:1.85rem; font-weight:735; letter-spacing:-.04em; overflow-wrap:anywhere }
.overview-grid { display:grid; grid-template-columns:minmax(0,2.65fr) minmax(0,1fr); gap:18px }
.panel { min-width:0; margin:0 0 20px; background:var(--surface); border:1px solid var(--line); border-radius:var(--raised-radius) }
.panel-head { min-height:56px; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:15px 19px }
.panel-head p,.subtle { color:var(--muted); font-size:.83rem }
.panel-head p { margin-top:3px }
.pipeline { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); padding:0 12px 13px }
.pipeline a { display:flex; flex-direction:column; align-items:center; text-align:center; min-width:0; min-height:98px; padding:8px 5px; border-radius:8px; text-decoration:none; transition:background-color .16s var(--ease) }
.pipeline-icon { display:grid; place-items:center; height:31px; width:31px; border-radius:8px; background:var(--accent-wash); color:#2b4caf }
.pipeline-icon svg { width:16px; height:16px }
.pipeline b { margin-top:4px; font-size:1.16rem }
.pipeline small { font-size:.73rem; font-weight:650; overflow-wrap:anywhere; line-height:1.28 }
.attention-list { margin:0; padding:0 17px 10px; list-style:none }
.attention-list a { display:block; min-height:44px; padding:7px 10px; border-radius:8px; background:#fff5eb; color:#763f18; text-decoration:none; overflow-wrap:anywhere }
.attention-list li+li { margin-top:5px }
.attention-list small { display:block; font-size:.77rem; font-weight:550 }
.attention-clear,.more { display:block; padding:0 19px 12px; color:var(--muted); font-size:.86rem }
.table-tools { display:flex; align-items:center; flex-wrap:wrap; gap:8px }
input,select,.search-box {
  min-height:44px;
  max-width:100%;
  border:1px solid var(--control-border);
  border-radius:var(--control-radius);
  background:var(--control-fill);
  font-size:16px;
}
input,select { padding:9px 12px }
input::placeholder { color:var(--muted); opacity:1 }
input,select { caret-color:var(--accent) }
input:focus,select:focus,.search-box:focus-within {
  border-color:var(--accent);
  outline:2px solid var(--accent);
  outline-offset:1px;
  background-color:var(--surface);
}
input:user-invalid { border-color:#ad2924 }
input:disabled,select:disabled { opacity:.65; cursor:default }
select {
  appearance:none;
  padding-inline-end:36px;
  color:var(--ink);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23455469' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 8 3-3 3 3m-6 4 3 3 3-3'/%3E%3C/svg%3E");
  background-position:right 10px center;
  background-repeat:no-repeat;
  background-size:19px 19px;
}
select:focus { background-color:var(--surface) }
#filter { width:185px }
.search-box { display:flex; align-items:center; gap:8px; width:235px; padding:0 0 0 12px; color:var(--muted) }
.search-box svg { flex:none }
.search-box input { flex:1; width:100%; min-width:0; min-height:42px; padding:0 8px 0 0; border:0; outline:0; background:transparent }
.search-box input::-webkit-search-cancel-button { appearance:none }
.clear-search { background:transparent }
.clear-search svg { width:18px; height:18px; padding:2px; border-radius:50%; background:#dfe1e8 }
#filter + .picker-trigger { min-width:175px }
.field input[type="date"] { min-width:0; text-align:start }
.field input[type="date"]::-webkit-date-and-time-value { text-align:start }
@media (forced-colors:active) {
  select { appearance:auto; background-image:none; padding-inline-end:12px }
}
table { border-collapse:collapse; width:100%; text-align:left }
th,td { padding:11px 13px; border-top:1px solid var(--line); overflow-wrap:anywhere }
th:first-child,td:first-child { padding-left:19px }
th { background:#f7f8fb; color:var(--muted); font-size:.77rem; font-weight:700 }
td { font-size:.91rem }
td a { font-weight:730; text-decoration:none }
td small { display:block; margin-top:2px; color:var(--muted); font-size:.77rem }
td .overdue { color:#8a4315; font-weight:650 }
.tag { display:inline-block; padding:3px 8px; border-radius:5px; background:#eef1f4; color:#405064; font-size:.76rem; font-weight:700 }
.stage-stores,.stage-production { background:#edf2ff; color:#2647a8 }
.stage-quality,.amber { background:#fff1e3; color:#824416 }
.stage-dispatch { background:#eaf6f6; color:#195d63 }
.stage-finance { background:#f1edfd; color:#5b3ba0 }
.stage-closed,.green { background:#e8f5ec; color:#256444 }
.empty { padding:26px 19px; border-top:1px solid var(--line); color:var(--muted) }
.back-link { margin-bottom:9px }
.detail-grid { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(0,1fr); gap:20px }
.next { padding:19px; background:#f0f4ff; border-color:#d4defb }
.next p { margin:7px 0 14px; color:#405577 }
.next .button { margin:0 7px 5px 0; white-space:normal; text-align:left }
.facts { margin:0; padding:0 19px 8px }
.facts div { display:flex; justify-content:space-between; gap:14px; padding:10px 0; border-top:1px solid var(--line); font-size:.9rem }
.facts dt,.facts dd { overflow-wrap:anywhere }
.facts dt { color:var(--muted) }
.facts dd { margin:0; text-align:right; font-weight:680 }
.events { margin:0; padding:0 19px; list-style:none }
.events li { padding:12px 0; border-top:1px solid var(--line); overflow-wrap:anywhere }
.events p { font-size:.92rem }
.events time { display:block; margin-top:3px; color:var(--muted); font-size:.79rem }
dialog { width:min(480px,calc(100% - 28px)); max-height:calc(100dvh - 28px); padding:20px; overflow:auto; border:1px solid var(--line); border-radius:var(--raised-radius); background:var(--surface); color:var(--ink); box-shadow:var(--elevation) }
dialog::backdrop { background:#15151b55 }
.dialog-head h2 { font-size:1.33rem }
.dialog-actions { border-top:1px solid var(--line); padding-top:14px }
.dialog-head,.dialog-actions { display:flex; align-items:center; justify-content:space-between; gap:10px }
.dialog-actions { justify-content:flex-end; margin-top:16px }
#fields { display:grid; gap:12px; margin-top:12px }
.field { display:grid; gap:5px; font-size:.91rem; font-weight:650 }
.field input,.field select { width:100%; font-weight:400 }
.error { margin-top:10px; color:#a02922; overflow-wrap:anywhere }
.error:empty { display:none }
@media (hover:hover) and (pointer:fine) {
  .nav-link:hover,.pipeline a:hover { background:var(--control-fill) }
  .icon-button:hover,.button:hover { background:#e7e9ee }
  .nav-link[aria-current]:hover { background:#e3ebff }
  .primary:hover { background:#005bb7 }
  select:hover { border-color:#aeb6c3 }
  .attention-list a:hover { background:#ffead5 }
  tbody tr:hover { background:#f8faff }
  td a:hover { color:var(--accent); text-decoration:underline }
}
@media (max-width:1160px) {
  .sidebar { width:205px }
  .workspace { margin-left:205px }
  main { padding-inline:23px }
  .overview-grid { grid-template-columns:minmax(0,2.4fr) minmax(0,1fr) }
  th,td { padding-inline:8px }
}
@media (max-width:970px) {
  .overview-grid { display:block }
  .attention-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr)); gap:8px }
  .attention-list li+li { margin:0 }
}
@media (max-width:800px) {
  .sidebar { position:relative; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:9px; width:auto; padding:max(11px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 11px max(14px,env(safe-area-inset-left)); border-right:0; border-bottom:1px solid var(--line); overflow:visible }
  .brand { padding:0 }
  .menu-toggle { display:inline-flex !important }
  #navigation { display:none; position:absolute; z-index:2; top:calc(100% + 6px); right:max(14px,env(safe-area-inset-right)); width:min(268px,calc(100% - 28px)); max-height:calc(100dvh - 84px); overflow:auto; margin:0; padding:6px; border:1px solid var(--line); border-radius:var(--raised-radius); background:var(--surface); box-shadow:var(--elevation); }
  .menu-toggle[aria-expanded="true"] { background:var(--accent-wash); color:var(--accent) }
  .menu-toggle[aria-expanded="true"] + #navigation { display:grid }
  .workspace { margin:0 }
  main { padding-top:23px }
}
@media (max-width:640px) {
  main { padding-left:max(14px,env(safe-area-inset-left)); padding-right:max(14px,env(safe-area-inset-right)) }
  main { padding-bottom:max(28px,env(safe-area-inset-bottom)) }
  h1 { font-size:1.97rem }
  .page-head { flex-wrap:wrap; gap:12px; margin-bottom:19px }
  .detail-grid { display:block }
  .metrics { grid-template-columns:repeat(2,minmax(0,1fr)) }
  .metrics div { padding:11px 14px }
  .metrics div:nth-child(odd) { border-left:0 }
  .metrics div:nth-child(n+3) { border-top:1px solid var(--line) }
  .metrics dd { font-size:1.52rem }
  .pipeline { grid-template-columns:repeat(3,minmax(0,1fr)); gap:2px; padding:0 9px 11px }
  .pipeline a { min-height:78px; padding:5px }
  .panel-head,.next { padding:13px 14px }
  .table-tools { width:100% }
  .search-box { flex:1; width:auto; min-width:130px }
  #filter + .picker-trigger { min-width:0 }
  #filter { width:auto; flex:1; min-width:125px }
  dialog {
    width:100%;
    max-width:none;
    margin:auto 0 0;
    border-radius:var(--raised-radius) var(--raised-radius) 0 0;
  }
  .dialog-actions { margin-bottom:env(safe-area-inset-bottom, 0px) }
  table,tbody,td { display:block }
  thead { position:absolute; width:1px; height:1px; clip-path:inset(50%); overflow:hidden }
  tbody tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 12px; padding:12px 14px; border-top:1px solid var(--line) }
  td,td:first-child { padding:0; border:0 }
  td:first-child { grid-column:1/-1 }
}
@media (prefers-reduced-motion:reduce) {
  .button,.pipeline a { transition:none }
  .button:active,.icon-button:active { transform:none }
}

.picker-frame { display:block; min-width:0 }
.picker-frame .picker-value { display:none }
.picker-trigger {
  display:flex; width:100%; min-height:44px; justify-content:space-between; align-items:center; gap:10px;
  padding:9px 12px; border:1px solid var(--control-border); border-radius:var(--control-radius);
  background:var(--control-fill); font-size:16px; font-weight:500; text-align:start;
}
.picker-trigger svg { width:19px; height:19px; flex:none; fill:none; stroke:var(--muted); stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round }
.picker-trigger[aria-expanded="true"] { border-color:var(--accent); background:white }
.picker-popover {
  position:fixed; inset:auto; margin:0; padding:5px; max-height:calc(100dvh - 16px); overflow:auto;
  border:1px solid var(--line); border-radius:var(--raised-radius); background:var(--surface); color:var(--ink);
  box-shadow:var(--elevation);
}
.picker-popover button { min-height:38px; border:0; border-radius:8px; padding:6px 10px; background:transparent; text-align:start }
.picker-popover > button { display:block; width:100%; padding-right:28px; position:relative }
.picker-popover button[aria-pressed="true"] { background:var(--accent-wash); color:var(--accent); font-weight:700 }
.picker-popover > button[aria-pressed="true"]::after { content:"✓"; position:absolute; right:10px }
.picker-popover button:focus-visible { outline-offset:-2px }
.calendar-head { display:grid; grid-template-columns:44px minmax(0,1fr) 44px; align-items:center; text-align:center }
.calendar-head button { text-align:center; color:var(--accent); font-size:1.55rem }
.calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:2px; text-align:center; padding:3px }
.calendar-grid button { padding:0; text-align:center; border-radius:50% }
.calendar-grid span { color:var(--muted); font-size:.76rem; padding:5px 0 }
@media (hover:hover) and (pointer:fine) {
  .picker-trigger:hover { border-color:#aeb6c3 }
  .picker-popover button:hover { background:var(--accent-wash) }
}
@media (max-width:640px) {
  .table-tools .picker-frame { flex:1; min-width:125px }
}
@media (pointer:coarse) {
  .picker-popover button { min-height:44px }
}

/* Shared list rows and dashboard summaries. */
.metric-urgent,.overdue { color:#854318 }
.overview-grid { grid-template-areas:"pipeline attention" }
.pipeline-panel { grid-area:pipeline }
.attention-panel { grid-area:attention }
.pipeline { gap:3px }
.pipeline a { justify-content:flex-start; gap:4px; min-height:94px; border-radius:var(--control-radius) }
.pipeline b { margin:0; font-size:1rem }
.pipeline small { min-height:2.55em; display:grid; align-items:center }
.attention-list a { position:relative; padding:10px 30px 10px 12px; border-radius:var(--control-radius) }
.disclosure { width:16px; height:16px; flex:none; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round }
.attention-list .disclosure { position:absolute; inset:0 10px 0 auto; margin:auto 0 }
.register th:nth-last-child(-n+2),.job-quantity,.job-shipped { text-align:right }
.register th:last-child,.job-shipped { padding-inline-end:19px }
.part-link { display:flex; align-items:center; justify-content:space-between; min-height:44px; gap:6px }
.part-link .disclosure { display:none; color:var(--muted) }
.tag { border-radius:999px; padding:4px 9px }
.job-status { display:grid; justify-items:end; gap:5px; font-size:.85rem; color:var(--muted) }
.job-actions { display:flex; flex-wrap:wrap; gap:8px }
.job-actions .button { margin:0 }
.facts div { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.1fr); padding:11px 0 }
.events li { position:relative; padding-inline-start:16px }
.events li::before { content:""; position:absolute; left:1px; top:20px; width:6px; height:6px; border-radius:50%; background:var(--accent) }

@media (max-width:640px) {
  .overview-grid { display:grid; grid-template-columns:minmax(0,1fr); grid-template-areas:"attention" "pipeline"; gap:0 }
  .pipeline { grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px }
  .pipeline a { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:6px; min-height:44px; text-align:start; align-items:center }
  .pipeline small { min-height:0; font-size:.77rem }
  .pipeline-icon { width:27px; height:27px }
  .pipeline b { font-size:.81rem }
  .register tbody tr {
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-areas:"part part" "customer stage" "due shipped";
    align-items:center;
    gap:5px 10px;
  }
  .register td { min-width:0 }
  .job-part { grid-area:part }
  .part-link .disclosure { display:block }
  .job-customer { grid-area:customer; color:var(--muted) }
  .job-stage { grid-area:stage; justify-self:end; text-align:end }
  .job-due { grid-area:due; font-size:.81rem; color:var(--muted) }
  .job-due time::before { content:"Due "; }
  .job-quantity { display:none }
  .register .job-shipped { grid-area:shipped; padding-inline-end:0; font-size:.81rem; color:var(--muted) }
  .job-shipped::before { content:"Shipped "; }
  .job-status { justify-items:start; display:flex; flex-wrap:wrap; align-items:center; gap:8px 10px }
  .detail-grid { display:flex; flex-direction:column; gap:14px }
  .detail-grid .panel { margin:0 }
  .detail-grid > div { display:contents }
  .detail-grid .next { order:-2 }
  .detail-grid .job-card { order:-1 }
  .detail-grid .activity-panel { order:1 }
  .job-actions .primary { width:100%; justify-content:center }
}

@media (prefers-reduced-motion:no-preference) {
  .picker-popover {
    --picker-offset:-3px;
    transform-origin:center top;
  }
  .picker-popover[data-side="above"] {
    --picker-offset:3px;
    transform-origin:center bottom;
  }

  #editor { --dialog-entry:translateY(4px) scale(.985) }

  .picker-popover,#editor {
    opacity:0;
    transition:opacity var(--motion-quick) var(--ease), transform var(--motion-quick) var(--ease);
    transition-behavior:allow-discrete;
  }
  .picker-popover { transform:translateY(var(--picker-offset)) scale(.97) }
  #editor { transform:var(--dialog-entry); transition-duration:var(--motion-dialog) }
  :is(.picker-popover:popover-open,#editor[open]) { opacity:1; transform:none }

  #editor::backdrop {
    opacity:0;
    transition:opacity var(--motion-dialog) var(--ease);
  }
  #editor[open]::backdrop { opacity:1 }

  @supports (transition:overlay 1s allow-discrete) {
    .picker-popover,#editor,#editor::backdrop {
      transition-property:opacity,transform,display,overlay;
      transition-behavior:allow-discrete;
    }
    .picker-popover:not(:popover-open),#editor:not([open]),#editor:not([open])::backdrop { pointer-events:none }
  }

  @starting-style {
    .picker-popover:popover-open { opacity:0; transform:translateY(var(--picker-offset)) scale(.97) }
    #editor[open] { opacity:0; transform:var(--dialog-entry) }
    #editor[open]::backdrop { opacity:0 }
  }

  @media (max-width:800px) {
    #navigation { transform-origin:top right; transition:opacity var(--motion-quick) var(--ease), transform var(--motion-quick) var(--ease) }
    @starting-style {
      .menu-toggle[aria-expanded="true"] + #navigation { opacity:0; transform:translateY(-3px) scale(.97) }
    }
  }
  @media (max-width:640px) {
    #editor { --dialog-entry:translateY(14px) }
  }
}
