:root {
  --bg: #10110e;
  --panel: #191b15;
  --ink: #f5f7ef;
  --muted: #a7ab9b;
  --line: #34382c;
  --input: #0d0e0b;
  --lime: #ccff33;
  --lime-hover: #b6ef2a;
  --lime-ink: #141800;
  --danger: #ff5c39;
  --hover: #242820;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font: 16px/1.45 "Avenir Next", "Segoe UI", sans-serif;
}

::selection { background: var(--lime); color: var(--lime-ink); }
button, input, textarea, select { font: inherit; color: inherit; }

button {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: var(--lime-hover); }
button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 500;
}
button.secondary:hover { background: var(--hover); }

a { color: var(--lime); }

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.shell { max-width: 1100px; margin: 0 auto; padding: 1.25rem; flex: 1; width: 100%; }
.shell.stack { align-content: start; display: grid; gap: 16px; }

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(10, 12, 8, 0.72);
  backdrop-filter: blur(10px);
  pointer-events: all;
}
.busy-card {
  width: min(360px, 100%);
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.busy-spin {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  border: 3px solid #34382c;
  border-top-color: var(--lime);
  border-radius: 99px;
  animation: busy-rotate 0.8s linear infinite;
}
.busy-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.busy-lede {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}
@keyframes busy-rotate {
  to { transform: rotate(360deg); }
}

.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0; }

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: inherit;
}
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand-title { font-weight: 650; letter-spacing: -0.02em; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
}

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 40%, rgba(204, 255, 51, 0.08), transparent 42%),
    #10140f;
}

.chooser { position: relative; z-index: 1; box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45); }
.badge {
  width: 50px;
  height: 50px;
  margin: 2px auto 6px;
  display: block;
  border-radius: 12px;
  object-fit: cover;
}
.provider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #34382c;
  border-radius: 10px;
  background: #12140f;
  color: #f5f7ef;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.provider svg {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
}
.provider:hover { background: #22261c; color: #f5f7ef; }
a.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 0;
  padding: 8px 12px 8px 10px;
  border: 1px solid #4a4f42;
  border-radius: 10px;
  background: #12140f;
  color: #f5f7ef;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
a.back::before { content: "←"; font-weight: 700; }
a.back:hover { background: #22261c; }

.login {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 0;
  background: #191b15;
  border: 1px solid #34382c;
  border-radius: 14px;
  padding: 24px;
  display: grid;
  gap: 10px;
  color: #f5f7ef;
}
.login:has(.error:not(:empty)) {
  width: min(520px, 100%);
}
.login h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 700;
  text-align: center;
}
.login .lede {
  margin: 0;
  color: #a7ab9b;
  text-align: center;
}
.login .error {
  min-width: 0;
  max-height: 8.5rem;
  margin: 4px 0 0;
  padding: 8px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  text-align: left;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 10px;
  background: rgba(255, 92, 57, 0.1);
}
.login .error:empty {
  display: none;
  padding: 0;
  max-height: 0;
  background: none;
}
.login label {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 14px;
  color: #a7ab9b;
  text-align: left;
}
.login input, .login select {
  width: 100%;
  border: 1px solid #34382c;
  border-radius: 10px;
  padding: 10px 12px;
  background: #0d0e0b;
  color: #f5f7ef;
}
.login .actions { display: flex; width: 100%; margin: 4px 0 0; }
.login .actions button {
  width: 100%;
  background: #ccff33;
  color: #141800;
}
.login .actions button:disabled,
.login .actions button:disabled:hover {
  background: #2a2d26;
  color: #6d7168;
  cursor: not-allowed;
}

.workspace-picker { position: relative; min-width: 0; }
.workspace-toggle {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 28px 4px 8px;
  background: var(--input);
  color: var(--ink);
  font-weight: 500;
  text-align: left;
}
.workspace-toggle:hover { background: var(--hover); }
.workspace-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 420px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.workspace-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--input);
}
.workspace-list { overflow: auto; display: grid; gap: 2px; }
.workspace-option {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  text-align: left;
}
.workspace-option:hover, .workspace-option.is-active { background: var(--hover); }
.workspace-option.is-current { color: var(--lime); }

.locked-card {
  justify-items: center;
  text-align: center;
  width: min(460px, 100%);
  padding: 32px 28px;
  gap: 12px;
  display: grid;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}
.locked-card .eyebrow {
  margin: 0;
  color: var(--lime);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.locked-card h1 { margin: 0; font-size: 29px; }
.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 650;
}
.nav a.is-on, .nav a:hover { border-color: var(--lime); color: var(--lime); }
.home-hero h1 {
  margin: 0 0 16px;
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  min-width: 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
}
.stat .label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stat .num {
  display: block;
  color: var(--lime);
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .hero-stats { grid-template-columns: 1fr; }
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--input);
}
.card h2 { margin: 0; font-size: 16px; }
.pill {
  display: inline-flex;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.pill.on { border-color: var(--lime); color: var(--lime); }

.site-foot {
  margin-top: auto;
  padding: 16px 20px 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
