:root {
  --bg: #0f1419;
  --panel: #1c2836;
  --text: #e8eef5;
  --muted: #9aa7b5;
  --accent: #4ea1ff;
  --border: #2a3a4d;
  --danger: #f07178;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
}

a {
  color: var(--accent);
}

.app-chrome {
  background: var(--panel);
}

.app-header-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.app-header-scroll h1 {
  font-size: 0.95rem;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

/* Keep destination + refresh on one row; shrink controls on narrow widths */
.app-header-dest-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.app-header-scroll #dest-select {
  flex: 1 1 6rem;
  min-width: 0;
  max-width: 11.5rem;
  font-size: 0.8rem;
  padding: 0.32rem 0.4rem;
  line-height: 1.2;
}

.app-header-scroll #btn-refresh {
  flex-shrink: 0;
  font-size: 0.8rem;
  padding: 0.32rem 0.5rem;
  line-height: 1.2;
  white-space: nowrap;
}

.app-header-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.app-tab-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
}

.app-tab-row .tabs {
  margin: 0;
}

.btn-logout-header {
  flex-shrink: 0;
  margin-left: auto;
}

/* Admin page (admin.html) */
header.app-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.app-header h1 {
  font-size: 1rem;
  margin: 0;
  flex: 1 1 auto;
}

select,
input,
button {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

button {
  cursor: pointer;
  background: #243044;
}

button.primary {
  background: #2f4f7a;
  border-color: #3d6cb5;
}

button.danger {
  background: #3a2226;
  border-color: #6b3038;
  color: #ffd0d4;
}

main {
  padding: 0.75rem 1rem 5rem;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #243044;
  color: var(--muted);
  border: 1px solid var(--border);
}

.list-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.toolbar-collapse-header {
  margin: -0.1rem 0 0;
}

.toolbar-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.35rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
}

.toolbar-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.toolbar-toggle-chevron {
  display: inline-block;
  width: 1rem;
  text-align: center;
  font-size: 0.6rem;
  line-height: 1;
  transition: transform 0.15s ease;
  color: var(--muted);
}

.list-toolbar.collapsed .toolbar-toggle-chevron {
  transform: rotate(-90deg);
}

.list-toolbar.collapsed .list-toolbar-body {
  display: none;
}

.list-toolbar-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}

.toolbar-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.toolbar-legend {
  font-size: 0.85rem;
  padding: 0;
}

.category-fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0;
  padding: 0.5rem 0.65rem 0.65rem;
}

.category-fieldset .hint {
  font-weight: normal;
  color: var(--muted);
  font-size: 0.8rem;
}

.category-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

button.linkish {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
}

.category-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
}

.category-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}

.category-checkboxes input {
  width: auto;
  margin: 0;
}

.list-count {
  margin: 0.15rem 0 0;
}

.place-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.place-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  text-align: left;
}

.place-card-header-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  justify-content: space-between;
}

.place-card-hit {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  border-radius: 8px;
  margin: -0.2rem;
  padding: 0.2rem;
}

.place-card-hit:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.place-card-hit:focus:not(:focus-visible) {
  outline: none;
}

.place-card-rating {
  flex-shrink: 0;
  text-align: right;
  max-width: 46%;
}

.place-card-google {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.place-card-avg {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.stars-inline {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.star-btn {
  min-width: 1.4rem;
  padding: 0.08rem 0.12rem;
  font-size: 0.88rem;
  line-height: 1;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  color: var(--accent);
}

.star-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.star-btn-lg {
  min-width: 2.1rem;
  font-size: 1.15rem;
  padding: 0.2rem 0.25rem;
}

.place-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  line-height: 1.25;
}

.place-card .place-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.place-card .place-lines {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.place-card .place-line-strong {
  color: var(--text);
}

.place-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.detail-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.detail-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.detail-address-line {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  max-width: 100%;
}

.detail-address-line a {
  color: var(--accent);
  word-break: break-word;
}

.detail-category-block {
  margin-top: 0.35rem;
}

.detail-category-block .detail-section-heading {
  margin: 0.6rem 0 0.2rem;
}

.detail-category-value {
  margin: 0;
  color: var(--text);
}

.detail-section-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1rem 0 0.35rem;
}

.detail-highlights-block {
  margin-top: 0.85rem;
}

.detail-micro-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.detail-highlights-field {
  background: rgba(232, 238, 245, 0.07);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 0.3rem;
}

.detail-highlights-field .detail-highlights-textarea {
  display: block;
  width: 100%;
  min-height: 3rem;
  max-height: 9rem;
  margin: 0;
  padding: 0.3rem 0.35rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 6px;
  resize: vertical;
  box-shadow: none;
}

.detail-highlights-field .detail-highlights-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.detail-highlights-actions {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.detail-highlights-save {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  line-height: 1.2;
  border-radius: 6px;
}

.detail-price-input {
  display: block;
  width: 100%;
  font-size: 0.84rem;
  line-height: 1.2;
  padding: 0.3rem 0.35rem;
}

.detail-priority-block .detail-section-heading {
  margin-top: 0.85rem;
}

.detail-priority-avg {
  margin: 0 0 0.4rem;
  color: var(--text);
}

.detail-priority-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

.detail-directions-block .detail-section-heading {
  margin-top: 1rem;
}

.detail-directions-foot {
  font-size: 0.78rem;
  margin: 0.5rem 0 0;
}

.stars {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.stars button:not(.star-btn) {
  min-width: 2.25rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0;
  flex-wrap: wrap;
}

.tabs button.active {
  border-color: var(--accent);
  color: var(--accent);
}

#map {
  width: 100%;
  height: 55vh;
  min-height: 240px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

.offline-banner {
  background: #3a2f1a;
  border: 1px solid #6b5426;
  color: #ffe8c2;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.refresh-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.35rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.refresh-loading.hidden {
  display: none;
}

.list-search-row {
  margin: 0.35rem 0 0.55rem;
}

.list-search-input {
  width: 100%;
  font-size: 0.9rem;
}

.refresh-loading-spinner {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tc-refresh-spin 0.65s linear infinite;
}

@keyframes tc-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

#btn-refresh:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#dest-select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 22rem;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}
