.admin-section {
  width: 100%;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header h2 {
  color: var(--text-main);
  margin: 0;
  font-weight: 700;
  font-size: 1.5rem;
}

.admin-form {
  background: var(--surface-muted);
  padding: 2rem;
  border-radius: var(--radius-sm);
  margin-bottom: 2rem;
  border: 1px solid var(--border);
}

.admin-form h3 {
  color: var(--primary);
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.hours-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem 1.25rem;
  margin: 0.5rem 0 1rem;
  background: var(--surface);
}

.hours-editor legend {
  padding: 0 0.5rem;
  font-weight: 600;
  color: var(--text-main);
}

.hours-editor-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
}

.hours-row {
  display: grid;
  grid-template-columns: 7rem 6.5rem 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
}

.hours-row.is-closed input[type="time"] {
  opacity: 0.45;
}

.hours-day {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.9rem;
}

.hours-closed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

.hours-sep {
  text-align: center;
  color: var(--text-muted);
}

.hours-row input[type="time"] {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-main);
}

@media (max-width: 600px) {
  .hours-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "day closed"
      "open close";
  }
  .hours-day { grid-area: day; }
  .hours-closed-toggle { grid-area: closed; justify-self: end; }
  .hours-row input[type="time"]:first-of-type { grid-area: open; }
  .hours-row input[type="time"]:last-of-type { grid-area: close; }
  .hours-sep { display: none; }
}

.btn-primary,
.btn-secondary,
.btn-edit,
.btn-delete {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-shadow);
}

.btn-secondary {
  background: var(--surface-muted);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-card);
  border-color: var(--border-strong);
}

.btn-edit {
  background: rgba(4, 120, 87, 0.1);
  color: var(--accent);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-edit:hover {
  background: rgba(4, 120, 87, 0.16);
}

.btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.06);
}

.item-content {
  flex: 1;
}

.item-content h4 {
  color: var(--text-main);
  margin: 0 0 0.35rem 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.item-content p {
  margin: 0.2rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.item-actions {
  display: flex;
  gap: 0.5rem;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem;
  font-style: italic;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
}

.info-text {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.info-box {
  background: var(--primary-faint);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
}

.info-box p {
  margin: 0.5rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.info-box p:first-child {
  margin-top: 0;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.medicine-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.pharmacy-medicines-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.pharmacy-medicines-section h3 {
  color: var(--text-main);
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Medicine search styles */
.loading-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-weight: 500;
}

.medicine-search-results {
  position: relative;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  background: var(--surface);
  box-shadow: var(--glass-shadow);
}

.search-result-item {
  padding: 1rem 1.25rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: var(--surface-muted);
}

.search-result-item strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.search-result-item span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.selected-medicine-info {
  background: var(--primary-faint);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-top: 0.5rem;
}

.selected-medicine-info p {
  margin: 0.25rem 0;
}

.selected-medicine-info .medicine-details {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  background: var(--surface-muted);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.2s, border-color 0.2s;
  font-family: inherit;
  font-weight: 600;
}

.btn-small:hover {
  background: var(--surface-card);
  border-color: var(--border-strong);
}

/* Source badges */
.source-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.source-badge--cima {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.source-badge--off {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

/* Pharmacies: search, region import, list filter */
.pharmacy-tools-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04);
}

.pharmacy-tools-card h3 {
  margin: 0 0 0.35rem 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.pharmacy-tools-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem 0;
  line-height: 1.45;
}

.city-lookup-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.city-lookup-input-wrap {
  flex: 1 1 220px;
  margin-bottom: 0;
}

.city-lookup-submit {
  flex-shrink: 0;
  margin-bottom: 0;
}

.city-lookup-feedback {
  font-size: 0.88rem;
  margin: 0 0 1.1rem 0;
  line-height: 1.45;
}

.city-lookup-feedback.ok {
  color: var(--accent);
}

.city-lookup-feedback.err {
  color: #b91c1c;
}

.pharmacy-tools-hint a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pharmacy-tools-hint a:hover {
  color: var(--primary-hover);
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .region-grid {
    grid-template-columns: 1fr;
  }
}

.region-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.region-presets label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.region-presets select {
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text-main);
}

.import-mode-row {
  margin-bottom: 1rem;
}

.import-mode-select-wrap {
  max-width: 28rem;
  margin-bottom: 0;
}

.open-data-url-row {
  margin-bottom: 1rem;
}

.pharmacy-tools-hint code {
  font-size: 0.85em;
  background: var(--surface-muted);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.tool-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
}

.tool-actions-row .btn-import-webhook {
  margin: 0;
}

.filter-region-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.filter-region-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.import-feedback {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.5;
}

.import-feedback.success {
  background: rgba(4, 120, 87, 0.1);
  border: 1px solid rgba(4, 120, 87, 0.25);
  color: var(--text-main);
}

.import-feedback.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.list-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: -0.5rem 0 1rem 0;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .admin-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .item-actions {
    width: 100%;
  }

  .item-actions button {
    flex: 1;
  }

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