:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #dfe3e8;
  --text: #17202a;
  --muted: #68727d;
  --accent: #167d72;
  --accent-dark: #106158;
  --danger: #b42318;
  --warning: #a15c07;
  --sidebar: #182128;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { border: 1px solid var(--accent); background: var(--accent); color: #fff; min-height: 38px; padding: 8px 13px; border-radius: 6px; cursor: pointer; }
button:hover { background: var(--accent-dark); }
button:disabled { cursor: wait; opacity: .55; }
button.secondary { background: #fff; color: #26323b; border-color: #cbd2d9; }
button.secondary:hover { background: #f1f3f5; }
input, select, textarea { width: 100%; min-height: 38px; border: 1px solid #cbd2d9; border-radius: 5px; background: #fff; padding: 8px 10px; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #96d5cd; border-color: var(--accent); }
label { display: grid; gap: 6px; color: #3f4b55; font-size: 13px; font-weight: 650; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; }
h2 { margin-bottom: 5px; font-size: 19px; }
h3 { margin-bottom: 4px; font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #edf0f2; }
.login-panel { width: min(390px, 100%); display: grid; gap: 16px; background: var(--panel); border: 1px solid var(--line); padding: 30px; border-radius: 8px; box-shadow: 0 14px 35px rgba(24,33,40,.08); }
.login-panel h1 { font-size: 22px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; background: var(--accent); color: #fff; border-radius: 6px; font-size: 14px; font-weight: 800; }
.brand-mark.small { width: 30px; height: 30px; }
.message, .notice { border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.error { background: #fff0ee; color: var(--danger); border: 1px solid #f4c7c2; }
.notice { margin-bottom: 18px; border: 1px solid #a8d9d2; background: #eaf7f5; color: #135f57; }
.notice.warning { border-color: #f1cf9e; background: #fff7e8; color: var(--warning); }
.app { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); color: #dbe2e7; display: flex; flex-direction: column; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 750; padding: 0 8px 22px; }
.sidebar nav { display: grid; gap: 3px; }
.nav-item { width: 100%; text-align: left; background: transparent; border-color: transparent; color: #bbc6cd; }
.nav-item:hover, .nav-item.active { background: #29343c; border-color: #35434c; color: #fff; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #35414a; padding: 14px 8px 2px; }
.status-line { color: #98a8b3; font-size: 12px; line-height: 1.5; }
.workspace { min-width: 0; padding: 0 28px 36px; }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.top-actions, .button-row, .card-head, .section-head { display: flex; align-items: center; gap: 10px; }
.top-actions { flex-wrap: wrap; justify-content: flex-end; }
.section-head { justify-content: space-between; margin-bottom: 14px; }
.section-head p, .card-head p { margin-bottom: 0; font-size: 13px; }
.card-head { justify-content: space-between; margin-bottom: 14px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
.metrics article { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 14px; }
.metrics span { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; margin-top: 5px; font-size: 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 16px; margin-bottom: 16px; }
.site-list { display: grid; gap: 8px; }
.section-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.section-actions .muted { font-size: 12px; }
.site-row { display: grid; grid-template-columns: minmax(210px, 1.3fr) minmax(150px, .8fr) minmax(190px, .7fr) minmax(400px, auto); gap: 16px; align-items: center; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.site-row .button-row { justify-content: flex-end; flex-wrap: wrap; }
.site-row .button-row button { min-height: 32px; padding: 5px 8px; font-size: 11px; }
.site-row p { margin: 3px 0 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.site-tier { margin-top: 8px; display: grid; grid-template-columns: auto minmax(92px, 1fr); align-items: center; gap: 7px; font-size: 11px; }
.site-tier select { min-height: 30px; padding: 4px 7px; font-size: 11px; text-transform: capitalize; }
.site-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 7px; border-radius: 4px; background: #edf1f3; color: #4d5962; font-size: 11px; font-weight: 700; }
.badge.on { background: #e3f4f0; color: #106158; }
.site-backup-check { background: #f6f8f9; border: 1px solid #d8dde2; border-radius: 5px; padding: 6px 8px; font-size: 11px; }
.danger-button { color: var(--danger) !important; border-color: #e8b5b0 !important; }
.backup-layout { grid-template-columns: minmax(280px, .75fr) minmax(360px, 1.25fr); }
.backup-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto; gap: 16px; align-items: center; padding: 11px 0; border-bottom: 1px solid #edf0f2; font-size: 12px; }
.backup-row p { margin: 3px 0 0; color: var(--muted); }
.backup-actions, .record-actions { display: flex; gap: 7px; justify-content: flex-end; }
.search, .domain-select { width: min(310px, 100%); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-stack { display: grid; gap: 14px; }
.narrow { max-width: 560px; }
.full { grid-column: 1 / -1; }
.option-group { display: flex; flex-wrap: wrap; gap: 14px 22px; border: 1px solid var(--line); border-radius: 6px; padding: 13px; }
.option-group legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.provision-dns-options { display: grid; grid-template-columns: minmax(190px, auto) minmax(220px, 1fr) minmax(180px, auto) minmax(220px, 1fr); align-items: end; }
.package-selection { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.package-selection > div { display: grid; gap: 9px; }
.package-checks { display: grid; gap: 7px; font-size: 12px; }
.package-upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-bottom: 14px; }
.package-row, .preset-draft-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #edf0f2; font-size: 12px; }
.package-row div { display: grid; gap: 3px; min-width: 0; }
.package-row strong, .preset-draft-row code { overflow-wrap: anywhere; }
.package-row span { color: var(--muted); }
.preset-draft-row { grid-template-columns: 54px minmax(140px, 1fr) 70px auto; }
.check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; font-weight: 550; }
.check input { width: 16px; min-height: 16px; }
.check.inline { align-self: end; min-height: 38px; }
.form-actions { display: flex; justify-content: flex-end; }
.group-title { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.group-title:first-child { border-top: 0; padding-top: 0; }
.group-title p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.result { border-color: #91cbc4; }
.result pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 16px; }
.rows { display: grid; gap: 6px; margin-bottom: 16px; }
.rows.empty { color: var(--muted); font-size: 13px; }
.data-row { display: grid; grid-template-columns: 60px minmax(120px, 1fr) minmax(160px, 1.5fr) 70px auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #edf0f2; font-size: 12px; }
.data-row code { overflow-wrap: anywhere; }
.compact-grid { display: grid; grid-template-columns: 90px minmax(130px, 1fr) minmax(100px, auto); gap: 10px; align-items: end; border-top: 1px solid var(--line); padding-top: 14px; }
.compact-grid .wide { grid-column: span 2; }
.preset-apply { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: end; gap: 10px; margin-bottom: 14px; }
.settings-tools { align-items: start; }
.compact-status { min-height: 76px; margin-top: 14px; margin-bottom: 0; }
.status-box { min-height: 115px; padding: 12px; margin-bottom: 14px; background: #f6f8f9; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; white-space: pre-wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-bottom: 1px solid #e8ebee; padding: 8px; font-size: 12px; vertical-align: middle; }
th { color: var(--muted); font-weight: 700; }
td input, td select { min-width: 120px; }
pre { margin: 0; background: #172027; color: #d9e4e8; border-radius: 5px; padding: 13px; max-height: 360px; overflow: auto; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 950px) {
  .app { grid-template-columns: 76px minmax(0, 1fr); }
  .brand > span:last-child, .nav-item { font-size: 0; }
  .nav-item::first-letter { font-size: 14px; }
  .sidebar-foot { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; }
  .site-row { grid-template-columns: 1fr 1fr; }
  .provision-dns-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-row { grid-template-columns: 60px minmax(120px, 1fr) minmax(160px, 1fr); }
  .record-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .app { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 10px; }
  .brand { padding-bottom: 10px; }
  .brand > span:last-child { display: inline; }
  .sidebar nav { grid-auto-flow: column; grid-auto-columns: minmax(92px, 1fr); overflow-x: auto; }
  .nav-item { font-size: 11px; text-align: center; padding: 8px 4px; }
  .workspace { padding: 0 14px 28px; }
  .topbar, .section-head, .card-head { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .metrics, .form-grid, .site-row, .provision-dns-options, .package-selection, .package-upload, .preset-draft-row { grid-template-columns: 1fr; }
  .backup-layout, .backup-row, .data-row, .preset-apply { grid-template-columns: 1fr; }
  .backup-actions, .record-actions { justify-content: flex-start; flex-wrap: wrap; }
  .compact-grid { grid-template-columns: 1fr; }
  .compact-grid .wide { grid-column: auto; }
}
