:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #666c70;
  --line: #d9ddd6;
  --soft: #eef1ec;
  --accent: #0f5f57;
  --accent-2: #b8d8cf;
  --danger: #a83232;
  --warn: #9a6a00;
  --ok: #22683f;
  --info: #2f5f8f;
  --shadow: 0 12px 32px rgba(22, 28, 24, 0.08);
  --radius: 8px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

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

button {
  border: 0;
  cursor: pointer;
}

a { color: inherit; }

.landing {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) 1.15fr;
  background: #fff;
}

.landing-hero {
  padding: 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f4f7f3 100%);
}

.brand {
  display: inline-grid;
  gap: 5px;
  align-self: flex-start;
  font-weight: 900;
  font-size: 40px;
  letter-spacing: 0;
  line-height: 0.9;
}

.brand::after {
  content: "";
  height: 4px;
  background: var(--ink);
}

.hero-copy h1 {
  max-width: 680px;
  margin: 42px 0 18px;
  font-size: 52px;
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.hero-cta {
  margin-top: 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 36px;
}

.proof {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.72);
  padding: 18px;
  border-radius: var(--radius);
}

.proof strong {
  display: block;
  margin-bottom: 6px;
}

.proof span {
  color: var(--muted);
}

.landing-panel {
  padding: 52px;
  display: grid;
  gap: 24px;
  align-content: center;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.promo-details {
  display: grid;
  gap: 20px;
}

.promo-block {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.promo-block h2 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.2;
}

.promo-block p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.5;
}

.promo-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.promo-grid,
.promo-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.promo-grid span {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.doctor-public {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
}

.doctor-photo {
  width: 72px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--accent-2);
  color: var(--accent);
  font-weight: 900;
  font-size: 22px;
}

.mini-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.mini-list span,
.map-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  text-decoration: none;
}

.map-link {
  margin: 4px 0 12px;
  color: var(--accent);
  font-weight: 700;
}

.process-line {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.process-line span {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.process-line b {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad { padding: 22px; }

.card h2, .card h3 {
  margin: 0 0 14px;
}

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

.state-card {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  align-content: start;
}

.state-card h1,
.state-card h2,
.state-card p {
  margin: 0;
}

.inline-state {
  margin: 0 auto;
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.muted {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field label {
  color: #42494d;
  font-size: 12px;
  font-weight: 700;
}

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

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

.checkline {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 10px 0 14px;
  color: #42494d;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.checkline input {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  flex: 0 0 auto;
}

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

.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin: 10px 0 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.table-wrap .btn {
  white-space: normal;
  line-height: 1.2;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn.ghost {
  background: #fff;
  border-color: var(--line);
}

.btn.warn {
  background: #fff7df;
  color: #714c00;
}

.btn.danger {
  background: #fff0f0;
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shell {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #101412;
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
}

.sidebar .brand {
  font-size: 30px;
}

.nav {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.nav button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: rgba(255,255,255,0.78);
  border-radius: 7px;
  padding: 10px 11px;
  font-weight: 700;
}

.nav button.active,
.nav button:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.userbox {
  margin-top: auto;
  display: grid;
  gap: 8px;
  color: rgba(255,255,255,0.75);
  font-size: 13px;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 3;
}

.content {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.page-title h1 {
  margin: 0 0 7px;
  font-size: 30px;
  line-height: 1.15;
}

.page-title > div,
.metric,
.notice,
.card {
  min-width: 0;
}

.page-title p,
.metric,
.notice {
  overflow-wrap: anywhere;
}

.page-title p {
  max-width: 720px;
  margin: 0;
}

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

.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.responsive-fields { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.product-list {
  display: grid;
  gap: 14px;
  align-content: start;
}

.product-card {
  display: grid;
  gap: 16px;
}

.product-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.product-card-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.25;
}

.product-card-head p {
  margin: 0;
  line-height: 1.45;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.product-detail-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.product-detail-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-actions {
  justify-content: flex-end;
}

.protocol-standard {
  display: grid;
  gap: 18px;
}

.protocol-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.protocol-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.protocol-step span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.protocol-step strong,
.protocol-avoid strong {
  display: block;
  margin-bottom: 6px;
}

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

.protocol-avoid {
  border-left: 4px solid var(--warn);
  background: #fff8e8;
  padding: 14px 16px;
  border-radius: 7px;
}

.protocol-avoid ul {
  margin: 0;
  padding-left: 18px;
  color: #5d4b1c;
  line-height: 1.55;
}

.metric {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric strong {
  font-size: 28px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.table-wrap.compact table {
  min-width: 0;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: normal;
}

th {
  font-size: 12px;
  color: #3e4649;
  background: #f8faf7;
  position: sticky;
  top: 0;
}

tr:last-child td { border-bottom: 0; }

.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--soft);
}

.status.ok { color: var(--ok); background: #e7f5eb; }
.status.warn { color: var(--warn); background: #fff4d7; }
.status.danger { color: var(--danger); background: #ffe8e8; }
.status.info { color: var(--info); background: #e6f0fa; }

.danger-text {
  color: var(--danger);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 18px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tabs button {
  border-radius: 7px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
}

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

.patient-history {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.notice {
  border: 1px solid var(--line);
  background: #f9fbf8;
  border-radius: var(--radius);
  padding: 13px;
  color: #3c4546;
}

.notice.warn {
  background: #fff8e8;
  border-color: #ead59f;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  background: #101412;
  color: #fff;
  padding: 13px 15px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
}

.small {
  font-size: 12px;
}

@media (max-width: 980px) {
  .landing,
  .shell,
  .split,
  .auth-grid,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .product-detail-grid,
  .checklist-grid,
  .protocol-steps,
  .inline-form,
  .promo-grid,
  .promo-split,
  .process-line {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    gap: 12px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    width: 100%;
    max-width: 100%;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    width: auto;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .userbox {
    margin-top: 0;
    grid-template-columns: 1fr auto;
    align-items: center;
    min-width: 0;
    width: 100%;
  }

  .userbox span {
    display: none;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .content {
    padding: 18px;
  }

  .page-title {
    flex-direction: column;
  }

  .page-title > div {
    min-width: 0;
  }

  .page-title p {
    line-height: 1.45;
  }

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