:root {
  color-scheme: light;
  --bg: #f4f8f6;
  --surface: #ffffff;
  --surface-soft: #eef5f1;
  --ink: #15251f;
  --muted: #61736b;
  --line: #dbe7e1;
  --primary: #155e4b;
  --primary-dark: #0d4537;
  --primary-soft: #dff1e9;
  --sidebar: #173d34;
  --sidebar-soft: #245247;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --warning: #9a6700;
  --warning-soft: #fff7dd;
  --shadow: 0 26px 75px -42px rgba(18, 58, 47, .5);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
button { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #123c30;
  background: #8ce0bf;
  font-size: 17px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.28);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -.01em; }
.brand small { margin-top: 1px; font-size: 11px; opacity: .62; }
.brand-light { color: #f5fbf8; }

.eyebrow {
  display: inline-block;
  margin: 0;
  color: #91e7c4;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.eyebrow.dark { color: #367362; }

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 13px;
  color: var(--ink);
  background: transparent;
  font-weight: 700;
  line-height: 1;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(21, 94, 75, .18);
  outline-offset: 1px;
}
.button-primary { color: #fff; background: var(--primary); box-shadow: 0 8px 20px -12px rgba(21,94,75,.8); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { border-color: var(--line); background: #fff; }
.button-secondary:hover, .button-ghost:hover { background: var(--surface-soft); }
.button-ghost { color: var(--muted); }
.button-danger { color: var(--danger); border-color: #efc7c2; background: var(--danger-soft); }
.button-small { min-height: 30px; padding: 6px 10px; font-size: 12px; }
.button-block { width: 100%; min-height: 44px; }

.alert {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 13px;
}
.alert-error { color: var(--danger); border-color: #efc7c2; background: var(--danger-soft); }
.alert-success { color: #156148; border-color: #b8ddcf; background: #e9f7f1; }
.alert-warning { color: var(--warning); border-color: #ecd897; background: var(--warning-soft); }

label { display: grid; gap: 6px; color: #31483f; font-size: 12px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cadbd3;
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input, select { min-height: 40px; }
textarea { resize: vertical; }
input::placeholder { color: #91a098; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 58px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  border: 0;
  padding: 5px;
  color: var(--primary);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.login-body {
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 8%, rgba(112, 211, 173, .22), transparent 33%),
    linear-gradient(135deg, #f7fbf9, #e5f1ec);
}
.login-shell {
  display: grid;
  width: min(1040px, 100%);
  min-height: 640px;
  margin: max(20px, calc((100vh - 688px) / 2)) auto;
  overflow: hidden;
  border: 1px solid rgba(21, 77, 62, .13);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow);
  grid-template-columns: 1.05fr .95fr;
}
.login-story {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  padding: 48px;
  color: #f3fbf7;
  background:
    radial-gradient(circle at 95% 0%, rgba(108, 218, 176, .2), transparent 28%),
    linear-gradient(145deg, #173f35, #102d27);
}
.login-story::before, .login-story::after {
  position: absolute;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  content: "";
}
.login-story::before { width: 300px; height: 300px; top: -140px; right: -120px; }
.login-story::after { width: 360px; height: 360px; left: -190px; bottom: -220px; }
.story-copy { position: relative; margin: auto 0; padding: 70px 0; }
.story-copy h1 {
  max-width: 480px;
  margin: 15px 0 17px;
  font-size: clamp(36px, 5vw, 55px);
  line-height: 1.02;
  letter-spacing: -.045em;
}
.story-copy p { max-width: 450px; color: rgba(243,251,247,.67); font-size: 15px; line-height: 1.7; }
.trust-row { display: flex; gap: 26px; color: rgba(243,251,247,.72); font-size: 12px; }
.trust-row span::first-letter { color: #8de2c0; }
.login-form-panel { display: grid; place-items: center; padding: 48px; }
.login-form { width: min(100%, 380px); }
.form-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 14px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 25px;
  font-weight: 800;
}
.login-form h2 { margin: 7px 0 5px; font-size: 30px; letter-spacing: -.035em; }
.login-form > label { margin-top: 18px; }
.login-form > .button { margin-top: 22px; }
.login-form > small { display: block; margin-top: 16px; line-height: 1.6; }

.app-grid { display: grid; min-height: 100vh; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 22px 15px;
  color: #edf8f4;
  background: var(--sidebar);
  z-index: 30;
}
.sidebar .brand { padding: 0 8px; }
.side-nav { display: grid; gap: 5px; margin-top: 34px; }
.side-nav a {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  border-radius: 10px;
  padding: 9px 11px;
  color: rgba(237,248,244,.65);
  font-size: 13px;
  font-weight: 650;
  transition: background .15s ease, color .15s ease;
}
.side-nav a:hover, .side-nav a.active { color: #fff; background: var(--sidebar-soft); }
.side-nav a > span { width: 18px; text-align: center; font-size: 16px; }
.side-nav a > b {
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 7px;
  color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.08);
  font-size: 10px;
}
.privacy-note {
  margin-top: auto;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  padding: 13px;
  color: rgba(237,248,244,.68);
  background: rgba(255,255,255,.04);
  font-size: 11px;
}
.privacy-note strong { color: #a6e9cf; }
.privacy-note p { margin: 7px 0 0; line-height: 1.55; }

.workspace { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  display: flex;
  height: 66px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  background: rgba(244,248,246,.92);
  backdrop-filter: blur(15px);
  z-index: 20;
}
.mobile-menu, .mobile-brand, .mobile-nav { display: none; }
.user-area { display: flex; align-items: center; gap: 11px; margin-left: auto; }
.user-copy { text-align: right; }
.user-copy strong, .user-copy small { display: block; }
.user-copy strong { font-size: 12px; }
.user-copy small { color: var(--muted); font-size: 10px; }
.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-size: 11px;
  font-weight: 800;
}
.content { width: min(1500px, 100%); margin: 0 auto; padding: 32px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading h1 { margin: 6px 0 5px; font-size: clamp(29px, 3vw, 38px); line-height: 1.13; letter-spacing: -.04em; }
.page-heading p { max-width: 700px; margin: 0; color: var(--muted); }
.heading-actions { display: flex; gap: 9px; flex-shrink: 0; }

.kpi-grid { display: grid; gap: 13px; margin-top: 27px; grid-template-columns: repeat(4, 1fr); }
.kpi {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  background: var(--surface);
  box-shadow: 0 9px 30px -28px rgba(21,94,75,.8);
}
.kpi::after {
  position: absolute;
  width: 58px;
  height: 58px;
  top: -22px;
  right: -18px;
  border-radius: 50%;
  background: var(--primary-soft);
  content: "";
}
.kpi span, .kpi strong, .kpi small { display: block; }
.kpi span { color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi strong { margin: 8px 0 3px; font-size: 28px; letter-spacing: -.035em; }
.kpi small { color: #7e8e86; font-size: 11px; }

.card {
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 14px 38px -36px rgba(21,94,75,.75);
}
.card-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; }
.card-heading h2 { margin: 0 0 2px; font-size: 17px; letter-spacing: -.02em; }
.card-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 9px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 11px 16px; background: #fbfdfc; }
.filters .search-field { flex: 1; }
.filters select { width: 165px; }
.filters input, .filters select { min-height: 38px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #e7efeb; padding: 13px 15px; text-align: left; vertical-align: middle; }
th { color: #677a71; background: #fbfdfc; font-size: 10px; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; }
td { min-width: 110px; font-size: 12px; }
td:first-child { min-width: 230px; }
td:last-child { width: 1%; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); }
tr:hover td { background: #fbfdfc; }
.employee-cell { display: flex; align-items: center; gap: 10px; }
.record-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  overflow: hidden;
  place-items: center;
  border: 1px solid #cfe1d9;
  border-radius: 11px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 10px;
  font-weight: 850;
}
.record-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.status { display: inline-flex; min-height: 23px; align-items: center; border: 1px solid; border-radius: 999px; padding: 2px 8px; white-space: nowrap; font-size: 10px; font-weight: 800; }
.status-active, .status-approved { color: #166247; border-color: #b5ddce; background: #ebf8f3; }
.status-pending { color: #8b620d; border-color: #eedb9f; background: #fff8df; }
.status-needs-review { color: var(--danger); border-color: #efc5c0; background: var(--danger-soft); }
.empty { padding: 36px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 14px; color: var(--muted); font-size: 12px; }
.pagination a { color: var(--primary); font-weight: 800; }

.activity-list { border-top: 1px solid var(--line); }
.activity { display: flex; gap: 12px; border-bottom: 1px solid #e7efeb; padding: 14px 20px; }
.activity-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.activity strong { font-size: 12px; }
.activity p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }

.record-dialog {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100vh - 34px);
  overflow-y: auto;
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 34px 90px -28px rgba(8,38,30,.6);
}
.record-dialog::backdrop { background: rgba(12,31,25,.46); backdrop-filter: blur(3px); }
.record-dialog form { padding: 22px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.dialog-heading h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.035em; }
.icon-button { border: 0; padding: 4px 8px; color: var(--muted); background: transparent; font-size: 26px; line-height: 1; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: grid; gap: 6px; }
.field-label { color: #31483f; font-size: 12px; font-weight: 700; }
.photo-upload {
  display: grid;
  align-items: center;
  gap: 14px;
  border: 1px dashed #bad2c8;
  border-radius: 13px;
  padding: 13px;
  background: #f8fcfa;
  grid-template-columns: 88px minmax(0, 1fr);
}
.photo-preview {
  display: grid;
  width: 88px;
  height: 88px;
  overflow: hidden;
  place-items: center;
  border: 1px solid #cfe1d9;
  border-radius: 15px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  text-align: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-controls { display: grid; gap: 7px; min-width: 0; }
.photo-controls input[type="file"] {
  min-height: 42px;
  padding: 7px;
  font-size: 11px;
}
.photo-controls input[type="file"]::file-selector-button {
  margin-right: 9px;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  color: #fff;
  background: var(--primary);
  font-weight: 750;
  cursor: pointer;
}
.photo-controls > small { color: var(--muted); font-size: 10px; }
.remove-photo {
  display: flex;
  align-items: center;
  grid-template-columns: auto 1fr;
  gap: 7px;
  color: var(--danger);
  font-size: 11px;
}
.remove-photo input { width: 16px; min-height: auto; }
.dialog-actions { display: flex; align-items: center; gap: 9px; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }

.setup-body {
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 90% 5%, rgba(114,213,174,.22), transparent 25%),
    linear-gradient(150deg, #edf6f2, #f8fbfa);
}
.setup-shell { width: min(880px, 100%); margin: 20px auto 50px; }
.setup-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.setup-step { border: 1px solid #c9ddd4; border-radius: 999px; padding: 6px 10px; color: var(--primary); background: rgba(255,255,255,.7); font-size: 11px; font-weight: 800; }
.setup-card { border: 1px solid var(--line); border-radius: 22px; padding: clamp(24px, 5vw, 46px); background: var(--surface); box-shadow: var(--shadow); }
.setup-intro { max-width: 650px; }
.setup-intro h1, .complete-card h1 { margin: 7px 0 8px; font-size: clamp(31px, 5vw, 45px); letter-spacing: -.045em; }
.setup-intro p, .complete-card > p { color: var(--muted); line-height: 1.7; }
.setup-form fieldset { margin: 26px 0 0; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.setup-form legend { padding: 0 7px; font-size: 13px; font-weight: 800; }
.confirm-line { display: flex; grid-template-columns: auto 1fr; align-items: flex-start; gap: 9px; margin: 20px 0; font-weight: 600; }
.confirm-line input { width: 17px; min-height: auto; margin-top: 2px; }
.complete-card { text-align: center; }
.complete-card .alert { text-align: left; }
.complete-icon { display: grid; width: 62px; height: 62px; margin: 0 auto 20px; place-items: center; border-radius: 50%; color: #fff; background: var(--primary); font-size: 28px; }

.sidebar-backdrop { display: none; }

@media (max-width: 1050px) {
  .app-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 26px 22px; }
}

@media (max-width: 780px) {
  .login-body { padding: 12px; }
  .login-shell { min-height: 0; margin: 0 auto; grid-template-columns: 1fr; }
  .login-story { min-height: 350px; padding: 28px; }
  .story-copy { padding: 55px 0; }
  .story-copy h1 { font-size: 40px; }
  .login-form-panel { padding: 38px 26px; }

  .app-grid { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-102%);
    width: 248px;
    transition: transform .2s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8,29,23,.36);
    z-index: 25;
  }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .mobile-menu {
    display: inline-grid;
    width: 35px;
    height: 35px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
  }
  .mobile-brand { display: block; margin-left: 10px; font-weight: 800; }
  .mobile-nav {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    padding: 9px 14px;
    background: #fff;
  }
  .mobile-nav a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; white-space: nowrap; font-size: 11px; font-weight: 700; }
  .topbar { padding: 0 14px; }
  .user-copy { display: none; }
  .content { padding: 22px 14px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .filters { flex-wrap: wrap; }
  .filters .search-field { min-width: 100%; }
  .filters select { width: auto; flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .photo-upload { grid-template-columns: 74px minmax(0, 1fr); }
  .photo-preview { width: 74px; height: 74px; }
}

@media (max-width: 520px) {
  .trust-row { flex-direction: column; gap: 7px; }
  .story-copy h1 { font-size: 34px; }
  .login-story { min-height: 320px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .user-area { gap: 7px; }
  .topbar .button { padding: 7px 9px; font-size: 11px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .spacer { display: none; }
  .dialog-actions .button { flex: 1; }
  .dialog-actions .button-danger { min-width: 100%; }
  .setup-header { align-items: flex-start; flex-direction: column; gap: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
