/* PCD Performance Management — design tokens + components. Light by default, WCAG 2.1 AA contrast. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f9fafb; --border: #e4e7ec; --border-strong: #cfd4dc;
  --text: #101828; --text-2: #475467; --muted: #667085;
  --primary: #0b3b8c; --primary-hover: #092f70; --primary-soft: #eaf0fb; --primary-border: #c5d5f3;
  --ok: #067647; --ok-soft: #e7f6ee; --warn: #92400e; --warn-soft: #fef3c7; --danger: #b42318; --danger-soft: #fdecea; --info: #175cd3; --info-soft: #e8f0fe;
  --radius: 10px; --radius-sm: 6px; --shadow: 0 1px 2px rgba(16,24,40,.05); --shadow-pop: 0 12px 32px rgba(16,24,40,.16), 0 2px 6px rgba(16,24,40,.08);
  --side: 232px; --top: 56px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r1: #b42318; --r2: #c2410c; --r3: #6b7280; --r4: #1d6fa5; --r5: #067647;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 11px; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack-16 { display: flex; flex-direction: column; gap: 16px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- shell ---- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 14px 10px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.brand b { display: block; font-size: 13.5px; line-height: 1.15; } .brand span { font-size: 11px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav .label { padding: 14px 10px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.side-foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--border); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: var(--top); background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 24px; }
.page { padding: 24px; max-width: 1560px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; } .icon.lg { width: 22px; height: 22px; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: #b9c0cb; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: #f3c3be; } .btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 6px; } .btn.icon-only { width: 34px; padding: 0; } .btn.sm.icon-only { width: 28px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.input, .select, textarea.input { height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px; background: var(--surface); font: inherit; color: var(--text); min-width: 0; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; width: 100%; }
.input:hover, .select:hover { border-color: #b9c0cb; } .input:focus, .select:focus { outline: 2px solid var(--primary-border); border-color: var(--primary); }
.select { padding-right: 26px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center; }
.select.sm, .input.sm { height: 28px; font-size: 12.5px; border-radius: 6px; }
.field { display: flex; flex-direction: column; gap: 5px; } .field > label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.search { position: relative; } .search .icon { position: absolute; left: 10px; top: 8px; color: var(--muted); } .search .input { padding-left: 33px; width: 100%; }
.check { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.seg { display: inline-flex; padding: 2px; background: #eceff3; border-radius: 8px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 12px; color: var(--muted); font-weight: 500; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); } .tabs button.on { color: var(--primary); border-color: var(--primary); }

/* ---- surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 0; }
.card-b { padding: 14px 16px 16px; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g-main { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis.k8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1380px) { .kpis.k8 { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis.k8 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { display: block; padding: 13px 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
a.kpi:hover { border-color: var(--primary-border); box-shadow: 0 2px 8px rgba(11,59,140,.08); text-decoration: none; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 500; } .kpi .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; } .kpi .s { font-size: 12px; color: var(--muted); }
.kpi.alert .v { color: var(--danger); } .kpi.good .v { color: var(--ok); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-size: 14px; }
.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--info-soft); color: #1849a9; border: 1px solid #c7dafb; font-size: 13px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: #f6dc8b; } .notice.danger { background: var(--danger-soft); color: var(--danger); border-color: #f3c3be; } .notice.ok { background: var(--ok-soft); color: var(--ok); border-color: #b6e3c9; }

/* ---- chips ---- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: #eef0f3; color: #344054; white-space: nowrap; border: 1px solid transparent; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.danger { background: var(--danger-soft); color: var(--danger); } .chip.info { background: var(--info-soft); color: var(--info); } .chip.primary { background: var(--primary-soft); color: var(--primary); }
.chip.outline { background: transparent; border-color: var(--border-strong); }
.rating { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 6px; font-weight: 650; font-size: 12.5px; font-variant-numeric: tabular-nums; background: #eef0f3; }
.rating.r1 { background: #fde8e6; color: var(--r1); } .rating.r2 { background: #ffedd5; color: #9a3412; } .rating.r3 { background: #eceff3; color: #344054; } .rating.r4 { background: #dff1fb; color: #0b5a8a; } .rating.r5 { background: #def5e8; color: var(--ok); }

/* ---- table ---- */
.tbl-wrap { overflow: auto; border-radius: inherit; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12px; color: var(--text-2); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.tbl th.sortable { cursor: pointer; } .tbl th.sortable:hover { color: var(--text); } .tbl th .arr { opacity: .8; margin-left: 4px; }
.tbl td { padding: 8px 12px; border-bottom: 1px solid #eef0f3; vertical-align: middle; background: var(--surface); }
.tbl.grid-nowrap td { white-space: nowrap; }
.tbl.grid-nowrap td.name-cell { max-width: 250px; overflow: hidden; text-overflow: ellipsis; }
.tbl tbody tr:hover td { background: #f8fafc; } .tbl tr.sel td { background: var(--primary-soft); } .tbl tr.active td { background: #e1eafb; }
.tbl tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); } .tbl tr.overdue td { background: #fffafa; } .tbl tr.overdue:hover td { background: #fff3f2; }
.tbl tr.removed td { opacity: .5; text-decoration: line-through; }
.tbl td.c-click { cursor: pointer; } .tbl .editable { cursor: cell; border-radius: 4px; } .tbl .editable:hover { outline: 1px dashed var(--border-strong); outline-offset: 2px; }
.tbl .sticky { position: sticky; left: 0; z-index: 1; } .tbl th.sticky { z-index: 3; } .tbl .sticky.s2 { left: 38px; box-shadow: 1px 0 0 var(--border); }
.tbl td.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.tbl.compact td { padding: 6px 10px; } .tbl.compact th { padding: 7px 10px; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- toolbar ---- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px; border-bottom: 1px solid var(--border); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.pill:hover { background: var(--surface-2); } .pill.on { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }
.pill .n { font-variant-numeric: tabular-nums; opacity: .75; }
.bulkbar { position: sticky; bottom: 16px; z-index: 20; margin: 12px auto 0; width: fit-content; max-width: calc(100% - 24px); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: #111c33; color: #fff; padding: 8px 10px 8px 14px; border-radius: 12px; box-shadow: var(--shadow-pop); }
.bulkbar .btn { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; height: 30px; } .bulkbar .btn:hover { background: rgba(255,255,255,.2); }
.bulkbar .btn.danger { color: #ffb4ab; } .bulkbar .sep { width: 1px; height: 20px; background: rgba(255,255,255,.2); margin: 0 4px; }
.bulkbar a { color: #bcd2ff; cursor: pointer; }

/* ---- popovers / menus / multiselect ---- */
.pop { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); min-width: 200px; max-height: 360px; overflow: auto; padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 6px; text-align: left; color: var(--text); }
.menu-item:hover { background: var(--surface-2); } .menu-item.on { background: var(--primary-soft); color: var(--primary); } .menu-sep { height: 1px; background: var(--border); margin: 5px 0; } .menu-h { padding: 6px 10px 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.ms-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; font-weight: 500; color: var(--text-2); }
.ms-btn:hover { border-color: #b9c0cb; } .ms-btn.on { border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary); } .ms-btn .cnt { background: var(--primary); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; min-width: 18px; text-align: center; }
.ms-list label { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 6px; cursor: pointer; } .ms-list label:hover { background: var(--surface-2); }
.ms-list .n { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---- modal / drawer / toast ---- */
.scrim { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 60; display: grid; place-items: center; padding: 20px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { width: min(980px, 100%); } .modal.mid { width: min(720px, 100%); }
.modal-h { padding: 18px 20px 4px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; } .modal-h p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-b { padding: 14px 20px; overflow: auto; } .modal-f { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.drawer-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(16,24,40,.25); animation: fade .12s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); box-shadow: var(--shadow-pop); z-index: 55; display: flex; flex-direction: column; animation: slide .18s ease-out; }
.drawer-h { padding: 18px 20px 12px; border-bottom: 1px solid var(--border); } .drawer-b { padding: 16px 20px; overflow: auto; flex: 1; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; background: #111c33; color: #fff; border-radius: 10px; box-shadow: var(--shadow-pop); animation: slide-up .18s; max-width: 420px; }
.toast.error { background: #7a1710; } .toast.ok .icon { color: #6ee7a8; } .toast button { background: rgba(255,255,255,.14); border: 0; color: #fff; padding: 4px 10px; border-radius: 6px; font-weight: 500; } .toast button:hover { background: rgba(255,255,255,.26); }
@keyframes fade { from { opacity: 0 } } @keyframes slide { from { transform: translateX(24px); opacity: 0 } } @keyframes slide-up { from { transform: translateY(8px); opacity: 0 } }

/* ---- detail lists / forms ---- */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; } .dl dt { color: var(--muted); } .dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; } .form-grid .full { grid-column: 1 / -1; }
.section-t { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 18px 0 8px; } .section-t:first-child { margin-top: 0; }
.timeline { display: flex; flex-direction: column; gap: 0; } .timeline > div { display: flex; gap: 12px; padding: 0 0 14px; position: relative; } .timeline > div::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 1px; background: var(--border); } .timeline > div:last-child::before { display: none; } .timeline .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--primary); border: 2px solid var(--primary-soft); margin-top: 4px; flex: none; }

/* ---- charts ---- */
.hbar { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 108px; gap: 10px; align-items: center; padding: 5px 6px; margin: 0 -6px; border-radius: 8px; color: inherit; text-decoration: none; }
a.hbar:hover { background: var(--surface-2); text-decoration: none; }
.hbar .lab { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .hbar .val { font-size: 12.5px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.track { height: 10px; background: #eef0f3; border-radius: 99px; overflow: hidden; display: flex; } .track > i { display: block; height: 100%; min-width: 0; }
.track.tall { height: 14px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; } .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.dist td, .dist th { white-space: nowrap; }
.mini-dist { display: flex; height: 10px; border-radius: 4px; overflow: hidden; min-width: 120px; background: #eef0f3; } .mini-dist i { display: block; }
svg text { font-family: var(--font); }
.stepper { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .step { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; } .step .d { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-size: 11px; background: var(--surface); }
.step.done { color: var(--ok); } .step.done .d { background: var(--ok); border-color: var(--ok); color: #fff; } .step.cur { color: var(--primary); font-weight: 600; } .step.cur .d { border-color: var(--primary); color: var(--primary); } .step-line { width: 22px; height: 1.5px; background: var(--border-strong); }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 50% -10%, #dfe9fb, transparent), var(--bg); }
.login-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-pop); }
.user-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; }
.user-opt:hover { border-color: var(--primary-border); background: var(--primary-soft); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }

/* ---- responsive (tablet down) ---- */
@media (max-width: 1100px) {
  .app { grid-template-columns: 64px 1fr; } .brand div:last-child, .nav .label, .nav a span, .side-foot .meta { display: none; } .nav a { justify-content: center; padding: 10px; } .brand { justify-content: center; padding-bottom: 12px; }
  .g-main, .g2, .g3 { grid-template-columns: 1fr; } .page { padding: 16px; } .top { padding: 0 16px; }
}
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; } }
@media print {
  .side, .top, .no-print, .toasts, .bulkbar { display: none !important; } .app { display: block; } body { background: #fff; } .page { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; } .kpis { grid-template-columns: repeat(4, 1fr); }
}
