/* Buse Console — mobile-first, brand-aligned with www.buse.pro */
:root {
  --brand: #fd7f01;
  --brand-soft: rgba(253, 127, 1, 0.15);
  --brand-glow: rgba(253, 127, 1, 0.35);
  --brand-dim: #a35200;
  --bg: #0a0a0a;
  --bg-2: #15161a;
  --surface: #1a1b1f;
  --surface-2: #232428;
  --surface-3: #2d2e34;
  --border: #2a2b30;
  --border-soft: #1e1f23;
  --text: #f5f5f5;
  --text-2: #c0c0c0;
  --text-dim: #7e8089;
  --danger: #ff4d4d;
  --success: #4ade80;
  --warn: #facc15;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow-glow: 0 0 20px var(--brand-glow);
  --ff-display: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  --ff-body: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', Roboto, sans-serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
  overflow-x: hidden;
}

/* Buse.Pro 3DMark inspired animated background */
.bp-bg {
  position: fixed; inset: 0; z-index: -1;
  background: #050505;
  overflow: hidden;
  pointer-events: none;
}
.bp-bg::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(253, 127, 1, 0.10), transparent 60%),
    radial-gradient(ellipse 80% 60% at 100% 100%, rgba(253, 127, 1, 0.06), transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 50%, rgba(99, 102, 241, 0.04), transparent 60%);
}
.bp-bg::after {
  content: 'BUSE.PRO';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  font-family: var(--ff-display);
  font-size: clamp(180px, 50vw, 380px);
  font-weight: 900;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(253, 127, 1, 0.10);
  text-stroke: 1.5px rgba(253, 127, 1, 0.10);
  white-space: nowrap;
  animation: floatRotate 28s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes floatRotate {
  0%   { transform: translate(-50%, -50%) rotate(-12deg) scale(1); opacity: 0.6; }
  50%  { transform: translate(-48%, -52%) rotate(-10deg) scale(1.04); opacity: 1; }
  100% { transform: translate(-52%, -48%) rotate(-14deg) scale(1); opacity: 0.7; }
}

/* Floating orbs */
.bp-bg .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  animation: orbFloat 20s ease-in-out infinite alternate;
}
.bp-bg .orb1 { width: 300px; height: 300px; top: -10%; left: -15%; background: radial-gradient(circle, var(--brand), transparent 70%); }
.bp-bg .orb2 { width: 400px; height: 400px; bottom: -20%; right: -20%; background: radial-gradient(circle, #6366f1, transparent 70%); animation-delay: -7s; }
.bp-bg .orb3 { width: 250px; height: 250px; top: 30%; right: 10%; background: radial-gradient(circle, #ec4899, transparent 70%); animation-delay: -14s; }
@keyframes orbFloat {
  0% { transform: translate(0, 0); }
  100% { transform: translate(40px, -50px); }
}

#root { min-height: 100vh; display: flex; flex-direction: column; }

/* ─── TOP BAR ─── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .brand {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 8px;
  line-height: 1.1;
}
.topbar .brand .col { display: flex; flex-direction: column; }
.topbar .brand .title { color: var(--text); }
.topbar .brand .sub { font-size: 8px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.18em; font-family: var(--ff-mono); margin-top: 2px; font-weight: 500; }
.topbar .brand .mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dim));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: white;
  box-shadow: 0 0 14px var(--brand-glow);
  letter-spacing: 0;
}

/* Big chat CTA */
.chat-cta {
  margin: 4px 14px 16px;
  padding: 16px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dim) 100%);
  color: white;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--brand-glow);
  position: relative;
  overflow: hidden;
  transition: transform 0.12s;
}
.chat-cta:active { transform: scale(0.98); }
.chat-cta::after {
  content: '';
  position: absolute; top: -50%; right: -10%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.15), transparent 60%);
}
.chat-cta .emoji { font-size: 36px; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.chat-cta .lbl { flex: 1; }
.chat-cta .lbl .t { font-family: var(--ff-display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.chat-cta .lbl .s { font-size: 11px; opacity: 0.9; font-family: var(--ff-mono); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.chat-cta .arrow { font-size: 20px; opacity: 0.7; }
.topbar .status-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-dim);
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--ff-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-pill .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim);
}
.status-pill.online .dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse 2s ease-in-out infinite;
}
.status-pill.offline .dot { background: var(--danger); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── HERO STATS ─── */
.hero {
  margin: 8px 14px 6px;
  padding: 10px 14px;
  background: rgba(26, 27, 31, 0.5);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* 3D Torus as BACKGROUND behind the tiles */
.home-wrap { position: relative; }
.bp-torus {
  position: absolute;
  inset: -20px 0 -20px 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
  opacity: 0.65;
}
.bp-torus canvas { display: block; width: 100%; height: 100%; }
.home-wrap .home { position: relative; z-index: 1; }

/* Quick search */
.q-search {
  margin: 0 12px 8px;
  position: relative;
}
.q-search input {
  padding: 10px 36px 10px 36px;
  font-size: 13px;
}
.q-search::before {
  content: '🔍'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; opacity: 0.6;
}

/* Mini chat on home */
.home-chat {
  margin: 12px 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.home-chat .head {
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.home-chat .head .title { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--ff-mono); }
.home-chat .head .expand { background: transparent; border: none; color: var(--brand); cursor: pointer; font-size: 14px; padding: 4px 8px; }
.home-chat .scroll {
  max-height: 200px; overflow-y: auto;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.home-chat .empty-chat { text-align: center; color: var(--text-dim); font-size: 12px; padding: 20px; }
.home-chat .composer { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border-soft); align-items: flex-end; }
.home-chat .composer textarea { flex: 1; min-height: 38px; max-height: 100px; padding: 8px 10px; font-size: 13px; font-family: inherit; }

/* Activity ticker (live last messages) */
.activity-ticker {
  margin: 0 12px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-height: 36px;
  overflow: hidden;
}
.activity-ticker .item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; padding: 4px 0;
}
.activity-ticker .item.fade { opacity: 0.5; }
.activity-ticker .role-tag { font-size: 9px; padding: 1px 6px; }
.activity-ticker .text { flex: 1; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-ticker .cost { color: var(--success); font-family: var(--ff-mono); font-size: 10px; }

/* Tile badge (small number) */
.tile-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--brand); color: white;
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 8px;
  min-width: 14px; text-align: center;
}
.hero::before {
  content: '';
  position: absolute; top: -30%; right: -10%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--brand-glow), transparent 70%);
  filter: blur(40px);
  pointer-events: none;
}
.hero .greeting { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; font-family: var(--ff-mono); display: flex; justify-content: space-between; }
.hero .greeting .day { }
.hero .greeting .uptime { color: var(--text-2); }

/* Live charts row */
.live-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}
.live-chart {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 10px 4px;
  position: relative;
  overflow: hidden;
}
.live-chart .lc-label {
  font-size: 9px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.1em;
  font-family: var(--ff-mono);
  display: flex; justify-content: space-between; align-items: center;
}
.live-chart .lc-val {
  font-family: var(--ff-display);
  font-size: 20px; font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
  color: var(--text);
}
.live-chart .lc-val.warn { color: var(--warn); }
.live-chart .lc-val.danger { color: var(--danger); }
.live-chart canvas {
  width: 100%; height: 28px;
  display: block; margin-top: 4px;
}
.live-chart .lc-sub { font-size: 9px; color: var(--text-dim); font-family: var(--ff-mono); margin-top: -2px; }

/* ─── HOMEGRID — Liquid glass iOS 18 inspired ─── */
.home {
  padding: 8px 14px 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 6px;
  position: relative;
  z-index: 1;
}
.tile {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s cubic-bezier(0.32, 0.72, 0, 1);
}
.tile:active { transform: scale(0.92); }
.tile .icon-box {
  width: 76px; height: 76px;
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
  /* Transparent fluo: tile color at low opacity for that neon glass vibe */
  background:
    linear-gradient(145deg, rgba(255,255,255,0.08), rgba(0,0,0,0.05)),
    color-mix(in srgb, var(--tile-c, #888) 35%, transparent);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  position: relative;
  overflow: hidden;
  /* Fluo neon-glass stack */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.25),
    inset 0 0 0 1px color-mix(in srgb, var(--tile-c, #888) 50%, transparent),
    0 0 14px color-mix(in srgb, var(--tile-c, #888) 60%, transparent),
    0 6px 22px rgba(0,0,0,0.4);
}
/* Specular highlight (glass shine) */
.tile .icon-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.35) 0%,
    rgba(255,255,255,0.12) 40%,
    transparent 100%
  );
  border-radius: 20px 20px 50% 50% / 20px 20px 100% 100%;
  pointer-events: none;
  opacity: 0.9;
}
/* Refraction blur overlay (subtle distortion) */
.tile .icon-box::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 30% 20%, rgba(255,255,255,0.15), transparent 60%),
    radial-gradient(ellipse 60% 40% at 70% 90%, rgba(0,0,0,0.2), transparent 60%);
  pointer-events: none;
}
.tile .icon-emoji {
  position: relative; z-index: 2;
  filter:
    drop-shadow(0 1px 2px rgba(0,0,0,0.5))
    drop-shadow(0 0 8px rgba(255,255,255,0.15));
}
.tile .label {
  font-size: 11px; line-height: 1.15; letter-spacing: 0.01em;
  color: var(--text-2); font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.tile.alert .icon-box {
  animation: alertPulse 2s ease-in-out infinite;
}
.tile.alert .icon-box::before {
  background: linear-gradient(180deg, rgba(255,77,77,0.4) 0%, transparent 100%);
}
@keyframes alertPulse {
  0%, 100% { box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    inset 0 -1px 0 rgba(0,0,0,0.3),
    inset 0 0 0 1px rgba(255,77,77,0.4),
    0 1px 2px rgba(0,0,0,0.4),
    0 8px 24px rgba(0,0,0,0.5),
    0 0 30px rgba(255,77,77,0.4); }
  50% { box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    inset 0 -1px 0 rgba(0,0,0,0.3),
    inset 0 0 0 1px rgba(255,77,77,0.7),
    0 1px 2px rgba(0,0,0,0.4),
    0 8px 24px rgba(0,0,0,0.5),
    0 0 50px rgba(255,77,77,0.7); }
}
.tile-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
  border: 2px solid var(--bg);
  z-index: 3;
}

/* Floating chat composer always visible on home */
.home-composer {
  margin: 6px 14px 18px;
  padding: 8px;
  border-radius: 24px;
  background: rgba(26, 27, 31, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex; gap: 6px; align-items: flex-end;
  position: relative; z-index: 1;
}
.home-composer .icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.home-composer .icon-btn:active { transform: scale(0.92); background: rgba(255,255,255,0.18); }
.home-composer .icon-btn.send { background: var(--brand); border-color: var(--brand); color: white; box-shadow: 0 4px 12px var(--brand-glow); }
.home-composer .icon-btn.recording { background: var(--danger); border-color: var(--danger); color: white; animation: recPulse 1s ease-in-out infinite; }
@keyframes recPulse { 0%, 100% { box-shadow: 0 0 0 0 var(--danger); } 50% { box-shadow: 0 0 0 8px rgba(255,77,77,0); } }
.home-composer textarea {
  flex: 1; min-height: 38px; max-height: 100px;
  padding: 8px 14px;
  font-size: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 19px;
  color: var(--text);
  resize: none;
  font-family: inherit;
}
.home-composer textarea::placeholder { color: var(--text-dim); }
.home-composer textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.home-composer .atts {
  position: absolute; bottom: 100%; left: 8px; right: 8px;
  display: flex; gap: 6px; padding-bottom: 6px; flex-wrap: wrap;
}
.home-composer .att-chip {
  display: flex; align-items: center; gap: 4px;
  background: rgba(26,27,31,0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 4px 10px; border-radius: 14px;
  font-size: 11px;
}
.home-composer .att-chip .x { color: var(--text-dim); cursor: pointer; margin-left: 4px; }
.tile-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
  border: 2px solid var(--bg);
}
.tile::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 100%, var(--brand-soft), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.tile:hover::before, .tile:active::before { opacity: 1; }
.tile:active { transform: scale(0.95); border-color: var(--brand); }
.tile .icon { font-size: 24px; }
.tile .label {
  font-size: 10px; color: var(--text-2);
  text-align: center; line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tile.alert::after {
  content: ''; position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; background: var(--danger);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--danger);
}

/* ─── VIEW (sub-page) ─── */
.view {
  position: fixed; inset: 0;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(40px) saturate(150%);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 20;
  will-change: transform;
}
/* Chat view = solid dark bg with subtle brand glow */
.view.chat-v {
  background: #0a0a0a;
  background-image:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(253, 127, 1, 0.10), transparent 60%),
    radial-gradient(ellipse 80% 60% at 100% 100%, rgba(253, 127, 1, 0.06), transparent 60%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.view.open { transform: translateX(0); }
.view-header {
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 2;
}
.view-header .back {
  background: transparent; border: none; color: var(--brand);
  font-size: 22px; cursor: pointer; padding: 0;
  font-weight: 500; line-height: 1;
}
.view-header h2 {
  font-family: var(--ff-display);
  font-size: 18px; font-weight: 600;
  letter-spacing: -0.02em;
  flex: 1;
}
.view-header .actions { display: flex; gap: 10px; }
.view-content { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }

/* ─── LOGIN ─── */
.login {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px; gap: 18px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(253, 127, 1, 0.08), transparent 60%),
    var(--bg);
}
.login .logo {
  font-family: var(--ff-display);
  font-size: 52px; color: var(--brand); font-weight: 800;
  letter-spacing: -0.04em;
  text-shadow: 0 0 30px var(--brand-glow);
}
.login .tagline {
  font-family: var(--ff-mono);
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  margin-bottom: 28px;
}
.login input {
  width: 100%; max-width: 320px; padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 16px;
  text-align: center;
  letter-spacing: 0.05em;
  font-family: var(--ff-mono);
}
.login input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.login button {
  padding: 16px 32px;
  background: var(--brand); border: none; color: white;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  min-width: 220px;
  font-family: var(--ff-display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 4px 16px var(--brand-glow);
  transition: transform 0.1s, box-shadow 0.2s;
}
.login button:active { transform: scale(0.97); box-shadow: 0 2px 8px var(--brand-glow); }
.login button:disabled { opacity: 0.5; cursor: not-allowed; }
.login .err { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ─── CARDS / ROWS ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.card h3 {
  font-family: var(--ff-mono);
  font-size: 10px; color: var(--text-dim);
  margin-bottom: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.15em;
}
.row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border-soft);
}
.row:last-child { border-bottom: none; padding-bottom: 0; }
.row .l { color: var(--text-2); font-size: 13px; }
.row .v { font-weight: 500; font-size: 14px; font-family: var(--ff-mono); }
.row .v.brand { color: var(--brand); }
.row .v.success { color: var(--success); }
.row .v.danger { color: var(--danger); }

/* ─── BUTTONS ─── */
.btn {
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-size: 13px; cursor: pointer; font-weight: 500;
  font-family: var(--ff-body);
  transition: background 0.15s, transform 0.1s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: scale(0.96); }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: white; font-weight: 600; }
.btn.primary:hover { background: var(--brand-dim); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.icon-only { padding: 8px 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── MESSAGES (chat-like) ─── */
.msg {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 13px;
}
.msg .head {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text-dim); font-size: 11px; margin-bottom: 8px;
  font-family: var(--ff-mono);
}
.msg .head .role-tag {
  padding: 2px 8px; border-radius: 4px;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--surface-2); color: var(--text-dim);
}
.msg .head .role-tag.BOSS { background: var(--brand); color: white; }
.msg .head .role-tag.SUB_ADMIN { background: #6366f1; color: white; }
.msg .head .role-tag.COLLEGA { background: #10b981; color: white; }
.msg .head .role-tag.DEMO { background: #a855f7; color: white; }
.msg .prompt { color: var(--text); margin-bottom: 8px; word-break: break-word; line-height: 1.5; }
.msg .response { color: var(--text-2); word-break: break-word; line-height: 1.5; padding-left: 12px; border-left: 2px solid var(--border); }
.msg .footer { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 10px; margin-top: 8px; font-family: var(--ff-mono); }
.msg .footer .cost { color: var(--success); }

/* ─── USERS ─── */
.user-row {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.user-row .head { display: flex; justify-content: space-between; align-items: center; }
.user-row .name { font-weight: 600; font-size: 15px; }
.user-row .role-tag {
  padding: 3px 9px; border-radius: 4px;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--surface-2); color: var(--text-dim);
}
.user-row .role-tag.BOSS { background: var(--brand); color: white; box-shadow: 0 0 8px var(--brand-glow); }
.user-row .role-tag.SUB_ADMIN { background: #6366f1; color: white; }
.user-row .role-tag.COLLEGA { background: #10b981; color: white; }
.user-row .role-tag.DEMO { background: #a855f7; color: white; }
.user-row .role-tag.CLIENTE { background: var(--surface-3); }
.user-row .meta { color: var(--text-dim); font-size: 11px; font-family: var(--ff-mono); }
.user-row .actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ─── BAR ─── */
.bar {
  background: var(--surface-2); height: 6px; border-radius: 3px; overflow: hidden;
  margin-top: 6px;
}
.bar > div { height: 100%; background: linear-gradient(90deg, var(--brand-dim), var(--brand)); transition: width 0.4s ease; }
.bar.warn > div { background: linear-gradient(90deg, #d97706, var(--warn)); }
.bar.danger > div { background: linear-gradient(90deg, #b91c1c, var(--danger)); }

/* ─── FILES ─── */
.file-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.file-row {
  display: flex; align-items: center; padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft); gap: 12px; cursor: pointer;
}
.file-row:last-child { border-bottom: none; }
.file-row:active { background: var(--surface-2); }
.file-row .icon { font-size: 22px; width: 24px; text-align: center; }
.file-row .name { flex: 1; word-break: break-all; font-size: 14px; font-family: var(--ff-mono); }
.file-row .size { color: var(--text-dim); font-size: 10px; font-family: var(--ff-mono); }
.path-bar {
  font-family: var(--ff-mono); font-size: 11px; color: var(--text-dim);
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 12px; word-break: break-all;
}

/* ─── FORMS ─── */
textarea, input[type=text], input[type=password], input[type=email], select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 15px; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { font-family: var(--ff-mono); font-size: 13px; min-height: 100px; resize: vertical; }
textarea:focus, input:focus, select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23fd7f01' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
label {
  display: block; font-size: 10px; color: var(--text-dim);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.1em;
  font-family: var(--ff-mono);
}
.form-group { margin-bottom: 16px; }

/* ─── LOGS ─── */
.log-stream {
  background: #050505; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0; max-height: 70vh; overflow-y: auto;
  font-family: var(--ff-mono);
}
.log-line {
  font-size: 11px; padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
  word-break: break-all; line-height: 1.4;
}
.log-line:last-child { border-bottom: none; }
.log-line .ts { color: var(--text-dim); }
.log-line .role-tag { color: var(--brand); font-weight: 700; }
.log-line .cost { color: var(--success); }
.log-line .arrow { color: var(--text-dim); margin: 0 4px; }
.log-line.error { background: rgba(255, 77, 77, 0.08); border-left: 3px solid var(--danger); }
.log-line.new { animation: flash 0.4s ease; }
@keyframes flash {
  0% { background: var(--brand-soft); }
  100% { background: transparent; }
}

/* ─── EMPTY / SPINNER ─── */
.empty {
  color: var(--text-dim); text-align: center; padding: 60px 20px;
  font-size: 14px;
}
.empty .icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.spinner {
  text-align: center; padding: 40px; color: var(--text-dim); font-size: 13px;
  font-family: var(--ff-mono);
}
.spinner::after { content: '...'; animation: dots 1.5s steps(4) infinite; }
@keyframes dots {
  0%, 33% { content: '.'; }
  34%, 66% { content: '..'; }
  67%, 100% { content: '...'; }
}

/* ─── TOAST ─── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border);
  padding: 12px 22px; border-radius: 999px;
  font-size: 13px; z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }

/* ─── CHAT BUBBLES (George) — liquid glass matching home ─── */
.chat-v .view-content { padding: 0 !important; }
.chat-v .view-header { border-bottom: 1px solid rgba(255,255,255,0.05); }
.chat-bg-mark {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--ff-display);
  font-size: clamp(120px, 30vw, 240px);
  font-weight: 900;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(253, 127, 1, 0.08);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  user-select: none;
}
.chat-scroll {
  flex: 1; overflow-y: auto;
  padding: 16px 14px 12px;
  display: flex; flex-direction: column; gap: 12px;
  -webkit-overflow-scrolling: touch;
  position: relative; z-index: 1;
}
.chat-bubble {
  display: flex;
  max-width: 86%;
}
.chat-bubble.user { align-self: flex-end; justify-content: flex-end; }
.chat-bubble.assistant { align-self: flex-start; }
.chat-bubble .bub {
  padding: 11px 16px;
  border-radius: 22px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.chat-bubble.user .bub {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dim) 100%);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 16px var(--brand-glow), 0 1px 0 rgba(255,255,255,0.2) inset;
}
.chat-bubble.assistant .bub {
  background: rgba(26, 27, 31, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 4px 16px rgba(0,0,0,0.4);
}
.chat-bubble .meta {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 6px;
  font-family: var(--ff-mono);
  letter-spacing: 0.02em;
}
.chat-bubble.user .meta { text-align: right; color: rgba(255,255,255,0.7); }
.chat-bubble .att img {
  max-width: 220px; border-radius: 12px;
  display: block; margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.chat-bubble .att .att-pill {
  background: rgba(0,0,0,0.25);
  padding: 6px 12px; border-radius: 14px;
  font-size: 12px; margin-bottom: 6px;
  display: inline-block;
}

/* Chat composer (glass, sticky bottom) — matches home */
.chat-composer {
  margin: 0;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255,255,255,0.06);
  position: sticky; bottom: 0; z-index: 2;
}
.chat-composer .row-inner {
  display: flex; gap: 6px; align-items: flex-end;
}
.chat-composer .att-strip {
  display: flex; gap: 6px; padding-bottom: 8px; flex-wrap: wrap;
}
.chat-composer .att-chip {
  display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 4px 10px; border-radius: 14px;
  font-size: 11px;
}
.chat-composer .att-chip .x { color: var(--text-dim); cursor: pointer; margin-left: 4px; }
.chat-composer .icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: transform 0.1s, background 0.15s;
}
.chat-composer .icon-btn:active { transform: scale(0.92); background: rgba(255,255,255,0.18); }
.chat-composer .icon-btn.send {
  background: var(--brand); border-color: var(--brand); color: white;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.chat-composer .icon-btn.recording {
  background: var(--danger); border-color: var(--danger); color: white;
  animation: recPulse 1s ease-in-out infinite;
}
.chat-composer textarea {
  flex: 1; min-height: 40px; max-height: 120px;
  padding: 9px 14px;
  font-size: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  color: var(--text);
  resize: none;
  font-family: inherit;
}
.chat-composer textarea::placeholder { color: var(--text-dim); }
.chat-composer textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

/* George avatar in header */
.george-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #ec4899);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px var(--brand-glow);
  position: relative;
}
.george-avatar::after {
  content: ''; position: absolute; bottom: -1px; right: -1px;
  width: 9px; height: 9px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px var(--success);
}

/* CodeMirror customization (theme: material-darker with brand cursor) */
.CodeMirror {
  height: auto !important;
  min-height: 60vh;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  background: #050505 !important;
  border-radius: 0 0 12px 12px;
}
.CodeMirror-gutters { background: #0a0a0a !important; border-right: 1px solid #1e1f23 !important; }
.CodeMirror-linenumber { color: #555 !important; font-size: 10px; }
.CodeMirror-cursor { border-left-color: #fd7f01 !important; border-left-width: 2px !important; }
.CodeMirror-selected { background: rgba(253,127,1,0.2) !important; }
.CodeMirror-line { padding: 0 8px; }
.CodeMirror-scroll { max-height: 60vh; }

/* Site Editor specific UI */
.se-tabs {
  display: flex; gap: 4px; overflow-x: auto;
  background: var(--surface-2); padding: 6px 8px 0;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid var(--border-soft);
}
.se-tab {
  padding: 7px 12px; background: var(--surface);
  border: 1px solid var(--border-soft); border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-family: var(--ff-mono); font-size: 11px;
  color: var(--text-2); white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer;
}
.se-tab.active { background: #050505; color: var(--brand); border-color: var(--brand); border-bottom: 1px solid #050505; margin-bottom: -1px; }
.se-tab.dirty::before { content: '●'; color: var(--brand); }
.se-tab .x { color: var(--text-dim); margin-left: 2px; opacity: 0.6; }
.se-tab:hover .x { opacity: 1; }

.se-header {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 12px 12px 0 0;
  font-family: var(--ff-mono); font-size: 11px;
  border: 1px solid var(--border-soft); border-bottom: none;
}
.se-header .path { flex: 1; color: var(--text-dim); word-break: break-all; }
.se-header .badge { padding: 1px 6px; border-radius: 4px; background: var(--brand); color: white; font-size: 9px; font-weight: 700; }
.se-header button { padding: 6px 10px; font-size: 11px; }

.se-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
}
.se-sidebar .file-row { padding: 8px 10px; }

.se-preview-frame {
  width: 100%;
  height: 60vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}

/* Markdown styling inside chat bubbles */
.bub.md { line-height: 1.55; }
.bub.md p { margin: 0 0 8px; }
.bub.md p:last-child { margin-bottom: 0; }
.bub.md h1, .bub.md h2, .bub.md h3, .bub.md h4 { font-family: var(--ff-display); margin: 10px 0 6px; font-weight: 700; letter-spacing: -0.01em; }
.bub.md h1 { font-size: 18px; }
.bub.md h2 { font-size: 16px; }
.bub.md h3 { font-size: 15px; }
.bub.md ul, .bub.md ol { margin: 6px 0 8px; padding-left: 22px; }
.bub.md li { margin-bottom: 3px; }
.bub.md code {
  background: rgba(253,127,1,0.12); color: var(--brand);
  padding: 1px 6px; border-radius: 5px;
  font-family: var(--ff-mono); font-size: 12px;
}
.bub.md pre {
  background: #050505; border: 1px solid var(--border-soft);
  padding: 10px 12px; border-radius: 8px;
  font-family: var(--ff-mono); font-size: 11px;
  overflow-x: auto; margin: 8px 0;
  line-height: 1.4;
}
.bub.md pre code { background: none; color: var(--text); padding: 0; }
.bub.md blockquote { border-left: 3px solid var(--brand); padding-left: 10px; margin: 6px 0; color: var(--text-2); }
.bub.md table { border-collapse: collapse; margin: 8px 0; font-size: 12px; }
.bub.md th, .bub.md td { border: 1px solid var(--border-soft); padding: 4px 8px; }
.bub.md th { background: var(--surface-2); }
.bub.md a { color: var(--brand); text-decoration: underline; }
.bub.md strong { font-weight: 600; }
.bub.md hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

/* Typing indicator */
.typing-dots {
  display: inline-flex; gap: 4px; align-items: center;
}
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: typingDot 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ─── MODAL ─── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  width: 100%; max-width: 420px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.modal h3 {
  font-family: var(--ff-display);
  font-size: 18px; margin-bottom: 14px; color: var(--text);
  font-weight: 600;
}
.modal .actions { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; }

/* ─── RESPONSIVE ─── */
/* Tablet (768-1199) */
@media (min-width: 768px) {
  .topbar { padding-left: 32px; padding-right: 32px; }
  .hero { max-width: 720px; margin-left: auto; margin-right: auto; padding: 16px 22px; }
  .home {
    max-width: 720px; margin-left: auto; margin-right: auto;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px 10px;
  }
  .tile .icon-box { width: 80px; height: 80px; border-radius: 24px; font-size: 40px; }
  .home-composer { max-width: 720px; margin-left: auto; margin-right: auto; }
  .view-content { max-width: 800px; margin: 0 auto; padding: 24px; }
  .chat-cta { max-width: 720px; margin-left: auto; margin-right: auto; }
  .activity-ticker { max-width: 720px; margin-left: auto; margin-right: auto; }
  .q-search { max-width: 720px; margin-left: auto; margin-right: auto; }
}
/* Desktop (1200+) — sidebar style */
@media (min-width: 1200px) {
  body { padding-left: 0; padding-right: 0; }
  .topbar { padding: 18px 40px; padding-top: calc(18px + env(safe-area-inset-top)); }
  .topbar .brand { font-size: 18px; }
  .hero { max-width: 1100px; padding: 20px 28px; }
  .hero .live-charts { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .live-chart { padding: 14px 18px; }
  .live-chart .lc-val { font-size: 28px; }
  .live-chart canvas { height: 40px; }
  .home {
    max-width: 1100px;
    grid-template-columns: repeat(8, 1fr);
    gap: 18px 12px;
    padding: 12px 24px;
  }
  .tile .icon-box { width: 88px; height: 88px; border-radius: 28px; font-size: 44px; }
  .tile .label { font-size: 12px; }
  .home-composer { max-width: 1100px; padding: 10px; }
  .home-composer textarea { font-size: 15px; }
  .home-composer .icon-btn { width: 44px; height: 44px; font-size: 18px; }
  .view { max-width: 100%; }
  .view-content { max-width: 1100px; padding: 28px 40px; }
  .chat-cta { max-width: 1100px; padding: 20px 26px; }
  .chat-cta .emoji { font-size: 44px; }
  .chat-cta .lbl .t { font-size: 22px; }
  .activity-ticker { max-width: 1100px; }
  .q-search { max-width: 1100px; }
}
/* Big desktop (1600+) */
@media (min-width: 1600px) {
  .home { grid-template-columns: repeat(10, 1fr); }
}
