:root {
  --bg: #eef2f6;
  --bg-soft: #f6f8fb;
  --panel: rgba(255, 255, 255, 0.98);
  --panel-strong: #ffffff;
  --line: rgba(69, 83, 107, 0.14);
  --text: #162032;
  --muted: #5e6b80;
  --primary: #18345f;
  --primary-soft: #e8edf5;
  --accent: #41597f;
  --danger: #b1453d;
  --sidebar-bg: #111a29;
  --sidebar-line: rgba(255, 255, 255, 0.07);
  --shadow: 0 8px 24px rgba(16, 27, 44, 0.05);
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: "Manrope", sans-serif; color: var(--text); background:
  linear-gradient(180deg, #f5f7fa, #eef2f6 52%, #e8edf4); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.login-shell, .app-shell { min-height: 100vh; }
.login-shell { display: grid; grid-template-columns: 1.05fr 0.95fr; padding: 28px; gap: 28px; }
.glass, .panel, .modal-card, .showcase-card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.72);
  box-shadow: var(--shadow);
}
.login-panel, .login-showcase { border-radius: var(--radius-xl); padding: 48px; }
.login-panel { display: flex; flex-direction: column; justify-content: center; }
.login-showcase { background: #1a2c47; color: #f8fbff; position: relative; overflow: hidden; }
.login-showcase::after { content: ""; position: absolute; inset: auto -10% -30% auto; width: 320px; height: 320px; background: radial-gradient(circle, rgba(255,255,255,0.24), transparent 62%); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.2rem, 4vw, 4rem); line-height: 1.02; letter-spacing: -0.04em; margin-bottom: 18px; }
h2 { font-size: 1.3rem; margin-bottom: 8px; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 60ch; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.75rem; color: var(--accent); margin-bottom: 14px; font-weight: 800; }
.badge { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,0.12); font-size: 0.82rem; margin-bottom: 18px; }
.feature-list { padding-left: 18px; line-height: 1.9; color: rgba(249,247,242,0.9); }

.stack-form, .form-grid { display: grid; gap: 16px; }
.stack-form label, .form-grid label { display: grid; gap: 8px; }
label span { font-size: 0.82rem; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
input, textarea, select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px 16px;
  color: var(--text);
}
textarea { resize: vertical; }
.button {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
  font-weight: 700;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--primary); color: white; }
.button-secondary { background: #eef2f7; color: var(--text); border: 1px solid rgba(69, 83, 107, 0.10); }
.button-danger { background: rgba(177, 69, 61, 0.12); color: var(--danger); }
.button-full { width: 100%; }
.form-error { color: var(--danger); font-weight: 700; }

.app-shell { display: grid; grid-template-columns: 1fr; gap: 0; padding: 18px; }
.app-header {
  position: sticky;
  top: 18px;
  z-index: 20;
  margin-bottom: 18px;
}
.app-header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(17, 26, 41, 0.96);
  color: #dbe4f0;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 10px 30px rgba(10, 22, 44, 0.14);
}
.app-header-brand {
  display: grid;
  gap: 4px;
}
.brand { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.03em; color: white; }
.app-header-caption {
  color: rgba(219, 228, 240, 0.68);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.top-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.top-nav .nav-link {
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(219, 228, 240, 0.78);
  font-weight: 700;
  border: 1px solid transparent;
}
.top-nav .nav-link:hover,
.top-nav .nav-link.active {
  background: rgba(255,255,255,0.08);
  color: white;
  border-color: rgba(255,255,255,0.08);
}
.app-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-meta {
  color: rgba(219, 228, 240, 0.68);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.app-header .button-secondary {
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.08);
}
.content-shell { display: grid; gap: 22px; padding-bottom: 32px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 10px 6px 0; }
.topbar h1 { font-size: clamp(2rem, 3vw, 3rem); margin-bottom: 0; }
.topbar-copy { margin-top: 12px; color: var(--muted); max-width: 68ch; line-height: 1.65; }
.topbar-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.topbar-corporate {
  padding: 14px 6px 2px;
  border-bottom: 1px solid rgba(56, 72, 97, 0.10);
  margin-bottom: 4px;
}
.topbar-actions-stack {
  flex-direction: column;
  align-items: flex-end;
}
.utility-chip-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.utility-chip {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.utility-chip-muted {
  background: #f1f4f8;
  color: #5f7087;
}
.page-view { display: grid; gap: 22px; }
.overview-board {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 18px;
}
.overview-primary,
.overview-secondary {
  border-radius: 14px;
  padding: 24px;
}
.overview-primary {
  background: #17263d;
  color: #f7fbff;
  box-shadow: 0 10px 26px rgba(21, 49, 95, 0.12);
}
.overview-primary h2 { font-size: clamp(1.8rem, 2vw, 2.35rem); line-height: 1.12; margin-bottom: 14px; color: white; max-width: 18ch; }
.overview-primary p { color: rgba(247, 251, 255, 0.82); line-height: 1.7; max-width: 62ch; margin-bottom: 0; }
.overview-secondary {
  background: #fff;
  border: 1px solid rgba(198, 211, 230, 0.48);
  display: grid;
  gap: 14px;
}
.hero-kicker {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
}
.neutral-kicker {
  background: rgba(255,255,255,0.12);
}
.brief-card {
  padding: 16px 18px;
  border-radius: 12px;
  background: #f7f9fc;
  border: 1px solid rgba(69, 83, 107, 0.08);
}
.brief-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 800;
}
.brief-card strong {
  display: block;
  font-size: 1.12rem;
  color: var(--text);
  margin-bottom: 8px;
}
.brief-card p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.stat-card, .panel { border-radius: 14px; padding: 22px; }
.stat-card {
  background: #fff;
  border: 1px solid rgba(198, 211, 230, 0.52);
  box-shadow: var(--shadow);
}
.panel {
  background: #fff;
  border: 1px solid rgba(198, 211, 230, 0.52);
}
.stat-label { color: var(--muted); font-size: 0.88rem; margin-bottom: 10px; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; }
.stat-subtle { color: var(--muted); margin-top: 10px; }
.stats-grid .stat-card {
  display: grid;
  gap: 8px;
  min-height: 160px;
}
.dashboard-focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 22px;
}
.dashboard-focus-grid-tight {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.spotlight-panel {
  display: grid;
  gap: 12px;
}
.compact-panel {
  min-height: 188px;
}
.section-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent);
}
.section-badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(31, 60, 136, 0.06);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
}
.panel-intro {
  color: var(--muted);
  line-height: 1.7;
  max-width: 56ch;
  margin-bottom: 0;
}
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr); gap: 22px; align-items: stretch; }
.corporate-grid {
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.9fr);
}
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 18px; }
.panel-head p { color: var(--muted); max-width: 50ch; }
.chart-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.chart-shell {
  position: relative;
  height: 360px;
  min-height: 360px;
  max-height: 360px;
  width: 100%;
}
.chart-shell-compact {
  height: 320px;
  min-height: 320px;
  max-height: 320px;
}
.chart-shell canvas {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.roster-panel .panel-head {
  align-items: end;
}

.employee-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.corporate-cards {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}
.employee-card {
  background: #fff;
  border: 1px solid rgba(198, 211, 230, 0.52);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}
.employee-card-top {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(69, 83, 107, 0.08);
}
.avatar, .avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: #edf2f8;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--primary);
}
.employee-meta h3 { margin-bottom: 4px; }
.muted { color: var(--muted); }
.employee-meta .muted + .muted {
  margin-top: 4px;
}
.summary-clamp {
  color: #2b3a4f;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 10;
  overflow: hidden;
  line-height: 1.6;
  min-height: 10.5em;
}
.metric-row { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 0.92rem; }
.stars { color: #d39a55; letter-spacing: 0.18em; }
.card-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.detail-grid { display: grid; gap: 22px; }
.hero-card { display: grid; grid-template-columns: 112px 1fr auto; gap: 22px; align-items: center; }
.hero-card .avatar, .hero-card .avatar-placeholder { width: 112px; height: 112px; border-radius: 12px; }
.hero-rating { text-align: right; }
.hero-rating .score { font-size: 3rem; font-weight: 800; letter-spacing: -0.05em; }
.hero-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.detail-columns { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 22px; }
.pill-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pill { padding: 8px 12px; border-radius: 999px; background: #eef2f7; color: var(--primary); font-size: 0.82rem; font-weight: 700; }
.list-card { border: 1px solid var(--line); background: #fbfcfe; border-radius: 10px; padding: 16px; }
.reference-grid, .settings-list, .stack-list { display: grid; gap: 14px; }
.reference-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.reference-card { border-radius: 12px; padding: 18px; background: #fbfcfe; border: 1px solid rgba(69,83,107,0.12); }
.reference-card.featured { background: #f4f7fb; }

.modal { border: 0; padding: 0; background: transparent; width: min(1100px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(34, 25, 18, 0.34); backdrop-filter: blur(8px); }
.modal-card { border-radius: 14px; padding: 28px; max-height: calc(100vh - 48px); overflow: auto; }
.modal-head, .modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.icon-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.full { grid-column: 1 / -1; }
.subsection { padding-top: 8px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.section-title { font-weight: 800; }
.inline-pair { display: grid; grid-template-columns: 1fr 150px; gap: 12px; }
.document-upload-form {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(69,83,107,0.12);
  border-radius: 10px;
  background: #f8fafc;
}
.document-upload-actions { justify-content: flex-start; }
.file-input { background: #fff; }
.form-status {
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 77, 69, 0.18);
  background: #eef7f4;
  color: #1f4d45;
  font-weight: 800;
}
.form-status.error {
  border-color: rgba(177, 69, 61, 0.24);
  background: rgba(177, 69, 61, 0.08);
  color: var(--danger);
}
.form-status[hidden] { display: none; }
.checkbox-line { display: flex !important; flex-direction: row; align-items: center; gap: 10px; }
.checkbox-line input { width: auto; }
.settings-layout { display: grid; grid-template-columns: 340px 1fr; gap: 22px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.compact-form { align-content: start; }
.user-card .stack-form { gap: 14px; }
.guest-permissions { display: grid; gap: 12px; }
.guest-permissions[hidden] { display: none; }
.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px 14px;
}
.empty-state { padding: 28px; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); text-align: center; background: rgba(255,255,255,0.45); }

@media (max-width: 1100px) {
  .app-shell, .login-shell, .dashboard-grid, .detail-columns, .settings-layout, .settings-grid, .overview-board, .dashboard-focus-grid { grid-template-columns: 1fr; }
  .app-header { position: static; }
  .app-header-inner { grid-template-columns: 1fr; align-items: start; }
  .top-nav { justify-content: flex-start; }
  .app-header-actions { justify-content: space-between; }
  .hero-card { grid-template-columns: 1fr; }
  .hero-rating { text-align: left; }
  .hero-actions { justify-content: flex-start; }
  .action-row { justify-content: flex-start; }
  .chart-shell, .chart-shell-compact { height: 320px; min-height: 320px; max-height: 320px; }
  .topbar-actions-stack { align-items: flex-start; }
  .utility-chip-group { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .login-shell, .app-shell { padding: 16px; }
  .login-panel, .login-showcase, .panel, .stat-card, .sidebar { padding: 20px; }
  .form-grid, .compact-form-grid { grid-template-columns: 1fr; }
  .employee-card-top, .inline-pair { grid-template-columns: 1fr; }
  .chart-shell, .chart-shell-compact { height: 260px; min-height: 260px; max-height: 260px; }
  .overview-primary h2 { max-width: none; }
}
