/* TownLine Web — light, readable, utility-first styling. */
:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --ink: #2b2b2b;
  --muted: #8a8a8a;
  --accent: #c96a1e;
  --accent-soft: #f6e8d8;
  --line: #e6e1d6;
  --danger: #b3402e;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--accent); text-decoration: none; }
.topbar nav a { margin-left: 16px; color: var(--ink); text-decoration: none; }
.topbar nav a:hover { color: var(--accent); }
.wrap { max-width: 860px; margin: 0 auto; padding: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; margin: 16px 0;
}
.card.narrow { max-width: 420px; margin: 40px auto; }
h1 { font-size: 1.5rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 22px 0 8px; }
label { display: block; margin: 10px 0; font-weight: 600; }
label.check { font-weight: 400; }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 1rem;
  background: #fff;
}
button, .btn {
  display: inline-block; padding: 9px 16px; margin-top: 10px;
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  font-size: 1rem; cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { filter: brightness(0.93); }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.small { padding: 5px 10px; font-size: 0.85rem; margin-top: 0; }
.btn.danger { background: var(--danger); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.pill {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 10px; padding: 1px 8px; vertical-align: middle;
}
.error { color: var(--danger); }
.empty { margin: 30px 0; }
.dashhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dashactions { display: flex; gap: 8px; flex-wrap: wrap; }
.flashes { list-style: none; padding: 0; margin: 0 0 12px; }
.flashes li {
  background: var(--accent-soft); border: 1px solid var(--accent);
  color: var(--ink); border-radius: 8px; padding: 10px 14px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip {
  padding: 5px 13px; border-radius: 20px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink);
  text-decoration: none; font-size: 0.9rem;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .count {
  display: inline-block; min-width: 22px; text-align: center;
  background: var(--accent); color: #fff; border-radius: 11px;
  font-size: 0.75rem; font-weight: 700; padding: 1px 7px; margin-left: 5px;
}
.chip.on .count { background: #fff; color: var(--accent); }
.switch-wrap {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 0.9rem; padding: 5px 4px; user-select: none;
}
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--line);
  border-radius: 22px; transition: .2s;
}
.slider:before {
  content: ""; position: absolute; width: 16px; height: 16px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%;
  transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(16px); }
.pager {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin: 18px 0 8px;
}
.stories { list-style: none; padding: 0; margin: 0; }
.story {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 10px;
  cursor: pointer;
}
.story.read { opacity: 0.62; }
.srow { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.stitle { font-weight: 600; color: var(--ink); text-decoration: none; font-size: 1.02rem; }
.stitle:hover { color: var(--accent); }
.cat {
  flex-shrink: 0; font-size: 0.75rem; background: var(--accent-soft);
  color: var(--accent); border-radius: 12px; padding: 2px 10px;
}
.smeta { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.smeta .actions { float: right; }
.smeta .actions a {
  margin-left: 10px; text-decoration: none; font-size: 1.05rem; color: var(--accent);
}
.feedlist { list-style: none; padding: 0; }
.feed {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 10px;
}
.feedactions { display: flex; gap: 8px; flex-shrink: 0; }
.feedactions form { margin: 0; }
.inline-form { display: inline; }
.locresults { list-style: none; padding: 0; margin: 8px 0; }
.locresults li { margin-bottom: 6px; }
.linklike {
  background: none; border: none; color: var(--accent); padding: 0; margin: 0;
  text-align: left; cursor: pointer; font-size: 0.95rem; text-decoration: underline;
}
@media (max-width: 640px) {
  .dashhead { flex-direction: column; }
  .feed { flex-direction: column; align-items: flex-start; }
}

/* Admin */
.admintable { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.admintable th, .admintable td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admintable tr.blocked td { opacity: 0.65; }
.linklike.danger { color: var(--danger); }

/* Removable category tiles: small × badge on the chip corner. */
.chipwrap { position: relative; display: inline-block; }
.chipx {
  position: absolute; top: -8px; right: -6px;
  width: 18px; height: 18px; padding: 0; margin: 0;
  border-radius: 50%; border: 1px solid var(--danger);
  background: var(--card); color: var(--danger);
  font-size: 12px; line-height: 1; cursor: pointer;
}
.chipx:hover { background: var(--danger); color: #fff; }

/* "Are you sure?" confirmation modal. */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--card); border-radius: 12px;
  border: 1px solid var(--line);
  max-width: 420px; width: 100%; padding: 22px;
}
.modal h3 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-actions .btn { margin-top: 0; }
