/* Neutral backend theme — deliberately generic so it reads as an admin tool and
   never competes with a city's own branding on the public board page. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #dfe3e8;
  --border-strong: #c6ccd4;
  --text: #1c2430;
  --muted: #66707d;
  --faint: #9aa3ae;
  --accent: #2f5fd0;
  --accent-hover: #2750b4;
  --accent-soft: #eaf0fd;
  --danger: #b3341f;
  --danger-soft: #fdeeeb;
  --ok: #1d7a4c;
  --ok-soft: #e8f5ee;
  --warn: #8a6212;
  --warn-soft: #fdf3dd;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(19, 26, 36, .06), 0 4px 14px rgba(19, 26, 36, .05);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 20px; height: 58px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; }
.topbar-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 900;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar-user { color: var(--muted); font-size: 13px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.01em; }
.card h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: -.01em; }
.card .card-sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.field .hint { margin: 6px 0 0; font-size: 12px; color: var(--faint); }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; min-height: 38px; padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); outline: none;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type=color] {
  width: 46px; height: 38px; padding: 3px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: auto; min-height: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius); border: 1px solid transparent;
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .13s ease, border-color .13s ease, color .13s ease;
  text-decoration: none;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--surface); border-color: var(--border-strong); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- misc ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
}
.tag.draft { background: var(--warn-soft); color: var(--warn); }
.tag.published { background: var(--ok-soft); color: var(--ok); }
.tag.locked { background: var(--accent-soft); color: var(--accent); }
.tag.neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.row:last-child { border-bottom: none; }
.row-main { min-width: 0; }
.row-title { font-size: 14px; font-weight: 700; }
.row-sub { margin-top: 2px; font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 18px; color: var(--muted); font-size: 13px; text-align: center;
  background: var(--surface-2);
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px; border: 0; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.board-card {
  display: block; text-align: left; width: 100%; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow);
  transition: border-color .13s ease, transform .13s ease;
}
.board-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.board-card-top { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.board-logo {
  width: 38px; height: 38px; border-radius: 9px; flex: 0 0 auto; object-fit: contain;
  background: var(--surface-2); border: 1px solid var(--border);
}
.board-logo.placeholder {
  display: grid; place-items: center; font-size: 12px; font-weight: 900; color: var(--faint);
}
.board-card h3 { margin: 0; font-size: 15px; }
.board-card .board-slug { margin: 2px 0 0; font-size: 12px; color: var(--faint); }

/* ---------- priority columns (backend copy) ---------- */
.columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .columns { grid-template-columns: 1fr; } }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; }
.column-head { margin-bottom: 10px; }
.column-head h3 { margin: 0 0 2px; font-size: 14px; }
.column-head p { margin: 0; font-size: 12px; color: var(--muted); }
.column-count { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }

.project-list { display: flex; flex-direction: column; gap: 8px; min-height: 56px; padding: 2px; border-radius: var(--radius); }
.project-list.drag-over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }

.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.project-card.dragging { opacity: .45; }
.project-head { display: flex; align-items: flex-start; gap: 8px; padding: 10px 11px; }
.drag-grip {
  cursor: grab; color: var(--faint); font-size: 14px; line-height: 1.1;
  user-select: none; flex: 0 0 auto; padding-top: 1px;
}
.drag-grip:active { cursor: grabbing; }
.project-rank {
  width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--muted);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: 0 0 auto;
}
.project-toggle {
  all: unset; box-sizing: border-box; flex: 1; min-width: 0; cursor: pointer; display: block;
}
.project-name { font-size: 13px; font-weight: 700; line-height: 1.25; }
.project-dept { margin-top: 2px; font-size: 12px; color: var(--muted); }
.project-chevron { color: var(--faint); font-size: 10px; flex: 0 0 auto; transition: transform .13s ease; }
.project-card[data-expanded="true"] .project-chevron { transform: rotate(90deg); }
.project-body { display: none; padding: 0 11px 11px 44px; }
.project-card[data-expanded="true"] .project-body { display: block; }
.project-notes { margin: 0 0 9px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.project-notes.empty-notes { color: var(--faint); font-style: italic; }

/* ---------- column editor ---------- */
.col-row {
  display: grid; grid-template-columns: auto 46px 1.2fr 1.6fr 90px auto;
  gap: 10px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.col-row:last-of-type { border-bottom: none; }
.col-row .col-move { display: flex; flex-direction: column; gap: 2px; }
.col-row .col-move button {
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 5px; width: 24px; height: 19px; cursor: pointer;
  font-size: 10px; line-height: 1; color: var(--muted); padding: 0;
}
.col-row .col-move button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.col-row .col-move button:disabled { opacity: .3; cursor: not-allowed; }
.col-row input[type=text] { min-height: 34px; }
.col-row input[type=color] { width: 46px; height: 34px; }
.col-count { font-size: 11px; color: var(--faint); white-space: nowrap; }
.col-removing {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--warn-soft); border: 1px solid #e8d9ae; border-radius: var(--radius);
  padding: 10px; font-size: 13px; color: var(--warn);
}
.col-removing select { width: auto; min-height: 32px; }
@media (max-width: 900px) {
  .col-row { grid-template-columns: 1fr 1fr; }
  .col-row .col-move { flex-direction: row; }
}

/* ---------- import mapper ---------- */
.map-row {
  display: grid; grid-template-columns: 1.1fr 1.4fr 200px; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.map-row:last-of-type { border-bottom: none; }
.map-source { font-size: 13px; font-weight: 700; word-break: break-word; }
.map-sample {
  font-size: 12px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-row select { min-height: 34px; }
.map-row.is-ignored { opacity: .55; }
@media (max-width: 760px) { .map-row { grid-template-columns: 1fr; gap: 6px; } }

#impPreview th, #impPreview td {
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border);
  vertical-align: top; max-width: 260px;
}
#impPreview th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
#impPreview td { color: var(--text); }
#impPreview td.muted-cell { color: var(--faint); font-style: italic; }

.notice {
  border-radius: var(--radius); padding: 11px 13px; font-size: 13px; margin-top: 14px;
}
.notice.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #e8d9ae; }
.notice.err { background: var(--danger-soft); color: var(--danger); border: 1px solid #f0cec7; }
.notice.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #c6e4d3; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 700; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  box-shadow: 0 8px 26px rgba(0,0,0,.28); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.error { background: var(--danger); }

/* ---------- credentials modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(19, 26, 36, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  width: 100%; max-width: 420px; background: var(--surface);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.modal-box h2 { margin: 0 0 4px; font-size: 17px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  background: var(--surface-2);
}
.copy-row .btn { flex: 0 0 auto; }

/* ---------- centered auth screen ---------- */
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .topbar-mark { width: 42px; height: 42px; border-radius: 11px; font-size: 15px; margin: 0 auto 12px; }
.auth-brand h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.auth-brand p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.hidden { display: none !important; }
