@import url("https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght@200;400;600;700&display=swap");

:root {
  --bg: #fff8f2;
  --surface: #fffdfb;
  --surface-2: #e9f6f5;
  --line: #e8d9cf;
  --text: #184e52;
  --muted: #68777a;
  --brand: #28bbc2;
  --brand-dark: #19959b;
  --brand-2: #ee5e1f;
  --peach: #f6aa89;
  --yellow: #f4c65c;
  --warn: #b66a20;
  --danger: #bd5151;
  --ok: #28bbc2;
  --shadow: 0 18px 42px rgba(40, 187, 194, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat Alternates", "Segoe UI", Arial, sans-serif;
  font-weight: 200;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
  font-weight: 600;
}

.app-shell {
  min-height: 100vh;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
}

.login-hero {
  display: flex;
  min-height: 100vh;
  align-items: end;
  padding: 48px;
  background:
    linear-gradient(180deg, rgba(40, 187, 194, 0.08), rgba(24, 78, 82, 0.68)),
    url("https://images.unsplash.com/photo-1503676260728-1c00da094a0b?auto=format&fit=crop&w=1600&q=80") center/cover no-repeat;
  color: white;
}

.hero-copy {
  width: min(680px, 100%);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
}

.logo-full {
  display: block;
  width: auto;
  object-fit: contain;
}

.hero-logo {
  width: min(520px, 82%);
  max-height: 96px;
  margin-bottom: 22px;
  filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.7));
}

.hero-copy p {
  max-width: 600px;
  margin: 0;
  font-size: 20px;
  line-height: 1.55;
}

.login-panel {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--surface);
}

.login-logo {
  width: min(360px, 100%);
  max-height: 82px;
  margin-bottom: 32px;
}

.topbar-logo {
  width: 250px;
  max-height: 48px;
}

.login-box {
  width: min(420px, 100%);
}

.eyebrow {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.login-box h2 {
  margin: 10px 0 8px;
  font-size: 32px;
}

.login-box h2,
.page-head h1,
.patient-summary h2,
.report-sheet > h2 {
  font-weight: 200;
}

.card h3,
.section-title h3,
strong {
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  font-weight: 400;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 7px;
  margin: 18px 0;
}

.field label {
  font-size: 13px;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 127, 115, 0.14);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f1eb;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: 0 4px 14px rgba(40, 187, 194, 0.12);
}

.primary,
.secondary,
.ghost,
.icon-btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  font-weight: 800;
}

.primary {
  width: 100%;
  background: var(--brand);
  color: white;
}

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

.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.ghost {
  background: transparent;
  color: var(--brand);
}

.icon-btn {
  width: 42px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
}

.demo-note {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.92);
  padding: 0 28px;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.content {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 4px 0 4px;
  font-size: 34px;
  line-height: 1.08;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 18px;
}

.tabs button {
  min-height: 38px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0 14px;
  font-weight: 600;
}

.tabs button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: 1.1fr 0.9fr;
}

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

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card:nth-child(3n + 2) {
  border-top-color: rgba(238, 94, 31, 0.55);
}

.card:nth-child(3n + 3) {
  border-top-color: rgba(242, 189, 73, 0.7);
}

.card h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.metric {
  display: grid;
  min-height: 124px;
  align-content: space-between;
}

.metric strong {
  display: block;
  margin-top: 14px;
  font-size: 29px;
}

.status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
}

.status.ok {
  background: rgba(36, 121, 90, 0.12);
  color: var(--ok);
}

.status.warn {
  background: rgba(168, 104, 31, 0.14);
  color: var(--warn);
}

.status.danger {
  background: rgba(180, 66, 66, 0.12);
  color: var(--danger);
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  gap: 5px;
  border-left: 3px solid var(--brand);
  padding: 4px 0 4px 12px;
}

.list-item strong {
  line-height: 1.25;
}

.progress-row {
  display: grid;
  grid-template-columns: 150px 1fr 42px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

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

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #19a1a1);
}

.finance-table {
  width: 100%;
  border-collapse: collapse;
}

.finance-table th,
.finance-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  text-align: left;
}

.finance-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.patient-list {
  display: grid;
  gap: 10px;
}

.patient-button {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  text-align: left;
}

.patient-button.active {
  border-color: var(--brand);
  background: var(--surface-2);
}

.admin-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 18px;
}

.patient-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid rgba(40, 187, 194, 0.24);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 18px;
}

.patient-summary h2 {
  margin: 4px 0;
  font-size: 25px;
}

.summary-stats {
  display: flex;
  gap: 8px;
}

.summary-stats span {
  display: grid;
  min-width: 76px;
  min-height: 64px;
  place-content: center;
  border: 1px solid rgba(40, 187, 194, 0.2);
  border-radius: 7px;
  background: #fff;
  text-align: center;
}

.summary-stats strong {
  color: var(--brand);
  font-size: 20px;
}

.summary-stats small {
  color: var(--muted);
  font-size: 11px;
}

.admin-tabs {
  margin: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title h3 {
  margin: 4px 0 0;
}

.compact-card textarea {
  min-height: 74px;
}

.privacy-row,
.privacy-note {
  margin: 12px 0 16px;
  border-radius: 7px;
  background: #fff3ed;
  color: #88553d;
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.privacy-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.goal-list,
.document-list,
.timeline {
  display: grid;
  gap: 12px;
}

.goal-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 0.8fr) 46px 100px;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.goal-item > div:first-child,
.document-item > div:nth-child(2) {
  display: grid;
  gap: 4px;
}

.timeline {
  position: relative;
  padding-left: 12px;
}

.timeline::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 18px;
  width: 2px;
  background: var(--line);
  content: "";
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  padding: 8px 0;
}

.timeline-item > div {
  display: grid;
  gap: 5px;
}

.timeline-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.timeline-dot {
  z-index: 1;
  display: block;
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}

.timeline-item.private .timeline-dot {
  background: var(--brand-2);
  box-shadow: 0 0 0 1px var(--brand-2);
}

.timeline-item.document .timeline-dot {
  background: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow);
}

.document-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
}

.document-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 7px;
  background: #fff3ed;
  color: var(--brand-2);
  font-size: 11px;
  font-weight: 700;
}

.report-sheet {
  line-height: 1.6;
}

.report-sheet > h2 {
  margin-top: 28px;
  color: var(--brand);
}

.report-sheet > h3 {
  margin: 22px 0 4px;
  color: var(--brand-dark);
}

.report-footer {
  display: grid;
  width: 260px;
  gap: 3px;
  margin: 40px 0 8px auto;
  border-top: 1px solid var(--text);
  padding-top: 8px;
  text-align: center;
}

.report-footer span {
  color: var(--brand);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 14px;
}

.full {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notice {
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 920px) {
  .login-screen,
  .grid.two,
  .grid.three,
  .grid.four,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 44vh;
    padding: 28px;
  }

  .login-panel {
    min-height: auto;
  }

  .page-head,
  .topbar,
  .patient-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding: 16px 20px;
  }

  .topbar-logo {
    width: min(310px, 100%);
  }
}

@media (max-width: 620px) {
  .content {
    width: min(100% - 24px, 1220px);
    padding-top: 18px;
  }

  .hero-copy h1 {
    font-size: 40px;
  }

  .form-grid,
  .progress-row,
  .goal-item {
    grid-template-columns: 1fr;
  }

  .finance-table {
    display: block;
    overflow-x: auto;
  }

  .summary-stats {
    width: 100%;
  }

  .summary-stats span {
    min-width: 0;
    flex: 1;
  }

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