/* ═════════════════════════════════════════════════════════════════════
   HRMS design system v3 — "modern & spacious" (30 Nov 2026)
   Navy + gold brand. Scoped to html.ds3, loaded after hrms.css + ui2.css.
   Layer 1 restyles the existing classes (.card .btn .bx .fld .modal table .sc)
   so every screen lifts at once; layer 2 adds x-* components for redesigned screens.
   ═════════════════════════════════════════════════════════════════════ */
html.ds3 {
  --bg: #f4f6fa; --s1: #ffffff; --s2: #f7f8fb; --s3: #eef1f6;
  --b1: #e6e9f0; --b2: #d3d8e3;
  --navy: #14213d; --navy-2: #1f3260; --gold: #f0b33a; --gold-2: #fff6e3;
  --acc: #2f5bea; --acc2: #eef3ff; --accT: #2448c8;
  --grn: #15803d; --grn2: #ecfdf3; --red: #c8302b; --red2: #fef1f0;
  --yel: #b45309; --yel2: #fff7e8; --pur: #6d4bd8; --pur2: #f4f0ff; --cyn: #0e7490; --cyn2: #ebfbfd;
  --txt: #101828; --t2: #344054; --t3: #667085; --t4: #98a2b3;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --sh-1: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.05);
  --sh-2: 0 4px 12px -2px rgba(16,24,40,.08), 0 2px 4px -2px rgba(16,24,40,.04);
  --sh-3: 0 24px 48px -12px rgba(16,24,40,.22);
  --f-head: 'Outfit', 'Inter', sans-serif;
}
html.ds3 body { font-size: 14px; letter-spacing: -.005em; -webkit-font-smoothing: antialiased; background: var(--bg); }

/* ── Layer 1: existing building blocks ───────────────────────────── */
html.ds3 .pg { padding: 26px 30px 48px; }
html.ds3 .hdr { min-height: 66px; padding: 12px 30px; }
html.ds3 .hdr h2 { font-size: 21px; letter-spacing: -.015em; }
html.ds3 .card { background: var(--s1); border: 1px solid var(--b1); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 22px 24px; }
html.ds3 .ch { margin-bottom: 16px; gap: 12px; }
html.ds3 .ct { font-family: var(--f-head); font-size: 16px; font-weight: 600; color: var(--txt); letter-spacing: -.01em; }
html.ds3 .g4, html.ds3 .g3, html.ds3 .g2 { gap: 18px; margin-bottom: 20px; }
html.ds3 .sc { border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--sh-1); border-color: var(--b1); }
html.ds3 .sc .lbl { font-size: 12.5px; font-weight: 500; color: var(--t3); margin-bottom: 8px; }
html.ds3 .sc .val { font-family: var(--f-head); font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
html.ds3 .sc .sub { font-size: 12.5px; margin-top: 6px; }

html.ds3 .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 10px;
  font: 600 13.5px/1 'Inter', sans-serif; border: 1px solid var(--b2); background: var(--s1); color: var(--t2); box-shadow: 0 1px 2px rgba(16,24,40,.05); cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s; white-space: nowrap; text-decoration: none; }
html.ds3 .btn:hover { background: var(--s2); border-color: #c2c8d6; }
html.ds3 .btn:focus-visible { outline: 3px solid rgba(47,91,234,.25); outline-offset: 1px; }
html.ds3 .btn.acc { background: var(--navy); border-color: var(--navy); color: #fff; }
html.ds3 .btn.acc:hover { background: var(--navy-2); border-color: var(--navy-2); }
html.ds3 .btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
html.ds3 .btn.danger, html.ds3 .btn.red { color: var(--red); border-color: #f3c9c6; }
html.ds3 .btn.danger:hover { background: var(--red2); }

html.ds3 .bx { padding: 3px 10px; font-size: 11.5px; font-weight: 600; border-radius: 99px; letter-spacing: 0; }
html.ds3 .bx.g { background: var(--grn2); color: var(--grn); } html.ds3 .bx.r { background: var(--red2); color: var(--red); }
html.ds3 .bx.y { background: var(--yel2); color: var(--yel); } html.ds3 .bx.b { background: var(--acc2); color: var(--accT); }
html.ds3 .bx.p { background: var(--pur2); color: var(--pur); } html.ds3 .bx.c { background: var(--cyn2); color: var(--cyn); }
html.ds3 .bx.gr { background: var(--s3); color: var(--t2); }

html.ds3 .fld { gap: 6px; }
html.ds3 .fld label { font-size: 12.5px; font-weight: 600; color: var(--t2); text-transform: none; letter-spacing: 0; }
html.ds3 .fld input, html.ds3 .fld select, html.ds3 .fld textarea { background: var(--s1); border: 1px solid var(--b2); border-radius: 10px; padding: 10px 13px; font-size: 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
html.ds3 .fld input:focus, html.ds3 .fld select:focus, html.ds3 .fld textarea:focus { border-color: var(--acc); box-shadow: 0 0 0 4px rgba(47,91,234,.12); }
html.ds3 .fld input::placeholder, html.ds3 .fld textarea::placeholder { color: var(--t4); }
html.ds3 .fg2 { gap: 16px 18px; }
html.ds3 .ferr { font-size: 12px; color: var(--red); }

html.ds3 table { border-collapse: separate; border-spacing: 0; width: 100%; }
html.ds3 th { font-size: 12px; font-weight: 600; color: var(--t3); text-transform: none; letter-spacing: 0; background: var(--s2); padding: 11px 16px; border-bottom: 1px solid var(--b1); text-align: left; }
html.ds3 th:first-child { border-top-left-radius: 10px; } html.ds3 th:last-child { border-top-right-radius: 10px; }
html.ds3 td { padding: 14px 16px; border-bottom: 1px solid var(--b1); font-size: 13.5px; color: var(--t2); vertical-align: middle; }
html.ds3 tbody tr:last-child td { border-bottom: 0; }
html.ds3 tbody tr:hover td { background: #fafbfd; }
html.ds3 .tw { border: 1px solid var(--b1); border-radius: 12px; }
html.ds3 .card > .tw, html.ds3 .card .tw { margin: 0; }

html.ds3 .modal { background: rgba(16,24,40,.45); backdrop-filter: blur(3px); }
html.ds3 .mb, html.ds3 .mo { border-radius: 18px; padding: 0; box-shadow: var(--sh-3); border: 0; width: 600px; }
html.ds3 .mb.wide, html.ds3 .mo.wide { width: 760px; }
html.ds3 .mh { padding: 22px 26px 18px; margin: 0; border-bottom: 1px solid var(--b1); }
html.ds3 .mt { font-family: var(--f-head); font-size: 19px; font-weight: 600; }
html.ds3 .mb > form, html.ds3 .mb > div:not(.mh) { padding: 22px 26px; }
html.ds3 .mf { margin: 22px -26px -22px; padding: 16px 26px; background: var(--s2); border-top: 1px solid var(--b1); border-radius: 0 0 18px 18px; }
html.ds3 .mc { width: 34px; height: 34px; border-radius: 9px; }

html.ds3 .empty { padding: 56px 24px; } html.ds3 .empty p { max-width: 460px; margin: 0 auto; font-size: 14px; line-height: 1.55; }
html.ds3 .hd-tabs { gap: 8px; margin-bottom: 18px; }
html.ds3 .hd-tabs a { padding: 8px 14px; font-size: 13px; font-weight: 500; border-radius: 10px; border-color: var(--b1); background: var(--s1); }
html.ds3 .hd-tabs a.on { background: var(--navy); border-color: var(--navy); }
html.ds3 .hd-sub { font-size: 12.5px; }
html.ds3 .hd-layout { gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; }
html.ds3 .hd-side .row { padding: 10px 0; font-size: 13.5px; }


/* ── Layer 2: components for redesigned screens ─────────────────── */
.x-page { max-width: 1240px; margin: 0 auto; }
.x-hero { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--s1); border: 1px solid var(--b1); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 22px 26px; margin-bottom: 20px; }
.x-hero-l { display: flex; gap: 16px; align-items: center; min-width: 0; }
.x-hero h2 { font-family: var(--f-head); font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 0; color: var(--txt); }
.x-hero .meta { display: flex; gap: 8px 14px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--t3); }
.x-hero .meta span + span::before { content: '·'; margin-right: 14px; color: var(--t4); }
.x-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.x-avatar { width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font: 600 18px var(--f-head); color: var(--navy); background: linear-gradient(135deg, var(--gold-2), #ffe7b0); flex-shrink: 0; }
.x-avatar.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.x-avatar.xs { width: 24px; height: 24px; border-radius: 7px; font-size: 10px; }

.x-steps { display: flex; background: var(--s1); border: 1px solid var(--b1); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 6px; gap: 4px; margin-bottom: 20px; overflow-x: auto; }
.x-step { flex: 1; min-width: 130px; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 11px; color: var(--t3); font-size: 12px; }
.x-step b { display: block; font-size: 13px; font-weight: 600; color: var(--t2); }
.x-step .n { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; background: var(--s3); color: var(--t3); flex-shrink: 0; }
.x-step.done .n { background: var(--grn); color: #fff; } .x-step.done b { color: var(--t2); }
.x-step.now { background: var(--navy); color: rgba(255,255,255,.72); } .x-step.now b { color: #fff; } .x-step.now .n { background: var(--gold); color: var(--navy); }
.x-step.stop .n { background: var(--red); color: #fff; }

.x-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.x-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.x-card { background: var(--s1); border: 1px solid var(--b1); border-radius: var(--r-lg); box-shadow: var(--sh-1); margin-bottom: 20px; }
.x-card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--b1); }
.x-card-h h3 { font-family: var(--f-head); font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.x-card-h .sub { font-size: 12.5px; color: var(--t3); margin-top: 2px; }
.x-card-b { padding: 20px 22px; }
.x-card-b.flush { padding: 0; }

.x-stat { background: var(--s1); border: 1px solid var(--b1); border-radius: 14px; padding: 16px 18px; box-shadow: var(--sh-1); }
.x-stat .l { font-size: 12.5px; color: var(--t3); font-weight: 500; }
.x-stat .v { font: 600 22px var(--f-head); margin-top: 6px; letter-spacing: -.02em; color: var(--txt); }
.x-stat .s { font-size: 12px; color: var(--t3); margin-top: 4px; }
.x-stat.warn .v { color: var(--red); } .x-stat.good .v { color: var(--grn); }

.x-kv { display: grid; grid-template-columns: 1fr; }
.x-kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--b1); font-size: 13.5px; }
.x-kv > div:last-child { border-bottom: 0; }
.x-kv dt, .x-kv .k { color: var(--t3); } .x-kv dd, .x-kv .v { color: var(--txt); font-weight: 500; text-align: right; margin: 0; }

.x-progress { height: 8px; background: var(--s3); border-radius: 99px; overflow: hidden; }
.x-progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--grn), #22c55e); border-radius: 99px; }

.x-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--s3); color: var(--t2); white-space: nowrap; }
.x-chip .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.x-chip.g { background: var(--grn2); color: var(--grn); } .x-chip.r { background: var(--red2); color: var(--red); } .x-chip.y { background: var(--yel2); color: var(--yel); }
.x-chip.b { background: var(--acc2); color: var(--accT); } .x-chip.p { background: var(--pur2); color: var(--pur); } .x-chip.gold { background: var(--gold-2); color: #8a5a00; }

.x-row { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--b1); }
.x-row:last-child { border-bottom: 0; }
.x-row .body { flex: 1; min-width: 0; } .x-row .t { font-weight: 600; color: var(--txt); font-size: 14px; } .x-row .m { font-size: 12.5px; color: var(--t3); margin-top: 3px; }
.x-row .trail { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.x-row.done .t { color: var(--t3); }
.x-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--b2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; color: #fff; }
.x-check.on { background: var(--grn); border-color: var(--grn); } .x-check.na { background: var(--s3); border-color: var(--s3); color: var(--t3); }

.x-timeline { position: relative; padding-left: 22px; }
.x-timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--b1); }
.x-tl { position: relative; padding: 0 0 18px; font-size: 13px; color: var(--t2); }
.x-tl::before { content: ''; position: absolute; left: -20px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--s1); border: 2px solid var(--b2); }
.x-tl.on::before { border-color: var(--grn); background: var(--grn); }
.x-tl .w { font-size: 12px; color: var(--t4); margin-top: 2px; }

.x-note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; background: var(--acc2); color: var(--t2); }
.x-note.warn { background: var(--yel2); } .x-note.bad { background: var(--red2); color: var(--red); } .x-note.good { background: var(--grn2); }

/* right-side drawer (use instead of cramped modals for edit/detail) */
.x-drawer { position: fixed; inset: 0; z-index: 1200; display: none; }
.x-drawer.on { display: block; }
.x-drawer .scrim { position: absolute; inset: 0; background: rgba(16,24,40,.42); backdrop-filter: blur(2px); }
.x-drawer .panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--s1); box-shadow: var(--sh-3); display: flex; flex-direction: column; animation: xdrawer .18s ease-out; }
@keyframes xdrawer { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.x-drawer .dh { padding: 22px 26px 16px; border-bottom: 1px solid var(--b1); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.x-drawer .dh h3 { font: 600 19px var(--f-head); margin: 0; } .x-drawer .dh .sub { font-size: 13px; color: var(--t3); margin-top: 4px; }
.x-drawer .db { padding: 22px 26px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.x-drawer .df { padding: 16px 26px; border-top: 1px solid var(--b1); background: var(--s2); display: flex; gap: 10px; justify-content: flex-end; }
.x-x { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--b1); background: var(--s1); cursor: pointer; font-size: 16px; color: var(--t3); }

.x-seg { display: inline-flex; background: var(--s3); border-radius: 10px; padding: 3px; gap: 2px; }
.x-seg label { padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--t3); cursor: pointer; }
.x-seg input { display: none; } .x-seg input:checked + span { color: var(--txt); }
.x-seg label:has(input:checked) { background: var(--s1); color: var(--txt); box-shadow: var(--sh-1); }

.x-muted { color: var(--t3); } .x-small { font-size: 12.5px; }
.x-money { font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) { .x-grid, html.ds3 .hd-layout { grid-template-columns: 1fr; } }
@media (max-width: 768px) { html.ds3 .pg { padding: 16px; } html.ds3 .hdr { padding: 8px 12px; } .x-hero { padding: 18px; } .x-card-h, .x-card-b, .x-row { padding-left: 16px; padding-right: 16px; } }

/* dense tables stay compact; buttons inside tables are small and sit in one line */
html.ds3 td { padding: 12px 14px; font-size: 13.5px; }
html.ds3 th { padding: 10px 14px; }
html.ds3 td .btn, html.ds3 td button.btn, html.ds3 td a.btn { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; margin: 2px 2px 2px 0; }
html.ds3 td:last-child { white-space: nowrap; }
html.ds3 td:last-child form { display: inline-block; }
