.admin-health-page { min-height: 100vh; }
.admin-health-shell { width: min(1500px, calc(100% - 64px)); padding: 32px 0 56px; }
.admin-back-link, .admin-text-button, .top-admin-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.admin-back-link:hover, .admin-text-button:hover, .top-admin-link:hover { color: var(--primary); }
.admin-text-button { padding: 0; border: 0; background: transparent; }
.admin-login { width: min(520px, 100%); max-width: 100%; margin: 8vh auto 0; }
.admin-login h1, .admin-hero h1 { margin: 9px 0; font-size: 36px; }
.admin-login p, .admin-hero p { color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.admin-login form { margin-top: 24px; }
.admin-login form, .admin-password-form { display: grid; gap: 18px; }
.admin-login .field, .admin-login input { min-width: 0; width: 100%; }
.admin-login .actions { margin-top: 18px; }
.admin-login code { overflow-wrap: anywhere; }
.admin-password-form { max-width: 520px; }
.admin-password-form input { min-width: 0; width: 100%; }
.admin-hero { margin-bottom: 18px; }

.admin-section-tabs { display: flex; flex-wrap: wrap; gap: 8px; width: fit-content; max-width: 100%; margin-bottom: 18px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-inset); }
.admin-section-tabs button { padding: 10px 16px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-weight: 800; }
.admin-section-tabs button.active { color: var(--on-primary); background: var(--primary); }
.admin-notice { margin-bottom: 14px; }

.admin-workspace { display: grid; grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); gap: 18px; align-items: start; }
.admin-project-sidebar, .admin-editor, .admin-service-panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.admin-project-sidebar { position: sticky; top: 82px; }
.admin-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.admin-panel-head h2 { margin: 0 0 5px; }
.admin-panel-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.admin-project-list { display: grid; gap: 8px; max-height: calc(100vh - 210px); overflow: auto; }
.admin-project-item { display: grid; gap: 4px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 11px; text-align: left; color: var(--text); background: var(--surface-subtle); }
.admin-project-item span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.admin-project-item.active { border-color: var(--selected-border); background: var(--selected-bg); }
.admin-project-item.inactive { opacity: .62; }
.admin-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.admin-field-wide { grid-column: 1 / -1; }
.admin-schedule-grid { grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px; }
.admin-secret-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.admin-secret-controls input { min-width: 0; }
.admin-switch-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-subtle); }
.admin-switch-row input { flex: 0 0 auto; width: 19px; height: 19px; margin-top: 2px; accent-color: var(--primary); }
.admin-switch-row span { display: grid; gap: 4px; }
.admin-switch-row small { color: var(--muted); line-height: 1.5; }
.admin-editor .actions, .admin-service-panel .actions { margin-top: 20px; }
.admin-service-panel { max-width: 900px; }
.admin-service-status { padding: 6px 10px; border-radius: 999px; color: var(--warning); background: color-mix(in srgb, var(--warning), transparent 90%); font-size: 12px; font-weight: 800; }
.admin-service-status.configured { color: var(--primary); background: color-mix(in srgb, var(--primary), transparent 90%); }
.admin-service-panel .field { max-width: 760px; }
.appearance-options { display: flex; flex-wrap: wrap; gap: 10px; max-width: 100%; margin: 0; padding: 0; border: 0; }
.appearance-options legend { margin-bottom: 12px; padding: 0; color: var(--text); font-size: 13px; font-weight: 600; }
.appearance-options label { display: flex; align-items: center; gap: 10px; min-width: 120px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; background: var(--surface-subtle); }
.appearance-options label:has(input:checked) { border-color: var(--selected-border); background: var(--selected-bg); color: var(--text); }
.appearance-options input { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--primary); }
.appearance-options:disabled label { cursor: wait; opacity: .65; }
.theme-swatch { width: 18px; height: 18px; border: 1px solid var(--line); border-radius: 50%; }
.theme-swatch.light { background: #edf3f7; }
.theme-swatch.dark { background: #07111f; }
.notice.admin-notice.show { display: block; }
.admin-editor-tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; padding-bottom: 10px; }
.admin-editor-tabs button { border: 0; background: transparent; color: var(--muted); padding: 10px 12px; border-radius: 6px; }
.admin-editor-tabs button.active { background: var(--selected-bg); color: var(--primary); }
.admin-detector-options { display: grid; gap: 10px; }
.admin-detector-option { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.admin-detector-option input, .admin-section-checks input { width: 18px; height: 18px; accent-color: var(--primary); }
.admin-detector-option small { display: block; color: var(--muted); margin-top: 5px; line-height: 1.6; overflow-wrap: anywhere; }
.admin-detector-option:has(input:disabled) { opacity: .65; }
.admin-settings-group { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.admin-settings-group h3 { font-size: 15px; margin: 0 0 16px; }
.admin-section-checks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.admin-section-checks label { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.admin-editor .field input, .admin-editor .field select { min-width: 0; width: 100%; }
.admin-editor .admin-secret-controls > input { min-width: 0; }
.admin-editor-actions { padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.admin-run-panel { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.admin-run-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-run-panel progress { width: 100%; height: 8px; margin-top: 16px; accent-color: var(--primary); }
.admin-run-result { padding: 12px 0; border-top: 1px solid var(--line); }
.admin-run-result header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.admin-run-result p { margin: 8px 0 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.65; }
.admin-run-result.error p { color: var(--danger); }
.admin-run-result.warning p { color: var(--warning); }
.admin-editor .hint { overflow-wrap: anywhere; }

@media (max-width: 840px) {
  .admin-health-shell { width: calc(100% - 32px); padding-top: 22px; }
  .admin-workspace { grid-template-columns: 1fr; }
  .admin-project-sidebar { position: static; }
  .admin-project-list { max-height: 300px; }
  .admin-field-grid { grid-template-columns: 1fr; }
  .admin-field-wide { grid-column: auto; }
  .admin-secret-controls { grid-template-columns: 1fr; }
  .admin-section-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .admin-health-page .topbar { align-items: flex-start; flex-direction: column; }
  .admin-health-page .top-actions { width: 100%; justify-content: space-between; }
  .admin-login h1, .admin-hero h1 { font-size: 30px; }
  .admin-section-tabs { width: 100%; }
  .admin-section-tabs button { flex: 1; }
  .admin-panel-head { display: grid; }
  .admin-panel-head .btn { width: 100%; }
  .admin-editor .actions, .admin-service-panel .actions { display: grid; }
}
