:root {
  --navy: #173b67;
  --blue: #245f9f;
  --blue-soft: #eaf2fb;
  --teal: #167a78;
  --teal-soft: #e8f5f3;
  --green: #4f8b62;
  --cream: #fbfaf6;
  --surface: #ffffff;
  --surface-alt: #f5f7f9;
  --text: #1d2935;
  --muted: #5c6a78;
  --border: #d7e0e8;
  --danger: #a83232;
  --danger-soft: #fff0f0;
  --shadow: 0 18px 48px rgba(23, 59, 103, 0.12);
  --radius: 18px;
  --radius-small: 10px;
  --focus: 3px solid #f2a900;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--text);
  background: var(--surface-alt);
  line-height: 1.5;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface-alt);
}

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

button,
a,
input {
  min-height: 44px;
}

a {
  color: var(--blue);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 10px 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand-context {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--teal);
}

.brand-name {
  min-height: auto;
  color: var(--navy);
  font-size: 1.22rem;
  font-weight: 800;
  text-decoration: none;
}

.primary-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.primary-nav > a {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}

.primary-nav > a:hover {
  background: var(--blue-soft);
}

.logout-form {
  margin: 0;
}

.nav-toggle {
  display: none;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.identity-strip {
  padding: 7px clamp(18px, 4vw, 56px);
  display: flex;
  gap: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 0.85rem;
}

.main-content {
  width: min(1480px, calc(100% - 36px));
  min-height: calc(100vh - 200px);
  margin: 0 auto;
  padding: 28px 0 54px;
}

.page-hero {
  padding: clamp(24px, 5vw, 50px);
  background:
    radial-gradient(circle at 90% 20%, rgba(22, 122, 120, 0.16), transparent 28%),
    linear-gradient(135deg, #eef5fc, #ffffff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.page-hero.compact {
  margin-bottom: 24px;
}

.page-hero h1,
.error-page h1,
.login-card h2,
.welcome-copy h1 {
  margin: 4px 0 10px;
  line-height: 1.13;
  color: var(--navy);
}

.page-hero p {
  max-width: 780px;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
}

.section-heading {
  margin: 30px 0 16px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2,
.panel h2 {
  margin: 3px 0;
  color: var(--navy);
}

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

.module-card,
.action-card,
.run-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(23, 59, 103, 0.06);
}

.module-card {
  padding: 22px;
}

.module-card h3 {
  margin: 10px 0 6px;
  color: var(--navy);
}

.module-card p,
.action-card span,
.run-card span {
  color: var(--muted);
}

.module-index {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}

.analytics-panel {
  margin-top: 36px;
}

.action-card,
.run-card {
  display: flex;
  min-height: 116px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 20px;
  color: var(--text);
  text-decoration: none;
}

.action-card:hover,
.run-card:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.action-card strong,
.run-card strong {
  color: var(--navy);
  font-size: 1.05rem;
}

.panel {
  margin: 20px 0;
  padding: clamp(18px, 3vw, 28px);
}

.status-badge {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}

.summary-grid div {
  padding: 14px;
  background: var(--surface-alt);
  border-radius: 12px;
}

.summary-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-grid dd {
  margin: 4px 0 0;
  font-weight: 750;
}

.table-wrap {
  width: 100%;
  margin-top: 16px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.88rem;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #edf3f8;
  color: var(--navy);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

tbody tr:hover {
  background: #fafcfe;
}

.suppressed-value {
  font-weight: 800;
  color: var(--muted);
}

.empty-state {
  margin-top: 14px;
  padding: 22px;
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.filter-form {
  display: flex;
  align-items: end;
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-field.grow {
  flex: 1;
  margin-bottom: 0;
}

.form-field label {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 750;
}

.form-field input {
  width: 100%;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid #bfcbd6;
  border-radius: var(--radius-small);
}

.form-field input:focus {
  border-color: var(--blue);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

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

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

.button-quiet {
  color: var(--navy);
  background: #fff;
  border-color: var(--border);
}

.button-full {
  width: 100%;
}

.quick-runs {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.quick-runs a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  text-decoration: none;
  font-size: 0.82rem;
}

.export-action {
  margin-top: 18px;
}

.alerts {
  margin-bottom: 18px;
}

.alert {
  padding: 12px 15px;
  border-radius: 10px;
  background: var(--blue-soft);
}

.form-error {
  margin: 16px 0;
  padding: 12px 14px;
  background: var(--danger-soft);
  border: 1px solid #ecc4c4;
  border-radius: 10px;
  color: var(--danger);
  font-weight: 650;
}

.site-footer,
.login-footer {
  padding: 20px clamp(18px, 4vw, 56px);
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
}

.login-body {
  background:
    radial-gradient(circle at 10% 10%, #dcecfb, transparent 30%),
    linear-gradient(135deg, #f4f8fc, #edf6f4);
}

.login-layout {
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(420px, 0.75fr);
}

.login-visual {
  position: relative;
  overflow: hidden;
  padding: clamp(34px, 6vw, 84px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.welcome-copy {
  position: relative;
  z-index: 2;
  max-width: 650px;
}

.welcome-copy h1 {
  max-width: 620px;
  font-size: clamp(2.2rem, 5vw, 4.7rem);
  letter-spacing: -0.045em;
}

.welcome-copy > p:last-child {
  max-width: 600px;
  color: var(--muted);
  font-size: 1.06rem;
}

.login-panel {
  padding: clamp(24px, 5vw, 70px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(100%, 470px);
  padding: clamp(26px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(215, 224, 232, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.login-card h2 {
  font-size: clamp(1.65rem, 3vw, 2.15rem);
}

.muted,
.privacy-note {
  color: var(--muted);
}

.privacy-note {
  margin: 20px 0 0;
  font-size: 0.8rem;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 100px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 88px;
  height: 100%;
  padding: 0 10px;
  color: var(--blue);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--border);
}

.care-illustration {
  position: absolute;
  z-index: 1;
  width: 400px;
  height: 310px;
  right: 3%;
  bottom: 15%;
  opacity: 0.92;
  pointer-events: none;
}

.care-sun {
  position: absolute;
  width: 92px;
  height: 92px;
  right: 25px;
  top: 0;
  border-radius: 50%;
  background: #f6c962;
  opacity: 0.72;
}

.care-house {
  position: absolute;
  width: 250px;
  height: 155px;
  left: 72px;
  bottom: 40px;
  border-radius: 36px 36px 16px 16px;
  background: #dbeaf8;
}

.care-house::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  left: 30px;
  top: -77px;
  transform: rotate(45deg);
  border-radius: 28px;
  background: #c7dff3;
}

.care-person {
  position: absolute;
  z-index: 3;
  border-radius: 50% 50% 18px 18px;
}

.care-person::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -34px;
  width: 54px;
  height: 54px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: inherit;
}

.care-person-adult {
  width: 82px;
  height: 130px;
  left: 118px;
  bottom: 38px;
  background: #2f719f;
}

.care-person-child-one {
  width: 62px;
  height: 90px;
  left: 210px;
  bottom: 38px;
  background: #55a37a;
}

.care-person-child-two {
  width: 58px;
  height: 84px;
  left: 280px;
  bottom: 38px;
  background: #e1a950;
}

.care-person-child-one::before,
.care-person-child-two::before {
  width: 43px;
  height: 43px;
  top: -27px;
}

.care-ground {
  position: absolute;
  width: 360px;
  height: 38px;
  left: 20px;
  bottom: 8px;
  border-radius: 50%;
  background: rgba(67, 129, 91, 0.2);
}

.trust-list {
  position: relative;
  z-index: 2;
  max-width: 620px;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 10px;
  list-style: none;
}

.trust-list li {
  min-width: 0;
  flex: 1;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}

.trust-list strong,
.trust-list span {
  display: block;
}

.trust-list strong {
  color: var(--navy);
}

.trust-list span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.error-page {
  max-width: 720px;
  margin: 9vh auto;
  padding: 44px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.error-code {
  margin: 0;
  color: var(--teal);
  font-size: 3rem;
  font-weight: 900;
}

@media (max-width: 1080px) {
  .card-grid,
  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-panel {
    order: -1;
    padding-bottom: 16px;
  }

  .login-visual {
    min-height: 650px;
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .primary-nav {
    display: none;
    width: 100%;
    position: absolute;
    z-index: 20;
    left: 0;
    top: 72px;
    padding: 14px 18px;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .primary-nav.is-open {
    display: flex;
  }

  .card-grid,
  .action-grid,
  .run-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .filter-form {
    align-items: stretch;
    flex-direction: column;
  }

  .form-field.grow {
    margin-bottom: 0;
  }

  .login-visual {
    min-height: 720px;
    padding: 30px 22px;
  }

  .login-panel {
    padding: 18px;
  }

  .trust-list {
    flex-direction: column;
  }

  .care-illustration {
    right: -120px;
    bottom: 180px;
    transform: scale(0.78);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .action-card:hover,
  .run-card:hover {
    transform: none;
  }
}
