:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --ink: #171b1f;
  --muted: #64706b;
  --line: #d8dfda;
  --teal: #0b756f;
  --teal-soft: #dff1ee;
  --berry: #9d315d;
  --berry-soft: #f5dce7;
  --amber: #9a6400;
  --amber-soft: #ffedc7;
  --forest: #27634f;
  --shadow: 0 20px 60px rgba(23, 27, 31, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(11, 117, 111, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(157, 49, 93, 0.08), transparent 30%),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 760px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-block,
.brand-inline {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  font-size: 22px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.legal-gate {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 16px;
}

.legal-gate h2 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.legal-intro {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.legal-docs {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
  padding-right: 4px;
}

.legal-docs details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 12px;
}

.legal-docs summary {
  cursor: pointer;
  font-weight: 900;
}

.legal-docs ol {
  margin: 10px 0 0;
  padding-left: 21px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.legal-docs li + li {
  margin-top: 7px;
}

.consent-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
}

.consent-row input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--teal);
}

.login-form label,
.search-box {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.login-form input:not([type="checkbox"]),
.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

.login-form input:not([type="checkbox"]):focus,
.search-box input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 117, 111, 0.16);
}

.form-error {
  min-height: 1.25rem;
  margin: -4px 0 0;
  color: #a32121;
  font-size: 0.9rem;
  font-weight: 700;
}

.primary-button,
.ghost-button,
.action-button,
.segment {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.primary-button {
  background: var(--ink);
  color: white;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.ghost-button,
.segment {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.action-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  background: var(--teal);
  color: white;
}

.action-button.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.primary-button:hover,
.ghost-button:hover,
.action-button:hover,
.segment:hover {
  transform: translateY(-1px);
}

.login-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.dashboard {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.profile-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(23, 27, 31, 0.06);
}

.profile-band p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.profile-stats div {
  min-width: 92px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
}

.profile-stats dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-stats dd {
  margin: 4px 0 0;
  font-size: 1.5rem;
  font-weight: 900;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin: 20px 0;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
}

.segment {
  padding: 9px 12px;
  background: transparent;
}

.segment.active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 6px 16px rgba(23, 27, 31, 0.08);
}

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

.program-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(23, 27, 31, 0.07);
}

.preview {
  position: relative;
  min-height: 126px;
  padding: 16px;
  display: grid;
  align-content: end;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.preview.has-image {
  min-height: 150px;
  padding: 0;
  display: block;
  overflow: hidden;
  background: var(--surface-2);
}

.preview.has-image img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  object-position: top center;
}

.preview.browser {
  background: linear-gradient(135deg, var(--teal-soft), #f7fbfa);
}

.preview.desktop {
  background: linear-gradient(135deg, var(--amber-soft), #fffaf0);
}

.preview.learning {
  background: linear-gradient(135deg, var(--berry-soft), #fff8fb);
}

.preview.utility {
  background: linear-gradient(135deg, #e8f2e8, #fbfdf9);
}

.preview-lines {
  display: grid;
  gap: 6px;
}

.preview-lines span {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: rgba(23, 27, 31, 0.16);
}

.preview-lines span:nth-child(2) {
  width: 74%;
}

.preview-lines span:nth-child(3) {
  width: 52%;
}

.preview-badge {
  width: fit-content;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 27, 31, 0.1);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.preview.has-image .preview-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  box-shadow: 0 8px 22px rgba(23, 27, 31, 0.12);
}

.card-body {
  padding: 16px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.pill {
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.pill.launch {
  background: var(--teal-soft);
  color: var(--teal);
}

.pill.download {
  background: var(--amber-soft);
  color: var(--amber);
}

.program-card h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.program-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.52;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.card-actions.single {
  grid-template-columns: 1fr;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

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

  .profile-band,
  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dashboard {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
  }

  .topbar .ghost-button {
    width: 100%;
  }

  .profile-stats,
  .program-grid,
  .segmented {
    grid-template-columns: 1fr;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }

  .login-panel,
  .profile-band {
    padding: 18px;
  }

  h1 {
    font-size: 2rem;
  }
}
