:root {
  --brand: #2c296a;
  --brand-2: #3a3588;
  --accent: #f87108;
  --accent-dark: #d95e00;
  --ink: #171a1f;
  --muted: #687078;
  --line: #dfe3e8;
  --soft: #f6f7f9;
  --paper: #ffffff;
  --success: #167357;
  --warning: #9b5b08;
  --danger: #c84040;
  --shadow: 0 12px 32px rgba(32, 34, 47, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  min-height: 100vh;
  background: #eef1f4;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(248, 113, 8, 0.3);
  outline-offset: 2px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 30px; line-height: 1.15; letter-spacing: 0; }
h2 { margin-bottom: 4px; font-size: 20px; line-height: 1.25; letter-spacing: 0; }
h3 { margin-bottom: 4px; font-size: 16px; line-height: 1.3; }
p { margin-bottom: 0; }

.portal-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  background: var(--brand);
  color: #fff;
  padding: 22px 16px;
}
.brand-lockup { display: flex; min-width: 0; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-logo { display: block; width: 58px; height: 58px; object-fit: contain; flex: 0 0 auto; }
.brand-copy strong { display: block; color: #fff; font-size: 18px; line-height: 1.15; }
.brand-copy span { display: block; margin-top: 3px; color: rgba(255,255,255,.68); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 3px; margin-top: 24px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.sidebar-nav a {
  display: grid;
  grid-template-columns: 28px minmax(0,1fr);
  align-items: center;
  min-height: 43px;
  border-radius: 7px;
  color: rgba(255,255,255,.78);
  padding: 0 11px;
  text-decoration: none;
  font-weight: 650;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-nav .nav-icon { color: var(--accent); font-size: 11px; font-weight: 900; }
.sidebar-nav .sub-link { min-height: 36px; margin-left: 39px; grid-template-columns: 1fr; color: rgba(255,255,255,.6); font-size: 13px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.16); padding-top: 16px; }
.admin-chip { display: flex; align-items: center; gap: 10px; }
.admin-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 900; }
.admin-chip > span:last-child { display: block; min-width: 0; }
.admin-chip > span:last-child strong, .admin-chip > span:last-child span { display: block; }
.admin-chip > span:last-child strong { color: #fff; font-size: 13px; }
.admin-chip > span:last-child span { color: rgba(255,255,255,.62); font-size: 11px; }

.workspace { min-width: 0; padding: 0 28px 36px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(238,241,244,.94);
  backdrop-filter: blur(12px);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.page-content { display: grid; min-width: 0; gap: 20px; max-width: 1480px; margin: 24px auto 0; }
.portal-footer { display: flex; align-items: center; justify-content: center; gap: 5px; max-width: 1480px; margin: 30px auto 0; color: #858b93; font-size: 11px; letter-spacing: 0; }
.portal-footer strong { color: var(--brand); font-size: 11px; font-weight: 900; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-heading p { max-width: 680px; color: var(--muted); }
.eyebrow { margin-bottom: 5px; color: var(--brand); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.muted { color: var(--muted); }

.button, button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  padding: 8px 14px;
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}
.button:hover, button:hover { background: var(--brand-2); }
button:disabled, .button[aria-disabled="true"] { cursor: not-allowed; opacity: .48; pointer-events: none; }
.button.secondary, button.secondary { border-color: var(--line); background: var(--paper); color: var(--ink); }
.button.secondary:hover, button.secondary:hover { border-color: #c7cbd2; background: #fafafa; }
.button.orange, button.orange { background: var(--accent); color: #fff; }
.button.orange:hover, button.orange:hover { background: var(--accent-dark); }
.button.danger, button.danger { border-color: #f0caca; background: #fff; color: var(--danger); }
.icon-button { display: inline-flex; width: 38px; min-height: 38px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--brand); padding: 0; font-size: 18px; text-decoration: none; }
.icon-button.danger { color: var(--danger); }

.panel { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: 0 1px 2px rgba(32,34,47,.03); }
.panel-header { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 16px 20px; }
.panel-body { padding: 20px; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.dashboard { grid-template-columns: minmax(0,1.6fr) minmax(320px,.9fr); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.stat { min-height: 126px; padding: 18px; }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 750; }
.stat strong { display: block; margin: 7px 0 4px; color: var(--brand); font-size: 30px; line-height: 1; }
.stat p { color: var(--muted); font-size: 12px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.search-field { position: relative; flex: 1 1 280px; max-width: 460px; }
.search-field input { padding-left: 40px; }
.search-field span { position: absolute; left: 14px; top: 50%; color: var(--muted); transform: translateY(-50%); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.compliance-toolbar { display: grid; grid-template-columns: minmax(260px,1fr) auto auto; align-items: end; gap: 12px; border-bottom: 1px solid var(--line); }
.compliance-toolbar .search-field { max-width: none; }
.compliance-toolbar .filters select { width: 168px; }
.compliance-toolbar > strong { align-self: center; color: var(--muted); font-size: 11px; white-space: nowrap; }
.compliance-table table { min-width: 940px; }
.document-number { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.table-action { min-height: 32px; padding: 5px 10px; font-size: 11px; }
.report-overview { align-items: start; }
.report-overview table { min-width: 580px; }
.report-links { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding: 14px; }
.report-links a { border: 1px solid var(--line); border-radius: 7px; color: var(--brand); padding: 7px 10px; font-size: 11px; font-weight: 800; text-decoration: none; }
.report-links a:hover { border-color: var(--brand); background: #f5f4fc; }
.report-table table { min-width: 880px; }

label { display: grid; gap: 6px; color: #4d545d; font-size: 12px; font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd5dc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
}
textarea { min-height: 92px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9299a2; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; grid-column: 1 / -1; margin-top: 4px; }
.form-note { color: var(--muted); font-size: 12px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { background: var(--soft); color: #6f7680; font-size: 10px; text-align: left; text-transform: uppercase; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.person { display: flex; min-width: 190px; align-items: center; gap: 11px; }
.avatar { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #eeecff; color: var(--brand); font-size: 11px; font-weight: 900; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person strong, .person small { display: block; }
.person small { color: var(--muted); }
.pill { display: inline-flex; min-height: 26px; align-items: center; border-radius: 999px; background: #eceaf8; color: var(--brand); padding: 3px 9px; font-size: 11px; font-style: normal; font-weight: 800; white-space: nowrap; }
.pill.success { background: #e6f3ee; color: var(--success); }
.pill.orange { background: #fff0e4; color: #bd5505; }
.pill.danger { background: #fbeaea; color: var(--danger); }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.empty { padding: 36px 20px; color: var(--muted); text-align: center; }

.metric-list, .activity-list, .request-list { display: grid; gap: 0; }
.metric-row, .activity-row, .request-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 14px 0; }
.metric-row:last-child, .activity-row:last-child, .request-row:last-child { border-bottom: 0; }
.leave-result { margin-top: 2px; border-radius: 7px; background: #e9f5f0; padding: 14px 12px; }
.leave-result strong { color: var(--success); font-size: 20px; }
.leave-result.negative { background: #fbeaea; }
.leave-result.negative strong { color: var(--danger); }
.activity-row time { color: var(--brand); font-size: 12px; font-weight: 900; }
.activity-copy { flex: 1; }
.activity-copy strong, .activity-copy span { display: block; }
.activity-copy span { color: var(--muted); font-size: 13px; }
.progress { height: 7px; overflow: hidden; border-radius: 7px; background: #e8e9ed; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }

.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 4px 0 2px; }
.dashboard-heading h1 { font-size: 36px; }
.dashboard-heading > div:first-child > p:last-child { max-width: 660px; color: var(--muted); }
.dashboard-lead { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(340px,.75fr); gap: 20px; }
.command-panel { display: flex; min-height: 380px; flex-direction: column; justify-content: space-between; overflow: hidden; border: 1px solid #e4dcd7; border-radius: 8px; background: #fffaf7; padding: clamp(24px,3vw,42px); box-shadow: 0 1px 2px rgba(32,34,47,.03); }
.command-copy { max-width: 820px; }
.command-copy h2 { max-width: 720px; margin-bottom: 14px; font-size: clamp(32px,3.2vw,48px); line-height: 1.06; }
.command-copy > p:last-child { max-width: 760px; color: var(--muted); font-size: 16px; }
.command-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 34px; }
.command-summary { display: flex; flex-wrap: wrap; gap: 22px; border-top: 1px solid #eadfd9; margin-top: 26px; padding-top: 20px; color: var(--muted); font-size: 12px; }
.command-summary strong { margin-right: 5px; color: var(--ink); font-size: 16px; }
.health-panel { min-height: 380px; padding: 24px; }
.health-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.live-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.live-indicator::before { width: 7px; height: 7px; border-radius: 50%; background: var(--success); content: ""; }
.health-chart { display: grid; place-items: center; gap: 24px; padding-top: 28px; }
.health-ring { display: grid; width: min(220px,65vw); aspect-ratio: 1; place-items: center; border-radius: 50%; background: conic-gradient(var(--brand) 0 var(--coverage), var(--accent) var(--coverage) calc(var(--coverage) + 46deg), #dfe3e8 calc(var(--coverage) + 46deg) 360deg); }
.health-ring::before { grid-area: 1/1; width: 58%; aspect-ratio: 1; border-radius: 50%; background: #fff; content: ""; }
.health-ring span { z-index: 1; display: grid; grid-area: 1/1; text-align: center; }
.health-ring strong { font-size: 30px; line-height: 1; }
.health-ring small { margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.health-legend { display: grid; width: 100%; gap: 8px; }
.health-legend span { display: grid; grid-template-columns: 9px 42px minmax(0,1fr); align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.health-legend i { width: 9px; height: 9px; border-radius: 50%; }
.brand-dot { background: var(--brand); }
.orange-dot { background: var(--accent); }
.green-dot { background: var(--success); }
.health-legend strong { color: var(--ink); }
.dashboard-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.kpi-card { display: flex; min-height: 128px; flex-direction: column; justify-content: space-between; padding: 18px; }
.kpi-card span { color: var(--brand); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.kpi-card strong { display: block; margin-top: 8px; font-size: 30px; line-height: 1; }
.kpi-note { font-size: 12px; font-weight: 700; }
.kpi-note.positive { color: var(--success); }
.kpi-note.warning { color: var(--warning); }
.kpi-note.neutral { color: var(--muted); }
.dashboard-detail { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(300px,.7fr); gap: 20px; }

.profile-sheet { width: 100%; max-width: 1100px; margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.profile-hero { display: flex; min-height: 190px; align-items: center; justify-content: space-between; gap: 28px; border-bottom: 1px solid #dedcf0; background: #f5f4fc; padding: 32px 36px; }
.profile-person { display: flex; min-width: 0; align-items: center; gap: 22px; }
.profile-avatar { display: grid; width: 104px; height: 104px; flex: 0 0 auto; place-items: center; overflow: hidden; border: 4px solid #fff; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(44,41,106,.16); font-size: 28px; font-weight: 900; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-person h2 { margin-bottom: 5px; font-size: 30px; }
.profile-person > div > p:not(.eyebrow) { color: var(--muted); }
.profile-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.profile-brand { display: grid; flex: 0 0 120px; justify-items: end; color: var(--brand); text-align: right; }
.profile-brand img { width: 72px; height: 72px; object-fit: contain; }
.profile-brand strong, .profile-brand span { display: block; }
.profile-brand span { color: var(--muted); font-size: 11px; }
.profile-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-bottom: 1px solid var(--line); }
.profile-summary div { min-width: 0; border-right: 1px solid var(--line); padding: 18px 22px; }
.profile-summary div:last-child { border-right: 0; }
.profile-summary span, .profile-summary strong { display: block; }
.profile-summary span { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.profile-summary strong { margin-top: 5px; font-size: 14px; }
.profile-sections { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0; padding: 12px 36px 28px; }
.profile-section { min-width: 0; border-bottom: 1px solid var(--line); padding: 24px 26px 24px 0; }
.profile-section:nth-child(even) { border-left: 1px solid var(--line); padding-right: 0; padding-left: 26px; }
.profile-section h3 { margin-bottom: 16px; color: var(--brand); font-size: 14px; text-transform: uppercase; }
.profile-section dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px 22px; margin: 0; }
.profile-section dt { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.profile-section dd { overflow-wrap: anywhere; margin: 3px 0 0; font-size: 13px; font-weight: 700; }
.profile-job-description, .profile-job-description:nth-child(even) { grid-column: 1 / -1; border-left: 0; padding: 24px 0 4px; }
.profile-job-description p { max-width: 920px; margin: 0; color: #3f464f; font-size: 13px; line-height: 1.65; white-space: pre-line; }
.profile-footer { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); padding: 0 36px 24px; font-size: 10px; }

.calendar-layout { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(330px,.8fr); gap: 20px; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.calendar-week, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); }
.calendar-week span { color: var(--muted); padding: 8px 5px; font-size: 10px; font-weight: 800; text-align: center; text-transform: uppercase; }
.calendar-grid { overflow: hidden; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.calendar-blank, .calendar-day { min-height: 92px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); padding: 9px; text-align: left; white-space: normal; }
.calendar-day { display: block; }
.calendar-blank { background: var(--soft); }
.calendar-day:hover { background: #f8f7ff; }
.calendar-day.selected { position: relative; z-index: 1; box-shadow: inset 0 0 0 2px var(--brand); background: #f4f3ff; }
.calendar-day strong, .calendar-day small { display: block; }
.calendar-day small { margin-top: 10px; color: var(--muted); font-size: 10px; }
.calendar-day.approved small { color: var(--success); }
.calendar-day.pending small { color: var(--warning); }
.calendar-day.conflict small { color: var(--danger); }
.calendar-names { display: grid; min-width: 0; gap: 4px; margin-top: 8px; }
.calendar-name { display: grid; min-width: 0; grid-template-columns: 7px minmax(0,1fr); align-items: center; gap: 5px; overflow: hidden; color: var(--ink); font-size: 10px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.calendar-name i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.calendar-name.approved i { background: var(--success); }
.calendar-name.pending i { background: var(--warning); }
.calendar-name.conflict i { background: var(--danger); }
.calendar-more { color: var(--muted); font-size: 9px; font-weight: 800; }
.employee-picker { display: grid; max-height: 224px; overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; }
.employee-picker button { min-height: 52px; justify-content: flex-start; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); padding: 8px 11px; text-align: left; white-space: normal; }
.employee-picker button:last-child { border-bottom: 0; }
.employee-picker button.selected { background: #f0effb; color: var(--brand); }
.employee-picker strong, .employee-picker small { display: block; }
.employee-picker small { color: var(--muted); font-weight: 500; }
.leave-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.leave-summary div { border: 1px solid var(--line); border-radius: 7px; background: var(--soft); padding: 13px; }
.leave-summary strong, .leave-summary span { display: block; }
.leave-summary strong { color: var(--brand); font-size: 24px; }
.leave-summary span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }

.org-workspace { padding: 0; }
.org-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); padding: 16px 18px; }
.org-search { display: grid; width: min(390px,100%); gap: 6px; color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.org-search input { min-height: 42px; background: var(--soft); }
.org-legend { display: flex; align-items: center; justify-content: flex-end; gap: 16px; color: var(--muted); font-size: 11px; font-weight: 700; }
.org-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.org-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--brand); }
.org-legend i.contributor { border: 1px solid #bfc4cd; background: #fff; }
.org-search-result { border-left: 1px solid var(--line); padding-left: 16px; }
.org-root-drop { display: flex; min-height: 62px; align-items: center; justify-content: center; gap: 11px; border: 1px dashed #aaa6cb; border-radius: 7px; background: #f6f5fc; color: var(--brand); margin: 16px 18px 0; padding: 10px 16px; text-align: left; }
.org-root-drop > span:last-child, .org-root-drop strong, .org-root-drop small { display: block; }
.org-root-drop strong { color: var(--brand); font-size: 12px; }
.org-root-drop small { color: var(--muted); font-size: 10px; font-weight: 600; }
.org-root-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 6px; background: var(--brand); color: #fff; font-weight: 900; }
.org-root-drop.drag-over { border-color: var(--accent); background: #fff4e9; box-shadow: inset 0 0 0 2px rgba(248,113,8,.12); }
.org-canvas { min-height: 430px; overflow: auto; background-color: #f8f9fb; background-image: radial-gradient(#d9dce3 .8px,transparent .8px); background-size: 20px 20px; margin-top: 16px; padding: 34px 28px 54px; scrollbar-color: #b7bac4 transparent; }
.org-tree, .org-tree ul { position: relative; display: flex; min-width: max-content; justify-content: center; margin: 0; padding: 28px 0 0; list-style: none; }
.org-tree { padding-top: 0; }
.org-tree ul::before { position: absolute; top: 0; left: 50%; width: 0; height: 28px; border-left: 2px solid #c9ccd4; content: ""; }
.org-tree-item { position: relative; padding: 28px 9px 0; text-align: center; }
.org-tree > .org-tree-item { padding-top: 0; }
.org-tree-item::before, .org-tree-item::after { position: absolute; top: 0; right: 50%; width: 50%; height: 28px; border-top: 2px solid #c9ccd4; content: ""; }
.org-tree-item::after { right: auto; left: 50%; border-left: 2px solid #c9ccd4; }
.org-tree-item:only-child::before, .org-tree-item:only-child::after { display: none; }
.org-tree-item:first-child::before, .org-tree-item:last-child::after { border: 0; }
.org-tree-item:last-child::before { border-right: 2px solid #c9ccd4; border-radius: 0 7px 0 0; }
.org-tree-item:first-child::after { border-radius: 7px 0 0; }
.org-tree > .org-tree-item::before, .org-tree > .org-tree-item::after { display: none; }
.org-tree-item.collapsed > ul { display: none; }
.org-card { position: relative; width: 248px; overflow: hidden; border: 1px solid #d8dbe2; border-radius: 7px; background: #fff; box-shadow: 0 9px 24px rgba(32,34,47,.09); text-align: left; transition: border-color .18s ease, box-shadow .18s ease, opacity .18s ease, transform .18s ease; }
.org-card:hover { border-color: #b9b7d3; box-shadow: 0 13px 30px rgba(44,41,106,.14); transform: translateY(-2px); }
.org-card-accent { height: 4px; background: #c8cbd2; }
.org-card.is-manager .org-card-accent { background: var(--brand); }
.org-tree > .org-tree-item > .org-card .org-card-accent { background: var(--accent); }
.org-card-main { display: grid; grid-template-columns: 46px minmax(0,1fr); align-items: center; gap: 11px; padding: 13px 14px 14px; }
.org-card-main .avatar { display: grid; width: 46px; height: 46px; align-items: center; justify-items: center; place-items: center; border: 2px solid #fff; box-shadow: 0 0 0 2px #e4e2f3; line-height: 1; text-align: center; }
.org-card-copy { min-width: 0; }
.org-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 3px; }
.org-card-meta .org-level { color: var(--brand); font-size: 8px; font-weight: 900; text-transform: uppercase; }
.org-card-meta .org-status { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 8px; font-weight: 750; }
.org-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--success); }
.org-card-main a, .org-card-main span, .org-card-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-card-main span.avatar { display: grid; }
.org-card-main a { color: var(--ink); font-size: 14px; font-weight: 850; text-decoration: none; }
.org-card-main a:hover { color: var(--brand); text-decoration: underline; }
.org-card-main span { color: var(--muted); font-size: 11px; }
.org-card-main small { color: #8a9098; font-size: 9px; }
.org-card-footer { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); background: var(--soft); padding: 6px 9px 6px 14px; }
.org-card-footer > span:first-child { color: var(--muted); font-size: 10px; font-weight: 750; }
.org-toggle { display: inline-grid; width: auto; min-width: 54px; min-height: 27px; grid-template-columns: 22px 18px; align-items: center; border-color: #d6d8df; background: #fff; color: var(--brand); padding: 2px 4px; line-height: 1; }
.org-toggle:hover { border-color: var(--brand); background: #f3f2fa; }
.org-toggle-count { display: grid; height: 20px; place-items: center; border-radius: 4px; background: #ecebf7; font-size: 9px; font-weight: 900; }
.org-toggle-chevron { display: block; font-size: 16px; transition: transform .18s ease; }
.org-tree-item.collapsed > .org-card .org-toggle-chevron { transform: rotate(-90deg); }
.org-leaf-dot { width: 7px; height: 7px; border: 2px solid #b9bdc6; border-radius: 50%; }
.org-card.org-match { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(248,113,8,.2),0 13px 30px rgba(44,41,106,.12); }
.org-card.org-dimmed { opacity: .32; }
.org-card[draggable="true"] { cursor: grab; }
.org-card[draggable="true"]:active { cursor: grabbing; }
.org-card.dragging { opacity: .45; }
.org-card.drag-over { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(248,113,8,.18); }

.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgba(21,20,51,.55); padding: 20px; }
.modal.open { display: flex; }
.modal-card { width: min(720px,100%); max-height: min(88vh,820px); overflow-y: auto; border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.modal-card.small { width: min(480px,100%); }

.notice { border-left: 4px solid var(--accent); border-radius: 0 7px 7px 0; background: #fff7f0; color: #75421e; padding: 12px 14px; }
.payroll-lock-notice strong { margin-right: 4px; color: var(--brand); }
.payroll-exception { color: var(--warning); font-size: 12px; }
.upload-box { display: grid; place-items: center; min-height: 140px; border: 1px dashed #aeb4bf; border-radius: 8px; background: var(--soft); padding: 20px; text-align: center; }
.upload-box input { max-width: 420px; }
.login-preview { min-height: 280px; background: var(--brand); background-position: center; background-size: cover; }

.login-page { display: grid; min-height: 100vh; grid-template-columns: minmax(360px, 480px) minmax(0,1fr); background: var(--brand); background-position: center; background-size: cover; }
.login-panel { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: center; background: #fff; padding: clamp(32px,6vw,72px); box-shadow: 20px 0 60px rgba(16,15,42,.18); }
.login-panel .portal-footer { position: absolute; right: 0; bottom: 24px; left: 0; margin: 0; }
.login-panel .brand-lockup { margin-bottom: 54px; }
.login-panel .brand-copy strong { color: var(--ink); }
.login-panel .brand-copy span { color: var(--muted); }
.login-panel h1 { font-size: 34px; }
.login-panel form { margin-top: 28px; }
.login-side { display: flex; align-items: flex-end; color: #fff; padding: 54px; }
.login-side-content { max-width: 600px; }
.login-side h2 { max-width: 560px; margin-bottom: 12px; font-size: 42px; }
.login-side p { color: rgba(255,255,255,.74); font-size: 17px; }
.login-message { min-height: 22px; margin-top: 12px; color: var(--danger); font-size: 13px; }

@media (max-width: 1100px) {
  .portal-shell { grid-template-columns: 220px minmax(0,1fr); }
  .workspace { padding-inline: 20px; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid.dashboard, .calendar-layout { grid-template-columns: 1fr; }
  .dashboard-lead, .dashboard-detail { grid-template-columns: 1fr; }
  .dashboard-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .health-chart { grid-template-columns: auto minmax(180px,1fr); }
  .profile-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profile-summary div:nth-child(2) { border-right: 0; }
  .profile-summary div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .portal-shell { display: block; }
  .sidebar { position: relative; height: auto; padding: 14px; }
  .sidebar .brand-lockup { padding: 0 4px 12px; }
  .brand-logo { width: 48px; height: 48px; }
  .sidebar-nav { display: flex; margin-top: 0; overflow-x: auto; padding: 0 0 6px; }
  .sidebar-nav a { flex: 0 0 auto; grid-template-columns: 1fr; min-height: 38px; padding: 0 12px; }
  .sidebar-nav .nav-icon, .sidebar-nav .sub-link, .sidebar-footer { display: none; }
  .workspace { padding: 0 14px 24px; }
  .topbar { min-height: 66px; }
  .topbar .button span, .topbar button span { display: none; }
  .page-content { margin-top: 16px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-heading h1 { font-size: 28px; }
  .command-panel { min-height: 0; padding: 22px; }
  .command-copy h2 { font-size: 32px; }
  .command-copy > p:last-child { font-size: 14px; }
  .command-actions .button { flex: 1 1 calc(50% - 8px); }
  .health-chart { grid-template-columns: 1fr; }
  .profile-hero { align-items: flex-start; padding: 24px; }
  .profile-person { align-items: flex-start; }
  .profile-avatar { width: 76px; height: 76px; font-size: 21px; }
  .profile-brand { display: none; }
  .profile-person h2 { font-size: 24px; }
  .profile-sections { grid-template-columns: 1fr; padding: 8px 22px 22px; }
  .profile-section, .profile-section:nth-child(even) { border-left: 0; padding: 20px 0; }
  h1 { font-size: 25px; }
  .grid.two, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full, .form-actions { grid-column: auto; }
  .panel-header, .panel-body { padding: 14px; }
  .calendar-day, .calendar-blank { min-height: 62px; padding: 5px; }
  .calendar-day small { display: none; }
  .calendar-names { margin-top: 5px; }
  .calendar-name { grid-template-columns: 6px minmax(0,1fr); gap: 3px; font-size: 8px; }
  .calendar-name i { width: 6px; height: 6px; }
  .calendar-name:nth-child(n+2), .calendar-more { display: none; }
  .leave-summary { grid-template-columns: 1fr; }
  .compliance-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .compliance-toolbar .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .compliance-toolbar .filters select { width: 100%; }
  .org-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .org-search { width: 100%; }
  .org-legend { justify-content: flex-start; overflow-x: auto; padding-bottom: 3px; }
  .org-root-drop { margin: 14px 14px 0; }
  .org-canvas { min-height: 390px; padding: 28px 18px 44px; }
  .login-page { grid-template-columns: 1fr; }
  .login-panel { min-height: 100vh; padding: 30px 22px; }
  .login-side { display: none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .dashboard-kpis { grid-template-columns: 1fr; }
  .command-actions .button { flex-basis: 100%; }
  .profile-hero { padding: 20px; }
  .profile-person { flex-direction: column; }
  .profile-summary { grid-template-columns: 1fr; }
  .profile-summary div, .profile-summary div:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-summary div:last-child { border-bottom: 0; }
  .profile-section dl { grid-template-columns: 1fr; }
  .topbar-actions .secondary { display: none; }
  .calendar-week span { font-size: 9px; }
}
@media print {
  .portal-footer { display: none; }
  .compliance-toolbar, .compliance-table .row-actions { display: none; }
  .report-links { display: none; }
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11px; }
  .sidebar, .topbar, .button, button, .panel-actions, .toolbar { display: none !important; }
  .portal-shell { display: block; }
  .workspace { padding: 0; }
  .page-content { max-width: none; margin: 0; }
  .panel { break-inside: avoid; box-shadow: none; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; }
  body[data-page="employee-profile"] .page-heading { display: none; }
  body[data-page="employee-profile"] .profile-sheet { max-width: none; border: 0; border-radius: 0; box-shadow: none; }
  body[data-page="employee-profile"] .profile-hero { min-height: 0; padding: 18px 20px; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body[data-page="employee-profile"] .profile-avatar { width: 78px; height: 78px; }
  body[data-page="employee-profile"] .profile-person h2 { font-size: 24px; }
  body[data-page="employee-profile"] .profile-summary div { padding: 12px 14px; }
  body[data-page="employee-profile"] .profile-sections { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 6px 20px 18px; }
  body[data-page="employee-profile"] .profile-section, body[data-page="employee-profile"] .profile-section:nth-child(even) { break-inside: avoid; padding: 16px 16px 16px 0; }
  body[data-page="employee-profile"] .profile-section:nth-child(even) { border-left: 1px solid var(--line); padding-right: 0; padding-left: 16px; }
  body[data-page="employee-profile"] .profile-job-description, body[data-page="employee-profile"] .profile-job-description:nth-child(even) { grid-column: 1 / -1; border-left: 0; padding: 14px 0 4px; }
  body[data-page="employee-profile"] .profile-section dl { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 16px; }
  body[data-page="employee-profile"] .profile-footer { padding: 0 20px 12px; }
  .org-toolbar, .org-root-drop { display: none; }
  .org-workspace { padding: 0; }
  .org-canvas { overflow: visible; border: 0; padding: 10px 0; }
  .org-tree-item.collapsed > ul { display: flex; }
  .org-card { box-shadow: none; }
}
