/* 与主站共享同一套深色令牌：独立文件，不改动主站样式，也不引用主站路径。 */
:root {
  --bg: #05070f;
  --card: rgba(255, 255, 255, 0.045);
  --card-hover: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #eaf0ff;
  --muted: #8b98ba;
  --accent: #5ee0c8;
  --accent-2: #7f9bff;
  --warn: #ffc861;
  --danger: #ff9a9a;
  --radius: 20px;
  --shadow: 0 18px 44px -26px rgba(0, 0, 0, 0.95);
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* hidden 属性要被自定义 display 尊重，否则弹窗/表格的隐藏态会失效 */
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px clamp(16px, 4vw, 32px) 8px;
}

.brand h1 { margin: 0; font-size: clamp(20px, 4vw, 26px); letter-spacing: 0.02em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.auth { display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 260px; max-width: 420px; }
.auth input { flex: 1 1 150px; min-width: 0; }

input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

input::placeholder { color: var(--muted); }
input:hover:not(:disabled) { border-color: var(--border-strong); }
input:disabled { opacity: 0.5; cursor: not-allowed; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  min-width: 38px;
  padding: 0 16px;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover:not(:disabled) { background: var(--card-hover); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  color: #04241f;
  font-weight: 600;
  background: linear-gradient(140deg, var(--accent), #8ef0dd);
  border-color: transparent;
}

.btn-primary:hover:not(:disabled) { background: linear-gradient(140deg, #6ff0d6, #a5f5e7); }
.btn-danger { color: var(--danger); border-color: rgba(255, 154, 154, 0.45); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 154, 154, 0.14); border-color: rgba(255, 154, 154, 0.7); }

.status {
  margin: 0;
  padding: 4px clamp(16px, 4vw, 32px);
  min-height: 24px;
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.status[data-kind="ok"] { color: var(--accent); }
.status[data-kind="error"] { color: var(--danger); }

main { padding: 8px clamp(16px, 4vw, 32px) 32px; }

.panel {
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 17px; }
#count { margin: 0; color: var(--muted); font-size: 13px; }
.panel-head input[type="search"] { flex: 1 1 220px; min-width: 0; }

.hint {
  margin: 0;
  padding: 22px 8px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}

.hint.is-error { color: var(--danger); }

.table-wrap { width: 100%; }

.city-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.city-table th,
.city-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.city-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.city-table tbody tr:last-child td { border-bottom: 0; }
.city-table tbody tr:hover { background: var(--card-hover); }

.cell-label { display: none; }

.cell-actions { width: 1%; white-space: nowrap; }
.cell-actions .btn { min-height: 36px; padding: 0 12px; font-size: 13px; }
.cell-actions .btn + .btn { margin-left: 8px; }

/* 窄屏把表格折成卡片：长时区值换行而不是把整页撑宽 */
@media (max-width: 640px) {
  .topbar { padding-top: 16px; }
  .auth { max-width: none; }
  .panel { padding: 14px; }

  .city-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .city-table,
  .city-table tbody,
  .city-table tr,
  .city-table td { display: block; width: 100%; }

  .city-table tr {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
  }

  .city-table tbody tr:last-child { margin-bottom: 0; }
  .city-table td { display: flex; gap: 10px; padding: 5px 0; border-bottom: 0; }
  .cell-label { display: block; flex: 0 0 68px; color: var(--muted); font-size: 12px; padding-top: 2px; }
  .cell-value { flex: 1 1 auto; min-width: 0; }
  .cell-actions { width: auto; justify-content: flex-end; padding-top: 8px; }
}

.dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 20px;
  color: var(--text);
  background: #0a1020;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.dialog::backdrop { background: rgba(2, 4, 10, 0.72); }
.dialog h2 { margin: 0 0 14px; font-size: 18px; }
.dialog p { margin: 0 0 14px; color: var(--muted); }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.req { color: var(--warn); }

.form-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--danger);
  background: rgba(255, 154, 154, 0.12);
  border: 1px solid rgba(255, 154, 154, 0.3);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 8px; }
