:root {
  font: 16px/1.5 Inter, system-ui, sans-serif;
  color: #19243b;
  background: #f5f7fb;
  --paper: #fff;
  --line: #dbe2ed;
  --muted: #51627c;
  --blue: #244fbe;
  --blue-dark: #193d9b;
  --blue-soft: #eaf0ff;
  --danger: #9b232b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 0; margin: 0; }
button, input { font: inherit; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 4vw, 2.2rem); line-height: 1.15; letter-spacing: -.035em; }
h2 { font-size: 1.13rem; line-height: 1.3; letter-spacing: -.012em; }
code { overflow-wrap: anywhere; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid #7295ff; outline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.stack { display: grid; gap: 14px; }

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner {
  width: min(1120px, 100% - 40px);
  margin: auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 10px;
}
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.brand-mark { display: grid; flex: none; place-content: center; gap: 4px; width: 32px; height: 32px; border-radius: 9px; background: var(--blue); }
.brand-mark i { display: block; width: 14px; height: 5px; border: 1px solid #fff; border-radius: 2px; }
.account { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }
.scope { padding: 3px 8px; border-radius: 6px; color: #405271; background: #eef2f9; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.account-email { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  max-width: 100%;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #263b60;
  font-weight: 650;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
.button-primary { background: var(--blue); color: #fff; }
.button-primary:not(:disabled):hover { background: var(--blue-dark); }
.button-secondary { background: var(--paper); border-color: var(--line); }
.button-secondary:not(:disabled):hover, .button-text:not(:disabled):hover { background: #edf2fc; }
.button-text { color: var(--blue); }
.button:disabled, .file-picker:has(input:disabled) { cursor: default; opacity: .58; }
.panel, .auth-card, dialog { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.boot-message { max-width: 32rem; margin: 48px auto; padding-inline: 20px; color: var(--muted); }

.auth-card { width: min(450px, 100% - 32px); margin: clamp(28px, 8vh, 88px) auto; padding: clamp(20px, 5vw, 32px); }
.auth-card > p { margin-block: 9px 23px; }
.field { display: grid; gap: 5px; min-width: 0; font-weight: 600; }
.field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #b9c7db;
  border-radius: 8px;
  background: var(--paper);
  color: inherit;
  font-weight: 400;
}
.field > span > .muted { margin-left: 6px; font-weight: 400; }
.feedback { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.feedback[data-kind="error"] { color: var(--danger); }

.dashboard { width: min(1120px, 100% - 40px); margin: clamp(24px, 5vw, 48px) auto 44px; }
.dashboard-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 24px; }
.dashboard-heading p { margin-top: 7px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 275px); gap: 20px; align-items: start; }
.sites-column, .site-list, .sidebar { display: grid; gap: 14px; min-width: 0; }
.site-list:empty { display: none; }
.empty, .list-error, .quota, .invites { padding: 19px; }
.empty p { margin-top: 7px; }
.list-error, .invites { display: grid; gap: 11px; }
.list-error button { justify-self: start; }
.quota-value { margin-top: 8px; font-weight: 650; }
.quota progress { display: block; width: 100%; height: 8px; margin: 11px 0 9px; accent-color: var(--blue); border: none; }
.quota progress::-webkit-progress-bar { background: #e7edf7; border-radius: 8px; }
.quota progress::-webkit-progress-value { background: var(--blue); border-radius: 8px; }
.quota progress::-moz-progress-bar { background: var(--blue); border-radius: 8px; }
.dashboard-feedback { margin-top: 16px; }

.site-card { padding: clamp(14px, 3vw, 20px); }
.site-heading, .site-meta, .site-links, .upload-controls, .dialog-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.site-heading, .site-meta { justify-content: space-between; }
.site-title { min-width: 0; overflow-wrap: anywhere; }
.site-title p { margin-top: 3px; }
.site-status { padding: 3px 9px; border-radius: 999px; color: #405271; background: #eef2f9; font-size: .8rem; font-weight: 650; }
.site-status[data-status="preview"] { color: #24489c; background: var(--blue-soft); }
.site-status[data-status="published"] { color: #17613b; background: #e7f6ee; }
.site-meta { margin-top: 10px; }
.upload-form { display: grid; gap: 7px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.file-picker { position: relative; }
.file-picker:focus-within { outline: 3px solid #7295ff; outline-offset: 3px; }
.file-picker input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.file-name { flex: 1 1 100px; min-width: 0; overflow-wrap: anywhere; }
.dns { margin-top: 14px; padding: 12px 14px; border-radius: 9px; background: #f2f5fb; overflow-wrap: anywhere; }
.dns-heading, .domain-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; }
.dns-heading { justify-content: space-between; }
.dns h3 { margin: 0; font-size: .9rem; }
.dns p { color: var(--muted); font-size: .875rem; }
.dns p[data-kind="error"] { color: var(--danger); }
.dns [data-field="domain-feedback"]:not([hidden]), .domain-form { margin-block: 8px; }
.domain-form { max-width: 430px; }
.domain-actions { justify-content: flex-end; }
.dns-records { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); gap: 8px; margin-block: 8px; }
.dns-record { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.dns-record h4 { margin: 0; font-size: .875rem; }
.dns dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 11px; margin: 7px 0; font-size: .875rem; }
.dns dt { color: var(--muted); }
.dns dd { margin: 0; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.dns [data-field="dns"] > p + p { margin-top: 5px; }

dialog { width: min(450px, 100% - 24px); max-height: calc(100% - 24px); padding: clamp(16px, 4vw, 24px); color: inherit; }
dialog::backdrop { background: #14213d80; }
dialog h2 + p { margin-top: 5px; }
.dialog-actions { justify-content: flex-end; }

@media (max-width: 720px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .sidebar { grid-row: 1; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
}
@media (max-width: 460px) {
  .topbar-inner, .dashboard { width: calc(100% - 24px); }
  .topbar-inner { align-items: flex-start; flex-wrap: wrap; }
  .account { justify-content: flex-start; }
  .upload-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .file-name { grid-row: 2; grid-column: 1 / -1; }
}
