:root {
  --bg: #0b0f1a;
  --surface: #121826;
  --surface-2: #1a2233;
  --text: #e8ecf4;
  --muted: #9aa6bd;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --border: #253046;
  --radius: 14px;
  --max: 1040px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 80% -10%, #1b2350 0%, var(--bg) 55%);
  color: var(--text);
  font: 16px/1.6 "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 26, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 700; color: var(--text); letter-spacing: 0.2px; }
.brand span { color: var(--accent); font-weight: 500; }
.nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.inline { display: inline; }
.link-button {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font: inherit; padding: 0;
}
.link-button:hover { color: var(--text); }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px 24px 64px;
  flex: 1;
}

.hero { padding: 24px 0 8px; }
.eyebrow {
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  margin: 0 0 12px;
}
h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.15; margin: 0 0 16px; }
h2 { font-size: 20px; margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 18px; max-width: 760px; }
.actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.actions-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.actions-row form { margin: 0; }
.reason-input {
  flex: 1 1 240px;
  max-width: 420px;
  min-width: 220px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.reason-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.limits-form { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.limits-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.limits-form input[type="number"] {
  width: 72px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.limits-form input[type="number"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.usage-badge { white-space: nowrap; }
.usage-badge.exhausted {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.08);
}

.button {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #5b8cff);
  color: #fff;
  font-weight: 600;
  border: 0;
  cursor: pointer;
}
.button:hover { text-decoration: none; filter: brightness(1.08); }
.button.secondary { background: var(--surface-2); border: 1px solid var(--border); }
.button.small { padding: 8px 14px; font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 40px 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card p { color: var(--muted); margin: 0; }
.note { margin-top: 8px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trust-seal {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
}

.trust-seal:hover { text-decoration: none; }

.trust-seal img {
  display: block;
  width: 124px;
  height: 32px;
}

.auth-trust {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .site-header { padding: 14px 16px; }
  .container { padding: 32px 16px 48px; }
  .nav { gap: 12px; }
}

.auth-card { max-width: 460px; margin: 24px auto; }
.form { display: grid; gap: 14px; margin-top: 16px; }
.form label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.form input, .form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}
.form input:focus, .form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.error {
  background: rgba(255, 82, 82, 0.12);
  border: 1px solid rgba(255, 82, 82, 0.4);
  border-radius: 10px;
  color: #ffb4b4;
  padding: 12px 14px;
}
.ok {
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.4);
  border-radius: 10px;
  color: #a8f0c6;
  padding: 12px 14px;
}
.muted { color: var(--muted); }
.table-wrap { overflow-x: auto; margin-top: 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th { color: var(--muted); font-weight: 600; }
.actions-cell { display: flex; gap: 8px; flex-wrap: wrap; }
.actions-cell form { margin: 0; }
.message { border-bottom: 1px solid var(--border); padding: 12px 0; }
.message:last-child { border-bottom: 0; }
.message.internal { opacity: 0.75; }


.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.preview { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); margin: 12px 0; }
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

.publisher-home {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}
.publisher-home label { flex: 1 1 320px; }
.publisher-home a { color: var(--accent-2); word-break: break-all; padding-bottom: 10px; }

.stat-link { color: inherit; text-decoration: none; }
.stat-link:hover h2 { color: var(--accent-2); text-decoration: underline; }

.job-wait { border-color: var(--accent); }
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.asset-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.asset-actions form { margin: 0; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0;
}
.toggle input { width: 16px; height: 16px; }

.field { display: grid; gap: 6px; }
.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.field-title { color: var(--muted); font-size: 14px; }
.field-head .toggle {
  margin: 0 0 0 auto;
  flex: 0 0 200px;
  width: 200px;
  white-space: nowrap;
}
.disabled-field {
  background: #1a1a1a !important;
  color: #6b6b6b !important;
  cursor: not-allowed;
  opacity: 0.75;
}

.badge.status-approved {
  background: #16a34a;
  border-color: #16a34a;
  color: #06140a;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.35), 0 0 16px rgba(22, 163, 74, 0.25);
}

.change-badge {
  color: #6ee7a8;
  border: 1px solid rgba(110, 231, 168, 0.45);
  background: rgba(110, 231, 168, 0.1);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  white-space: nowrap;
}
.changed-field {
  border-color: rgba(110, 231, 168, 0.65) !important;
  box-shadow: 0 0 0 1px rgba(110, 231, 168, 0.25);
}
@media (max-width: 640px) {
  .field-head .toggle {
    flex: 0 0 100%;
    width: 100%;
    margin-left: 0;
    white-space: normal;
  }
}

.done-banner {
  background: #16a34a;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 0 0 20px;
  font-size: 18px;
}
