:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #15202b;
  --muted: #667085;
  --line: #d9e1e8;
  --accent: #0f766e;
  --accent-weak: #e6f5f2;
  --danger: #9f1239;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(920px, calc(100vw - 32px));
  margin: 32px auto;
}

.lookup {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.count,
.search-label,
.source,
.hint {
  color: var(--muted);
}

.search-label {
  display: block;
  padding: 16px 20px 6px;
  font-size: 13px;
  font-weight: 600;
}

.search {
  display: block;
  width: calc(100% - 40px);
  margin: 0 20px 18px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 18px;
  outline: none;
}

.search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.content {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.1fr);
  border-top: 1px solid var(--line);
  min-height: 420px;
}

.medications {
  list-style: none;
  margin: 0;
  padding: 8px;
  border-right: 1px solid var(--line);
  max-height: 62vh;
  overflow: auto;
}

.medication {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
}

.medication-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.medication-shortcut {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.medication:hover,
.medication.selected {
  background: var(--accent-weak);
}

.actions {
  padding: 18px;
}

.selected-title {
  margin: 0 0 14px;
  font-size: 18px;
}

.action-grid {
  display: grid;
  gap: 10px;
}

.action {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
}

.action:hover,
.action:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 700;
}

.action-title {
  display: block;
  font-weight: 700;
}

.source {
  display: block;
  margin-top: 2px;
  font-size: 13px;
}

.empty {
  margin: 18px;
  color: var(--danger);
}

@media (max-width: 720px) {
  .shell {
    width: 100%;
    margin: 0;
  }

  .lookup {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

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

  .medications {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 34vh;
  }
}
