/* Agent Alpaca — dark, terminal-forward theme. */
:root {
  --bg: #0e0e12;
  --panel: #17171f;
  --panel-2: #1e1e28;
  --border: #2a2a36;
  --text: #e7e7ef;
  --muted: #9a9aad;
  --accent: #7c5cff;
  --accent-hover: #6a49f0;
  --ok: #35c98b;
  --err: #ff6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* The `hidden` attribute must win even when a class sets `display` (e.g. the
   modal's .modal-backdrop { display: flex }); otherwise hidden elements show. */
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Layout */
.wrap { max-width: 860px; margin: 0 auto; padding: 24px 20px 64px; }
header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(14,14,18,0.9); backdrop-filter: blur(8px); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand img { width: 26px; height: 26px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s; text-decoration: none;
}
.btn:hover { background: #262633; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost { background: transparent; }

/* Cards / forms */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.auth-card {
  max-width: 420px; margin: 12vh auto 0; background: var(--panel);
  border: 1px solid var(--border); border-radius: 16px; padding: 32px;
}
.field {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 15px; margin: 6px 0 14px;
}
.field:focus { outline: none; border-color: var(--accent); }
label { font-size: 13px; font-weight: 600; color: var(--muted); }

.msg { padding: 10px 12px; border-radius: 10px; margin-top: 12px; font-size: 14px; }
.msg-ok { background: rgba(53,201,139,.12); color: var(--ok); }
.msg-err { background: rgba(255,107,107,.12); color: var(--err); }

/* Session list */
.session-list { display: grid; gap: 12px; margin-top: 18px; }
.session {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s;
}
.session:hover { border-color: var(--accent); }
.session .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.session.online .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(53,201,139,.18); }
.session .grow { min-width: 0; flex: 1; }
.session .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge.live { color: var(--ok); border-color: rgba(53,201,139,.4); }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; }

/* Pairing code */
.code-box {
  font-family: ui-monospace, monospace; font-size: 26px; letter-spacing: 2px; font-weight: 700;
  text-align: center; padding: 18px; background: var(--panel-2); border: 1px dashed var(--accent);
  border-radius: 12px; margin: 14px 0; color: #fff; user-select: all;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 20;
}
.modal { max-width: 440px; width: 100%; }

/* Terminal view */
body.term-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.term-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--panel);
}
.term-bar .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-bar .status { font-size: 12px; }
.status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.status.online .dot { background: var(--ok); }
.status.offline .dot { background: var(--err); }
#terminal { flex: 1; min-height: 0; padding: 8px; background: #000; }
.term-hint { font-size: 12px; color: var(--muted); padding: 6px 16px; border-top: 1px solid var(--border); background: var(--panel); }

/* Landing */
.hero { text-align: center; padding: 8vh 0 4vh; }
.hero h1 { font-size: 40px; margin: 0 0 12px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 560px; margin: 0 auto 24px; }
.steps { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 28px; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.step h3 { margin: 0 0 6px; font-size: 15px; }
.step .n { color: var(--accent); font-weight: 700; }
pre.cmd { background: #000; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow-x: auto; color: #e7e7ef; }
