:root {
  color-scheme: light;
  --app: #f2f4f7;
  --surface: #ffffff;
  --subtle: #eef2f6;
  --inset: #f7f9fc;
  --line: #dfe5ee;
  --line-strong: #c9d3df;
  --ink: #0b1220;
  --ink-soft: #43516a;
  --ink-muted: #7d8aa1;
  --blue: #2563eb;
  --blue-strong: #1d4ed8;
  --blue-soft: #eaf1fe;
  --cyan: #0891b2;
  --green: #067647;
  --green-soft: #e7f5ee;
  --amber: #b54708;
  --amber-soft: #fff4e5;
  --red: #b42318;
  --red-soft: #fdecec;
  --shadow: 0 16px 42px rgba(31, 42, 68, 0.08);
  --shadow-soft: 0 1px 3px rgba(31, 42, 68, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(37, 99, 235, 0.03) 1px, transparent 1px),
    var(--app);
  background-size: 32px 32px;
  font-family: Avenir Next, Segoe UI, Helvetica Neue, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 340px;
  min-height: 100vh;
}

.sidebar,
.coach {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.sidebar {
  min-width: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin-bottom: 20px;
}

.brand-mark {
  width: 38px;
  height: 38px;
}

.brand p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand strong {
  display: block;
  font-size: 15px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--blue), var(--shadow-soft);
}

.nav-item span {
  color: var(--ink-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.nav-item strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item em {
  min-width: 42px;
  padding: 4px 6px;
  color: var(--ink-soft);
  background: var(--subtle);
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  text-align: center;
}

.ghost-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: var(--radius);
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  font-weight: 700;
}

.ghost-button {
  width: 100%;
  margin-top: 14px;
  color: var(--ink-soft);
  background: transparent;
}

.primary-button {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.primary-button:hover {
  background: var(--blue-strong);
}

.secondary-button {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #c8dcff;
}

.main {
  min-width: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  min-height: 88px;
  margin-bottom: 14px;
}

.topbar-controls {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: min(100%, 360px);
}

.employee-switcher {
  width: min(100%, 320px);
}

.employee-switcher select {
  padding: 8px 34px 8px 10px;
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 860px;
  font-size: 32px;
  line-height: 1.08;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

p {
  line-height: 1.55;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-strip span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 9px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid #ffd9a3;
  border-radius: var(--radius);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 14px;
}

.hero-panel,
.panel-card,
.metric {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
}

.hero-panel p {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--ink-soft);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric span {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.metric small {
  color: var(--ink-soft);
}

.two-column,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.compact {
  margin-top: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.local-output {
  margin-top: 14px;
  white-space: pre-wrap;
}

.form-grid.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel-card {
  min-width: 0;
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.employee-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--subtle);
  object-fit: cover;
}

.avatar.small {
  width: 38px;
  height: 38px;
}

.employee-card p,
.employee-card small {
  margin: 4px 0 0;
  color: var(--ink-soft);
}

.mini-receipt,
.receipt-detail,
.output-box,
.review-context {
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--inset);
}

.mini-receipt,
.receipt-detail {
  min-height: 132px;
  margin: 0;
  padding: 14px;
  color: var(--ink-soft);
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.receipt-detail {
  min-height: 420px;
  color: #eaf1fe;
  background: #101827;
  border-color: #101827;
}

.output-box,
.review-context {
  min-height: 118px;
  padding: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.login-visual {
  display: grid;
  align-content: end;
  min-height: 420px;
  overflow: hidden;
  position: relative;
  color: #ffffff;
  background: #10203f;
}

.login-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.62;
  object-fit: cover;
}

.login-visual div {
  position: relative;
  z-index: 1;
}

.login-visual .eyebrow,
.login-visual p {
  color: #dce8ff;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  outline: none;
  padding: 12px 13px;
  text-transform: none;
}

textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.5;
}

.short-textarea {
  min-height: 94px;
}

.compact-textarea {
  min-height: 104px;
}

.onboarding-group {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 22px 0 0;
  padding: 20px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.onboarding-group legend {
  padding: 0 10px 0 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.genesis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.genesis-item {
  display: grid;
  gap: 5px;
  min-height: 64px;
  padding: 11px 12px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}

.genesis-item span {
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.genesis-item strong {
  color: var(--ink-soft);
  font-size: 13px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.template-card {
  display: grid;
  gap: 8px;
  min-height: 128px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.template-card span {
  color: var(--ink-soft);
  line-height: 1.45;
}

.template-card.selected {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.list-stack {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.list-item button {
  justify-self: start;
}

.list-item small {
  color: var(--ink-soft);
  line-height: 1.45;
}

.coach {
  position: sticky;
  top: 0;
  height: 100vh;
  border-left: 1px solid var(--line);
  padding: 18px;
}

.coach-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.coach-head strong,
.coach-head span {
  display: block;
}

.coach-head span {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 12px;
}

.coach p {
  margin: 0;
  padding: 14px;
  background: var(--blue-soft);
  border: 1px solid #c8dcff;
  border-radius: var(--radius);
}

.coach-risk {
  margin-top: 12px;
  padding: 12px;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid #ffd9a3;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}

.is-good {
  color: var(--green);
  background: var(--green-soft);
}

.is-warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.is-bad {
  color: var(--red);
  background: var(--red-soft);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .coach {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    top: 0;
    height: auto;
    max-width: 100vw;
    overflow-y: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }

  .brand {
    min-height: 38px;
    margin-bottom: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .nav-list {
    display: flex;
    width: 100%;
    max-width: calc(100vw - 24px);
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .nav-item {
    flex: 0 0 168px;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 44px;
    padding: 8px 10px;
  }

  .nav-item span {
    display: none;
  }

  .ghost-button {
    display: none;
  }

  .kpi-grid,
  .template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column,
  .form-grid,
  .form-grid.three-column {
    grid-template-columns: 1fr;
  }

  .topbar,
  .hero-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .main,
  .sidebar {
    padding: 12px;
  }

  .kpi-grid,
  .template-grid,
  .genesis-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }
}
