:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --soft: #fafafa;
  --ink: #161616;
  --sub: #7a7a7a;
  --line: #ededed;
  --blue: #2f6fed;
  --blue-soft: #eef3ff;
  --green: #199a63;
  --amber: #c98a00;
  --red: #cf4444;
  --radius: 13px;
}
[data-theme="dark"] {
  --bg: #000000;
  --panel: #000000;
  --soft: #080808;
  --ink: #f2f2f2;
  --sub: #8a8a8a;
  --line: #262626;
  --blue: #4f8dff;
  --blue-soft: #1b2a44;
  --green: #35b97a;
  --amber: #d9a520;
  --red: #f2706a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { font-size: 16px; }
.brand small { color: var(--sub); font-size: 10px; letter-spacing: 1.2px; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--sub); font-size: 13px; }
.who b { color: var(--ink); font-weight: 600; }
.page { max-width: 1120px; margin: 0 auto; padding: 26px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.eyebrow { display: block; color: var(--sub); font-size: 10.5px; letter-spacing: 1.5px; margin-bottom: 5px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--sub); font-size: 14px; }
.page-actions { display: flex; gap: 8px; }
.pill { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 600; }
.notice { padding: 12px 14px; border: 1px solid #f0d9a3; background: #fff7e5; color: #8a5d00; border-radius: 10px; font-size: 12.5px; line-height: 1.7; margin-bottom: 16px; }
[data-theme="dark"] .notice { background: #2b2413; border-color: #4a3c19; color: #e7c46a; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.type-MSystem { background: #fff7e5; color: #8a5d00; border-color: #f0d9a3; }
.type-Operator { background: var(--blue-soft); color: var(--blue); border-color: #c9dbff; }
.type-Observer { background: #e8f7ef; color: var(--green); border-color: #bfe7d2; }
.type-CSurrounding { background: #f1edff; color: #6d5bd0; border-color: #ddd2ff; }
.type-user { background: #f1f4f8; color: var(--sub); border-color: #e1e7ef; }
[data-theme="dark"] .type-MSystem { background: #2b2413; color: #e7c46a; border-color: #4a3c19; }
[data-theme="dark"] .type-Operator { background: #1b2a44; color: #8fb6ff; border-color: #2b446b; }
[data-theme="dark"] .type-Observer { background: #16291f; color: #6fd3a1; border-color: #24513a; }
[data-theme="dark"] .type-CSurrounding { background: #251f3d; color: #b9a7ff; border-color: #3b3060; }
[data-theme="dark"] .type-user { background: #202832; color: #b9c4d1; border-color: #2a3341; }
.admin-tabs {
  position: relative;
  display: flex;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  margin: 0 0 16px;
  padding: 4px;
  border-radius: 11px;
  background: var(--soft);
  overflow-x: auto;
  isolation: isolate;
}
[data-theme="dark"] .admin-tabs { background: var(--soft); }
.admin-tabs button {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sub);
  padding: 8px 16px;
  font-size: 13px;
  white-space: nowrap;
  transition: color .18s ease;
}
.admin-tabs button.on { color: var(--ink); font-weight: 600; }
.tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  z-index: 0;
  width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1), width .28s cubic-bezier(.4, 0, .2, 1);
}
@keyframes panel-in-right {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes panel-in-left {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
.panel-in-right { animation: panel-in-right .24s cubic-bezier(.4, 0, .2, 1); }
.panel-in-left { animation: panel-in-left .24s cubic-bezier(.4, 0, .2, 1); }

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 11px 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; }
.user-row .avatar { width: 34px; height: 34px; }
.user-meta { min-width: 0; flex: 1; line-height: 1.3; }
.user-meta b { display: block; font-size: 13.5px; font-weight: 600; }
.user-meta small { display: block; color: var(--sub); font-size: 11px; font-family: ui-monospace, Consolas, monospace; }
.user-type { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.user-type select { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 7px 9px; font-size: 12px; min-width: 130px; }
[data-theme="dark"] .user-type select { background: var(--panel); }
.user-type .lock { color: var(--sub); font-size: 11px; white-space: nowrap; }
.site-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.site-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.site-head { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.site-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 15px; flex: 0 0 auto; }
.site-title { min-width: 0; flex: 1; }
.site-title h2 { margin: 0; font-size: 16px; font-weight: 600; }
.site-title small { display: block; margin-top: 2px; color: var(--sub); font-size: 11px; font-family: ui-monospace, Consolas, monospace; }
.status { color: var(--sub); font-size: 11px; white-space: nowrap; }
.status::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 5px; vertical-align: 1px; }
.status.planned::before { background: var(--sub); }
.admin-list { border-top: 1px solid var(--line); }
.admin-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.admin-row:last-child { border-bottom: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); color: var(--ink); font-size: 12px; font-weight: 600; flex: 0 0 auto; }
.admin-meta { min-width: 0; flex: 1; line-height: 1.3; }
.admin-meta b { display: block; font-size: 13px; font-weight: 600; }
.admin-meta small { display: block; color: var(--sub); font-size: 11px; font-family: ui-monospace, Consolas, monospace; }
.admin-note { color: var(--sub); font-size: 11px; white-space: nowrap; }
.remove { border: 1px solid #f3c9c7; background: transparent; color: var(--red); border-radius: 8px; padding: 4px 9px; font-size: 11px; }
.remove:hover { background: #fdf3f3; }
.add-row { display: flex; gap: 7px; margin-top: 12px; }
.add-row select { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 7px 9px; font-size: 12px; }
[data-theme="dark"] .add-row select { background: var(--panel); }
.add-row button { border: 1px solid var(--blue); background: var(--blue); color: #fff; border-radius: 9px; padding: 7px 11px; font-size: 12px; white-space: nowrap; }
.add-row button:disabled { opacity: .4; cursor: not-allowed; }
.empty-line { color: var(--sub); font-size: 12px; padding: 9px 0; }
.foot-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--sub); font-size: 12px; line-height: 1.7; }
.login-card { width: min(380px, calc(100vw - 32px)); margin: 8vh auto 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: none; }
.login-head { text-align: center; margin-bottom: 20px; }
.login-head h1 { margin: 0 0 6px; font-size: 24px; font-weight: 600; }
.login-head p { margin: 0; color: var(--sub); font-size: 13px; }
.field { display: block; margin-bottom: 13px; color: var(--sub); font-size: 13px; }
.field span { display: block; margin-bottom: 5px; }
.input { width: 100%; height: 41px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); outline: none; }
[data-theme="dark"] .input { background: var(--panel); }
.input:focus { border-color: #b9cdfb; background: var(--panel); }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 9px 15px; }
.btn-primary { width: 100%; border-color: var(--blue); background: var(--blue); color: #fff; padding: 11px; font-size: 15px; }
.btn-ghost { width: 100%; }
.error { min-height: 18px; margin: 0 0 8px; color: var(--red); font-size: 12px; }
.foot-note a { color: var(--blue); text-decoration: none; }
.toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; pointer-events: none; }
.toast { padding: 9px 15px; border-radius: 9px; background: #1e222b; color: #fff; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
@media (max-width: 760px) {
  .site-list { grid-template-columns: 1fr; }
  .page { padding: 20px 14px 48px; }
  .topbar { padding: 0 14px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .login-card { margin-top: 4vh; padding: 24px; }
}

/* Flat separators: no enclosing boxes, only light horizontal dividers */
.site-list {
  grid-template-columns: 1fr;
  gap: 0;
}
.site-card {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 0;
  box-shadow: none;
}
.site-card:last-child {
  border-bottom: 0;
}
.site-head {
  margin-bottom: 8px;
}
.site-mark {
  width: auto;
  height: auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--sub);
  font-size: 15px;
}
.admin-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.user-row {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0;
}
.user-row:last-child {
  border-bottom: 0;
}
.notice {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 0;
  color: var(--sub);
}
.foot-note {
  border-top: 1px solid var(--line);
}
.login-card {
  box-shadow: none;
}
/* Align letter markers without drawing boxes */
.site-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 38px;
  line-height: 1;
  font-size: 14px;
  padding: 0;
}
/* Search, compact site switcher, action menu and modal */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 6px 0;
  font-size: 13px;
  outline: none;
}
.search-input:focus {
  border-bottom-color: var(--blue);
}
.search-input::placeholder {
  color: var(--sub);
}
.list-count {
  flex: 0 0 auto;
  color: var(--sub);
  font-size: 11px;
  white-space: nowrap;
}
.filter-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 16px;
  margin: 14px 0;
}
.filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
}
.filter-head strong { font-size: 13px; font-weight: 600; }
.filter-head span { color: var(--sub); font-size: 11px; line-height: 1.6; text-align: right; }
.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
}
.filter-label {
  flex: 0 0 70px;
  padding-top: 6px;
  color: var(--sub);
  font-size: 11.5px;
  font-weight: 600;
}
.filter-row .search-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 7px 10px;
}
.filter-row .search-input:focus { border-color: var(--blue); }
.filter-chips { display: flex; flex: 1; flex-wrap: wrap; gap: 6px; min-width: 0; }
.filter-chip {
  height: 27px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--sub);
  font-size: 11.5px;
  cursor: pointer;
}
.filter-chip:hover { color: var(--ink); background: var(--soft); }
.filter-chip.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); font-weight: 600; }
.filter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
}
.clear-filters {
  border: 0;
  background: transparent;
  color: var(--sub);
  font-size: 11.5px;
  padding: 4px 0;
}
.clear-filters:hover:not(:disabled) { color: var(--ink); }
.clear-filters:disabled { opacity: .35; cursor: not-allowed; }
.inline-clear {
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  padding: 0 0 0 4px;
}
@media (max-width: 700px) {
  .filter-head { flex-direction: column; gap: 3px; }
  .filter-head span { text-align: left; }
  .filter-row { flex-direction: column; gap: 4px; }
  .filter-label { padding-top: 0; }
}
.site-head {
  width: 100%;
  margin: 0;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}
.site-head:hover .site-title h2 {
  color: var(--blue);
}
.site-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.site-count {
  color: var(--sub);
  font-size: 11px;
  white-space: nowrap;
}
.site-chevron {
  width: 16px;
  text-align: center;
  color: var(--sub);
  font-size: 14px;
}
.site-card.open .site-head {
  border-bottom: 1px solid var(--line);
}
.more {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--sub);
  font-size: 16px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.more:hover {
  background: var(--soft);
  color: var(--ink);
}
.user-row .tag {
  margin-left: auto;
}
.user-row .user-type {
  margin-left: 0;
}
.action-menu {
  position: fixed;
  z-index: 60;
  min-width: 170px;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}
.action-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
}
.action-menu button:hover {
  background: var(--soft);
}
.action-menu button.danger {
  color: var(--red);
}
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .35);
}
.modal-card {
  width: min(420px, 100%);
  max-height: 80vh;
  overflow: auto;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.modal-x {
  border: 0;
  background: transparent;
  color: var(--sub);
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.modal-sub {
  margin: 10px 0;
  color: var(--sub);
  font-size: 12px;
}
.type-option,
.site-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.type-option:last-child,
.site-check:last-child {
  border-bottom: 0;
}
.type-option input,
.site-check input {
  margin-top: 3px;
  accent-color: var(--blue);
}
.type-option b,
.site-check b {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.type-option small,
.site-check small {
  display: block;
  margin-top: 2px;
  color: var(--sub);
  font-size: 11px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}
.modal-actions .btn,
.modal-actions .btn-primary {
  width: auto;
}
@media (max-width: 760px) {
  .site-count {
    display: none;
  }
  .site-head {
    gap: 8px;
  }
  .list-toolbar {
    gap: 8px;
  }
}@media (max-width: 760px) {
  .site-count {
    display: inline;
    font-size: 10px;
  }
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--sub);
}
.theme-toggle:hover { background: var(--soft); color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .theme-sun { display: none; }
.theme-toggle .theme-moon { display: block; }
[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
[data-theme="dark"] .theme-toggle .theme-moon { display: none; }

.notice-muted {
  background: var(--soft);
  border-color: var(--line);
  color: var(--sub);
}
[data-theme="dark"] .notice-muted {
  background: var(--soft);
  border-color: var(--line);
  color: var(--sub);
}

/* ---------- Site workbench ---------- */
.site-workbench {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.site-pane {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.pane-head strong { font-size: 12.5px; font-weight: 600; }
.site-workbench .site-list { display: flex; flex-direction: column; gap: 0; }
.site-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}
.site-list-item:last-child { border-bottom: 0; }
.site-list-item:hover { background: var(--soft); }
.site-list-item.on { background: var(--blue-soft); }
.site-list-main { flex: 1; min-width: 0; line-height: 1.3; }
.site-list-main b { display: block; font-size: 13px; font-weight: 600; }
.site-list-main small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--sub);
  font-size: 10.5px;
  font-family: ui-monospace, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-list-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 0 0 auto;
  color: var(--sub);
  font-size: 10.5px;
  white-space: nowrap;
}
.site-detail {
  min-height: 420px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.site-detail-head { display: flex; align-items: center; gap: 12px; }
.site-detail-title { flex: 1; min-width: 0; }
.site-detail-title h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.site-detail-title p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--sub);
  font-size: 11px;
  font-family: ui-monospace, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.detail-stats > div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.detail-stats b { display: block; font-size: 20px; font-weight: 600; line-height: 1.2; }
.detail-stats span { display: block; margin-top: 2px; color: var(--sub); font-size: 10.5px; }
.detail-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.detail-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 6px;
}
.detail-section-head strong { font-size: 12.5px; font-weight: 600; }
.detail-section-head span { color: var(--sub); font-size: 10.5px; text-align: right; }
.role-pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.role-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--sub);
  font-size: 11px;
}
.detail-add {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.site-detail-empty { padding: 80px 20px; text-align: center; }
.site-detail-empty strong { display: block; font-size: 15px; }
.site-detail-empty p { margin: 6px 0 12px; color: var(--sub); font-size: 12px; }

@media (max-width: 900px) {
  .site-workbench { grid-template-columns: 1fr; }
  .site-detail { min-height: 0; }
  .detail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* ---------- Mobile master/detail ---------- */
.mobile-back {
  display: none;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding: 4px 3px 4px 0;
  border: 0;
  background: transparent;
  color: var(--sub);
  font-size: 12px;
}
.mobile-back svg { width: 17px; height: 17px; }
.mobile-back:hover { color: var(--ink); }

@media (max-width: 900px) {
  .site-workbench { grid-template-columns: 1fr; }
  #sites-panel:not(.detail-open) .site-workbench .site-detail { display: none; }
  #sites-panel.detail-open .site-workbench .site-pane { display: none; }
  #sites-panel.detail-open > .notice,
  #sites-panel.detail-open > .filter-card { display: none; }
  .mobile-back { display: inline-flex; }
  .site-detail { min-height: 0; padding: 14px; }
}

@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 0 14px; }
  .brand { min-width: 0; }
  .brand small { display: none; }
  .who { gap: 6px; min-width: 0; font-size: 12px; }
  .who span { display: none; }
  .who b {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .who .btn { padding: 4px 8px; }
  .theme-toggle { width: 32px; height: 32px; }
  .page { padding: 18px 14px 44px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 21px; }
  .filter-card { padding: 12px; margin: 12px 0; }
  .filter-head { gap: 2px; }
  .filter-head span { font-size: 10.5px; }
  .filter-row { gap: 4px; }
  .filter-row .search-input { width: 100%; }
  .filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 1px 0 3px;
    scrollbar-width: none;
  }
  .filter-chips::-webkit-scrollbar { display: none; }
  .filter-chip { flex: 0 0 auto; }
  .filter-foot { gap: 8px; }
  .site-detail { padding: 13px; }
  .site-detail-head { align-items: flex-start; gap: 9px; }
  .site-detail-title h2 { font-size: 17px; }
  .site-detail-head .site-mark { width: 34px; height: 34px; }
  .detail-stats { gap: 6px; margin-top: 13px; }
  .detail-stats > div { padding: 8px 9px; }
  .detail-stats b { font-size: 18px; }
  .detail-stats span { font-size: 10px; }
  .detail-section-head { gap: 8px; }
  .detail-section-head span { font-size: 10px; }
  .add-row { flex-direction: column; }
  .add-row button { width: 100%; padding: 9px 11px; }
  .site-list-item { padding: 11px 12px; }
  .site-detail-empty { padding: 56px 14px; }
}

/* ---------- Admin picker ---------- */
.admin-picker {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}
.admin-picker-search input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12.5px;
  outline: none;
}
.admin-picker-search input:focus { border-color: var(--blue); }
.admin-results {
  max-height: 220px;
  margin-top: 8px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}
.admin-candidate {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}
.admin-candidate:hover,
.admin-candidate.on { background: var(--blue-soft); }
.admin-candidate-meta { flex: 1; min-width: 0; line-height: 1.3; }
.admin-candidate-meta b { display: block; font-size: 12.5px; font-weight: 600; }
.admin-candidate-meta small {
  display: block;
  overflow: hidden;
  color: var(--sub);
  font-size: 10.5px;
  font-family: ui-monospace, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-picker-empty { padding: 14px 6px; color: var(--sub); font-size: 11.5px; text-align: center; }
.admin-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.admin-pick-note {
  min-width: 0;
  overflow: hidden;
  color: var(--sub);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-pick-add {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--blue);
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}
.btn-pick-add:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Animated expandable filters ---------- */
.filter-advanced {
  max-height: 420px;
  overflow: hidden;
  opacity: 1;
  transition: max-height .28s cubic-bezier(.4, 0, .2, 1), opacity .18s ease;
}

/* ---------- Collapsible filters on small screens ---------- */
.mobile-filter-toggle {
  display: none;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  height: 29px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--sub);
  font-size: 11.5px;
}
.mobile-filter-toggle:hover { background: var(--soft); color: var(--ink); }
.mobile-filter-toggle::after { content: "⌄"; font-size: 12px; transition: transform .2s ease; }
.filter-card.open .mobile-filter-toggle::after { transform: rotate(180deg); }
.filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
}
.list-summary {
  display: flex;
  justify-content: flex-end;
  padding: 4px 0 8px;
}

@media (max-width: 700px) {
  .filter-head { align-items: center; }
  .filter-head .filter-hint { display: none; }
  .mobile-filter-toggle { display: inline-flex; margin-left: auto; }
  .filter-card:not(.open) .filter-advanced { max-height: 0; opacity: 0; pointer-events: none; }
  .filter-search-row { padding-top: 8px; }
}


@media (max-width: 600px) {
  .admin-results { max-height: 180px; }
  .admin-picker-foot { flex-direction: column; align-items: stretch; }
  .btn-pick-add { width: 100%; }
}
