:root {
  color-scheme: light;
  --page: #f3f5f7;
  --surface: #fcfcfd;
  --surface-subtle: #eef1f3;
  --text: #18201e;
  --muted: #5f6b67;
  --line: #d9dfdc;
  --accent: #176b4f;
  --accent-hover: #11563f;
  --accent-soft: #dcece5;
  --danger: #a1372c;
  --danger-soft: #fae8e5;
  --success: #176b4f;
  --success-soft: #e0efe8;
  --focus: #238965;
  --shadow: 0 18px 50px rgba(37, 54, 48, 0.09);
  --radius-card: 14px;
  --radius-control: 9px;
  font-family: "Avenir Next", Avenir, "Segoe UI", "Noto Sans SC", sans-serif;
  font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #111614;
    --surface: #18201d;
    --surface-subtle: #212b27;
    --text: #edf2ef;
    --muted: #aebbb6;
    --line: #35423d;
    --accent: #58ad8b;
    --accent-hover: #72bea0;
    --accent-soft: #213d33;
    --danger: #f09589;
    --danger-soft: #422724;
    --success: #75c5a5;
    --success-soft: #203b32;
    --focus: #7bc9aa;
    --shadow: 0 18px 50px rgba(3, 8, 6, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
input,
textarea,
.dropzone {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.025em;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.35rem);
  font-weight: 680;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 650;
}

h3 {
  font-size: 1rem;
  font-weight: 650;
}

.page-width {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.brand-link {
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #f7fbf9;
  font-size: 0.82rem;
  font-weight: 760;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.account {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-name {
  color: var(--muted);
  font-size: 0.88rem;
}

.main-layout {
  padding-block: 64px 80px;
}

.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
  margin-bottom: 36px;
}

.page-heading p,
.section-heading p,
.workspace-copy > p {
  max-width: 60ch;
  margin-top: 12px;
  color: var(--muted);
}

.site-count {
  min-width: 112px;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.site-count strong,
.site-count span {
  display: block;
}

.site-count strong {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.site-count span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.notice {
  margin-bottom: 20px;
  padding: 13px 15px;
  border: 1px solid;
  border-radius: var(--radius-control);
  font-size: 0.9rem;
}

.notice-error {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.notice-success {
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  background: var(--success-soft);
  color: var(--success);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 64px;
  padding: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-copy {
  padding-top: 4px;
}

.deployment-rules {
  display: grid;
  gap: 18px;
  margin-top: 36px;
}

.deployment-rules div {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 16px;
}

.deployment-rules dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.deployment-rules dd {
  font-size: 0.88rem;
}

.form-stack,
.upload-form {
  display: grid;
  gap: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label,
.field-label {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 620;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  outline: none;
  background: var(--page);
  color: var(--text);
  resize: vertical;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.field textarea {
  min-height: 88px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent);
  background: var(--surface);
}

.field-help {
  color: var(--muted);
  font-size: 0.78rem;
}

.dropzone {
  min-height: 126px;
  padding: 24px;
  display: grid;
  place-content: center;
  gap: 3px;
  border: 1px dashed color-mix(in srgb, var(--muted) 65%, transparent);
  border-radius: var(--radius-control);
  background: var(--page);
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone:active {
  transform: translateY(1px);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.dropzone:focus-within {
  outline: 3px solid color-mix(in srgb, var(--focus) 24%, transparent);
  outline-offset: 2px;
}

.dropzone-title {
  max-width: 340px;
  overflow: hidden;
  color: var(--text);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone-help {
  color: var(--muted);
  font-size: 0.8rem;
}

.button {
  min-height: 40px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:focus-visible,
.site-link:focus-visible,
.brand-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 32%, transparent);
  outline-offset: 3px;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button-primary {
  background: var(--accent);
  color: #f7fbf9;
}

.button-primary:hover {
  background: var(--accent-hover);
}

@media (prefers-color-scheme: dark) {
  .button-primary {
    color: #0e1713;
  }
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--muted);
  background: var(--surface-subtle);
}

.button-quiet {
  min-height: 36px;
  padding-inline: 10px;
  background: transparent;
  color: var(--muted);
}

.button-quiet:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.button-block {
  width: 100%;
  min-height: 46px;
}

.sites-section {
  margin-top: 72px;
}

.section-heading {
  margin-bottom: 24px;
}

.site-list {
  border-top: 1px solid var(--line);
}

.site-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  padding: 24px 2px;
  border-bottom: 1px solid var(--line);
}

.site-summary {
  min-width: 0;
}

.site-identity {
  display: flex;
  align-items: center;
  gap: 13px;
}

.site-initial {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 760;
  text-transform: uppercase;
}

.site-identity p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-description {
  max-width: 62ch;
  margin-top: 14px;
  padding-left: 52px;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-description p {
  white-space: pre-wrap;
}

.site-description .muted {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}

.site-actions {
  display: flex;
  align-items: center;
  align-self: start;
  gap: 10px;
}

.site-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 620;
  text-decoration: none;
}

.site-link:hover span:first-child {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.description-form {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding: 20px;
  border-radius: var(--radius-control);
  background: var(--surface-subtle);
}

.description-form[hidden] {
  display: none;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.empty-state {
  padding: 52px 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  text-align: center;
}

.empty-state p {
  margin-top: 7px;
  color: var(--muted);
}

.footer {
  padding-block: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-shell {
  width: min(100%, 420px);
}

.login-panel {
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-heading {
  margin-block: 44px 28px;
}

.login-heading h1 {
  font-size: 2rem;
}

.login-heading p {
  margin-top: 10px;
  color: var(--muted);
}

.login-footnote {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 820px) {
  .page-width {
    width: min(100% - 32px, 680px);
  }

  .main-layout {
    padding-block: 44px 64px;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 30px;
  }

  .deployment-rules {
    margin-top: 26px;
  }

  .sites-section {
    margin-top: 56px;
  }

  .site-row {
    grid-template-columns: 1fr;
  }

  .site-actions {
    padding-left: 52px;
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .page-width {
    width: calc(100% - 28px);
  }

  .topbar-inner {
    min-height: 62px;
  }

  .account-name {
    display: none;
  }

  .main-layout {
    padding-block: 36px 52px;
  }

  .page-heading {
    grid-template-columns: 1fr;
    gap: 22px;
    margin-bottom: 28px;
  }

  .site-count {
    padding: 0;
    border: 0;
  }

  .site-count strong,
  .site-count span {
    display: inline;
    font-size: 0.86rem;
  }

  .site-count strong {
    margin-right: 4px;
  }

  .workspace {
    gap: 30px;
    padding: 22px;
  }

  .deployment-rules div {
    grid-template-columns: 88px 1fr;
    gap: 10px;
  }

  .site-actions {
    padding-left: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .site-link {
    min-height: 40px;
  }

  .site-actions .button {
    width: 100%;
  }

  .site-description {
    padding-left: 0;
  }

  .description-form {
    padding: 16px;
  }

  .login-panel {
    padding: 28px 22px;
  }

  .login-heading {
    margin-block: 36px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
