/* AAGS PM Phase 20.1 — visual-only corporate theme. Reference: AAGS Parts / Field Team screenshots. */
:root{
 --pm-bg:#f4f4f4;--pm-text:#263442;--pm-header:#3c7eac;
 --pm-sidebar:#fff;--pm-sidebar-text:#2e5c7c;--pm-surface:#fff;
 --pm-border:#dce2e7;--pm-muted:#647586;--pm-input-border:#b8c9d7;
 --pm-primary:#347bad;--pm-secondary:#eaf2f8;--pm-secondary-text:#245c83;
 --pm-radius:8px;--pm-font:system-ui,-apple-system,"Segoe UI",Arial,sans-serif;
}
html{scroll-behavior:smooth}body{background:var(--pm-bg);color:var(--pm-text);font-family:var(--pm-font);font-size:14px;line-height:1.5}
body>header,.pm-app-header{background:#3c7eac;color:#fff;min-height:86px;padding:14px clamp(16px,2vw,32px);display:flex;gap:14px;align-items:center;flex-wrap:wrap;box-shadow:0 2px 5px #1d35421c;border-bottom:3px solid #31709e}
body>header a,.pm-app-header a{color:#fff!important;text-decoration:none;font-size:13px;font-weight:600;padding:8px 10px;border-radius:5px;white-space:nowrap}
body>header a:hover,.pm-app-header a:hover,body>header a[aria-current=page],.pm-app-header a[aria-current=page]{background:#ffffff25}
.pm-brand{display:flex;flex-direction:column;gap:1px;min-width:185px;margin-right:10px;line-height:1.2}
.pm-brand-title{font-size:19px;font-weight:800;letter-spacing:.1px;color:white}
.pm-brand-subtitle{font-size:10px;font-weight:700;letter-spacing:1.1px;color:#edf7ff}
body>header span:not(.pm-brand-title):not(.pm-brand-subtitle),.pm-app-header>span{font-size:12px}
body>header form,.pm-app-header form{margin:0}
body>header button.secondary,.pm-app-header button.secondary{background:#fff;color:#286c9d;border:1px solid #fff;font-weight:700}
.shell{min-height:calc(100vh - 86px);align-items:stretch}
.shell>nav{background:#fff;border-right:1px solid var(--pm-border);box-shadow:2px 0 9px #20374a09;width:240px;padding:21px 12px;gap:3px}
.shell>nav h3{font-size:11px;text-transform:uppercase;letter-spacing:1.2px;color:#6e8293;padding:0 12px;margin:7px 0 12px}
.shell>nav a{color:#2f638a;border-radius:6px;padding:9px 12px;line-height:1.35;overflow-wrap:anywhere;transition:background .15s,color .15s}
.shell>nav a:hover,.shell>nav a[aria-current=page]{background:#eaf3f9;color:#165f92}
.shell>main{width:100%;max-width:none;padding:clamp(16px,2.5vw,34px);min-width:0}
h1{font-size:clamp(23px,2.3vw,31px);line-height:1.25;color:#244f70;font-weight:750;margin:0 0 10px}
h2{font-size:19px;color:#2a648e;letter-spacing:-.2px}
h3{color:#315e7e}
section,.card{background:#fff;border:1px solid #dce2e7;border-radius:8px;box-shadow:0 2px 7px #183d5610;padding:clamp(14px,1.6vw,23px);margin:16px 0}
.cards,.stats{gap:14px}.cards .card,.stats .card{transition:transform .15s,box-shadow .15s}
.cards a.card:hover,.stats a.card:hover{transform:translateY(-2px);box-shadow:0 5px 16px #214f7222}
.stats b{color:#2c6f9e;font-size:29px;font-variant-numeric:tabular-nums}
a{color:#2877ae}a:hover{color:#185e8f}
button,.button,input[type=submit]{background:#377eaf;color:#fff;border:1px solid #2d729f;border-radius:5px;padding:9px 14px;font-weight:650;box-shadow:0 1px 2px #173b531a;transition:background .15s,transform .12s}
button:hover,input[type=submit]:hover{background:#286b9c}button:active{transform:translateY(1px)}
button.secondary{background:#eaf2f8;border-color:#c8d8e6;color:#28638e}button.secondary:hover{background:#dcebf6}
input:not([type=checkbox]):not([type=radio]),textarea,select{background:#fff;border:1px solid #b9c9d5;border-radius:5px;padding:9px 10px;color:#263442;box-shadow:none;min-height:36px}
input:focus-visible,select:focus-visible,textarea:focus-visible,button:focus-visible,a:focus-visible{outline:3px solid #8fc5e9;outline-offset:2px}
label{font-size:13px;font-weight:600;color:#3b5367}label input,label select,label textarea{font-weight:400}
table{border-collapse:collapse;width:100%;font-size:13px}table th{background:#edf4f9;color:#315e7d;text-align:left;font-size:12px;letter-spacing:.2px;font-weight:750;border-bottom:2px solid #c8d9e7}table th,table td{padding:10px 12px;border-bottom:1px solid #e3e9ee;vertical-align:middle}table tbody tr:nth-child(even){background:#fbfcfd}table tbody tr:hover{background:#f0f7fc}
.pm-project-tabs{border-bottom-color:#cbdce8}.pm-project-tabs a{color:#326f9b}.pm-project-tabs a[aria-current=page],.pm-project-tabs a.active{color:#205d87}
progress{accent-color:#367fab}hr{border:0;border-top:1px solid #dce4eb}
.login{max-width:450px;margin:clamp(55px,10vh,125px) auto;padding:0 28px 30px;border-radius:9px;overflow:hidden;box-shadow:0 12px 34px #21486620}
.pm-login-brand{margin:0 -28px 25px;background:#3c7eac;color:#fff;padding:28px;text-align:center}
.pm-login-brand h1{color:#fff;font-size:24px;margin:9px 0}.pm-login-brand p{color:#f0f7fc;margin:0}
.pm-login-kicker{font-size:11px;font-weight:750;letter-spacing:1.2px}
.login label{margin-bottom:10px}.login input{width:100%}.login button{width:100%;margin-top:6px}
@media(max-width:960px){body>header,.pm-app-header{min-height:auto}.shell>nav{width:205px}.pm-brand{min-width:160px}}
@media(max-width:760px){body>header,.pm-app-header{padding:12px;gap:6px}.pm-brand{width:100%;margin-bottom:6px}.pm-brand-title{font-size:18px}.shell{display:block}.shell>nav{width:100%;max-height:none;display:flex;flex-direction:row;flex-wrap:nowrap;overflow-x:auto;gap:5px;padding:9px 10px;border-right:0;border-bottom:1px solid #dce2e7;scrollbar-width:thin}.shell>nav h3{display:none}.shell>nav a{flex:0 0 auto;max-width:185px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;padding:8px 10px}.shell>main{padding:14px}.fields{gap:12px}.fields>label{flex:1 1 180px}section,.card{padding:14px}table{font-size:12px}table th,table td{padding:8px}body>header a,.pm-app-header a{padding:7px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition:none!important;scroll-behavior:auto!important}}

/* Phase 20.2 — shared AAGS chrome */
.pm-app-header{height:105px;min-height:105px;display:flex;justify-content:space-between;align-items:center;padding:10px 26px;background:#3c7eac;border-bottom:0}
.pm-header-title{color:#fff;font-weight:750;font-size:19px}
.pm-header-logo{margin-left:auto;display:flex;flex-direction:column;align-items:flex-end;gap:1px}
.pm-vingcard-logo{display:block;max-width:210px;max-height:57px;width:auto;height:auto;object-fit:contain}
.pm-header-logo span{font-size:15px;color:#fff;font-weight:650;letter-spacing:.3px}
.pm-crumb-bar{background:#347aa9;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:9px 26px;min-height:55px;border-bottom:2px solid #2d6f9d}
.pm-breadcrumbs{display:flex;align-items:center;flex-wrap:wrap;gap:9px;color:#fff;font-size:13px;font-weight:650;min-width:0}
.pm-breadcrumbs a{color:#fff;text-decoration:none}.pm-breadcrumbs a:hover{text-decoration:underline}
.pm-global-search{display:flex;align-items:center;gap:7px;margin:0 0 0 auto}
.pm-global-search input[type=search]{min-width:190px;width:min(27vw,330px);background:#fff;padding:7px 11px;min-height:35px}
.pm-global-search button{background:#fff;color:#286c9d;border:1px solid #fff;padding:7px 13px;min-height:35px}
.pm-global-search button:hover{background:#eaf2f8;color:#21577b}
.pm-visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.pm-side-menu .pm-account-label{font-size:12px;color:#667d90;padding:8px 12px;overflow-wrap:anywhere}
.pm-sidebar-logout{margin:4px 12px 14px}
.pm-sidebar-logout button{width:100%}
.shell>main.cal-main{width:100%;max-width:none;min-width:0;padding:clamp(16px,2.5vw,34px)}
@media(max-width:760px){
 .pm-app-header{height:auto;min-height:86px;padding:12px 16px;gap:12px}
 .pm-header-title{font-size:15px}
 .pm-vingcard-logo{max-width:145px;max-height:42px}
 .pm-header-logo span{font-size:12px}
 .pm-crumb-bar{padding:10px 14px;flex-wrap:wrap;gap:8px}
 .pm-global-search{width:100%}
 .pm-global-search input[type=search]{flex:1;width:auto;min-width:0}
 .shell>nav.pm-side-menu{display:flex;flex-wrap:wrap;overflow-x:auto;max-height:175px;align-content:flex-start;gap:5px}
 .shell>nav.pm-side-menu h3{display:none}
 .pm-sidebar-logout{margin:0}
 .pm-sidebar-logout button{width:auto}
 .pm-side-menu .pm-account-label{padding:8px 4px}
}

/* Phase 20.2 header correction: move application title beneath double-size brand */
.pm-app-header{height:auto;min-height:180px;justify-content:flex-end;padding:14px 26px}
.pm-app-header .pm-header-title{display:none}
.pm-header-logo{margin-left:auto;align-items:flex-end;gap:5px}
.pm-vingcard-logo{max-width:420px;max-height:114px}
.pm-header-logo span{font-size:18px;font-weight:700;line-height:1.3;text-align:right}
@media(max-width:760px){
 .pm-app-header{min-height:132px;padding:12px 16px}
 .pm-vingcard-logo{max-width:min(290px,85vw);max-height:84px}
 .pm-header-logo span{font-size:14px}
}

/* Phase 20.3 — account-specific dark theme; light remains the default */
html[data-theme="dark"]{color-scheme:dark;
 --pm-bg:#101923;--pm-text:#e7eef5;--pm-header:#234e70;--pm-sidebar:#172633;
 --pm-sidebar-text:#c3d9e9;--pm-surface:#1b2b39;--pm-border:#344b5c;
 --pm-muted:#a7bccc;--pm-input-border:#526a7b;--pm-primary:#6bb5e8;
 --pm-secondary:#243d50;--pm-secondary-text:#c9e8fc;
}
html[data-theme="dark"] body{background:var(--pm-bg);color:var(--pm-text)}
html[data-theme="dark"] .pm-app-header,html[data-theme="dark"] body>header{background:#234e70;border-color:#1c425e}
html[data-theme="dark"] .pm-crumb-bar{background:#1b405d;border-color:#17364f}
html[data-theme="dark"] .shell>nav,html[data-theme="dark"] .shell>nav.pm-side-menu{background:var(--pm-sidebar);border-color:var(--pm-border);box-shadow:none}
html[data-theme="dark"] .shell>nav h3{color:#a8c4d7}
html[data-theme="dark"] .shell>nav a{color:#b9d7ec}
html[data-theme="dark"] .shell>nav a:hover,html[data-theme="dark"] .shell>nav a[aria-current="page"]{background:#294961;color:#fff}
html[data-theme="dark"] .pm-side-menu .pm-account-label{color:#a7bac9}
html[data-theme="dark"] .shell>main,html[data-theme="dark"] .cal-main{background:var(--pm-bg);color:var(--pm-text)}
html[data-theme="dark"] section,html[data-theme="dark"] .card,html[data-theme="dark"] .login,html[data-theme="dark"] fieldset,html[data-theme="dark"] dialog,html[data-theme="dark"] .modal-content,html[data-theme="dark"] .panel{background:var(--pm-surface);color:var(--pm-text);border-color:var(--pm-border);box-shadow:0 2px 10px #0002}
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3,html[data-theme="dark"] h4{color:#a9d9f8}
html[data-theme="dark"] a{color:#8bd0ff}html[data-theme="dark"] a:hover{color:#c4e9ff}
html[data-theme="dark"] label,html[data-theme="dark"] .muted,html[data-theme="dark"] small{color:#c1d1de}
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),html[data-theme="dark"] textarea,html[data-theme="dark"] select{background:#132330;color:#e7f1f8;border-color:#536d80}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#a8b9c7;opacity:1}
html[data-theme="dark"] button,html[data-theme="dark"] .button,html[data-theme="dark"] input[type="submit"]{background:#326e9a;color:#fff;border-color:#4c92c1}
html[data-theme="dark"] button:hover,html[data-theme="dark"] input[type="submit"]:hover{background:#4186b6}
html[data-theme="dark"] button.secondary{background:#2a4153;color:#d5eafa;border-color:#57758a}
html[data-theme="dark"] .pm-global-search button{background:#dceaf4;color:#16496b;border-color:#dceaf4}
html[data-theme="dark"] .pm-global-search button:hover{background:#fff;color:#123b58}
html[data-theme="dark"] table{color:var(--pm-text);background:var(--pm-surface)}
html[data-theme="dark"] table th{background:#28465b;color:#e4f3ff;border-color:#456277}
html[data-theme="dark"] table td{border-color:#344a5c;color:#e2edf6}
html[data-theme="dark"] table tbody tr:nth-child(even){background:#203443}
html[data-theme="dark"] table tbody tr:hover{background:#30506a}
html[data-theme="dark"] .pm-project-tabs{border-color:#456175}
html[data-theme="dark"] .pm-project-tabs a{color:#b3dbf7}
html[data-theme="dark"] .pm-project-tabs a.active,html[data-theme="dark"] .pm-project-tabs a[aria-current="page"]{color:#fff;border-color:#75c5fa}
html[data-theme="dark"] hr,html[data-theme="dark"] details{border-color:var(--pm-border)}
html[data-theme="dark"] .stats b{color:#9bd7ff}
html[data-theme="dark"] progress{accent-color:#79bce9}
html[data-theme="dark"] :is(input,select,textarea,button,a):focus-visible{outline:3px solid #8fd3ff;outline-offset:2px}
html[data-theme="dark"] .pm-login-brand{background:#234e70}
@media print{html[data-theme="dark"]{color-scheme:light}html[data-theme="dark"] body,html[data-theme="dark"] section,html[data-theme="dark"] .card,html[data-theme="dark"] table{background:white!important;color:black!important}}

/* Phase 20.4: consistent visual hierarchy, cards, data panels and both modes */
.pm-page-subtitle{font-size:14px;margin:4px 0 20px;max-width:66ch}
.pm-section-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:17px}
.pm-section-heading h2{margin:3px 0 0;font-size:21px;line-height:1.25}
.pm-section-heading p{margin:5px 0 0}
.pm-section-eyebrow{display:block;font-size:10px;letter-spacing:1.7px;font-weight:800;color:#5c87a4}
.pm-heading-link{font-size:12px;font-weight:700;text-decoration:none;white-space:nowrap}
.pm-count-pill{background:#e7f1f8;border:1px solid #c7dfef;color:#28638e;padding:5px 11px;border-radius:20px;font-size:12px;font-weight:750}
.pm-quick-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.pm-quick-link{display:flex;align-items:center;gap:14px;text-decoration:none!important;color:var(--pm-text)!important;border:1px solid var(--pm-border);border-radius:10px;padding:18px;background:var(--pm-surface);min-width:0;transition:box-shadow .15s,transform .15s,border-color .15s}
.pm-quick-link:hover{transform:translateY(-2px);border-color:#83b4d7;box-shadow:0 8px 24px #1e4d6c1a}
.pm-quick-symbol{display:grid;place-items:center;width:48px;height:48px;flex:0 0 48px;background:#e6f2fa;color:#276d9c;border-radius:12px;font-size:26px;font-weight:800}
.pm-quick-link>span:nth-child(2){display:flex;flex-direction:column;gap:4px;min-width:0}
.pm-quick-link strong{font-size:16px}.pm-quick-link small{font-size:12px;color:var(--pm-muted);line-height:1.5}
.pm-quick-arrow{margin-left:auto;color:var(--pm-primary);font-size:26px;font-weight:700}
.pm-metrics-section .stats .card,.overview-stats .card{position:relative;overflow:hidden;min-height:106px;border-top:3px solid #498fbc;padding:18px 18px 14px!important}
.pm-metrics-section .stats .card:before,.overview-stats .card:before{content:'';position:absolute;right:-24px;top:-32px;width:90px;height:90px;border-radius:50%;background:#8fc3e219;pointer-events:none}
.pm-metrics-section .stats .card b,.overview-stats .card b{display:block;font-size:clamp(26px,2.5vw,35px);line-height:1.1;margin-bottom:9px}
.pm-metrics-section .stats .card small,.overview-stats .card small{display:block;font-size:12px;color:var(--pm-muted);font-weight:650}
.pm-overview-heading{margin:26px 0 12px}.pm-project-list-heading{margin:30px 0 12px}
.pm-project-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,290px),1fr));gap:15px}
.pm-project-grid .pm-dashboard-card{display:block;min-width:0;border-radius:10px;padding:20px!important;border-left-width:5px}
.pm-project-grid .pm-dashboard-card>strong{font-size:16px;line-height:1.4;display:block;margin-bottom:6px}
.pm-project-grid .pm-dashboard-card>p{margin:5px 0;font-size:12px}
.pm-project-grid .pm-dashboard-card>small{font-size:12px;line-height:1.7}
.pm-project-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(155px,1fr));gap:10px;margin:14px 0 20px}
.pm-project-facts>div{display:flex;flex-direction:column;gap:6px;background:var(--pm-surface);border:1px solid var(--pm-border);border-top:3px solid #4389b8;border-radius:8px;padding:13px 15px;min-width:0}
.pm-project-facts small{font-size:10px;letter-spacing:.65px;text-transform:uppercase;font-weight:750;color:var(--pm-muted)}
.pm-project-facts strong{font-size:13px;overflow-wrap:anywhere}
/* Provide scannable hierarchy on all secondary pages without changing their markup */
.shell>main>section>h2:first-child{border-left:4px solid #4a94c5;padding-left:11px;margin:0 0 17px}
.shell>main>section>p.muted{max-width:85ch}
.shell>main .entry{border-left:3px solid transparent;padding:12px 14px;border-bottom:1px solid var(--pm-border);transition:background .15s,border-color .15s}
.shell>main .entry:hover{border-left-color:#68a5ce;background:color-mix(in srgb,var(--pm-primary) 6%,var(--pm-surface))}
.shell>main details{border:1px solid var(--pm-border);border-radius:8px;padding:12px 15px;margin:12px 0;background:var(--pm-surface)}
.shell>main details>summary{font-weight:700;cursor:pointer;color:var(--pm-primary);padding:4px 0}
.shell>main details[open]>summary{margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid var(--pm-border)}
.shell>main table{border:1px solid var(--pm-border);border-radius:8px;overflow:hidden}
.shell>main table th{white-space:normal}
.shell>main table td{overflow-wrap:anywhere}
.shell>main .pm-project-tabs a[aria-current=page]{box-shadow:inset 0 -3px 0 #438fbd}
/* Dark/Midnight mode: all new surfaces use existing theme variables */
html[data-theme=dark] .pm-section-eyebrow{color:#9bc9e7}
html[data-theme=dark] .pm-count-pill{background:#26465c;color:#c5e8ff;border-color:#496b81}
html[data-theme=dark] .pm-quick-symbol{background:#284c65;color:#b8e4ff}
html[data-theme=dark] .pm-quick-link:hover{border-color:#6bb0db;box-shadow:0 8px 24px #0004}
html[data-theme=dark] .pm-metrics-section .stats .card:before,html[data-theme=dark] .overview-stats .card:before{background:#7cc6f50c}
html[data-theme=dark] .shell>main .entry:hover{background:#243d50}
html[data-theme=dark] .shell>main details>summary{color:#a6dbff}
@media(max-width:700px){.pm-quick-grid{grid-template-columns:1fr}.pm-project-facts{grid-template-columns:repeat(2,minmax(0,1fr))}.pm-section-heading h2{font-size:19px}}
@media(max-width:430px){.pm-project-facts{grid-template-columns:1fr}.pm-quick-link{padding:13px}.pm-quick-symbol{width:40px;height:40px;flex-basis:40px}}
@media(prefers-reduced-motion:reduce){.pm-quick-link{transition:none}}
@media print{.pm-quick-link,.pm-project-facts>div{box-shadow:none!important}.pm-section-eyebrow{color:#444!important}}

/* Phase 20.4.1 — Midnight Mode: maintain contrast on white-hover project tabs. */
html[data-theme="dark"] .shell main nav.pm-project-tabs > a:hover,
html[data-theme="dark"] .shell main nav.pm-project-tabs > a:focus-visible {
  background: #f3f8fc !important;
  color: #173f5c !important;
  border-color: #c3d8e8 !important;
}
html[data-theme="dark"] .shell main nav.pm-project-tabs > a:hover *,
html[data-theme="dark"] .shell main nav.pm-project-tabs > a:focus-visible * {
  color: #173f5c !important;
}
/* Keep the selected tab visibly selected when not hovered. */
html[data-theme="dark"] .shell main nav.pm-project-tabs > a[aria-current="page"]:not(:hover):not(:focus-visible) {
  background: #294961;
  color: #ffffff !important;
  border-color: #54758b;
}

/* Phase 20.5–20.8 — cohesive visual system, both appearance modes */
:root{--pm-polish-accent:#3e8fbe;--pm-polish-soft:color-mix(in srgb,var(--pm-primary) 9%,var(--pm-surface));--pm-polish-shadow:0 3px 16px #173c5810}
.shell>main{min-width:0}
.shell>main>section{min-width:0;margin-bottom:22px;box-shadow:var(--pm-polish-shadow)}
.shell>main>section>h2:first-child{display:flex;align-items:center;gap:10px;font-size:clamp(19px,2vw,23px);letter-spacing:-.3px;padding:0 0 12px 13px;border-left:4px solid var(--pm-polish-accent);border-bottom:1px solid var(--pm-border)}
.shell>main>section>h2:first-child::after{content:'';height:5px;width:5px;border-radius:50%;background:var(--pm-polish-accent);margin-left:auto}
.shell>main section h3{letter-spacing:-.15px}
.shell>main .muted,.shell>main small{line-height:1.55}
.shell>main .fields{gap:13px}
.shell>main label{font-weight:600}
.shell>main :is(input,select,textarea){transition:border-color .15s,box-shadow .15s}
.shell>main :is(input,select,textarea):focus-visible{outline:2px solid var(--pm-polish-accent);outline-offset:1px;box-shadow:0 0 0 3px color-mix(in srgb,var(--pm-polish-accent) 15%,transparent)}
.shell>main button,.shell>main .btn{transition:filter .15s,transform .15s}
.shell>main button:hover{filter:brightness(1.09)}
.shell>main button:active{transform:translateY(1px)}
.shell>main :is(table,.pm-products-table){border-spacing:0;border-collapse:separate;border:1px solid var(--pm-border);border-radius:10px;overflow:hidden;width:100%}
.shell>main :is(table,.pm-products-table) thead th{background:var(--pm-polish-soft);color:var(--pm-text);font-size:11px;letter-spacing:.55px;text-transform:uppercase;font-weight:800;padding:12px 11px}
.shell>main :is(table,.pm-products-table) tbody td{padding:11px 12px;border-bottom:1px solid var(--pm-border);vertical-align:middle}
.shell>main :is(table,.pm-products-table) tbody tr:last-child td{border-bottom:0}
.shell>main :is(table,.pm-products-table) tbody tr:hover:not(.pm-product-group){background:var(--pm-polish-soft)}
.shell>main :is(table,.pm-products-table) td .muted{font-size:12px}
/* Products: concise KPI strip, better source grouping, more readable quantities */
#project-products .pm-product-counts,#project-notes .pm-note-counts{display:grid;grid-template-columns:repeat(auto-fit,minmax(135px,1fr));gap:10px;margin:16px 0 20px}
#project-products .pm-product-counts span,#project-notes .pm-note-counts span{border:1px solid var(--pm-border);border-top:3px solid var(--pm-polish-accent);border-radius:9px;padding:13px 15px;background:var(--pm-surface);color:var(--pm-text);font-size:13px;font-weight:700;box-shadow:var(--pm-polish-shadow)}
#project-products .pm-product-counts span:first-child,#project-notes .pm-note-counts span:first-child{border-top-color:#4b9cce}
#project-products .pm-product-counts span:nth-child(3){border-top-color:#d99044}
#project-products .pm-product-counts span:last-child{border-top-color:#3d9b77}
#project-products .pm-product-tools,#project-notes .pm-note-filters{background:var(--pm-polish-soft);border:1px solid var(--pm-border);border-radius:10px;padding:14px;align-items:end}
#project-products .pm-products-scroll{border:1px solid var(--pm-border);border-radius:10px;overflow:auto;max-width:100%;margin:12px 0 20px}
#project-products .pm-products-table{border:0;border-radius:0;min-width:650px}
#project-products .pm-products-table .pm-product-group td{background:var(--pm-polish-soft);font-weight:800;color:var(--pm-text);border-top:2px solid var(--pm-border)}
#project-products .pm-products-table .pm-sku{font-weight:750;color:var(--pm-primary)}
#project-products .pm-products-table .pm-qty{font-variant-numeric:tabular-nums}
#project-products .pm-product-status{background:var(--pm-polish-soft);color:var(--pm-text);font-weight:650;border-radius:6px}
#project-products .pm-product-dialog{background:var(--pm-surface);color:var(--pm-text);border:1px solid var(--pm-border);box-shadow:0 25px 75px #0008}
#project-products .pm-product-dialog .pm-dialog-heading{border-bottom:1px solid var(--pm-border);padding-bottom:10px}
#project-products #pm-bulk-track{background:var(--pm-polish-soft);border-color:var(--pm-border)!important}
/* Notes: visually distinct meeting records, with category and author separated */
#project-notes .pm-note-entry{border:1px solid var(--pm-border);border-left:4px solid var(--pm-polish-accent);border-radius:9px;background:var(--pm-surface);padding:16px 18px;margin:12px 0;box-shadow:var(--pm-polish-shadow)}
#project-notes .pm-note-entry .pm-note-meta{margin-bottom:10px}
#project-notes .pm-note-entry .pm-note-kind{background:var(--pm-polish-soft);border:1px solid var(--pm-border);color:var(--pm-primary);padding:4px 10px;font-size:12px}
#project-notes .pm-note-entry p{line-height:1.75;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
#project-notes>form:last-of-type{background:var(--pm-polish-soft);border:1px solid var(--pm-border);border-radius:10px;padding:16px}
/* Actions, milestones, documents, risk and audit: structured list rows */
#project-actions .entry,#project-milestones .entry,#project-activity .entry,.shell>main section>.entry{border:1px solid var(--pm-border);border-left:3px solid var(--pm-polish-accent);border-radius:8px;padding:13px 15px;margin:9px 0;background:var(--pm-surface);align-items:center;gap:12px}
#project-actions .entry small,#project-milestones .entry small{display:block;color:var(--pm-muted);margin-top:4px}
#project-actions .entry form,#project-milestones .entry form{margin:0}
.shell>main details{box-shadow:0 1px 7px #00000009}
.shell>main details>summary:hover{color:var(--pm-primary);text-decoration:underline;text-underline-offset:3px}
/* Secondary pages, calendar, timeline, reporting and management screens */
.shell>main .stats,.shell>main .cards,.shell>main .grid{gap:14px}
.shell>main .card{border:1px solid var(--pm-border);border-radius:11px;box-shadow:var(--pm-polish-shadow)}
.shell>main .card h3{margin-top:0}
.shell>main :is(.cal-toolbar,.toolbar,.filters){background:var(--pm-polish-soft);border:1px solid var(--pm-border);border-radius:10px;padding:12px;gap:10px}
.shell>main .cal-toolbar{display:flex;flex-wrap:wrap;align-items:center}
.shell>main :is(.cal-day,.cal-event,.timeline-item){border-radius:7px}
.shell>main .pm-activity-table td{line-height:1.6}
.shell>main a:focus-visible,.pm-side-menu a:focus-visible{outline:2px solid var(--pm-polish-accent);outline-offset:2px}
/* Midnight Mode: preserve contrast in every new component and table hover */
html[data-theme=dark]{--pm-polish-accent:#75b9e1;--pm-polish-shadow:0 3px 16px #00000025}
html[data-theme=dark] #project-products .pm-product-counts span,html[data-theme=dark] #project-notes .pm-note-counts span{background:var(--pm-surface);color:var(--pm-text)}
html[data-theme=dark] .shell>main :is(table,.pm-products-table) tbody tr:hover:not(.pm-product-group){background:#29475b;color:#f2f7fa}
html[data-theme=dark] .shell>main :is(table,.pm-products-table) tbody tr:hover a{color:#bde5ff}
html[data-theme=dark] #project-products .pm-product-status{color:var(--pm-text)}
html[data-theme=dark] #project-products .pm-product-dialog :is(input,select,textarea){color:var(--pm-text);background:var(--pm-bg)}
html[data-theme=dark] .shell>main button.secondary:hover{color:#132f45;background:#f3f8fc}
/* Responsive: no viewport overflow; keep data tables scrollable */
@media(max-width:960px){.shell>main{min-width:0}.shell>main .fields{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}}
@media(max-width:640px){
 #project-products .pm-product-counts,#project-notes .pm-note-counts{grid-template-columns:repeat(2,minmax(0,1fr))}
 .shell>main>section{padding:14px}
 #project-notes .pm-note-entry{padding:13px}
 .shell>main :is(table,.pm-products-table) thead th{padding:10px 8px}
 .shell>main :is(table,.pm-products-table) tbody td{padding:9px 8px}
 .shell>main .fields{grid-template-columns:1fr}
 .shell>main .cal-toolbar{gap:7px}
}
@media(max-width:370px){#project-products .pm-product-counts,#project-notes .pm-note-counts{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){.shell>main button,.shell>main :is(input,select,textarea){transition:none}}
@media print{.shell>main>section,.shell>main .card,#project-notes .pm-note-entry{box-shadow:none!important;break-inside:avoid}.shell>main :is(.cal-toolbar,.toolbar,.filters){background:transparent!important}}

/* Products page — guided hierarchy and compact workflows */
#project-products{display:grid;gap:14px}
#project-products .pm-products-intro h2{margin:0 0 5px}
#project-products .pm-products-intro p{margin:0}
#project-products .pm-products-section-head{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--pm-border);padding:12px 0 8px;margin-top:4px}
#project-products .pm-products-section-head h3{margin:0 0 3px}
#project-products .pm-products-section-head p{margin:0;font-size:.87rem}
#project-products .pm-product-counts{margin:0}
#project-products .pm-product-counts span{display:flex;flex-direction:column;gap:3px;border-radius:9px;padding:12px 14px;line-height:1.4}
#project-products .pm-product-tools{margin:0;display:grid;grid-template-columns:repeat(4,minmax(145px,1fr));gap:12px;padding:14px;background:var(--pm-surface);border:1px solid var(--pm-border);border-radius:10px}
#project-products .pm-product-tools label{min-width:0}
#project-products .pm-product-tools :is(input,select){width:100%;min-width:0}
#project-products .pm-product-result-count{margin:0;font-size:.85rem}
#project-products .pm-products-help{margin:0;font-size:.85rem}
#project-products .pm-products-scroll{border:1px solid var(--pm-border);border-radius:10px}
#project-products .pm-product-workflow{margin:0;border:1px solid var(--pm-border);border-radius:10px;padding:0;background:var(--pm-surface)}
#project-products .pm-product-workflow>summary{cursor:pointer;padding:15px 17px;display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px}
#project-products .pm-product-workflow>summary .muted{font-size:.85rem;font-weight:400}
#project-products .pm-product-workflow[open]>summary{border-bottom:1px solid var(--pm-border)}
#project-products .pm-product-workflow> :not(summary){margin:12px 16px}
#project-products .pm-bulk-editor{padding:0;border:0;margin:0}
#project-products .pm-bulk-editor p{margin:5px 0 12px}
html[data-theme=dark] #project-products .pm-product-tools,
html[data-theme=dark] #project-products .pm-product-workflow{background:var(--pm-surface);color:var(--pm-text)}
@media(max-width:1050px){#project-products .pm-product-tools{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){#project-products .pm-product-tools{grid-template-columns:1fr}#project-products .pm-product-workflow>summary{display:block}#project-products .pm-product-workflow>summary span{display:block;margin-top:5px}}

/* Phase 20 products: filters belong to the table they control */
#project-products .pm-product-detail-body{padding:16px;display:grid;gap:14px}
#project-products .pm-product-detail-body>.pm-products-section-head{margin:0}
#project-products .pm-product-detail-body>.pm-product-tools{margin:0}
#project-products .pm-product-detail-body>.pm-product-workflow{background:transparent}
#project-products .pm-product-detail-body>.pm-products-scroll{margin:0}
#project-products #pm-document-history>summary{background:var(--pm-surface);border-radius:10px}
#project-products #pm-document-history[open]>summary{border-radius:10px 10px 0 0}
#project-products #pm-document-history .pm-product-detail-body{margin:0}
#project-products .pm-product-result-count{margin:0}

/* Project-first navigation and dedicated project creation */
.pm-side-menu .pm-sidebar-projects{padding-bottom:15px;margin-bottom:15px;border-bottom:2px solid var(--pm-border)}
.pm-side-menu .pm-sidebar-projects h3{margin-top:8px}
.pm-side-menu .pm-sidebar-project-link{border-left:4px solid var(--pm-nav-project-color);padding-left:12px;overflow-wrap:anywhere}
.pm-side-menu .pm-create-project-link{font-weight:750;color:var(--pm-link,#2678aa);border:1px solid var(--pm-border);border-radius:7px;margin:9px 9px 13px;padding:10px 12px}
.pm-side-menu .pm-create-project-link:hover{background:var(--pm-surface);color:var(--pm-text)}
.pm-create-project-form{max-width:900px}
html[data-theme="dark"] .pm-side-menu .pm-sidebar-projects{border-color:var(--pm-border)}

/* Sidebar regression fix: section wrappers must not become horizontal flex items. */
@media(min-width:761px){
 .shell>nav.pm-side-menu{display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;justify-content:flex-start;gap:0;min-width:0;overflow-x:hidden}
 .pm-side-menu .pm-sidebar-projects,.pm-side-menu .pm-sidebar-main{display:flex;flex-direction:column;align-items:stretch;flex:0 0 auto;width:100%;min-width:0}
 .pm-side-menu .pm-sidebar-projects a,.pm-side-menu .pm-sidebar-main>a{display:block;width:100%;box-sizing:border-box;white-space:normal;overflow-wrap:anywhere;word-break:normal}
 .pm-side-menu .pm-sidebar-main h3{display:block;flex:0 0 auto}
 .pm-side-menu .pm-sidebar-logout{width:100%}
}
@media(max-width:760px){
 .shell>nav.pm-side-menu{display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;max-height:none;overflow-x:visible;gap:0}
 .pm-side-menu .pm-sidebar-projects,.pm-side-menu .pm-sidebar-main{display:flex;flex-wrap:wrap;gap:5px;align-items:center;min-width:0;width:100%}
 .pm-side-menu .pm-sidebar-projects{padding-bottom:10px;margin-bottom:10px}
 .pm-side-menu .pm-sidebar-projects h3,.pm-side-menu .pm-sidebar-main h3{display:block;flex:0 0 100%;margin:8px 0 4px;padding:0 6px}
 .pm-side-menu .pm-sidebar-projects a,.pm-side-menu .pm-sidebar-main>a{flex:0 1 auto;max-width:100%;white-space:normal;overflow-wrap:anywhere}
 .pm-side-menu .pm-sidebar-logout{flex:0 0 100%}
}

/* Header height reduction: 25% from 180px desktop / 132px mobile. */
.pm-app-header{min-height:135px;padding-top:10px;padding-bottom:10px}
.pm-vingcard-logo{max-height:85px}
@media(max-width:760px){
  .pm-app-header{min-height:99px;padding-top:9px;padding-bottom:9px}
  .pm-vingcard-logo{max-height:63px}
}

/* Branded sign-in card — reuse the existing Vingcard asset */
.pm-login-brand{padding:25px 24px 23px}
.pm-login-brand .pm-login-logo{display:block;width:min(100%,300px);height:auto;max-height:110px;object-fit:contain;margin:0 auto 12px}
.pm-login-brand h1{font-size:20px;line-height:1.3;margin:6px 0 8px;color:#fff}
.pm-login-brand p{font-size:13px}
@media(max-width:500px){.pm-login-brand .pm-login-logo{width:min(100%,250px)}.pm-login-brand{padding:22px 16px}}

/* Phase 22.1: actionable dashboard overview */
.pm-priority-overview{margin:18px 0 24px}
.pm-priority-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:12px}
.pm-priority-tile{display:flex;flex-direction:column;gap:6px;text-decoration:none!important;padding:17px;border:1px solid var(--pm-border,#d5dce4);border-left:4px solid var(--pm-primary,#3c7eac);border-radius:10px;background:var(--pm-surface,#fff);color:var(--pm-text,inherit)!important;transition:transform .15s,border-color .15s}
.pm-priority-tile:hover,.pm-priority-tile:focus-visible{transform:translateY(-2px);border-color:var(--pm-primary,#3c7eac);outline-offset:2px}
.pm-priority-tile b{font-size:1.9rem;line-height:1.1;font-variant-numeric:tabular-nums}
.pm-priority-tile span{font-size:.93rem;font-weight:700}
.pm-priority-tile small{font-size:.78rem;opacity:.75}
.pm-priority-clear{margin:12px 0 0;font-size:.9rem}
@media(max-width:600px){.pm-priority-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.pm-priority-tile{padding:12px}}

/* Phase 22.2: separate adjusted-product filters from document-line tracking */
.pm-delivery-overview{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.pm-delivery-overview>div{background:var(--pm-surface,#fff);border:1px solid var(--pm-border,#d4dce5);border-radius:10px;padding:14px;display:flex;flex-direction:column;gap:6px}
.pm-delivery-overview strong{font-size:1.5rem;font-variant-numeric:tabular-nums}
.pm-delivery-overview span{font-size:.84rem;opacity:.82}
.pm-consolidated-tools{display:flex;align-items:end;gap:12px;flex-wrap:wrap}
.pm-consolidated-tools label{display:flex;flex-direction:column;gap:5px;min-width:180px;flex:1}
.pm-consolidated-tools :is(select,input){width:100%;min-width:0}
#pm-consolidated-count{font-size:.83rem;opacity:.75;padding-bottom:10px}
.pm-delivery-progress{height:5px;min-width:70px;background:var(--pm-border,#d5dce4);border-radius:8px;overflow:hidden;margin-top:6px}
.pm-delivery-progress span{display:block;height:100%;background:#3987b8;border-radius:8px}
.pm-consolidated-row[hidden]{display:none!important}
@media(max-width:760px){.pm-delivery-overview{grid-template-columns:repeat(2,minmax(0,1fr))}.pm-consolidated-tools label{min-width:100%}}

/* Phase 22.3: rolling agenda and targeted event navigation */
.pm-calendar-agenda{margin:18px 0 20px;border:1px solid var(--pm-border,#d2dce5);border-radius:12px;padding:16px;background:var(--pm-surface,#fff);color:var(--pm-text,inherit)}
.pm-calendar-agenda-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}
.pm-calendar-agenda-head h2{margin:0 0 4px;font-size:1.15rem}
.pm-calendar-agenda-head p{margin:0;font-size:.85rem}
.pm-calendar-agenda-head>a{font-weight:700;font-size:.88rem}
.pm-calendar-agenda-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(270px,1fr));gap:9px}
.pm-calendar-agenda-item{display:flex;align-items:center;gap:12px;border:1px solid var(--pm-border,#d2dce5);border-left:4px solid var(--agenda-color,#3c7eac);border-radius:8px;padding:11px 12px;color:var(--pm-text,inherit)!important;text-decoration:none!important;min-width:0}
.pm-calendar-agenda-item:hover,.pm-calendar-agenda-item:focus-visible{background:var(--pm-polish-soft,rgba(100,140,170,.1));outline-offset:2px}
.pm-calendar-agenda-item time{min-width:42px;font-weight:750;font-size:.85rem}
.pm-calendar-agenda-text{display:flex;flex:1;flex-direction:column;min-width:0;gap:3px}
.pm-calendar-agenda-text strong{font-size:.9rem;overflow-wrap:anywhere}
.pm-calendar-agenda-text small{font-size:.77rem;opacity:.75}
.pm-calendar-agenda-empty{margin:0;padding:14px;background:var(--pm-polish-soft,rgba(100,140,170,.1));border-radius:7px}
@media(max-width:600px){.pm-calendar-agenda-list{grid-template-columns:minmax(0,1fr)}.pm-calendar-agenda{padding:12px}}
