:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --line: #d9dee5;
  --text: #17202a;
  --muted: #687382;
  --primary: #1261a0;
  --primary-dark: #0b4b7f;
  --danger: #b42318;
  --success: #18794e;
  --warning: #9a6700;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
.topbar { min-height: 58px; padding: 0 24px; display: flex; align-items: center; gap: 28px; background: #18232d; color: #fff; border-bottom: 1px solid #0e171f; }
.brand { color: #fff; font-size: 18px; font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; align-items: stretch; gap: 6px; flex: 1; }
.topbar nav a { color: #dbe4ec; padding: 19px 10px 17px; border-bottom: 2px solid transparent; }
.topbar nav a:hover { color: #fff; text-decoration: none; border-color: #71b7e6; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions form { margin: 0; }
.quiet-link { color: #dbe4ec; }
.language-form select { border: 1px solid #53616d; background: #24333f; color: #fff; padding: 6px 28px 6px 8px; border-radius: 4px; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 30px auto 60px; }
.page-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-head { margin-bottom: 20px; }
h1, h2 { margin: 0; line-height: 1.25; letter-spacing: 0; }
h1 { font-size: 27px; }
h2 { font-size: 17px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-weight: 600; }
.muted, small { color: var(--muted); }
.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 13px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.button:hover { text-decoration: none; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.topbar .button.ghost { background: transparent; color: #fff; border-color: #53616d; }
.button.danger { background: #fff; color: var(--danger); border-color: #e6b8b3; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); margin-bottom: 24px; }
.stat { min-height: 100px; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; color: var(--text); border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat:hover { text-decoration: none; background: #f9fbfc; }
.stat span { color: var(--muted); }
.stat strong { font-size: 30px; }
.section-block, .form-surface, .secret-surface, .auth-panel { background: var(--surface); border: 1px solid var(--line); padding: 22px; }
.section-block { margin-top: 22px; }
.section-head { margin-bottom: 16px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: #4c5967; background: #f7f9fa; font-size: 12px; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.actions { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.actions form { margin: 0; }
.status { display: inline-block; padding: 2px 7px; border-radius: 4px; background: #edf0f3; color: #4c5967; font-size: 12px; font-weight: 700; }
.status.running, .status.success { background: #e7f6ee; color: var(--success); }
.status.stopped, .status.failed, .status.error { background: #fbe9e7; color: var(--danger); }
.status.unknown { background: #fff4d6; color: var(--warning); }
.empty, .empty-state { color: var(--muted); text-align: center; padding: 28px; }
.notice { border: 1px solid var(--line); background: #eef5fb; padding: 11px 14px; margin-bottom: 16px; }
.notice.success { border-color: #a8d8bd; background: #edf8f1; }
.notice.error { border-color: #efb7b2; background: #fff0ef; }
.stacked-form { display: grid; gap: 16px; }
.stacked-form label { display: grid; gap: 6px; font-weight: 600; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid #b9c2cc; border-radius: 4px; background: #fff; color: var(--text); }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }
.errorlist { margin: 3px 0 0; padding: 0; list-style: none; color: var(--danger); font-weight: 500; }
.form-surface { max-width: 760px; }
.form-actions { display: flex; gap: 10px; }
.fixed-field { display: grid; gap: 4px; padding: 12px; background: #f3f6f8; border: 1px solid var(--line); }
.fixed-field span { color: var(--muted); font-size: 12px; }
.account-form { display: grid; gap: 20px; max-width: 900px; }
.form-section { border-top: 1px solid var(--line); padding-top: 18px; }
.form-section h2 { margin-bottom: 15px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field-grid.single-column { grid-template-columns: 1fr; }
.form-row-gap { margin-top: 16px; }
.field { display: grid; align-content: start; gap: 6px; font-weight: 600; }
.cm-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cm-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cm-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); padding: 18px; }
.cm-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cm-card-head h2 { margin-bottom: 3px; }
.cm-card-details { display: grid; gap: 11px; margin: 18px 0; }
.cm-card-details div { min-width: 0; }
.cm-card-details dt { color: var(--muted); font-size: 12px; }
.cm-card-details dd { margin: 2px 0 0; overflow-wrap: anywhere; font-weight: 600; }
.cm-card-details.admin-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cm-card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.link-button { border: 0; padding: 0; background: transparent; color: var(--primary); cursor: pointer; }
.link-button:disabled { color: var(--muted); cursor: not-allowed; }
.server-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.server-card { min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); padding: 18px; }
.server-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.server-card-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 16px; margin: 18px 0; }
.server-card-details div { min-width: 0; }
.server-card-details dt { color: var(--muted); font-size: 12px; }
.server-card-details dd { margin: 2px 0 0; overflow-wrap: anywhere; font-weight: 600; }
.server-card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); margin-top: auto; }
.server-card-actions form, .cm-card-actions form { margin: 0; }
.job-report { margin: 0 0 16px; padding: 11px; background: #f7f9fa; border: 1px solid var(--line); }
.job-report > div { display: flex; justify-content: space-between; gap: 10px; }
.job-report p { margin: 7px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.job-report .error-text { color: var(--danger); }
.status.pending, .status.running { background: #fff4d6; color: var(--warning); }
.status.partial { background: #eef5fb; color: var(--primary); }
.status.info { background: #eef5fb; color: var(--primary); }
.status.warning { background: #fff4d6; color: var(--warning); }
.deploy-dialog { width: min(520px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.deploy-dialog::backdrop { background: rgba(14, 23, 31, .52); }
.deploy-dialog .stacked-form { padding: 20px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-close { width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 24px; line-height: 1; }
.auth-panel { max-width: 400px; margin: 10vh auto 0; }
.auth-panel h1 { margin-bottom: 22px; }
.list-lines { background: var(--surface); border: 1px solid var(--line); }
.list-line { min-height: 58px; padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--text); border-bottom: 1px solid var(--line); }
.list-line:last-child { border-bottom: 0; }
a.list-line:hover { background: #f8fafb; text-decoration: none; }
.list-line span:first-child { display: grid; gap: 3px; }
.list-lines.compact .list-line { min-height: 48px; }
.document-body { min-height: 160px; background: var(--surface); border: 1px solid var(--line); padding: 24px; white-space: normal; }
.attachment-meta, .upload-row { display: flex; align-items: center; gap: 12px; }
.attachment-meta form { margin: 0; }
.link-danger { border: 0; padding: 0; background: transparent; color: var(--danger); cursor: pointer; }
.upload-row { margin-top: 14px; }
.detail-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.detail-grid div { min-width: 0; }
.detail-grid dt { color: var(--muted); margin-bottom: 4px; }
.detail-grid dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.secret-value { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; user-select: all; }
.filter { display: flex; gap: 8px; }
.filter input { min-width: 230px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 18px; }
.backup-settings-form { display: grid; grid-template-columns: auto repeat(3, minmax(130px, 1fr)) auto; align-items: end; gap: 14px; }
.backup-settings-form label { display: grid; gap: 6px; font-weight: 600; }
.backup-settings-form label:first-of-type { display: flex; align-items: center; gap: 8px; padding-bottom: 9px; white-space: nowrap; }
.backup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.backup-card { min-width: 0; border: 1px solid var(--line); padding: 16px; background: var(--surface); }
.backup-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.backup-card-head strong { overflow-wrap: anywhere; }
.backup-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 16px 0; }
.backup-meta dt { color: var(--muted); font-size: 12px; }
.backup-meta dd { margin: 2px 0 0; overflow-wrap: anywhere; font-weight: 600; }
.backup-actions { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.backup-actions form { margin: 0; }
.backup-actions details { position: relative; }
.backup-actions summary { list-style: none; }
.backup-actions summary::-webkit-details-marker { display: none; }
.backup-confirm-form { width: 290px; display: grid; gap: 12px; position: absolute; z-index: 5; top: 42px; left: 0; padding: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 10px 28px rgba(20, 31, 42, .18); }
.backup-confirm-form label { display: grid; gap: 6px; }
.backup-confirm-form label:first-child { display: flex; align-items: flex-start; gap: 8px; }
@media (max-width: 820px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; gap: 10px 18px; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .topbar nav a { padding: 9px 8px; }
  .top-actions { margin-left: auto; }
  .shell { width: min(100% - 22px, 1180px); margin-top: 20px; }
  .stats-grid, .detail-grid, .field-grid { grid-template-columns: 1fr; }
  .backup-settings-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cm-card-grid, .server-card-grid, .cm-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .page-head { align-items: flex-start; }
}
@media (max-width: 560px) { .cm-card-grid, .server-card-grid, .cm-admin-grid, .backup-grid, .backup-settings-form { grid-template-columns: 1fr; } .server-card-details, .cm-card-details.admin-details, .backup-meta { grid-template-columns: 1fr; } .backup-confirm-form { width: min(290px, calc(100vw - 54px)); } }
