@font-face {
  font-family: Inter;
  src: url("assets/inter-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --accent: #4cbb17;
  --accent-hover: #3fa412;
  --accent-light: #eff9e9;
  --green: #2e7d32;
  --green-deep: #175b29;
  --green-dark: #123f22;
  --page: #ffffff;
  --outside: #e8ebe8;
  --surface: #ffffff;
  --surface-soft: #f7f9f6;
  --ink: #263028;
  --muted: #6e786f;
  --line: #dfe5dd;
  --warn: #fff6d9;
  --warn-line: #e3b73f;
  --danger: #a2382b;
  --shadow-soft: 0 4px 14px rgba(24, 61, 31, 0.07);
  --shadow-page: 0 12px 42px rgba(32, 49, 35, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--outside);
  color: var(--ink);
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

h1, h2, h3 { margin: 0 0 0.55rem; line-height: 1.2; }
h1 { font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -0.035em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0.35rem 0 1rem; }
a { color: var(--green-deep); }

.appbar {
  min-height: 76px;
  background: var(--surface);
  border-top: 6px solid var(--accent);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px max(22px, calc((100vw - 1180px) / 2 + 22px));
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 12px rgba(27, 58, 31, 0.06);
}

.brand {
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brandmark {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(76, 187, 23, 0.25);
}

.brand small { display: block; color: var(--muted); line-height: 1.05; }
.brand strong { font-size: 1.2rem; color: var(--green-dark); }

.globalnav { display: flex; gap: 4px; align-items: center; }
.globalnav a, .globalnav span {
  padding: 9px 13px;
  border-radius: 3px;
  text-decoration: none;
}
.globalnav a:hover { color: var(--accent-hover); }
.globalnav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}
.globalnav span { color: var(--muted); opacity: 0.45; }

.wrap {
  width: min(1220px, calc(100% - 34px));
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: 26px 34px 76px;
  background: var(--page);
  box-shadow: var(--shadow-page);
}

.testbar {
  background: var(--green-deep);
  color: #fff;
  border-left: 6px solid var(--accent);
  padding: 8px 13px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  margin-bottom: 24px;
}

.button, button {
  min-height: 42px;
  padding: 10px 17px;
  border: 0;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 800 14px Inter, system-ui;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 3px 9px rgba(76, 187, 23, 0.2);
  transition: background 0.16s ease, transform 0.16s ease;
}
.button:hover, button:hover { background: var(--accent-hover); transform: translateY(-1px); }
.button.accent { background: var(--accent); color: #fff; }
.button.ghost { background: #fff; color: var(--green-deep); border: 1px solid var(--line); box-shadow: none; }

.kicker {
  color: var(--accent-hover);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero {
  min-height: 190px;
  margin: 0 0 27px;
  padding: clamp(28px, 5vw, 54px);
  color: #fff;
  background:
    radial-gradient(circle at 85% 25%, rgba(255,255,255,0.16) 0 3px, transparent 4px),
    radial-gradient(circle at 76% 68%, rgba(255,255,255,0.10) 0 55px, transparent 56px),
    linear-gradient(120deg, var(--green-dark), var(--green) 58%, var(--accent));
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 22px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  right: -80px;
  bottom: -140px;
  border: 28px solid rgba(255,255,255,0.08);
  border-radius: 50%;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; }
.hero p { color: rgba(255,255,255,0.86); max-width: 620px; }
.hero .kicker { color: #d9ffc9; }
.hero .button { background: #fff; color: var(--green-deep); box-shadow: none; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.patientcard {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 4px;
  padding: 19px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 15px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.patientcard:hover { transform: translateY(-2px); box-shadow: 0 9px 24px rgba(24, 61, 31, 0.11); }
.patientcard > b { color: var(--accent); font-size: 1.3rem; }

.avatar {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 2px solid #cdebbf;
  display: grid;
  place-items: center;
  color: var(--green-deep);
  font-weight: 900;
  font-size: 1.4rem;
}
.patientcard h2 { margin: 0; font-size: 1.2rem; color: var(--green-dark); }
.patientcard p { margin: 3px 0; }
.patientcard small { color: var(--muted); }

.patienthead {
  min-height: 155px;
  padding: 28px 30px;
  color: #fff;
  background: linear-gradient(120deg, var(--green-dark), var(--green) 70%, var(--accent));
  display: flex;
  align-items: center;
  gap: 17px;
  position: relative;
  overflow: hidden;
}
.patienthead::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -55px;
  top: -95px;
  border: 25px solid rgba(255,255,255,0.08);
  border-radius: 50%;
}
.patienthead > * { position: relative; z-index: 1; }
.patienthead h1, .patienthead .kicker { color: #fff; }
.patienthead .muted { color: rgba(255,255,255,0.82); }
.patienthead .avatar { width: 70px; height: 70px; font-size: 1.75rem; background: #fff; }
.patienthead .actions { margin-left: auto; }
.patienthead .button { background: #fff; color: var(--green-deep); box-shadow: none; }

.caution {
  background: var(--warn);
  border-left: 5px solid var(--warn-line);
  padding: 12px 14px;
  margin: 14px 0;
  font-weight: 750;
}

.tabs {
  display: flex;
  gap: 0;
  overflow: auto;
  padding: 0;
  margin-bottom: 18px;
  position: sticky;
  top: 76px;
  background: #fff;
  border: 1px solid var(--line);
  z-index: 12;
}
.tabs a {
  white-space: nowrap;
  text-decoration: none;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  color: var(--ink);
}
.tabs a:hover { color: var(--accent-hover); }
.tabs a.active { background: var(--accent); color: #fff; font-weight: 800; }

.grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 0 0 20px;
  padding: 1px;
  background: rgba(255,255,255,0.35);
  border: 0;
  box-shadow: var(--shadow-soft);
}
.grid4 .metric {
  min-height: 105px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(145deg, var(--accent), #66c93c);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  box-shadow: none;
}
.grid4 .metric small { color: rgba(255,255,255,0.78); text-transform: uppercase; letter-spacing: 0.07em; }
.grid4 .metric strong, .grid4 .metric a { color: #fff; }

.metric, .panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}
.metric small { display: block; color: var(--muted); }
.metric strong { display: block; font-size: 1.12rem; margin-top: 4px; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.panel + .panel { margin-top: 14px; }
.panel h2 { color: var(--green-deep); }
.panelhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--muted); }
.phone { font-size: 1.1rem; font-weight: 850; }

.compactlist { display: grid; gap: 8px; }
.compactrow {
  background: var(--surface-soft);
  border-left: 4px solid var(--accent);
  padding: 12px 13px;
  display: grid;
  grid-template-columns: 105px 1fr auto;
  gap: 10px;
  align-items: center;
}
.compactrow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sectionform {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 4px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}
.sectionform h2 { color: var(--green-deep); }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.wide { grid-column: 1 / -1; }
label { display: block; color: #3a443c; font-size: 0.8rem; font-weight: 800; }

input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid #ccd5ca;
  border-radius: 3px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 3px solid rgba(76,187,23,0.18);
  border-color: var(--accent);
}

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  background: var(--surface-soft);
}
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.check input { width: auto; margin: 0; accent-color: var(--accent); }

.savebar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 10px;
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--line);
  padding: 10px;
  box-shadow: var(--shadow-soft);
}

.visit {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  margin: 9px 0;
  overflow: hidden;
}
.visit summary {
  cursor: pointer;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 10px;
  list-style: none;
}
.visit summary::-webkit-details-marker { display: none; }
.visitbody { border-top: 1px solid var(--line); padding: 16px; }
.visitbody h3 { color: var(--green-deep); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 15px; }

.upload {
  border: 2px dashed #a8d795;
  background: var(--accent-light);
  padding: 20px;
}
.filelist { display: grid; gap: 8px; margin-top: 15px; }
.file {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #f9fbf8, #dfe7de);
  padding: 20px;
}
.authbox {
  width: min(450px, 100%);
  background: #fff;
  border-top: 6px solid var(--accent);
  padding: 32px;
  box-shadow: var(--shadow-page);
}
.authbox form { display: grid; gap: 13px; }
.error { background: #fae5df; color: var(--danger); border-left: 5px solid var(--danger); padding: 11px; }
.success { background: var(--accent-light); border-left: 5px solid var(--accent); padding: 11px; }

@media (max-width: 800px) {
  .appbar { min-height: 70px; padding: 9px 14px; }
  .brand small { display: none; }
  .globalnav span { display: none; }
  .globalnav a { padding: 8px 9px; }
  .wrap { width: 100%; padding: 18px 14px 60px; box-shadow: none; }
  .hero { min-height: 165px; padding: 25px 20px; align-items: flex-start; flex-direction: column; }
  .cards, .twocol, .formgrid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .patienthead { align-items: flex-start; flex-wrap: wrap; padding: 23px 20px; }
  .patienthead .actions { margin-left: 0; width: 100%; }
  .patienthead .button { width: 100%; }
  .tabs { top: 70px; }
  .compactrow, .visit summary { grid-template-columns: 90px 1fr; }
  .compactrow b, .visit summary b { display: none; }
}

@media (max-width: 480px) {
  .brand strong { font-size: 1rem; }
  .brandmark { width: 34px; height: 34px; }
  .globalnav a:not(.active):not(:last-child) { display: none; }
  .grid4 { grid-template-columns: 1fr; }
  .patientcard { grid-template-columns: auto 1fr; }
  .patientcard > b { display: none; }
  .sectionform { padding: 17px 14px; }
}
