.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 18px;
  padding: var(--s1);
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--accent);
}

body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.landing-page {
  width: min(100%, calc(var(--content-max) + 420px));
  margin: 0 auto;
  padding: var(--s4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  min-height: 0;
  overflow: hidden;
}

.landing-hero {
  display: flex;
  gap: var(--s4);
  padding: var(--s5);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 15%, transparent), transparent 40%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg2) 92%, var(--accent) 8%), var(--bg2));
}

.landing-copy,
.landing-auth,
.dashboard-shell {
  display: flex;
  flex-direction: column;
}

.landing-copy {
  gap: var(--s4);
}

.landing-title {
  max-width: 12ch;
  margin: 0;
}

.landing-summary {
  max-width: 58ch;
  margin: 0;
  font-size: var(--text-body-lg);
  line-height: 1.7;
  color: var(--text-dim);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.landing-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: var(--s4);
  min-height: 0;
  overflow: hidden;
}

.landing-auth {
  gap: var(--s4);
  padding: var(--s4);
  min-height: 0;
  overflow: auto;
}

.auth-header,
.auth-form,
.auth-stack,
.dashboard-head,
.widget,
.section-heading {
  display: flex;
  flex-direction: column;
}

.auth-header,
.auth-form,
.auth-stack {
  gap: var(--s3);
}

.auth-form .input {
  width: 100%;
}

.auth-message {
  min-height: 20px;
  font-size: var(--text-body);
  color: var(--danger);
}

.auth-message.is-info {
  color: var(--accent);
}

.auth-switch {
  color: var(--text-dim);
  font-size: var(--text-body);
}

.auth-switch button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.landing-user {
  font-family: var(--font-ui);
  font-size: var(--text-label);
  color: var(--text-dim);
}

.landing-user strong {
  color: var(--accent);
}

.landing-role,
.landing-warning {
  color: var(--text-dimmer);
}

.landing-warning {
  color: var(--warning);
}

.dashboard-shell {
  gap: var(--s4);
  padding: var(--s4);
  min-height: 0;
  overflow: hidden;
}

.dashboard-head {
  flex-direction: row;
  justify-content: space-between;
  align-items: end;
  gap: var(--s4);
  flex-shrink: 0;
}

.dashboard-meta {
  font-size: var(--text-body);
  color: var(--text-dim);
}

.dashboard-scroll {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding-right: var(--s1);
}

.widgets-grid,
.apps-grid {
  display: grid;
  gap: var(--s4);
}

.widgets-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.apps-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.widget,
.app-card {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  min-height: 100%;
  text-decoration: none;
  color: inherit;
}

.widget {
  padding: var(--s4);
  justify-content: space-between;
}

.widget-meta,
.section-heading {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.widget-subtitle,
.section-kicker {
  color: var(--text-dim);
}

.widget-value {
  font-family: var(--font-ui);
  font-size: var(--text-headline);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

.widget-sub,
.weather-details,
.app-desc {
  font-size: var(--text-body);
  color: var(--text-dim);
  line-height: 1.5;
}

.widget-rows {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.widget-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s3);
  padding-top: var(--s2);
  border-top: 1px solid var(--border);
}

.widget-label {
  font-size: var(--text-body);
  color: var(--text-dim);
}

.widget-num {
  font-family: var(--font-ui);
  font-size: var(--text-title);
  font-weight: 700;
}

.weather-main {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.weather-icon,
.app-icon {
  line-height: 1;
}

.weather-icon {
  font-size: 2rem;
}

.app-card {
  padding: var(--s4);
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-2);
}

.app-icon {
  font-size: 1.6rem;
}

.app-title {
  font-family: var(--font-ui);
  font-size: var(--text-title);
  font-weight: 700;
  color: var(--text);
}

.app-card .btn-open {
  margin-top: auto;
  align-self: flex-start;
}

@media (max-width: 980px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .landing-page {
    overflow: visible;
    min-height: auto;
  }

  .landing-workspace {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .landing-auth {
    overflow: visible;
  }

  .dashboard-shell,
  .dashboard-scroll {
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .landing-page {
    padding: var(--s3);
  }

  .widgets-grid {
    grid-template-columns: 1fr;
  }

  /* Apps: 2 columns on mobile — compact launcher style */
  .apps-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Apps always come before widgets on mobile */
  .apps-section {
    order: -1;
  }

  /* Compact app card: icon + title only */
  .app-card {
    padding: var(--s3);
    gap: var(--s2);
    align-items: center;
    text-align: center;
  }

  .app-icon {
    font-size: 2rem;
  }

  .app-desc,
  .app-card .btn-open {
    display: none;
  }

  /* Compact hero on mobile */
  .landing-hero {
    padding: var(--s4);
  }

  .landing-title {
    font-size: var(--text-headline);
    max-width: none;
  }

  /* When authenticated: no point showing the hero */
  .is-authenticated .landing-hero {
    display: none;
  }

  .dashboard-head {
    flex-direction: column;
    align-items: start;
  }

  .topbar-home {
    padding-inline: var(--s3);
  }

  .topbar-home .topbar-title {
    font-size: var(--text-label-sm);
  }
}
