:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #d9e1ea;
  --text: #1c2530;
  --muted: #5e6b79;
  --primary: #0f62fe;
  --primary-dark: #0a4ac2;
  --success: #147d64;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner,
.header-nav,
.list-card,
.stat-grid,
.form-row,
.meta-grid,
.actions,
.inline-list {
  display: flex;
  gap: 16px;
}

.header-inner,
.list-card,
.actions {
  align-items: center;
  justify-content: space-between;
}

.header-inner {
  min-height: 64px;
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.header-nav {
  align-items: center;
  flex-wrap: wrap;
}

.nav-item {
  display: flex;
  align-items: center;
}

.nav-link {
  color: var(--text);
  font-weight: 600;
}

.nav-link:hover {
  text-decoration: none;
}

.nav-dropdown {
  position: relative;
  padding-bottom: 8px;
  margin-bottom: -8px;
}

.nav-dropdown-trigger {
  display: block;
  padding: 10px 0;
  min-width: 0;
  text-align: left;
  cursor: pointer;
}

.nav-dropdown-trigger::after {
  content: "▾";
  display: inline-block;
  margin-left: 8px;
  color: var(--muted);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  min-width: 260px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(28, 37, 48, 0.12);
  padding: 8px;
  display: none;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text);
}

.nav-dropdown-menu a:hover {
  background: #eef3f8;
  text-decoration: none;
}

.page {
  padding: 24px 0 48px;
}

.breadcrumbs {
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 8px;
  color: var(--muted);
}

.breadcrumbs span[aria-current="page"] {
  color: var(--text);
}

.site-footer {
  margin-top: 32px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 32px 0 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 24px;
}

.site-footer h2 {
  margin-top: 0;
  font-size: 1rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li + li {
  margin-top: 8px;
}

.footer-note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.site-footer p,
.site-footer a,
.site-footer li {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.small-note {
  font-size: 0.9rem;
}

.card,
.flash,
.table-wrap,
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.section + .section,
.table-wrap + .table-wrap {
  margin-top: 20px;
}

.card + .card {
  margin-top: 0px;
}

.advertisement-slot {
  overflow-x: auto;
}

.grid-2,
.grid-3,
.grid-3-fixed,
.stat-grid,
.meta-grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3,
.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-3-fixed {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.meta-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.list-reset {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-reset li + li {
  border-top: 1px solid var(--border);
}

.list-card {
  padding: 16px 0;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eaf2ff;
  color: var(--primary-dark);
  font-size: 0.85rem;
}

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

.flash {
  margin-bottom: 20px;
}

.flash-notice {
  border-color: #b7e4d7;
  background: #edfdf6;
  color: var(--success);
}

.flash-alert {
  border-color: #f2c0b9;
  background: #fff5f3;
  color: var(--danger);
}

.button,
button,
input[type="submit"] {
  appearance: none;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
}

.button-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--primary-dark);
  padding: 0;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  font: inherit;
}

textarea {
  min-height: 100px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.form-row {
  flex-wrap: wrap;
}

.form-row > div {
  flex: 1 1 260px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table th {
  font-size: 0.9rem;
  color: var(--muted);
}

.pill-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-nav a {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef3f8;
}

.hidden {
  position: absolute;
  left: -9999px;
}

.pagy {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.pagy a,
.pagy span {
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.star-display {
  color: #f4b400;
  letter-spacing: 0;
}

.rating-stars {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 4px;
}

.rating-stars input {
  display: none;
}

.rating-stars label {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: #c9d2dc;
}

.rating-stars label:hover,
.rating-stars label:hover ~ label,
.rating-stars input:checked ~ label {
  color: #f4b400;
}

.map-frame {
  width: 100%;
  min-height: 320px;
  border: 0;
  border-radius: 6px;
}

.entity-logo {
  display: block;
  max-width: min(220px, 100%);
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.entity-logo-admin {
  max-height: 96px;
}

.pharmacy-status {
  margin: -8px 0 16px;
  font-weight: 700;
}

.pharmacy-status-open {
  color: var(--success);
}

.pharmacy-status-closed {
  color: var(--danger);
}

.pharmacy-status-unknown {
  color: var(--muted);
}

.modal-dialog {
  width: min(680px, calc(100% - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.modal-dialog::backdrop {
  background: rgba(28, 37, 48, 0.55);
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.working-day-current {
  font-weight: 700;
}

.working-day-label-current,
.working-day-hours-open,
.working-day-hours-closed {
  font-weight: 700;
}

.working-day-open {
  background: #edfdf6;
}

.working-day-closed {
  background: #fff5f3;
}

.working-day-hours-open {
  color: var(--success);
}

.working-day-hours-closed {
  color: var(--danger);
}

@media (max-width: 720px) {
  .header-inner,
  .list-card,
  .actions {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .grid-3-fixed {
    grid-template-columns: 1fr;
  }

  .nav-dropdown-menu {
    left: 0;
    right: auto;
    min-width: 220px;
  }
}
