:root {
  --bg: #f4f7f8;
  --surface: #fff;
  --surface-soft: #f8fafb;
  --text: #172329;
  --muted: #6b7a80;
  --border: #dfe7e9;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #e6f4f2;
  --shadow: 0 8px 30px rgba(25, 45, 52, .07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Arial, sans-serif;
}

button, input { font: inherit; }

.page-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 50px;
}

.site-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 0 0;
}

.site-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: .18s ease;
}

.site-nav-link:hover {
  border-color: #b9cccf;
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.site-nav-link.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.page-header {
  padding: 34px 0 24px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.06;
  letter-spacing: -.035em;
}

.subtitle {
  max-width: 900px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.search-panel {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 0 14px;
  background: rgba(244,247,248,.92);
  backdrop-filter: blur(12px);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: .18s ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15,118,110,.10), var(--shadow);
}

.search-icon {
  width: 52px;
  flex: 0 0 52px;
  text-align: center;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  transform: rotate(-20deg);
}

#searchInput {
  width: 100%;
  height: 58px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

#searchInput::placeholder { color: #8a979b; }

.clear-search {
  width: 42px;
  height: 42px;
  margin-right: 8px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.clear-search:hover {
  background: #edf1f2;
  color: var(--text);
}

.search-info {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 4px 0;
  color: var(--muted);
  font-size: 13px;
}

#resultCount {
  color: var(--accent-dark);
  font-weight: 800;
}

.medicine-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.medicine-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: .18s ease;
}

.medicine-card:hover {
  border-color: #bfd4d1;
  transform: translateY(-1px);
}

.medicine-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.medicine-content h2 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.35;
}

.medicine-form {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.form-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.medicine-form p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

mark {
  padding: 0 2px;
  border-radius: 4px;
  background: #d9f2ee;
  color: inherit;
}

.empty-state {
  padding: 70px 20px;
  text-align: center;
}

.empty-icon {
  color: var(--accent);
  font-size: 42px;
  transform: rotate(-20deg);
}

.empty-state h2 {
  margin: 10px 0 5px;
  font-size: 22px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .page-shell { width: min(100% - 20px, 1100px); }

  .site-nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .site-nav-link {
    justify-content: center;
  }

  .page-header {
    padding-top: 25px;
  }

  .search-info {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .medicine-card {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 15px;
  }

  .medicine-number {
    width: 38px;
    height: 32px;
  }
}
