/* 後台 */
:root {
  --paper: #f3f6f5;
  --surface: #ffffff;
  --ink: #15211e;
  --ink-2: #4a5a56;
  --ink-3: #74837f;
  --line: #d9e1de;
  --teal: #0f4c47;
  --teal-2: #1d6f66;
  --teal-soft: #e3f0ed;
  --amber: #e5a21c;
  --red: #b4442f;
  --red-soft: #fbe7e2;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.6; }
a { color: var(--teal-2); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 12px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; margin-top: 22px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: .8125rem; }
code { background: var(--teal-soft); padding: 1px 5px; border-radius: 4px; }

.bar { background: var(--teal); color: #fff; }
.bar-in { max-width: 1100px; margin: 0 auto; padding: 0 16px; min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { color: #fff; text-decoration: none; font-weight: 700; }
.logo span { font-weight: 400; color: #a9d4cc; margin-left: 8px; font-size: .875rem; }
.bar nav { display: flex; gap: 4px; align-items: center; }
.bar nav a, .bar .linkish { color: #cfe8e3; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.bar nav a.on, .bar nav a:hover, .bar .linkish:hover { background: rgba(255,255,255,.12); color: #fff; }

.page { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.crumb { margin: 0 0 6px; font-size: .875rem; color: var(--ink-3); }
.crumb a { color: var(--ink-2); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; word-break: break-word; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
@media (min-width: 760px) { .card { padding: 22px 26px; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--teal-2); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-2); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .8125rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--red); }
.btn-danger-ghost:hover { border-color: var(--red); }
.linkish { background: none; border: 0; padding: 0; color: var(--teal-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
form.inline { display: inline; margin: 0; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash-success { background: #e4f4ec; border-color: #b6dfca; color: #14563a; }
.flash-error { background: var(--red-soft); border-color: #efc2b8; color: #8a2f1e; }
.flash-info { background: var(--teal-soft); border-color: #bfdcd6; color: #134a43; }
.flash-warn { background: #fdf2d8; border-color: #f0d79a; color: #6b4a00; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 5px; font-weight: 600; font-size: .9rem; }
.form label em { font-style: normal; font-weight: 400; color: var(--red); font-size: .8125rem; }
.form input[type=text], .form input[type=password], .form input[type=email], .form input[type=tel],
.form input[type=number], .form textarea, .form select, .search input, .url-input, .danger-zone input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400;
}
.form textarea { resize: vertical; line-height: 1.7; }
.form small, .hint { font-weight: 400; color: var(--ink-3); font-size: .8125rem; margin: 0; }
.form .check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; }
.form .check input { margin-top: 5px; }
.err { color: var(--red); font-weight: 400; font-size: .8125rem; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 10px; margin: 0; }
legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }

.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { flex: 1; min-width: 0; }

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
.list th, .list td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list th { font-size: .8125rem; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.list .n { text-align: right; }
.list .actions { text-align: right; white-space: nowrap; }
.list .actions > * { margin-left: 4px; }
.list.compact td { padding: 7px 10px; font-size: .875rem; }
.list .strong { font-weight: 600; color: var(--ink); text-decoration: none; }
.list .strong:hover { color: var(--teal-2); text-decoration: underline; }
.list tbody tr:last-child td { border-bottom: 0; }
.list .hl { background: #fdf2d8; color: #8a5a00; font-size: .6875rem; padding: 2px 5px; border-radius: 4px; }
table.list:not(.compact) { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.card table.list { border: 0; }

@media (max-width: 719px) {
  table.list thead { display: none; }
  table.list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list tr { border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .list td { border: 0; padding: 3px 0; text-align: left !important; }
  .list td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 6.5em; color: var(--ink-3); font-size: .8125rem; }
  .list td:first-child::before { display: none; }
  .list td:first-child { font-size: 1rem; padding-bottom: 6px; }
  .list .actions { padding-top: 8px; white-space: normal; }
  .list .actions > * { margin: 0 4px 4px 0; }
}

.badge, .badge-btn { display: inline-block; white-space: nowrap; font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; }
.badge-btn { cursor: pointer; }
.badge-on { background: #e4f4ec; color: #14563a; border-color: #b6dfca; }
.badge-off { background: #eef1f0; color: var(--ink-3); border-color: var(--line); }

.empty-state { text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; }
.empty-state p { color: var(--ink-2); max-width: 30em; margin: 0 auto 16px; }

.link-card .url-row { display: flex; gap: 8px; flex-wrap: wrap; }
.url-input { flex: 1 1 280px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .875rem; background: var(--paper) !important; }
.link-tools { display: flex; gap: 18px; margin-top: 10px; font-size: .875rem; }
.warn { background: #fdf2d8; color: #7a5200; padding: 8px 12px; border-radius: 8px; margin: 0 0 12px; font-size: .9rem; }
.contact { margin: 12px 0 0; font-size: .875rem; }
.note { margin: 8px 0 0; padding: 8px 12px; background: var(--paper); border-radius: 8px; font-size: .875rem; color: var(--ink-2); }

.drop { position: relative; display: block !important; border: 2px dashed #b9cbc6; border-radius: 10px; padding: 22px 16px; text-align: center; background: var(--paper); cursor: pointer; }
.drop:hover, .drop.is-over { border-color: var(--teal-2); background: var(--teal-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-text { font-weight: 400; color: var(--ink-2); }
.drop.has-file .drop-text { color: var(--teal); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.stats > div { background: var(--surface); padding: 12px 14px; }
.stats span { display: block; font-size: .8125rem; color: var(--ink-3); }
.stats b { font-size: 1.25rem; }
.stats .wide { grid-column: 1 / -1; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr) 1.6fr; } .stats .wide { grid-column: auto; } }

.danger-zone summary { cursor: pointer; color: var(--red); font-weight: 600; }
.danger-zone[open] summary { margin-bottom: 12px; }

.login { max-width: 380px; margin: 12vh auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px 24px; }
.login h1 { font-size: 1.35rem; margin-bottom: 2px; }
.login .sub { color: var(--ink-3); margin: 0 0 18px; }

.install { max-width: 680px; margin: 24px auto; }
.install h2 { margin-top: 18px; }
.checks { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; font-size: .9rem; }
.checks .ok { color: #14563a; }
.checks .warn { color: #7a5200; background: none; padding: 0; margin: 0; }
.checks .bad { color: var(--red); font-weight: 600; }
.steps { padding-left: 1.2em; }
textarea.code { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8125rem; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 8px; font-size: .875rem; z-index: 50; }
.import-check { border-color: #f0d79a; background: #fffaf0; }
.import-check h2 { color: #6b4a00; }
.import-check ul { margin: 0; padding-left: 1.2em; font-size: .875rem; color: #5a4300; }
.stats small { display: block; font-size: .75rem; margin-top: 2px; }
