/* -- Unified Brand System -- */
:root {
  --brand-bg:       #0f0f10;
  --brand-surface:  #1a1a1c;
  --brand-border:   #2a2a2e;
  --brand-red:      #8b1a1a;
  --brand-red-hi:   #a83232;
  --brand-text:     #e8e3dc;
  --brand-muted:    #9ca3af;
  --brand-ok:       #2ecc96;
  --brand-warn:     #f2b94f;
  --product-tint:   #3b82f6;

  /* Legacy compat */
  --bg-0: var(--brand-bg);
  --bg-1: var(--brand-surface);
  --bg-2: #242424;
  --panel: rgba(24, 24, 24, 0.82);
  --panel-strong: rgba(29, 29, 29, 0.95);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.24);
  --text: var(--brand-text);
  --text-muted: var(--brand-muted);
  --accent: var(--brand-red);
  --accent-2: var(--brand-red-hi);
  --text-main: #f7f7f3;
  --ok: var(--brand-ok);
  --warn: var(--brand-warn);
  --danger: #ff6b7f;
  --radius: 14px;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: radial-gradient(1400px 680px at 18% -12%, #2c2c2c 0%, rgba(20, 20, 20, 0) 62%),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
}

.bg-gradient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(transparent 96%, rgba(255, 255, 255, 0.06) 100%),
    linear-gradient(90deg, transparent 96%, rgba(255, 255, 255, 0.05) 100%);
  background-size: 24px 24px, 24px 24px;
  mask-image: radial-gradient(circle at center, black 15%, transparent 90%);
  z-index: 0;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  position: relative;
  z-index: 2;
}

.login-card {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: lift 0.55s ease;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #cf5563;
  font-size: 0.74rem;
  font-weight: 700;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text-main);
  font-weight: 800;
}

h1 {
  margin-top: 0.45rem;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 1.1;
}

.subtext {
  color: var(--text-muted);
  margin: 0.9rem 0 1.4rem;
}

.inline-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.88rem;
}

.inline-link:hover {
  text-decoration: underline;
}

.form {
  display: grid;
  gap: 0.9rem;
}

.form label {
  display: grid;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(18, 18, 18, 0.92);
  color: var(--text);
  padding: 0.66rem 0.7rem;
}

button {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(120deg, #5b151e, #93222d);
  color: white;
  padding: 0.7rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.18s ease;
}

button:hover {
  filter: brightness(1.08);
}

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

button.ghost {
  background: rgba(143, 44, 56, 0.2);
  border: 1px solid rgba(184, 84, 95, 0.52);
}

button.danger {
  background: rgba(255, 93, 122, 0.2);
  border: 1px solid rgba(255, 107, 127, 0.55);
}

.demo-box {
  margin-top: 1rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.8rem;
}

.demo-box p {
  margin: 0.15rem 0;
}

.error {
  min-height: 1.2rem;
  margin: 0.45rem 0 0;
  color: #ff8ea0;
  font-size: 0.9rem;
}

.app-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(32, 32, 32, 0.92), rgba(22, 22, 22, 0.9));
  padding: 1.2rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.5rem;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(120deg, #8a222f, #cc525f);
  box-shadow: 0 0 16px rgba(204, 82, 95, 0.45);
}

.brand-title {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
}

.brand-sub {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.menu {
  display: grid;
  gap: 0.34rem;
}

.menu-item {
  text-align: left;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.6rem 0.65rem;
  border-radius: 9px;
}

.menu-item.active,
.menu-item:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.menu-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.86rem;
  padding: 0.6rem 0.65rem;
  border-radius: 9px;
  border: 1px solid transparent;
}

.menu-link:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-note {
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
}

.sidebar-note p {
  margin: 0.1rem 0;
}

.content {
  padding: 1.2rem 1.2rem 1.8rem;
  display: grid;
  gap: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  backdrop-filter: blur(8px);
}

.topbar h2 {
  margin-top: 0.22rem;
  font-size: clamp(1.2rem, 2vw, 1.62rem);
}

.top-actions {
  display: flex;
  gap: 0.6rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem;
}

.card h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.card p {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.35rem;
  color: var(--text-main);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.75rem;
}

.panel {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
  gap: 0.5rem;
}

.panel h3 {
  font-size: 1.02rem;
}

.meta {
  margin: 0;
  font-size: 0.91rem;
  color: var(--text-muted);
}

.chip {
  font-size: 0.78rem;
  border: 1px solid var(--line-strong);
  padding: 0.2rem 0.48rem;
  border-radius: 999px;
  color: #efefea;
  background: rgba(255, 255, 255, 0.08);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.52rem 0.35rem;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--text-muted);
  font-weight: 500;
}

.badge {
  display: inline-block;
  font-size: 0.74rem;
  border-radius: 999px;
  padding: 0.16rem 0.48rem;
  border: 1px solid var(--line-strong);
}

.badge.active {
  color: var(--accent);
}

.badge.review {
  color: var(--warn);
}

.badge.ready {
  color: var(--ok);
}

.badge.blocked {
  color: var(--danger);
}

.badge.merged {
  color: var(--text-muted);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.48rem;
}

.list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.58rem 0.62rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: rgba(16, 16, 16, 0.74);
}

.two-col {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.admin-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.connection-grid {
  margin-top: 0.75rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.form.compact {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.72rem;
  background: rgba(16, 16, 16, 0.72);
}

.form.compact h4 {
  margin: 0 0 0.5rem;
}

.form.inline {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
}

.checkbox {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
}

.checkbox input {
  width: 16px;
  height: 16px;
}

.token-output {
  min-height: 95px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(18, 18, 18, 0.92);
  color: var(--text);
  padding: 0.66rem 0.7rem;
}

.digest-output {
  min-height: 180px;
  width: 100%;
  margin: 0.6rem 0 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(18, 18, 18, 0.92);
  color: var(--text);
  padding: 0.75rem;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.35;
}

.mfa-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.mfa-row input {
  max-width: 210px;
}

.mfa-form {
  margin-bottom: 0.35rem;
}

.split {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.9rem 0;
}

.public-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: 1.5rem 1rem 2.5rem;
  display: grid;
  gap: 1rem;
}

.public-nav {
  width: min(900px, 100%);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.public-brand {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.public-nav-links {
  display: flex;
  gap: 1.5rem;
}

.public-nav-links a {
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.15s;
}

.public-nav-links a:hover {
  color: #e8e3dc;
}

.public-button {
  color: white;
  text-decoration: none;
  border-radius: 6px;
  background: linear-gradient(120deg, #5b151e, #93222d);
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 500;
}

.public-button.ghost {
  background: none;
  border: 1px solid #374151;
  color: #9ca3af;
}

.public-button.ghost:hover {
  border-color: #6b7280;
  color: #e8e3dc;
}

.public-hero {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 2.3rem 1.35rem;
  background: linear-gradient(145deg, rgba(28, 28, 28, 0.94), rgba(38, 38, 38, 0.88));
  border: 1px solid var(--line);
  border-radius: 18px;
}

.public-hero h1 {
  margin: 0.35rem 0 0.8rem;
  font-size: clamp(2.3rem, 4.8vw, 4.4rem);
  line-height: 1.02;
  font-weight: 800;
  color: var(--text-main);
}

.public-copy {
  max-width: 760px;
  color: var(--text-muted);
}

.welcome-hero {
  min-height: min(72vh, 860px);
  display: grid;
  align-content: center;
}

.welcome-title {
  margin-top: 0.45rem;
  font-size: clamp(2.6rem, 7vw, 6.2rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  max-width: 980px;
}

.welcome-subtitle {
  margin: 1rem 0 0;
  font-size: clamp(1.15rem, 2.5vw, 2rem);
  color: var(--text-muted);
  max-width: 900px;
}

.public-hero-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.public-grid {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 0.8rem;
}

.public-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  padding: 0.9rem;
}

.public-card p {
  color: var(--text-muted);
  margin: 0.45rem 0 0;
}

.public-footer {
  width: min(1120px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(22, 22, 22, 0.86);
  padding: 0.85rem 1rem;
  color: var(--text-muted);
}

.public-contact-panel {
  width: min(1120px, 100%);
  margin: 0 auto;
}

@keyframes lift {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* -- Deploy section -- */
.deploy-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; }
.deploy-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.deploy-card-title { font-weight: 700; font-size: .9rem; color: var(--text-main); }
.deploy-card-method { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.deploy-card-target { font-size: .85rem; color: var(--text); font-family: monospace; }
.deploy-card-actions { display: flex; gap: .5rem; margin-top: .75rem; }
.deploy-status-success { color: var(--ok); }
.deploy-status-failed { color: var(--danger); }
.deploy-status-running { color: var(--warn); }
.deploy-log-item { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .85rem; }

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .menu {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .public-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .cards,
  .panel-grid,
  .two-col,
  .admin-grid,
  .connection-grid {
    grid-template-columns: 1fr;
  }

  .menu {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
  }
}

/* -- Registration Flow -- */

.reg-toggle {
  margin-top: 0.8rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--brand-muted);
}

.reg-toggle a {
  color: var(--brand-red-hi);
  text-decoration: none;
  cursor: pointer;
}

.reg-toggle a:hover {
  text-decoration: underline;
}

.step-indicators {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-muted);
  background: transparent;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.step-dot.active {
  border-color: var(--brand-red-hi);
  color: #fff;
  background: var(--brand-red);
}

.step-dot.done {
  border-color: var(--brand-ok);
  color: #fff;
  background: var(--brand-ok);
}

.reg-step {
  display: none;
  animation: lift 0.35s ease;
}

.reg-step.active {
  display: block;
}

.reg-step h2 {
  font-size: 1.35rem;
  margin-bottom: 0.3rem;
}

.reg-step .subtext {
  margin: 0.3rem 0 1rem;
}

.verify-code-input {
  width: 100%;
  max-width: 220px;
  margin: 0.8rem auto;
  display: block;
  text-align: center;
  font-size: 1.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.3em;
  padding: 0.6rem 0.5rem;
}

.qr-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin: 1rem 0;
}

.qr-area img {
  width: 180px;
  height: 180px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.manual-key {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(18, 18, 18, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--brand-text);
}

.manual-key button {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}

.skip-link {
  display: block;
  text-align: center;
  margin-top: 0.6rem;
  color: var(--brand-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}

.skip-link:hover {
  color: var(--brand-text);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  margin: 1rem 0;
}

.preview-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(16, 16, 16, 0.74);
  padding: 0.85rem;
}

.preview-card h4 {
  font-size: 0.92rem;
  margin-bottom: 0.3rem;
  color: var(--text-main);
}

.preview-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--brand-muted);
  line-height: 1.35;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin: 1rem 0;
}

.plan-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  padding: 1rem;
  text-align: center;
}

.plan-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.plan-card .plan-price {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0.3rem 0;
}

.plan-card .plan-price span {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--brand-muted);
}

.plan-card p {
  font-size: 0.82rem;
  color: var(--brand-muted);
  margin: 0.4rem 0;
  line-height: 1.3;
}

.plan-card button {
  margin-top: 0.6rem;
  width: 100%;
}

.plan-free-link {
  display: block;
  text-align: center;
  margin-top: 0.8rem;
  font-size: 0.88rem;
  color: var(--brand-muted);
  cursor: pointer;
  text-decoration: none;
}

.plan-free-link:hover {
  color: var(--brand-text);
}

@media (max-width: 600px) {
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .plan-grid {
    grid-template-columns: 1fr;
  }
}
