:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #d9e2ef;
  --text: #10243e;
  --muted: #667991;
  --brand: #1257c2;
  --brand-dark: #0d469c;
  --soft: #edf4ff;
  --ok: #17804f;
  --warn: #d6911b;
  --danger: #c84242;
  --shadow: 0 16px 38px rgba(16, 36, 62, .08);
  --radius: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: 'Cairo', sans-serif; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
#app { min-height: 100vh; }
.hidden { display: none !important; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar { background: linear-gradient(180deg, #0b3d86, #1562d5); padding: 22px; color: #fff; display: grid; gap: 18px; align-content: start; }
.sidebar-brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 50px; height: 50px; border-radius: 16px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 1.35rem; font-weight: 800; }
.small-muted { color: var(--muted); font-size: .88rem; }
.sidebar .small-muted { color: rgba(255,255,255,.72); }
.sidebar-nav { display: grid; gap: 9px; }
.sidebar-nav button { background: rgba(255,255,255,.08); color: #fff; border-radius: 14px; padding: 13px 14px; text-align: right; }
.sidebar-nav button.active { background: #fff; color: var(--brand-dark); font-weight: 800; }
.sidebar-box { display: grid; gap: 10px; background: rgba(255,255,255,.1); padding: 14px; border-radius: 18px; }
.full { width: 100%; }
.main { padding: 24px 28px 32px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 18px; }
.topbar h2 { margin: 0 0 6px; }
.topbar p { margin: 0; color: var(--muted); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.search-input, .select-box { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 11px 12px; min-width: 220px; }
.mini-select { min-width: 170px; }
.primary-btn, .ghost-btn { padding: 11px 15px; border-radius: 14px; font-weight: 800; }
.primary-btn { background: var(--brand); color: #fff; }
.primary-btn.mini { padding: 8px 12px; font-size: .9rem; }
.ghost-btn { background: var(--soft); color: var(--brand-dark); }
.icon-btn { width: 36px; height: 36px; border-radius: 12px; background: #eef4ff; color: var(--brand-dark); }
.full-input { width: 100%; min-width: 0; }
.compact-actions { gap: 8px; }
.stack-actions { display: grid; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(980px, 100%); background: var(--card); border-radius: 26px; box-shadow: var(--shadow); padding: 26px; display: grid; gap: 24px; }
.brand-row { display: flex; gap: 14px; align-items: center; }
.brand-row h1 { margin: 0; }
.brand-row p { margin: 4px 0 0; color: var(--muted); }
.login-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, 1fr); }
.panel, .card, .stat-card, .survey-card, .employee-row, .check-item, .activity-item, .summary-box, .resource-card { background: var(--card); border: 1px solid rgba(16,36,62,.07); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 22px; display: grid; gap: 14px; }
.panel p { margin: 0; color: var(--muted); line-height: 1.9; }

.grid { display: grid; }
.gap-16 { gap: 16px; }
.two-col { grid-template-columns: 1.2fr .95fr; }
.stats-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); }
.stat-card { padding: 18px; }
.stat-card span { display: block; color: var(--muted); font-size: .92rem; }
.stat-card strong { display: block; margin: 8px 0; font-size: 1.7rem; }
.stat-card p { margin: 0; color: var(--muted); }
.card { padding: 18px; }
.card-title-row { display: flex; justify-content: space-between; gap: 14px; align-items: start; margin-bottom: 14px; }
.card-title-row h3 { margin: 0; }
.card-title-row p { margin: 5px 0 0; color: var(--muted); }
.inline-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.table-wrap { overflow: auto; }
.table-wrap.short { max-height: 420px; }
.data-table { width: 100%; min-width: 1040px; border-collapse: collapse; }
.data-table.compact { min-width: 760px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 11px 10px; text-align: right; vertical-align: top; }
.data-table th { position: sticky; top: 0; background: #f8fbff; z-index: 2; }
.progress { min-width: 120px; position: relative; height: 10px; border-radius: 999px; background: #edf2f8; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #63a8ff); }
.progress em { position: absolute; top: -22px; left: 0; font-style: normal; font-size: .82rem; color: var(--muted); }
.pill { display: inline-flex; border-radius: 999px; padding: 6px 10px; font-size: .82rem; font-weight: 800; }
.pill.ok { background: #e8f8ef; color: var(--ok); }
.pill.pending { background: #fff4df; color: var(--warn); }
.pill.doing { background: #eaf1ff; color: var(--brand); }
.pill.danger { background: #ffe8e8; color: var(--danger); }

.employees-layout { grid-template-columns: 1fr; }
.side-scroll { max-height: none; display: grid; grid-template-rows: auto 1fr auto; }
.employee-scroller { overflow: auto; display: grid; gap: 10px; padding-inline-end: 6px; }
.employee-row { padding: 14px; display: grid; gap: 7px; text-align: right; }
.employee-row.active { border-color: #89b1ef; background: #f7fbff; }
.summary-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
.summary-grid-three { grid-template-columns: repeat(3, 1fr); }
.summary-box { padding: 14px; }
.summary-box span { display: block; color: var(--muted); font-size: .88rem; margin-bottom: 6px; }
.summary-box strong { display: block; }
.check-list, .activity-list, .survey-grid, .step-timeline, .content-stack { display: grid; gap: 12px; }
.check-item, .activity-item, .survey-card, .resource-card { padding: 14px; }
.check-item p, .activity-item p, .survey-card p, .resource-card p { margin: 4px 0 0; color: var(--muted); line-height: 1.8; }
.check-item strong, .survey-card h4 { margin: 0; }

.hero-card { background: linear-gradient(135deg, #0e52b5, #257ef2); color: #fff; padding: 24px; border-radius: 24px; display: flex; justify-content: space-between; gap: 20px; align-items: center; box-shadow: var(--shadow); }
.hero-card h3 { margin: 10px 0 10px; font-size: 1.75rem; }
.hero-card p { margin: 0; color: rgba(255,255,255,.88); }
.tag { background: rgba(255,255,255,.16); display: inline-flex; padding: 6px 12px; border-radius: 999px; font-size: .85rem; }
.progress-ring { width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; border: 10px solid rgba(255,255,255,.24); }
.progress-ring span { font-size: 1.3rem; font-weight: 800; }
.current-step-card .focus-step { display: grid; gap: 10px; }
.current-step-card .focus-step p { margin: 0; color: var(--muted); line-height: 1.8; }
.timeline-row { border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: start; }
.timeline-index { width: 40px; height: 40px; border-radius: 50%; background: #eef4ff; color: var(--brand); display: grid; place-items: center; font-weight: 800; }
.timeline-index.done { background: #e8f8ef; color: var(--ok); }
.timeline-body p { margin: 5px 0 0; color: var(--muted); line-height: 1.8; }
.timeline-action { min-width: 140px; }

.stage-tabs { display: flex; flex-wrap: wrap; gap: 10px; }
.stage-tab { padding: 10px 13px; border-radius: 14px; background: #eef4ff; color: var(--brand-dark); }
.stage-tab.active { background: var(--brand); color: #fff; }
.stage-info-box { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #f8fbff; }
.stage-info-box h3 { margin: 0 0 8px; }
.stage-info-box p { margin: 0 0 12px; color: var(--muted); line-height: 1.8; }
.resource-viewer { border: 1px dashed var(--line); border-radius: 18px; padding: 16px; background: #fbfdff; }
.rich-text { line-height: 2; color: var(--text); white-space: normal; }
.resource-image { max-width: 100%; border-radius: 16px; display: block; }
.muted-block { margin: 0; color: var(--muted); line-height: 1.9; }

.modal-overlay { position: fixed; inset: 0; background: rgba(16,36,62,.36); display: grid; place-items: center; padding: 16px; z-index: 80; }
.modal-card { width: min(880px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 24px; box-shadow: 0 26px 60px rgba(16,36,62,.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 0; }
.modal-header h3 { margin: 0; }
.modal-body { padding: 16px 20px; }
.modal-footer { padding: 0 20px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.form-grid label { display: grid; gap: 8px; }
.form-grid label span { font-weight: 700; }
.full-span { grid-column: 1 / -1; }
.multi-select { min-height: 160px; }

.chat-launcher { position: fixed; left: 24px; bottom: 24px; z-index: 30; background: var(--brand); color: #fff; padding: 14px 20px; border-radius: 999px; font-weight: 800; box-shadow: 0 14px 34px rgba(18,87,194,.3); }
.chat-panel { position: fixed; left: 24px; bottom: 84px; z-index: 31; width: 400px; max-width: calc(100vw - 40px); background: #fff; border-radius: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.chat-header { background: #f8fbff; display: flex; justify-content: space-between; align-items: start; padding: 14px 16px 10px; }
.chat-header p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; }
.quick-questions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }
.quick-questions button { padding: 8px 10px; border-radius: 999px; background: #eef4ff; color: var(--brand-dark); }
.chat-body { height: 330px; overflow: auto; padding: 16px; display: grid; gap: 10px; }
.chat-msg { max-width: 84%; padding: 12px 14px; border-radius: 16px; line-height: 1.9; }
.chat-msg.bot { background: #f4f7fb; }
.chat-msg.user { background: #eaf1ff; justify-self: end; }
.chat-input-row { display: flex; gap: 10px; border-top: 1px solid var(--line); padding: 14px 16px 16px; }
.chat-input-row input { flex: 1; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }

@media (max-width: 1180px) {
  .stats-grid, .summary-grid, .two-col, .login-grid, .form-grid, .summary-grid-three { grid-template-columns: 1fr; }
  .employees-layout { grid-template-columns: 1fr; }
  .side-scroll { max-height: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .topbar { display: grid; }
  .timeline-row { grid-template-columns: 40px 1fr; }
  .timeline-action { grid-column: 2; min-width: 0; }
}


.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #2158d8, #0f2c59 70%);
  transition: opacity .5s ease, visibility .5s ease;
}
.splash-screen.hide { opacity: 0; visibility: hidden; }
.splash-logo {
  color: #fff;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 800;
  letter-spacing: .08em;
  text-shadow: 0 10px 30px rgba(0,0,0,.24);
}
.stage-overview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stage-overview-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: #fbfdff; display: grid; gap: 8px; }
.stage-overview-card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.7; }
.survey-fill-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: grid; gap: 12px; }
.rating-row { display: flex; flex-wrap: wrap; gap: 10px; }
.rating-row label { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 6px; background: #f8fbff; }
@media (max-width: 1180px) {
  .stage-overview-grid { grid-template-columns: 1fr; }
}


/* v4 responsive fixes */
html{ -webkit-text-size-adjust:100%; }
body{ overflow-x:auto; }
img,video{ max-width:100%; height:auto; }
.primary-btn,.ghost-btn,.select-box,.search-input,input,textarea,select{ min-height:44px; }
.sidebar{ position:sticky; top:0; z-index:20; }
.employee-scroller{ overscroll-behavior:contain; }
.current-step-card .inline-actions .primary-btn,.current-step-card .inline-actions .ghost-btn{ width:100%; }
@media (max-width: 900px){
  .login-wrap{ padding:12px; }
  .login-card{ padding:16px; border-radius:20px; }
  .panel,.card,.stat-card,.survey-card,.employee-row,.check-item,.activity-item,.summary-box,.resource-card{ border-radius:16px; }
  .brand-row{ align-items:flex-start; }
  .brand-mark{ width:42px; height:42px; border-radius:12px; }
  .main{ padding:12px; }
  .sidebar{ padding:12px; gap:12px; position:static; border-bottom-left-radius:18px; border-bottom-right-radius:18px; }
  .sidebar-brand{ gap:10px; }
  .sidebar-nav{ grid-auto-flow:column; grid-auto-columns:minmax(140px,1fr); overflow:auto; padding-bottom:4px; }
  .sidebar-nav button{ white-space:nowrap; min-height:44px; }
  .topbar{ gap:12px; margin-bottom:12px; }
  .top-actions{ flex-wrap:wrap; }
  .top-actions > *{ width:100%; min-width:0; }
  .select-box,.search-input{ min-width:0; width:100%; }
  .hero-card{ padding:16px; flex-direction:column; align-items:flex-start; }
  .hero-card h3{ font-size:1.25rem; }
  .progress-ring{ width:92px; height:92px; border-width:8px; align-self:flex-end; }
  .card-title-row{ gap:10px; }
  .card-title-row,.modal-header,.modal-footer{ flex-wrap:wrap; }
  .inline-actions,.compact-actions{ width:100%; }
  .inline-actions > *, .compact-actions > *{ flex:1 1 100%; }
  .timeline-row{ grid-template-columns:32px 1fr; gap:10px; }
  .timeline-index{ width:32px; height:32px; font-size:.9rem; }
  .chat-launcher{ left:12px; bottom:12px; padding:12px 16px; }
  .chat-panel{ left:12px; right:12px; width:auto; bottom:70px; max-width:none; }
  .chat-body{ height:260px; }
  .form-grid{ grid-template-columns:1fr; }
  .modal-card{ width:100%; max-height:calc(100vh - 16px); border-radius:18px; }
  .table-wrap{ -webkit-overflow-scrolling:touch; }
  .data-table{ min-width:820px; }
  .data-table.compact{ min-width:680px; }
  .employees-layout{ grid-template-columns:1fr; }
  .side-scroll{ max-height:none; grid-template-rows:auto auto auto; }
  .employee-scroller{ max-height:280px; }
  .summary-grid,.summary-grid-three,.stats-grid,.stage-overview-grid{ grid-template-columns:1fr; }
}
@media (max-width: 640px){
  .login-grid{ grid-template-columns:1fr; }
  .panel{ padding:16px; }
  .panel p{ line-height:1.7; }
  .brand-row h1{ font-size:1.4rem; }
  .main h2{ font-size:1.2rem; }
  .main p{ line-height:1.7; }
  .current-step-card .focus-step strong{ font-size:1rem; }
  .pill{ font-size:.78rem; }
  .modal-body,.modal-footer,.modal-header{ padding-inline:14px; }
  .chat-input-row{ flex-direction:column; }
  .chat-input-row .primary-btn{ width:100%; }
  .quick-questions{ display:grid; grid-template-columns:1fr; }
  .quick-questions button{ width:100%; text-align:right; }
  .employee-row{ padding:12px; }
}


.shell{grid-template-columns:minmax(0,1fr) 310px; min-height:100vh; align-items:start;}
.main{min-width:0; overflow-x:auto;}
.topbar{grid-template-columns:minmax(0,1fr) auto; align-items:start;}
.two-col,.employees-layout,.stats-grid,.summary-grid,.summary-grid-three{grid-template-columns:minmax(0,1fr) minmax(0,1fr);}
.employees-layout{grid-template-columns:minmax(0,1fr) 320px; align-items:start; min-height:calc(100vh - 180px);}
.table-wrap{overflow:auto; max-width:100%;}
.data-table td,.data-table th{font-size:.9rem; vertical-align:top;}
.card h3,.panel h3{font-size:1.15rem;}
.main h2{font-size:1.55rem; margin:0 0 6px;}
.main p,.small-muted,.check-item p,.activity-item p,.survey-card p,.resource-card p,.timeline-body p{font-size:.92rem;}
.primary-btn,.ghost-btn,.stage-tab,.select-box,.search-input{font-size:.95rem;}
.stage-ribbon{display:flex;justify-content:space-between;align-items:center;gap:16px;background:#f8fbff;border:1px solid var(--line);border-radius:20px;padding:14px 16px;margin-bottom:14px;box-shadow:var(--shadow-soft);}
.stage-ribbon-title{font-size:1.1rem;font-weight:800;color:var(--brand-dark);margin:4px 0;}
.stage-ribbon-progress{display:grid;gap:4px;text-align:left;min-width:110px;}
.stage-ribbon-progress strong{font-size:1.2rem;color:var(--brand);}
.compact-hero h3{font-size:1.35rem;}
.stage-mini-banner{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;border:1px solid var(--line);border-radius:14px;background:#f8fbff;}
.inline-actions{flex-wrap:wrap;}
.sidebar-nav button,.sidebar-box button{font-size:.95rem;}
.employee-scroller{max-height:420px; overflow:auto;}
.resource-viewer{max-width:100%; overflow:auto;}
@media (max-width:1180px){.employees-layout,.two-col,.stats-grid,.summary-grid,.summary-grid-three{grid-template-columns:1fr;}.shell{grid-template-columns:1fr;}}
@media (max-width:900px){body{font-size:13px;} .main h2{font-size:1.25rem;} .card h3,.panel h3{font-size:1rem;} .stage-ribbon{padding:12px;align-items:flex-start;flex-direction:column;} .employees-layout{grid-template-columns:1fr;} .employee-scroller{max-height:260px;} .sidebar-nav{grid-auto-columns:minmax(130px,1fr);} }


/* v6 refined UI */
:root{
  --sidebar-width: 272px;
  --sidebar-collapsed-width: 88px;
}
html,body{overflow-x:hidden !important;}
body{
  font-size:14px;
  line-height:1.65;
}
h1{font-size:1.5rem;}
h2{font-size:1.2rem;}
h3{font-size:1.02rem;}
h4{font-size:.96rem;}
p,.small-muted,.muted-block,.check-item p,.activity-item p,.survey-card p,.resource-card p,.timeline-body p{font-size:.86rem;}
button,input,select,textarea{font-family:'Cairo',sans-serif; font-size:.9rem;}
.shell{
  grid-template-columns: var(--sidebar-width) minmax(0,1fr);
  width:100%;
  max-width:100%;
  overflow:hidden;
  background:#f4f7fb;
}
.shell.sidebar-collapsed{grid-template-columns: var(--sidebar-collapsed-width) minmax(0,1fr);}
.sidebar{
  width:100%;
  min-width:0;
  height:100vh;
  overflow:auto;
  position:sticky;
  top:0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.sidebar-brand{
  display:grid;
  grid-template-columns:46px 1fr 34px;
  align-items:center;
  gap:10px;
}
.brand-copy{min-width:0;}
.brand-copy strong{font-size:1.08rem;}
.small-muted{font-size:.78rem;}
.sidebar-toggle-btn{width:34px;height:34px;background:rgba(255,255,255,.12);color:#fff;border:1px solid rgba(255,255,255,.18);}
.sidebar-nav{display:grid;gap:10px;}
.sidebar-nav button,.sidebar-box .ghost-btn{
  min-height:48px;
  border-radius:14px;
  font-size:.92rem;
  justify-content:flex-start;
  padding-inline:16px;
}
.shell.sidebar-collapsed .sidebar-brand{grid-template-columns:46px 34px;}
.shell.sidebar-collapsed .brand-copy,
.shell.sidebar-collapsed .sidebar-box .ghost-btn,
.shell.sidebar-collapsed .sidebar-nav button{overflow:hidden;}
.shell.sidebar-collapsed .sidebar-nav button,
.shell.sidebar-collapsed .sidebar-box .ghost-btn{
  font-size:0;
  padding-inline:0;
  justify-content:center;
}
.shell.sidebar-collapsed .sidebar-nav button::first-letter,
.shell.sidebar-collapsed .sidebar-box .ghost-btn::first-letter{font-size:1.15rem;}
.main{min-width:0; padding:18px 20px; overflow:auto; min-height:100vh;}
.topbar{
  align-items:center;
  gap:12px;
  margin-bottom:14px;
  background:#fff;
  padding:14px 16px;
  border-radius:16px;
  box-shadow:var(--shadow);
}
.topbar-title p{margin-top:4px;}
.top-actions{min-width:0; display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end;}
.search-input,.select-box,.primary-btn,.ghost-btn{border-radius:12px;}
.primary-btn,.ghost-btn{padding:10px 14px; min-height:42px; font-weight:700;}
.panel,.card,.stat-card,.survey-card,.employee-row,.check-item,.activity-item,.summary-box,.resource-card,.stage-overview-card,.timeline-row{border-radius:14px;}
.card,.panel{padding:14px;}
.card-title-row{gap:10px; margin-bottom:12px;}
.summary-grid,.summary-grid-three{gap:10px;}
.summary-box{padding:12px;}
.summary-box strong{font-size:.96rem;}
.employee-scroller{max-height:calc(100vh - 300px); overflow:auto; padding-inline-end:2px;}
.employee-row{padding:12px; gap:8px; text-align:right;}
.data-table{font-size:.87rem; min-width:0; width:100%; table-layout:auto;}
.data-table th,.data-table td{padding:12px 10px; vertical-align:top; line-height:1.7;}
.table-wrap{overflow:auto; max-width:100%; -webkit-overflow-scrolling:touch;}
.table-wrap.short{max-height:360px; overflow:auto;}
.compact-actions{display:flex; flex-wrap:wrap; gap:8px;}
.compact-actions > *{flex:0 0 auto;}
.pill{font-size:.78rem; padding:6px 10px;}
.hero-card{padding:18px 20px; border-radius:18px;}
.progress-ring{width:96px; height:96px; border-width:8px;}
.chat-launcher{left:18px; bottom:18px; padding:12px 16px; font-size:.9rem;}
.chat-panel{left:18px; bottom:74px; width:360px; border-radius:18px;}
.modal-card{border-radius:18px;}
.form-grid{gap:12px;}
.resource-viewer{padding:14px; border-radius:14px;}
.stage-ribbon, .stage-tabs{overflow:auto hidden; scrollbar-width:thin;}
.mobile-menu-btn,.sidebar-overlay{display:none;}

@media (max-width: 1200px){
  .shell{grid-template-columns: var(--sidebar-width) minmax(0,1fr);}
  .main{padding:16px;}
  .data-table{min-width:760px;}
}
@media (max-width: 900px){
  .mobile-menu-btn{
    display:grid;
    place-items:center;
    position:fixed;
    top:12px;
    right:12px;
    z-index:55;
    width:42px;
    height:42px;
    border-radius:12px;
    background:#0e52b5;
    color:#fff;
    box-shadow:var(--shadow);
  }
  .shell,.shell.sidebar-collapsed{grid-template-columns: 1fr;}
  .sidebar{
    position:fixed;
    top:0;
    right:0;
    width:min(86vw,320px);
    height:100vh;
    transform:translateX(105%);
    transition:transform .25s ease;
    z-index:60;
    border-radius:0;
  }
  .shell.sidebar-open .sidebar{transform:translateX(0);}
  .shell.sidebar-open .sidebar-overlay{
    display:block;
    position:fixed;
    inset:0;
    background:rgba(15,36,65,.35);
    z-index:50;
  }
  .main{padding:12px;}
  .topbar{padding:12px 14px; margin-top:48px;}
  .top-actions{justify-content:stretch;}
  .top-actions > *{flex:1 1 100%;}
  .employee-scroller{max-height:280px;}
}
@media (max-width: 640px){
  body{font-size:13px;}
  h2{font-size:1.05rem;}
  h3{font-size:.95rem;}
  .card,.panel{padding:12px;}
  .sidebar-nav button,.sidebar-box .ghost-btn{font-size:.88rem; min-height:44px;}
  .data-table{font-size:.82rem; min-width:680px;}
  .hero-card h3{font-size:1.05rem;}
  .summary-box span{font-size:.76rem;}
  .chat-panel{left:12px; right:12px; width:auto; max-width:none;}
}


/* v7 employees page refinement */
.shell{overflow:visible;}
.main > section, .main > .grid, .main > .card{min-width:0;}
.employees-layout > .card:first-child{position:sticky; top:88px; max-height:calc(100vh - 120px);}
.employee-detail-stack{min-height:0; grid-template-rows:auto minmax(0,1fr);}
.employee-detail-stack .card:last-child{min-height:0; display:grid;}
.employee-detail-stack .card:last-child .table-wrap{max-height:calc(100vh - 430px); min-height:300px;}
.summary-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
.employees-toolbar{display:flex; gap:10px; align-items:center; flex-wrap:wrap;}
.employee-scroller .employee-row{border:1px solid rgba(16,36,62,.08);}
.employee-row strong{font-size:.96rem;}
.employee-row span{font-size:.82rem; color:var(--muted);}
@media (max-width: 1180px){
  .employees-layout{grid-template-columns:1fr; min-height:auto;}
  .employees-layout > .card:first-child{position:static; max-height:none;}
  .employee-detail-stack .card:last-child .table-wrap{max-height:480px; min-height:unset;}
}
@media (max-width: 900px){
  .summary-grid{grid-template-columns:1fr 1fr;}
  .employee-detail-stack .card:last-child .table-wrap{max-height:420px;}
}
@media (max-width: 640px){
  .summary-grid{grid-template-columns:1fr;}
  .employees-toolbar > *{width:100%;}
  .employee-scroller{max-height:220px;}
  .employee-detail-stack .card:last-child .table-wrap{max-height:360px;}
}


/* v8 guided refinements */
.employees-workspace{align-items:start;}
.employees-list-card{position:sticky; top:88px; max-height:calc(100vh - 110px); overflow:hidden;}
.employees-scroll-list{max-height:calc(100vh - 260px);}
.employee-sticky-head{position:static; top:auto; z-index:auto;}
.employee-summary-grid{grid-template-columns:repeat(4,minmax(0,1fr));}
.employee-steps-card{min-height:calc(100vh - 320px); display:grid; align-content:start;}
.journey-step-scroll{max-height:none; overflow:visible; display:grid; gap:12px; padding-inline-end:4px;}
.journey-step-card{display:grid; grid-template-columns:44px 1fr auto; gap:12px; align-items:start; padding:14px; border:1px solid var(--line); border-radius:16px; background:#fff;}
.journey-step-card.done{background:#f8fcf9; border-color:#bfe2cb;}
.step-check-wrap{display:grid; place-items:start; padding-top:4px;}
.step-check{position:absolute; opacity:0; pointer-events:none;}
.step-check-box{width:26px; height:26px; border-radius:9px; border:2px solid #b6c7dd; background:#fff; position:relative; display:block;}
.step-check:checked + .step-check-box{background:#1b7f51; border-color:#1b7f51;}
.step-check:checked + .step-check-box::after{content:'✓'; color:#fff; position:absolute; inset:0; display:grid; place-items:center; font-weight:800;}
.journey-step-main strong{display:block; font-size:1rem; margin-bottom:4px;}
.journey-step-main p{margin:6px 0; color:var(--muted); line-height:1.8;}
.journey-step-head{display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:6px;}
.journey-step-side{display:grid; gap:8px; align-content:start;}
.resource-chip-row{display:flex; gap:8px; flex-wrap:wrap; margin-top:8px;}
.resource-chip{background:#eef4ff; color:var(--brand-dark); padding:5px 9px; border-radius:999px; font-size:.78rem;}
.stage-line-card{margin-top:12px; padding:12px 14px; border:1px solid var(--line); background:#f8fbff; border-radius:16px;}
.stage-line-header{display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:10px;}
.stage-line-track{display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:8px; align-items:start;}
.stage-node{display:grid; gap:6px; justify-items:center; text-align:center; position:relative;}
.stage-node .dot{width:12px; height:12px; border-radius:50%; background:#cfd9e6; display:block;}
.stage-node strong{font-size:.78rem; font-weight:700; line-height:1.5; color:var(--muted);}
.stage-node.done .dot{background:#1b7f51;}
.stage-node.done strong{color:#1b7f51;}
.stage-node.current .dot{background:#1257c2; box-shadow:0 0 0 6px rgba(18,87,194,.12);}
.stage-node.current strong{color:#1257c2;}
.stage-node.upcoming .dot{background:#cfd9e6;}
.employee-home-layout{grid-template-columns:1.15fr .85fr;}
.guided-hero{align-items:center;}
.employee-focus-card{border:1px solid #cfe0fb;}
.employee-focus-step strong{font-size:1.12rem;}
.employee-focus-actions{align-items:center;}
.compact-step-timeline .timeline-row{grid-template-columns:38px 1fr auto; padding:12px;}
.resource-picker-block{display:grid; gap:10px;}
.field-label{font-weight:700; color:var(--text);}
.resource-pick-grid{display:grid; gap:8px; max-height:220px; overflow:auto; border:1px solid var(--line); border-radius:14px; padding:10px; background:#fbfdff;}
.resource-pick-item{display:grid; grid-template-columns:18px 1fr; gap:10px; align-items:start; padding:8px 10px; border:1px solid #eef2f7; border-radius:12px; background:#fff;}
.resource-pick-item strong{display:block; font-size:.9rem;}
.resource-pick-item small{display:block; margin-top:3px; color:var(--muted); font-size:.78rem;}
@media (max-width: 1180px){
  .employee-home-layout,.employees-layout{grid-template-columns:1fr;}
  .employees-list-card,.employee-sticky-head{position:static; max-height:none;}
  .employees-scroll-list{max-height:240px;}
  .employee-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .journey-step-scroll{max-height:520px;}
  .stage-line-track{grid-template-columns:repeat(4,minmax(0,1fr));}
}
@media (max-width: 760px){
  .journey-step-card{grid-template-columns:32px 1fr;}
  .journey-step-side{grid-column:2; justify-items:start;}
  .employee-summary-grid{grid-template-columns:1fr;}
  .stage-line-track{grid-template-columns:repeat(2,minmax(0,1fr));}
  .stage-line-header{flex-direction:column; align-items:flex-start;}
  .employees-scroll-list{max-height:200px;}
}


/* v9 employees vertical */
.employees-vertical-page{grid-template-columns:1fr; align-items:start;}
.employees-top-card{display:grid; gap:14px;}
.vertical-employee-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:12px; max-height:none; overflow:visible;}
.employee-fixed-header-card{position:sticky; top:16px; z-index:3;}
.compact-summary-grid{grid-template-columns:repeat(4,minmax(0,1fr));}
.vertical-steps-card{display:grid; gap:12px;}
.journey-step-stack{display:grid; gap:12px; max-height:none; overflow:visible;}
.stack-actions-on-small{display:flex; flex-wrap:wrap;}
.employees-list-card .employee-row{min-height:112px;}
@media (max-width: 1100px){
  .compact-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width: 760px){
  .vertical-employee-grid{grid-template-columns:1fr;}
  .compact-summary-grid{grid-template-columns:1fr;}
  .stack-actions-on-small{display:grid; width:100%;}
  .employee-fixed-header{display:grid; gap:10px;}
}
