/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --border:   #2a2d3a;
  --text:     #e2e8f0;
  --muted:    #8892a4;
  --accent:   #6366f1;
  --green:    #22c55e;
  --yellow:   #f59e0b;
  --red:      #ef4444;
  --radius:   8px;
  --font:     'Inter', system-ui, sans-serif;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.6; }

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

/* ========== Layout ========== */
body { display: flex; }

.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.logo { font-size: 18px; font-weight: 700; padding: 0 20px 16px; color: var(--text); }
.tenant-name { font-size: 11px; color: var(--muted); padding: 0 20px 12px; text-transform: uppercase; letter-spacing: .05em; }

.sidebar ul { list-style: none; flex: 1; }
.sidebar ul li a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; color: var(--muted); font-size: 13px;
  transition: color .15s, background .15s;
}
.sidebar ul li a:hover, .sidebar ul li a.active {
  color: var(--text); background: rgba(99,102,241,.1); text-decoration: none;
}

.user-info { padding: 12px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.user-info button { margin-top: 8px; font-size: 12px; }

.container { flex: 1; padding: 32px; overflow-y: auto; max-width: 1200px; }

/* ========== Buttons ========== */
button, .btn-primary, .btn-secondary, .btn-danger, .btn-sm {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: opacity .15s;
}
button:hover, .btn-primary:hover, .btn-secondary:hover, .btn-danger:hover { opacity: .85; text-decoration: none; }

.btn-primary  { background: var(--accent); color: #fff; }
.btn-secondary{ background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-sm       { padding: 4px 10px; font-size: 12px; }

/* ========== Forms ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea {
  width: 100%; padding: 8px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 13px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

/* ========== Tables ========== */
table { width: 100%; border-collapse: collapse; }
thead th { padding: 10px 12px; text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody td { padding: 10px 12px; font-size: 13px; }

/* ========== Badges ========== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-green  { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-yellow { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-red    { background: rgba(239,68,68,.15);  color: var(--red); }
.badge-gray   { background: var(--border);        color: var(--muted); }

/* ========== Status dots ========== */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.active  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--muted); }

/* ========== Alerts & Toasts ========== */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-error { background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.3); }

#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: var(--radius); font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.3); animation: slide-in .2s ease; }
.toast-success { background: rgba(34,197,94,.15); color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.toast-error   { background: rgba(239,68,68,.15); color: var(--red);   border: 1px solid rgba(239,68,68,.3); }
@keyframes slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== Cards ========== */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.stat-value { font-size: 32px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stats-row  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }

/* ========== Approval cards ========== */
.approval-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.approval-card.done     { border-color: var(--green); opacity: .6; }
.approval-card.rejected { opacity: .5; }
.approval-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.approval-time, .approval-host { color: var(--muted); font-size: 12px; }
.approval-command code {
  display: block; background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 10px 14px; font-family: monospace;
  font-size: 13px; margin: 8px 0;
}
.approval-reasoning { color: var(--muted); font-size: 13px; margin: 8px 0; }
.approval-model     { font-size: 11px; color: var(--muted); }
.approval-actions   { display: flex; gap: 10px; margin-top: 16px; }

/* ========== Feed ========== */
.feed-entry { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.feed-meta  { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.feed-time  { color: var(--muted); font-size: 12px; }
.feed-agent { font-weight: 500; }
.feed-cmd   { font-family: monospace; font-size: 12px; color: var(--accent); }
.outcome-ok   { color: var(--green); }
.outcome-fail { color: var(--red); }

/* ========== Login ========== */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px; width: 380px;
}
.login-card h1 { font-size: 22px; margin-bottom: 24px; }
.login-footer { margin-top: 16px; text-align: center; color: var(--muted); font-size: 12px; }

/* ========== Founding Member ========== */
.fm-hero { max-width: 680px; margin: 0 auto; padding: 60px 20px; }
.fm-hero h1 { font-size: 36px; font-weight: 800; margin-bottom: 12px; }
.fm-sub { color: var(--muted); font-size: 16px; margin-bottom: 32px; }
.fm-counter { margin-bottom: 32px; }
.fm-bar  { background: var(--border); border-radius: 99px; height: 8px; overflow: hidden; }
.fm-fill { background: var(--accent); height: 100%; border-radius: 99px; transition: width .3s; }
.fm-spots { margin-top: 8px; font-size: 13px; color: var(--muted); }
.fm-perks { margin-bottom: 32px; padding-left: 20px; }
.fm-perks li { margin-bottom: 8px; }
.fm-cta .btn-primary { font-size: 16px; padding: 14px 28px; }
.fm-sold-out { color: var(--muted); }
.fm-logos h3 { margin: 40px 0 16px; }
#fm-logo-wall { display: flex; flex-wrap: wrap; gap: 16px; }
.fm-logo-item img { height: 40px; filter: grayscale(1); opacity: .6; transition: all .2s; }
.fm-logo-item:hover img { filter: none; opacity: 1; }

/* ========== Onboarding ========== */
.onboarding { max-width: 680px; margin: 0 auto; }
.wizard-steps { display: flex; gap: 4px; margin-bottom: 32px; }
.wizard-step { padding: 6px 14px; border-radius: var(--radius); font-size: 12px; color: var(--muted); background: var(--surface); }
.wizard-step.active { background: var(--accent); color: #fff; }
.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.plan-card h3 { margin-bottom: 8px; }
.plan-price { font-size: 20px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.plan-extra { font-size: 12px; color: var(--green); margin-bottom: 12px; }
.install-cmd { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; font-family: monospace; font-size: 12px; overflow-x: auto; white-space: pre; }
.install-options h3 { margin: 20px 0 8px; }

/* ========== Empty states ========== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon  { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 8px; }

/* ========== Modal ========== */
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-top: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.modal h2 { margin-bottom: 20px; }

/* ========== Pattern preview ========== */
.pattern-match    { color: var(--green); font-size: 12px; }
.pattern-no-match { color: var(--muted); font-size: 12px; }
.pattern-error    { color: var(--red);   font-size: 12px; }

/* ========== Page header ========== */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }

/* ========== Locale switcher ========== */
.locale-switcher { display: flex; gap: 6px; padding: 8px 20px 4px; }
.locale-link   { font-size: 11px; color: var(--muted); text-decoration: none; padding: 2px 6px; border-radius: 4px; }
.locale-link:hover { color: var(--text); text-decoration: none; }
.locale-active { font-size: 11px; color: var(--accent); font-weight: 700; padding: 2px 6px;
                 background: rgba(99,102,241,.15); border-radius: 4px; }

/* ========== Misc ========== */
.muted   { color: var(--muted); }
.success { color: var(--green); }
.revoked { color: var(--muted); font-style: italic; }
h1, h2, h3 { font-weight: 600; }
h1 { font-size: 22px; margin-bottom: 20px; }
h2 { font-size: 18px; margin-bottom: 16px; }
section { margin-bottom: 32px; }
