/* Snaper AI Assistant OS — original visual identity (no third-party assets/fonts). */
:root {
  --bg: #0b0e17;
  --bg-2: #121627;
  --panel: #161b2e;
  --panel-2: #1c2238;
  --line: #262d47;
  --text: #e8ecf8;
  --text-dim: #9aa3c0;
  --accent: #6d5dfc;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --off: #6b7280;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}
html[data-theme="light"] {
  --bg: #f4f6fb; --bg-2: #ffffff; --panel: #ffffff; --panel-2: #eef1f9;
  --line: #d9dfeb; --text: #171b2e; --text-dim: #5a6379;
  --shadow: 0 8px 24px rgba(23,27,43,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }

/* Boot */
.boot-screen { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.boot-orb { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--accent-2), var(--accent)); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); opacity: .7; } }

/* Layout: mobile-first */
#app { height: 100%; display: flex; flex-direction: column; }
.shell { display: flex; flex-direction: column; height: 100%; }
.main { flex: 1; overflow-y: auto; padding: 12px 12px 84px; } /* bottom space for mobile nav */
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .sidebar { display: flex !important; }
  .bottom-nav { display: none !important; }
  .main { padding: 24px 32px 32px; max-width: 1100px; }
  .topbar { border-bottom: 1px solid var(--line); }
}
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand .logo { width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--accent-2), var(--accent)); }
.brand small { display: block; font-weight: 400; color: var(--text-dim); font-size: 11px; }
.topbar .spacer { flex: 1; }

/* Sidebar (desktop) */
.sidebar { display: none; flex-direction: column; gap: 4px; width: 230px; padding: 16px 10px; background: var(--bg-2); border-right: 1px solid var(--line); }
.sidebar .nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text-dim); cursor: pointer; border: none; background: none; text-align: left; width: 100%; }
.sidebar .nav-item:hover { background: var(--panel); }
.sidebar .nav-item.active { background: var(--panel); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.sidebar .sidebar-foot { margin-top: auto; font-size: 11px; color: var(--text-dim); padding: 10px 12px; }

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  display: flex; background: var(--bg-2); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: none; color: var(--text-dim); font-size: 10.5px; padding: 6px 2px; border-radius: 10px; cursor: pointer; }
.bottom-nav .glyph { font-size: 17px; }
.bottom-nav .nav-item.active { color: var(--text); background: var(--panel); }
.nav-more-wrap { position: relative; }
.nav-more-menu { position: absolute; bottom: 60px; right: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; min-width: 160px; box-shadow: var(--shadow); z-index: 20; }
.nav-more-menu button { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: none; background: none; color: var(--text); text-align: left; border-radius: 8px; cursor: pointer; font-size: 14px; }
.nav-more-menu button:hover { background: var(--panel-2); }

/* Cards, badges, buttons */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card .muted { color: var(--text-dim); font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 700px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }
.grid3 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 700px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid transparent; vertical-align: middle; }
.badge.ready, .badge.available, .badge.configured, .badge.enabled, .badge.granted { background: rgba(52,211,153,.12); color: var(--ok); border-color: rgba(52,211,153,.35); }
.badge.warn, .badge.not-configured, .badge.permission-required, .badge.not-requested, .badge.pending, .badge.denied { background: rgba(251,191,36,.10); color: var(--warn); border-color: rgba(251,191,36,.35); }
.badge.bad, .badge.error { background: rgba(248,113,113,.10); color: var(--bad); border-color: rgba(248,113,113,.35); }
.badge.off, .badge.unavailable, .badge.disabled { background: rgba(107,114,128,.14); color: var(--off); border-color: rgba(107,114,128,.4); }
.badge.not-implemented { background: transparent; color: var(--off); border: 1px dashed var(--off); }

.btn { background: var(--accent); color: #fff; border: none; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; }
.btn:hover { filter: brightness(1.1); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); }
.btn.ghost { background: none; border: 1px solid var(--line); color: var(--text-dim); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label.f-label { display: block; font-size: 12px; color: var(--text-dim); margin: 10px 0 4px; }
.chip { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text-dim); margin: 2px 4px 4px 0; }
.chip.active { color: var(--text); border-color: var(--accent); }

/* Assistant */
.chat-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thread { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .meta { display: block; margin-top: 6px; font-size: 10.5px; opacity: .65; }
.composer { display: flex; gap: 8px; padding-top: 8px; }
.composer textarea { resize: none; min-height: 44px; max-height: 120px; }
.avatar-orb { width: 44px; height: 44px; border-radius: 50%; flex: none; background: radial-gradient(circle at 32% 32%, var(--accent-2), var(--accent)); transition: box-shadow .3s, transform .3s; position: relative; }
.avatar-orb.idle { box-shadow: 0 0 0 0 rgba(109,93,252,.0); }
.avatar-orb.thinking { animation: pulse 1s ease-in-out infinite; }
.avatar-orb.speaking { box-shadow: 0 0 0 6px rgba(34,211,238,.25); }
.avatar-orb.listening { box-shadow: 0 0 0 6px rgba(52,211,153,.35); }
.statusline { font-size: 11.5px; color: var(--text-dim); margin: 6px 0; }
.empty-state { text-align: center; color: var(--text-dim); margin: 40px 12px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.banner { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.35); color: var(--warn); padding: 10px 12px; border-radius: 12px; margin-bottom: 10px; font-size: 13px; }
.banner.error { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.35); color: var(--bad); }

/* Lists */
.list-row { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; font-size: 14px; }
.list-row .sub { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv .k { color: var(--text-dim); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.table th { color: var(--text-dim); font-weight: 600; }
.test-pass { color: var(--ok); } .test-fail { color: var(--bad); }
.screen-title { margin: 2px 0 14px; font-size: 20px; }
.screen-sub { color: var(--text-dim); margin: -8px 0 16px; font-size: 13px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 80px; background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 12px; z-index: 50; box-shadow: var(--shadow); font-size: 13px; max-width: 90vw; }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.hint { font-size: 12px; color: var(--text-dim); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }