:root {
  --bg: #0d1117;
  --card: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #388bfd;
  --accent-hover: #58a6ff;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --starting: #79c0ff;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Logged-out marketing/auth pages (landing, login, register, forgot/reset
   password) pick up The T-W-O Project's brand accent (sage green, from
   thetwoproject.com/styles.css) instead of the default blue. The signed-in
   app (dashboard, admin, change-password) intentionally keeps the blue
   developer-tool palette — different context, not the same page flow. */
body.theme-brand {
  --accent: #66715b;
  --accent-hover: #4f5945;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ── Layout ── */
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}
header .brand { font-weight: 600; font-size: 15px; color: var(--text); }
.brand-link { color: inherit; text-decoration: none; cursor: pointer; }
.brand-link:hover { color: inherit; text-decoration: none; }
header .nav-links { display: flex; gap: 16px; align-items: center; }
header .nav-links a, header .nav-links button {
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font);
}
header .nav-links a:hover, header .nav-links button:hover { color: var(--text); }

main { padding: 32px 0; }
html.embedded header { display:none; }
html.embedded main { padding-top:0; }
html.embedded body { background:transparent; }

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--accent); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled)  { opacity: 0.85; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--border); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Status Badge ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-running  { background: rgba(63,185,80,.15);  color: var(--success); }
.badge-stopped  { background: rgba(139,148,158,.12); color: var(--muted); }
.badge-starting { background: rgba(121,192,255,.15); color: var(--starting); }
.badge-error    { background: rgba(248,81,73,.15);  color: var(--danger); }

.tab-badge {
  display: inline-block;
  min-width: 16px;
  height: 16px;
  margin-left: 6px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  vertical-align: middle;
}

/* ── Table ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ── Alert ── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-error   { background: rgba(248,81,73,.1);  border: 1px solid rgba(248,81,73,.3);  color: var(--danger); }
.alert-success { background: rgba(63,185,80,.1);  border: 1px solid rgba(63,185,80,.3);  color: var(--success); }
.alert-info    { background: rgba(56,139,253,.1); border: 1px solid rgba(56,139,253,.3); color: var(--accent); }

/* ── Login page ── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
/* Pages that render <header> above .login-wrap use this instead, so the box
   still centers in the remaining viewport instead of adding a header's worth
   of extra scroll below it. */
.login-wrap.with-header {
  min-height: calc(100vh - 61px);
}
.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
}
.login-box h1 { font-size: 18px; margin-bottom: 6px; }
.login-box p  { color: var(--muted); margin-bottom: 24px; font-size: 13px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; scrollbar-width: thin; }
.tab {
  padding: 10px 20px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }
.tab-panel  { display: none; }
.tab-panel.active { display: block; }
.dashboard-frame-wrap { margin-top: -24px; }
.dashboard-frame { display:block; width:100%; min-height:calc(100vh - 126px); border:0; background:var(--bg); }
.list-tools { display:flex; gap:10px; align-items:center; margin:0 0 16px; }
.list-tools input[type="search"] { max-width:420px; }
.list-tools select { width:auto; min-width:150px; }
.pager { min-height:38px; display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--muted); font-size:12px; margin-top:14px; }
.pager div { display:flex; gap:8px; }
.btn:disabled { opacity:.45; cursor:not-allowed; }

/* ── Workspace card ── */
.workspace-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.workspace-card .team-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.workspace-card .team-slug { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.workspace-card .status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.workspace-card .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.workspace-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: rgba(63,185,80,.1);
  border: 1px solid rgba(63,185,80,.3);
  color: var(--success);
  font-size: 13px;
  font-weight: 500;
}
.workspace-link:hover { background: rgba(63,185,80,.2); text-decoration: none; }

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 { font-size: 16px; font-weight: 600; }

/* ── Empty state ── */
.empty { color: var(--muted); padding: 32px 0; text-align: center; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: var(--starting);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Collapsible form ── */
.form-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ── Landing page ── */
.hero {
  text-align: center;
  padding: 72px 20px 56px;
}
.hero h1 { font-size: 32px; margin-bottom: 14px; }
.hero p {
  color: var(--muted);
  font-size: 16px;
  max-width: 560px;
  margin: 0 auto 28px;
}
.hero .actions { display: flex; gap: 12px; justify-content: center; }
.hero .btn { padding: 10px 22px; font-size: 14px; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 900px;
  margin: 0 auto 64px;
  padding: 0 20px;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.feature-card h3 { font-size: 15px; margin-bottom: 8px; }
.feature-card p { color: var(--muted); font-size: 13px; }

.steps-section {
  max-width: 900px;
  margin: 0 auto 64px;
  padding: 0 20px;
}
.steps-section h2 {
  text-align: center;
  font-size: 22px;
  margin-bottom: 32px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.step { text-align: center; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px;
}
.step h3 { font-size: 15px; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: 13px; }

.cta-band {
  max-width: 900px;
  margin: 0 auto 64px;
  padding: 40px 20px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.cta-band h2 { font-size: 20px; margin-bottom: 18px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}
.site-footer .inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.site-footer a { margin-left: 4px; }

@media (max-width: 640px) {
  .list-tools { align-items:stretch; flex-direction:column; }
  .list-tools input[type="search"], .list-tools select { width:100%; max-width:none; }
  .pager { align-items:flex-start; }
  .features { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .hero .actions { flex-direction: column; align-items: center; }
}
