/* 管理后台沿用原站暖色、MiSans 和紧凑后台密度。 */
:root {
  --ah-bg: #f5f0ee;
  --ah-surface: #fffdfb;
  --ah-surface-muted: #f9f5f2;
  --ah-text: #24202b;
  --ah-muted: #8b8185;
  --ah-faint: #aaa0a2;
  --ah-line: #e4dbd7;
  --ah-line-strong: #d4c8c3;
  --ah-accent: #e8685e;
  --ah-accent-soft: #fbe9e5;
  --ah-green: #4d7c68;
  --ah-green-soft: #e8f0eb;
  --ah-ochre: #a57442;
  --ah-danger: #a8443f;
}
html.dark {
  --ah-bg: #111011;
  --ah-surface: #1a1819;
  --ah-surface-muted: #211e1f;
  --ah-text: #f0e9e6;
  --ah-muted: #a79b98;
  --ah-faint: #756c6b;
  --ah-line: #373031;
  --ah-line-strong: #4b4141;
  --ah-accent-soft: #3b2525;
  --ah-green: #83b59e;
  --ah-green-soft: #21332c;
  --ah-ochre: #d1a572;
  --ah-danger: #dc7871;
}
body.admin-hub-active .layout-content > :not(#admin-hub) {
  display: none !important;
}
#admin-hub {
  min-height: calc(100vh - 170px);
  padding: 22px 24px 60px;
  color: var(--ah-text);
  font-family: MiSans, "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  box-sizing: border-box;
}
#admin-hub[hidden] { display: none !important; }
#admin-hub *, .ah-toast { box-sizing: border-box; }
#admin-hub button, #admin-hub input, #admin-hub textarea { font: inherit; }
#admin-hub button { color: inherit; }
.ah-icon { width: 17px; height: 17px; display: block; flex: 0 0 auto; }
.ah-eyebrow { display: block; color: var(--ah-faint); font-size: 10px; line-height: 1.2; letter-spacing: .16em; font-weight: 650; }
.ah-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid var(--ah-line-strong); }
.ah-head h1 { margin: 6px 0 6px; font-size: clamp(28px, 3.4vw, 42px); line-height: 1.15; letter-spacing: -.035em; font-weight: 650; }
.ah-head p, .ah-panel-head p { margin: 0; color: var(--ah-muted); font-size: 12px; }
.ah-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 14px; border: 1px solid var(--ah-line-strong); border-radius: 6px; background: var(--ah-surface); color: var(--ah-text); cursor: pointer; white-space: nowrap; transition: border-color .15s, background-color .15s, color .15s; }
.ah-button:hover { border-color: var(--ah-faint); background: var(--ah-surface-muted); }
.ah-button:focus-visible, .ah-icon-button:focus-visible, .ah-text-button:focus-visible, #admin-hub input:focus-visible, #admin-hub textarea:focus-visible { outline: 2px solid var(--ah-accent); outline-offset: 2px; }
.ah-button:disabled { opacity: .55; cursor: wait; }
.ah-button-primary { border-color: var(--ah-accent); background: var(--ah-accent); color: #fff !important; }
.ah-button-primary:hover { border-color: #d95c53; background: #d95c53; }
.ah-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--ah-line); }
.ah-summary > div { min-width: 0; padding: 18px 18px 16px 0; }
.ah-summary > div + div { padding-left: 18px; border-left: 1px solid var(--ah-line); }
.ah-summary span { display: block; color: var(--ah-muted); font-size: 11px; }
.ah-summary strong { display: block; margin-top: 4px; font-size: 24px; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-summary small { display: block; margin-top: 5px; color: var(--ah-faint); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-panel { padding: 30px 0 0; }
.ah-panel + .ah-panel { margin-top: 32px; padding-top: 30px; border-top: 1px solid var(--ah-line-strong); }
.ah-panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.ah-panel-head h2 { margin: 5px 0 0; font-size: 20px; line-height: 1.3; font-weight: 650; letter-spacing: -.02em; }
.ah-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 12px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--ah-line); border-radius: 8px; background: var(--ah-surface); }
.ah-form label { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: var(--ah-muted); font-size: 10px; }
.ah-form input, .ah-form textarea { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--ah-line); border-radius: 6px; outline: 0; background: var(--ah-bg); color: var(--ah-text); }
.ah-form textarea { min-height: 72px; resize: vertical; }
.ah-form input:focus, .ah-form textarea:focus { border-color: var(--ah-accent); background: var(--ah-surface); }
.ah-form input::placeholder, .ah-form textarea::placeholder { color: var(--ah-faint); }
.ah-form small { color: var(--ah-faint); font-size: 10px; }
.ah-wide { grid-column: span 2; }
.ah-note-form { grid-template-columns: 130px 150px minmax(0, 1fr) auto; }
.ah-note-form .ah-wide:nth-of-type(3) { grid-column: span 2; }
.ah-note-form .ah-wide:nth-of-type(4) { grid-column: 1 / -1; }
.ah-note-form .ah-button { grid-column: 4; grid-row: 2; }
.ah-apify-form { grid-template-columns: minmax(0, 1fr) auto auto; }
.ah-apify-form .ah-wide { grid-column: auto; }
.ah-switch { min-height: 38px; flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--ah-text) !important; font-size: 12px !important; white-space: nowrap; }
.ah-switch input { width: 17px !important; min-height: 17px !important; accent-color: var(--ah-accent); }
.ah-table-wrap { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--ah-line-strong) transparent; }
.ah-table { width: 100%; min-width: 680px; border-collapse: collapse; table-layout: fixed; }
.ah-table th { height: 36px; padding: 0 12px; border-bottom: 1px solid var(--ah-line-strong); color: var(--ah-faint); font-size: 10px; font-weight: 500; text-align: left; letter-spacing: .05em; }
.ah-table th:first-child, .ah-table td:first-child { padding-left: 0; }
.ah-table th:last-child, .ah-table td:last-child { padding-right: 0; }
.ah-table td { height: 62px; padding: 10px 12px; border-bottom: 1px solid var(--ah-line); vertical-align: middle; font-size: 12px; }
.ah-table tbody tr:hover { background: color-mix(in srgb, var(--ah-surface) 62%, transparent); }
.ah-table th:nth-child(1) { width: 22%; }
.ah-table th:nth-child(2) { width: 30%; }
.ah-table th:nth-child(3), .ah-table th:nth-child(4) { width: 14%; }
.ah-table th:nth-child(5) { width: 20%; }
.ah-table strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-table small { color: var(--ah-faint); font-size: 9px; }
.ah-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; white-space: nowrap; }
.ah-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ah-faint); }
.ah-status.is-active { color: var(--ah-green); }
.ah-status.is-active::before { background: var(--ah-green); }
.ah-status.is-disabled { color: var(--ah-faint); }
.ah-row-actions { display: flex; align-items: center; gap: 5px; }
.ah-text-button { padding: 5px 0; border: 0; border-bottom: 1px solid var(--ah-line-strong); background: transparent; color: var(--ah-muted); font-size: 11px; cursor: pointer; }
.ah-text-button:hover { color: var(--ah-accent); border-color: var(--ah-accent); }
.ah-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ah-muted); cursor: pointer; transition: color .15s, background-color .15s; }
.ah-icon-button:hover { color: var(--ah-text); background: var(--ah-surface-muted); }
.ah-icon-button.is-danger:hover { color: var(--ah-danger); background: var(--ah-accent-soft); }
.ah-empty { padding: 44px 20px; border: 1px dashed var(--ah-line-strong); border-radius: 8px; text-align: center; color: var(--ah-muted); }
.ah-empty strong { color: var(--ah-text); font-size: 14px; }
.ah-empty p { margin: 6px 0 0; font-size: 11px; }
.ah-note-list { border-top: 1px solid var(--ah-line); }
.ah-plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ah-plan-card { display: flex; flex-direction: column; gap: 4px; min-height: 96px; padding: 12px 14px; border: 1px solid var(--ah-line); border-radius: 8px; background: var(--ah-surface); cursor: pointer; transition: border-color .15s, background-color .15s; }
.ah-plan-card:hover { border-color: var(--ah-faint); }
.ah-plan-card.is-active { border-color: var(--ah-accent); background: var(--ah-accent-soft); }
.ah-plan-card input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ah-plan-card strong { font-size: 13px; font-weight: 650; }
.ah-plan-card small { flex: 1; color: var(--ah-muted); font-size: 10px; line-height: 1.5; }
.ah-plan-card em { color: var(--ah-ochre); font-size: 10px; font-style: normal; font-weight: 650; }
.ah-autosync-key { margin-bottom: 14px; padding: 14px; border: 1px solid var(--ah-line); border-radius: 8px; background: var(--ah-surface); }
.ah-autosync-key label { display: flex; flex-direction: column; gap: 5px; max-width: 260px; color: var(--ah-muted); font-size: 10px; }
.ah-autosync-key input { min-height: 38px; padding: 7px 10px; border: 1px solid var(--ah-line); border-radius: 6px; outline: 0; background: var(--ah-bg); color: var(--ah-text); }
.ah-autosync-key input:focus { border-color: var(--ah-accent); background: var(--ah-surface); }
.ah-autosync-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 24px; max-height: 220px; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--ah-line); overflow-y: auto; list-style: none; counter-reset: ah-key; scrollbar-width: thin; }
.ah-autosync-preview li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--ah-line); font-size: 11px; counter-increment: ah-key; }
.ah-autosync-preview li::before { content: counter(ah-key) "."; color: var(--ah-faint); font-size: 9px; }
.ah-autosync-preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ah-autosync-preview span { flex: 0 0 auto; color: var(--ah-faint); font-size: 10px; }
.ah-autosync-hint { margin: 10px 0 0; color: var(--ah-faint); font-size: 11px; }
.ah-autosync-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ah-autosync-status { display: flex; flex-direction: column; gap: 3px; color: var(--ah-muted); font-size: 11px; }
.ah-autosync-actions { display: flex; gap: 8px; }
.ah-note { display: grid; grid-template-columns: 92px minmax(0, 1fr) 36px; align-items: start; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--ah-line); }
.ah-note time { padding-top: 3px; color: var(--ah-faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.ah-note span { display: inline-block; margin-bottom: 4px; padding: 1px 6px; border: 1px solid var(--ah-line-strong); border-radius: 999px; color: var(--ah-ochre); font-size: 9px; }
.ah-note h3 { margin: 0; font-size: 14px; line-height: 1.4; font-weight: 650; }
.ah-note p { margin: 4px 0 5px; color: var(--ah-muted); font-size: 11px; white-space: pre-wrap; }
.ah-note small { color: var(--ah-faint); font-size: 9px; }
.ah-loading { min-height: 260px; display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; color: var(--ah-muted); }
.ah-loading span { width: 4px; height: 22px; background: var(--ah-line-strong); }
.ah-loading span:nth-child(2) { height: 34px; background: var(--ah-accent); }
.ah-loading p { flex-basis: 100%; margin: 3px 0 0; text-align: center; font-size: 12px; }
.ah-state, .ah-denied { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ah-state strong { font-size: 16px; }
.ah-state p { margin: 8px 0 18px; color: var(--ah-muted); }
.ah-denied > span { display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; margin-bottom: 16px; border: 1px solid var(--ah-line-strong); border-radius: 50%; color: var(--ah-accent); }
.ah-denied h1 { margin: 0; font-size: 24px; }
.ah-denied p { margin: 8px 0 20px; color: var(--ah-muted); }
.ah-toast { position: fixed; z-index: 10000; left: 50%; bottom: 28px; transform: translate(-50%, 12px); max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border: 1px solid var(--ah-line-strong); border-radius: 6px; background: var(--ah-text); color: var(--ah-surface); font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.ah-toast.is-success, .ah-toast.is-error { opacity: 1; transform: translate(-50%, 0); }
.ah-toast.is-error { border-color: var(--ah-danger); background: var(--ah-danger); color: #fff; }
#admin-hub-link { display: flex; align-items: center; gap: 10px; min-height: 40px; border-radius: 8px; color: inherit; text-decoration: none; transition: background-color .15s, color .15s; }
#admin-hub-link:hover, #admin-hub-link.is-active { color: var(--ah-accent); background: var(--ah-accent-soft); }
.workspace-sidebar.is-collapsed #admin-hub-link { justify-content: center; }
.workspace-sidebar.is-collapsed #admin-hub-link span { display: none; }
@media (max-width: 1000px) {
  #admin-hub { padding: 18px 18px 46px; }
  .ah-form, .ah-employee-form, .ah-apify-form, .ah-note-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ah-form .ah-button, .ah-note-form .ah-button { grid-column: auto; grid-row: auto; }
  .ah-wide, .ah-note-form .ah-wide:nth-of-type(3), .ah-note-form .ah-wide:nth-of-type(4) { grid-column: 1 / -1; }
  .ah-plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  #admin-hub { padding: 16px 14px 42px; }
  .ah-head, .ah-panel-head { align-items: flex-start; flex-direction: column; }
  .ah-summary { grid-template-columns: 1fr; }
  .ah-summary > div + div { padding-left: 0; border-top: 1px solid var(--ah-line); border-left: 0; }
  .ah-form { grid-template-columns: 1fr; }
  .ah-note { grid-template-columns: 74px minmax(0, 1fr) 34px; gap: 9px; }
  .ah-plan-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  #admin-hub *, .ah-toast, #admin-hub-link { transition: none !important; }
}
