:root {
  color-scheme: dark;
  --bg: #080b10;
  --bg-secondary: #0d1119;
  --surface: #111722;
  --surface-hover: #151d2b;
  --surface-raised: #18202d;
  --border: rgb(255 255 255 / 8%);
  --border-strong: rgb(255 255 255 / 14%);
  --text: #f5f7fa;
  --muted: #8e9aab;
  --orange: #ff7a18;
  --orange-light: #ff9a3d;
  --orange-dark: #d95700;
  --success: #38d996;
  --danger: #ff5d67;
  --warning: #ffb84d;
  --shadow: 0 22px 60px rgb(0 0 0 / 30%);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -5%, rgb(255 122 24 / 8%), transparent 30rem),
    linear-gradient(180deg, #090c12 0%, var(--bg) 38%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
[hidden] { display: none !important; }

.login-page {
  display: grid;
  padding: 24px;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgb(255 122 24 / 10%), transparent 25rem),
    radial-gradient(circle at 50% 45%, #101722 0%, var(--bg) 52%);
}

.login-shell { width: min(100%, 440px); }

.login-card {
  padding: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: rgb(13 17 25 / 94%);
  box-shadow: 0 26px 80px rgb(0 0 0 / 44%);
  backdrop-filter: blur(18px);
}

.login-brand,
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.login-brand { margin-bottom: 30px; }

.brand-eye {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 10px rgb(255 122 24 / 36%));
}

.brand-eye svg { width: 100%; height: auto; }
.brand-eye-header { width: 38px; }
.brand-eye-login { width: 52px; }

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
}

.brand-copy strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: .115em;
  white-space: nowrap;
}

.brand-copy small {
  margin-top: 6px;
  color: #778394;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .19em;
  white-space: nowrap;
}

.login-brand .brand-copy strong { font-size: 20px; }
.login-brand .brand-copy small { font-size: 9px; }

.eyebrow {
  margin: 0 0 7px;
  color: var(--orange-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .17em;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 9px;
  font-size: clamp(28px, 3.4vw, 36px);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -.035em;
}
h2 { margin-bottom: 8px; font-size: 23px; font-weight: 700; line-height: 1.22; letter-spacing: -.025em; }
h3 { margin-bottom: 7px; font-size: 17px; font-weight: 700; line-height: 1.3; }
.muted { color: var(--muted); font-weight: 400; }

.form-stack {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: #c8d0dc;
  font-size: 13px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  height: 50px;
  min-width: 0;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: #0a0e15;
  line-height: 1;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:hover,
select:hover { border-color: rgb(255 255 255 / 19%); }

input:focus,
select:focus {
  border-color: var(--orange);
  background: #0c1119;
  box-shadow: 0 0 0 3px rgb(255 122 24 / 12%);
}

input::placeholder { color: #5f6a79; }
input[readonly] { color: #707c8d; background: #0c1017; cursor: default; }
input[type="checkbox"] { accent-color: var(--orange); }

.button {
  display: inline-flex;
  height: 46px;
  min-width: 0;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  transition: color .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .12s ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(1px); }

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--orange) 0%, #f36a08 58%, var(--orange-dark) 100%);
  box-shadow: 0 9px 24px rgb(255 122 24 / 17%);
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--orange-light), var(--orange));
  box-shadow: 0 10px 28px rgb(255 122 24 / 26%);
}

.button-secondary,
.button-ghost {
  border-color: var(--border-strong);
  color: #dce2ea;
  background: #121923;
  box-shadow: inset 0 1px rgb(255 255 255 / 2%);
}

.button-secondary:hover:not(:disabled),
.button-ghost:hover:not(:disabled) {
  border-color: rgb(255 122 24 / 65%);
  color: var(--orange-light);
  background: #171c24;
}

.button-danger {
  border-color: rgb(255 93 103 / 28%);
  color: #ffabb1;
  background: rgb(255 93 103 / 8%);
}

.button-danger:hover:not(:disabled) {
  border-color: rgb(255 93 103 / 55%);
  color: #ffd1d4;
  background: rgb(255 93 103 / 13%);
}

.button:disabled {
  border-color: rgb(255 255 255 / 6%);
  color: #697386;
  background: #171b22;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
  transform: none;
}

.button-wide { width: 100%; height: 52px; }
.form-message { margin: 0; font-size: 13px; font-weight: 500; }
.error { color: #ff8c94; }
.success { color: var(--success); }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 76px;
  padding: 0 max(22px, calc((100vw - 1240px) / 2));
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: rgb(8 11 16 / 91%);
  backdrop-filter: blur(18px);
}

.brand { flex: 0 0 auto; }
.topnav { display: flex; align-items: center; gap: 8px; }

.nav-link {
  display: inline-flex;
  height: 46px;
  padding: 0 15px;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: #aeb8c6;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition: color .16s ease, background .16s ease;
}

.nav-link:hover { color: var(--orange-light); background: rgb(255 255 255 / 3%); }

.app-shell {
  width: min(1240px, calc(100% - 44px));
  margin: 0 auto;
  padding: 30px 0 64px;
}

.loading-state,
.empty-state {
  padding: 58px 22px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  color: var(--muted);
  background: rgb(17 23 34 / 45%);
  text-align: center;
}

.empty-state p { margin-bottom: 18px; }

.page-heading,
.section-heading {
  display: flex;
  gap: 22px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-heading > div:first-child,
.section-heading > div:first-child { min-width: 0; }

.heading-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.stat {
  display: inline-flex;
  min-height: 34px;
  padding: 0 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: #0f141d;
  font-size: 13px;
}

.stat strong { margin-left: 4px; color: var(--text); font-weight: 700; }

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-wrap {
  position: relative;
  width: min(100%, 480px);
}

.search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 15px;
  width: 18px;
  height: 18px;
  color: #6e7988;
  pointer-events: none;
  transform: translateY(-50%);
}

.search {
  max-width: none;
  height: 46px;
  padding-left: 44px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.site-card {
  display: flex;
  min-width: 0;
  min-height: 248px;
  padding: 22px;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 14px 38px rgb(0 0 0 / 14%);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.site-card:hover {
  border-color: rgb(255 255 255 / 13%);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.site-card h3 {
  margin: 0 0 3px;
  overflow-wrap: anywhere;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.site-name {
  min-height: 21px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-label {
  margin: 23px 0 5px;
  color: #7d8999;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.config-value {
  min-width: 0;
  min-height: 20px;
  overflow: hidden;
  color: #d7dde6;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 10px;
  margin-top: auto;
  padding-top: 22px;
}

.card-actions .button { width: 100%; padding-inline: 12px; }

.back-link {
  display: inline-flex;
  min-height: 38px;
  margin-bottom: 16px;
  align-items: center;
  color: #9da8b7;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: color .16s ease;
}

.back-link:hover { color: var(--orange-light); }

.site-heading { align-items: center; }

.editor-layout {
  width: min(100%, 1100px);
}

.panel-card {
  min-width: 0;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 14px 40px rgb(0 0 0 / 13%);
}

.panel-card > .muted { margin-bottom: 26px; }
.field { margin-bottom: 21px; }
.field-row { position: relative; min-width: 0; }
.field-row input { padding-right: 119px; }

.copy-button {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 104px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 650;
}

.copy-button--success {
  border-color: rgb(56 217 150 / 34%);
  color: var(--success);
  background: rgb(56 217 150 / 8%);
}

.hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.unsaved {
  min-height: 19px;
  margin: 4px 0 12px;
  color: var(--warning);
  font-size: 12px;
  font-weight: 500;
}

.save-result {
  margin: 13px 0 0;
  padding: 11px 13px;
  border: 1px solid rgb(56 217 150 / 22%);
  border-radius: 11px;
  color: var(--success);
  background: rgb(56 217 150 / 7%);
  font-size: 13px;
  line-height: 1.45;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 14px 40px rgb(0 0 0 / 12%);
}

table { width: 100%; min-width: 700px; border-collapse: collapse; }
th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: #7e8a9a;
  background: #0e141d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgb(255 255 255 / 2%); }
tr:last-child td { border-bottom: 0; }

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-actions .button {
  height: 40px;
  padding-inline: 14px;
  border-radius: 10px;
  font-size: 12px;
}

.modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgb(2 4 8 / 78%);
  backdrop-filter: blur(9px);
}

.modal-card {
  width: min(100%, 570px);
  max-height: calc(100vh - 40px);
  padding: 28px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: #101620;
  box-shadow: 0 30px 90px rgb(0 0 0 / 52%);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.icon-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: #151b25;
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.icon-button:hover { border-color: rgb(255 122 24 / 55%); color: var(--orange-light); background: #191d24; }

.checkbox-list {
  display: grid;
  max-height: 220px;
  padding: 8px;
  overflow-y: auto;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0a0f16;
}

.check-row {
  display: flex;
  padding: 8px 9px;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
}

.check-row:hover { background: rgb(255 255 255 / 3%); }
.check-row input { width: 17px; height: 17px; min-height: 17px; flex: 0 0 auto; }

.history-list { display: grid; gap: 12px; }

.history-item {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color .16s ease, background .16s ease;
}

.history-item:hover { border-color: var(--border-strong); background: var(--surface-hover); }

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.change-list {
  display: grid;
  gap: 8px;
  margin: 15px 0;
  color: #b7c0cc;
  font-size: 13px;
}

.change-list code {
  color: #e2e7ed;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.history-item .button { height: 40px; font-size: 12px; }

.toast {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100% - 44px));
  padding: 13px 17px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  color: #e7ebf0;
  background: #171e29;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast::before { color: var(--orange); }
.toast.error-toast { border-color: rgb(255 93 103 / 36%); color: #ffc2c6; }

@media (max-width: 1050px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .app-shell { padding-top: 25px; }
  .page-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .heading-actions { justify-content: flex-start; }
  .history-meta { flex-direction: column; gap: 4px; }
}

@media (max-width: 640px) {
  .login-page { padding: 16px; }
  .login-card { padding: 28px 22px; border-radius: 18px; }
  .login-brand { margin-bottom: 25px; }
  .topbar { height: 70px; padding: 0 12px; gap: 10px; }
  .brand-eye-header { width: 33px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { margin-top: 4px; font-size: 7px; }
  .topnav { gap: 4px; }
  .nav-link { height: 42px; padding: 0 8px; font-size: 12px; }
  .topnav .button { height: 42px; padding: 0 12px; font-size: 12px; }
  .app-shell { width: min(100% - 28px, 1240px); padding-top: 22px; }
  h1 { font-size: 28px; }
  .heading-actions { display: grid; width: 100%; grid-template-columns: 1fr; }
  .heading-actions .button { width: 100%; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .site-card { min-height: 260px; padding: 20px; }
  .panel-card { padding: 21px; }
  .modal { padding: 12px; }
  .modal-card { max-height: calc(100vh - 24px); padding: 22px 18px; }
  .toolbar,
  .search-wrap { width: 100%; }
}

@media (max-width: 430px) {
  .brand { gap: 8px; }
  .brand-copy small { display: none; }
  .card-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card-actions .button { padding-inline: 8px; font-size: 13px; }
  .field-row input { padding-right: 109px; font-size: 13px; }
  .copy-button { width: 94px; font-size: 10px; }
  .stats { display: grid; grid-template-columns: 1fr 1fr; }
  .stat { justify-content: center; padding-inline: 8px; font-size: 12px; }
  .toast { right: 14px; bottom: 14px; max-width: calc(100% - 28px); }
}
