:root {
  --navy: #102033;
  --ink: #172235;
  --muted: #647184;
  --line: #dbe5ea;
  --surface: #ffffff;
  --mist: #eef7f8;
  --teal: #0e9c95;
  --teal-dark: #08746f;
  --coral: #e86d5b;
  --amber: #f5b84b;
  --green: #2ea56f;
  --danger: #d85b5b;
  --shadow: 0 24px 70px rgba(16, 32, 51, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: #f8fbfb;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(219, 229, 234, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--navy);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--teal), var(--navy));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 600;
  margin-left: auto;
}

[dir="rtl"] .nav-links {
  margin-right: auto;
  margin-left: 0;
}

.language-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfb;
}

.language-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.language-switch a.active {
  color: white;
  background: var(--teal);
}

.nav-links a:hover {
  color: var(--teal-dark);
}

.nav-cta,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.nav-cta,
.button.secondary {
  color: var(--navy);
  background: white;
  border-color: var(--line);
}

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

.button.primary:hover {
  background: var(--teal-dark);
}

.wide {
  width: 100%;
}

.menu-toggle {
  display: inline-block;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

@media (min-width: 821px) {
  .menu-toggle {
    display: none;
  }
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--navy);
}

.hero-section {
  position: relative;
  min-height: min(720px, calc(100vh - 72px));
  display: flex;
  align-items: center;
  overflow: hidden;
  max-width: 100vw;
}

.hero-image,
.hero-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

[dir="rtl"] .hero-overlay {
  background:
    linear-gradient(270deg, rgba(248, 251, 251, 0.96) 0%, rgba(248, 251, 251, 0.86) 38%, rgba(248, 251, 251, 0.3) 70%),
    linear-gradient(0deg, rgba(248, 251, 251, 0.92) 0%, rgba(248, 251, 251, 0) 28%);
}

.hero-image {
  object-fit: cover;
  object-position: center;
}

.hero-overlay {
  background:
    linear-gradient(90deg, rgba(248, 251, 251, 0.96) 0%, rgba(248, 251, 251, 0.86) 38%, rgba(248, 251, 251, 0.3) 70%),
    linear-gradient(0deg, rgba(248, 251, 251, 0.92) 0%, rgba(248, 251, 251, 0) 28%);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  padding: clamp(62px, 10vw, 120px) clamp(20px, 5vw, 72px);
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(3rem, 7vw, 5.9rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin: 12px 0 16px;
  font-size: 1.45rem;
}

.hero-copy {
  max-width: 620px;
  margin: 22px 0 28px;
  color: #405066;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.65;
  word-break: break-word;
}

.hero-actions,
.pill-row,
.oauth-row,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions .button {
  flex: 0 1 auto;
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.feature-strip article {
  min-height: 132px;
  padding: 26px clamp(18px, 3vw, 34px);
  background: white;
}

.feature-strip strong,
.feature-strip span {
  display: block;
}

.feature-strip strong {
  color: var(--navy);
  margin-bottom: 9px;
}

.feature-strip span,
.section-copy p,
.plan-card p,
.admin-grid p,
.footer p {
  color: var(--muted);
  line-height: 1.6;
}

section:not(.hero-section):not(.feature-strip) {
  padding: clamp(64px, 9vw, 112px) clamp(20px, 5vw, 72px);
}

.split-section,
.scanner-layout,
.assistant-layout,
.tracking-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.section-copy {
  max-width: 620px;
}

.section-copy p {
  font-size: 1.05rem;
}

.pill-row span,
.oauth-row button,
.scanner-tabs button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-weight: 700;
}

.auth-panel,
.scanner-box,
.medication-result,
.calendar-panel,
.chat-panel,
.disclaimer-panel,
.chart-panel,
.journal-panel,
.plan-card,
.admin-grid article,
.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  gap: 16px;
  padding: clamp(22px, 4vw, 34px);
}

.panel-header,
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(46, 165, 111, 0.12);
}

label {
  display: grid;
  gap: 8px;
  color: #344357;
  font-size: 0.9rem;
  font-weight: 700;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdfd;
}

.oauth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.oauth-row button {
  border-radius: 8px;
}

.dashboard-section,
.scanner-section,
.tracking-section,
.plans-section {
  background: var(--mist);
}

.section-heading {
  max-width: 860px;
  margin-bottom: 34px;
}

.dashboard-grid,
.plans-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.metric-card {
  padding: 22px;
}

.metric-card span,
.metric-card .mini-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-card strong {
  display: block;
  margin: 10px 0;
  color: var(--navy);
  font-size: 2.35rem;
}

.progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eef0;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.scanner-box,
.medication-result {
  padding: clamp(18px, 3vw, 28px);
}

.scanner-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.scanner-tabs button {
  cursor: pointer;
}

.scanner-tabs button.active {
  color: white;
  border-color: var(--teal);
  background: var(--teal);
}

.scan-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 2px dashed #97c6c4;
  border-radius: 8px;
  color: var(--teal-dark);
  background:
    linear-gradient(90deg, rgba(14, 156, 149, 0.11) 1px, transparent 1px),
    linear-gradient(rgba(14, 156, 149, 0.11) 1px, transparent 1px),
    #f7fbfb;
  background-size: 26px 26px;
  font-weight: 800;
  text-align: center;
}

.scan-line {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 28%;
  height: 3px;
  background: var(--coral);
  box-shadow: 0 0 16px rgba(232, 109, 91, 0.6);
  animation: scan 2.2s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { transform: translateY(-55px); }
  50% { transform: translateY(75px); }
}

.manual-input {
  margin-bottom: 14px;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dl div {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  color: #35475e;
  line-height: 1.55;
}

.calendar-panel {
  padding: 26px;
}

.dose-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
  gap: 10px;
  margin-top: 18px;
  overflow-x: auto;
}

.dose-grid button {
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  background: white;
  font-weight: 800;
  cursor: pointer;
}

.dose-grid .taken {
  border-color: rgba(46, 165, 111, 0.45);
  background: rgba(46, 165, 111, 0.12);
}

.dose-grid .missed {
  border-color: rgba(216, 91, 91, 0.45);
  background: rgba(216, 91, 91, 0.12);
}

.dose-grid .skipped {
  border-color: rgba(245, 184, 75, 0.55);
  background: rgba(245, 184, 75, 0.16);
}

.dose-grid .due {
  border-color: rgba(14, 156, 149, 0.4);
  background: rgba(14, 156, 149, 0.11);
}

.assistant-section {
  background: #fff;
}

.assistant-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
}

.chat-panel,
.disclaimer-panel,
.chart-panel,
.journal-panel {
  padding: clamp(20px, 3vw, 30px);
}

.message {
  max-width: 78%;
  margin-bottom: 14px;
  padding: 15px 16px;
  border-radius: 8px;
  line-height: 1.55;
}

.message.user {
  margin-left: auto;
  color: white;
  background: var(--navy);
}

[dir="rtl"] .message.user {
  margin-right: auto;
  margin-left: 0;
}

.message.ai {
  color: #314258;
  background: var(--mist);
}

.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 22px;
}

.disclaimer-panel {
  border-left: 5px solid var(--coral);
}

[dir="rtl"] .disclaimer-panel {
  border-right: 5px solid var(--coral);
  border-left: 1px solid var(--line);
}

.disclaimer-panel p,
.disclaimer-panel li {
  color: var(--muted);
  line-height: 1.55;
}

.tracking-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
}

.bar-chart {
  display: flex;
  align-items: end;
  gap: 12px;
  height: 240px;
  margin-top: 22px;
  padding: 18px;
  border-radius: 8px;
  background: #f6fafb;
  border: 1px solid var(--line);
}

.bar-chart span {
  flex: 1;
  min-width: 22px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--teal), #66c8c2);
}

.journal-panel {
  display: grid;
  gap: 14px;
}

.journal-panel label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

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

.plan-card {
  padding: 26px;
}

.plan-card span {
  color: var(--teal-dark);
  font-weight: 800;
}

.plan-card strong {
  display: block;
  margin: 12px 0;
  color: var(--navy);
  font-size: 2.5rem;
}

.plan-card.featured {
  border-color: rgba(14, 156, 149, 0.45);
  transform: translateY(-10px);
}

.admin-section {
  background: white;
}

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

.admin-grid article {
  padding: 24px;
  box-shadow: none;
}

.admin-grid strong {
  color: var(--navy);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px clamp(20px, 5vw, 72px);
  color: white;
  background: var(--navy);
}

.footer p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
}

.footer-credit {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
}

.footer-links {
  color: rgba(255, 255, 255, 0.84);
  font-weight: 700;
}

@media (max-width: 1060px) {
  .feature-strip,
  .dashboard-grid,
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-section,
  .scanner-layout,
  .assistant-layout,
  .tracking-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    flex-wrap: nowrap;
    gap: 10px;
    padding-inline: 18px;
    width: 100%;
    max-width: 100vw;
  }

  .menu-toggle {
    display: inline-block;
    position: absolute;
    top: 14px;
    right: 18px;
  }

  [dir="rtl"] .menu-toggle {
    right: auto;
    left: 18px;
  }

  .nav-links,
  .nav-cta,
  .language-switch {
    display: none;
  }

  .topbar.menu-open .nav-links,
  .topbar.menu-open .language-switch,
  .topbar.menu-open .nav-cta {
    grid-column: 1 / -1;
    width: 100%;
  }

  .topbar.menu-open .nav-links,
  .topbar.menu-open .nav-cta {
    display: flex;
  }

  .topbar.menu-open .language-switch {
    display: inline-grid;
  }

  .topbar.menu-open .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: 10px;
  }

  .topbar.menu-open .nav-links a {
    min-height: 42px;
  }

  .topbar.menu-open .nav-cta {
    width: 100%;
  }

  .hero-section {
    min-height: 680px;
    align-items: end;
  }

  .hero-overlay {
    background:
      linear-gradient(0deg, rgba(248, 251, 251, 0.98) 0%, rgba(248, 251, 251, 0.87) 55%, rgba(248, 251, 251, 0.22) 100%);
  }

  .hero-content {
    padding-top: 210px;
  }

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

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

  .plan-card.featured {
    transform: none;
  }
}

@media (max-width: 620px) {
  .feature-strip,
  .dashboard-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2.6rem, 15vw, 4rem);
  }

  .hero-actions,
  .chat-input,
  .oauth-row {
    grid-template-columns: 1fr;
  }

  .hero-actions .button,
  .chat-input .button {
    width: 100%;
  }

  .message {
    max-width: 100%;
  }

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