:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d23;
  --text-muted: #667085;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

header.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.topbar .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  white-space: nowrap;
}

header.topbar nav {
  margin-left: auto;
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
}

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

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: white;
  font-weight: 600;
}
button:hover {
  background: var(--accent-hover);
}
button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover {
  background: var(--bg);
}
button.danger {
  background: var(--danger);
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}
.search-bar input[type="text"] {
  flex: 1;
  min-width: 160px;
}

.chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  height: calc(100vh - 116px);
}
@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  #map {
    height: 320px;
  }
}

.list-pane {
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 0.75rem;
}

#map {
  width: 100%;
  height: 100%;
  background: #eef0f3;
}

.place-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.place-card:hover {
  border-color: var(--accent);
}
.place-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}
.place-card .meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--accent);
}
.badge.pending {
  background: #fff7ed;
  color: #c2410c;
}
.badge.rejected {
  background: #fef2f2;
  color: var(--danger);
}

.notice {
  margin: 0.75rem 1.25rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.88rem;
  border: 1px solid #fed7aa;
}
.notice.error {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stars {
  color: #f59e0b;
}

.review {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0;
}
.review:first-child {
  border-top: none;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
}

/* ---- NearMe: ricerca aziende ---- */
.container.wide {
  max-width: 1100px;
}
.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}
code {
  background: #eef2ff;
  padding: 0.05rem 0.35rem;
  border-radius: 5px;
  font-size: 0.85em;
}

.card h1 {
  margin-top: 0;
}

.cat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.cat-actions a {
  font-size: 0.85rem;
}

.category-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.35rem 0.75rem;
}
.cat-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  padding: 0.15rem 0;
}
.cat-check input {
  width: auto;
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.results-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.table-scroll {
  overflow-x: auto;
}
table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.results th,
table.results td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.results th {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
}
table.results td.num,
table.results th.num {
  text-align: right;
  white-space: nowrap;
}
table.results tbody tr:hover {
  background: var(--bg);
}

.settings-list {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.cat-row {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) minmax(140px, 1fr) auto auto;
  gap: 0.4rem;
  align-items: center;
}
.cat-row.add {
  grid-template-columns: auto minmax(140px, 1fr) minmax(140px, 1fr) auto;
  margin-top: 0.4rem;
}
.cat-row input[type="checkbox"] {
  width: auto;
}
@media (max-width: 640px) {
  .cat-row,
  .cat-row.add {
    grid-template-columns: auto 1fr 1fr;
  }
}
