/* ZeroVaR developer portal - light, Stripe-inspired finance UI */

:root {
  --bg: #f6f9fc;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --border: #e6ebf1;
  --border-hover: #cfd7e2;
  --text: #0a2540;
  --muted: #425466;
  --accent: #635bff;
  --accent-hover: #0a2540;
  --accent-pressed: #4b44d1;
  --accent-soft: rgba(99, 91, 255, 0.08);
  --danger: #df1b41;
  --danger-hover: #c11838;
  --ok: #0d9488;
  --warn: #c45c00;
  --err: #df1b41;
  --code-bg: #0a2540;
  --code-text: #e7ecf3;
  --radius: 8px;
  --radius-sm: 6px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --font-display: "Literata", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 24px rgba(16, 30, 54, 0.06);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.layout-hero {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.layout-hero main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.layout-console main {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.bg-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% -10%, rgba(99, 91, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 0%, rgba(10, 37, 64, 0.06), transparent 50%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%);
}

.bg-grain::after {
  content: none;
}

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 1.25rem;
  animation: fadeUp 0.45s ease-out both;
}

.shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem 2rem 2rem;
  box-shadow: var(--shadow-md);
}

body.layout-console .shell {
  padding: 1.5rem 1.75rem 1.75rem;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

.brand {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.5vw, 2.15rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--text);
}

.brand-sm {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: -0.015em;
}

h1 {
  margin: 0 0 0.45rem;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.lead {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 36ch;
  line-height: 1.55;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.msg { margin: 0.75rem 0 0; font-size: 0.9rem; }
.err { color: var(--err); }
.ok { color: var(--ok); }
.warn { color: var(--warn); font-size: 0.95rem; }

.trust {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.signin-block { margin-top: 0.5rem; }

.tunnel-panel {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tunnel-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.tunnel-copy {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

.tunnel-copy code {
  font-family: var(--mono);
  font-size: 0.8em;
  color: var(--text);
  background: #eef2f7;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.tunnel-cmd {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.45;
  background: var(--code-bg);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--code-text);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.btn-primary,
.btn-ghost,
.btn-text,
.btn-danger {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 1.15rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff !important;
  font-size: 0.85rem;
  text-decoration: none;
}

a.btn-primary:hover,
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #fff !important;
  text-decoration: none;
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-pressed);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.btn-ghost:hover {
  border-color: var(--border-hover);
  background: #eef2f7;
}

.btn-text {
  padding: 0.4rem 0.65rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.btn-text:hover {
  color: var(--text);
  background: #eef2f7;
}

.btn-danger {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(223, 27, 65, 0.28);
  font-size: 0.85rem;
  font-weight: 500;
}

.btn-danger:hover {
  background: rgba(223, 27, 65, 0.06);
  border-color: var(--danger);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.switch-hint {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.whoami {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.console-head .btn-primary {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 1.15rem;
  font-size: 0.9rem;
}

.empty {
  padding: 2rem 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.key-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.key-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.key-row:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.key-row .name {
  font-weight: 600;
  font-size: 1rem;
}

.key-row .meta {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
}

.key-row .meta-id {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
}

.key-row .row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 1.5rem;
  max-width: 26rem;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-md);
}

dialog::backdrop {
  background: rgba(10, 37, 64, 0.45);
  backdrop-filter: blur(3px);
}

dialog[open] {
  animation: dlgIn 0.22s ease-out both;
}

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

.dlg-secret pre.secret-box {
  animation: secretReveal 0.35s ease-out 0.08s both;
}

@keyframes secretReveal {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin: 1rem 0 0.35rem;
}

label:first-of-type { margin-top: 0.5rem; }

input, select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.secret-box {
  margin: 1rem 0;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  background: var(--code-bg);
  border: none;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: #c4b5fd;
}

@media (max-width: 480px) {
  main { padding: 1rem; }
  .shell { padding: 1.35rem 1.25rem 1.5rem; }
  .console-head {
    flex-direction: column;
    align-items: stretch;
  }
  .console-head .btn-primary { width: 100%; }
}
