* { box-sizing: border-box; }
:root {
  --bg: #0b0f14;
  --panel: #0f1720;
  --card: #121a24;
  --muted: #9fb0c0;
  --text: #e8f0f7;
  --primary: #4f8cff;
  --primary-600: #3b74e6;
  --success: #22c55e;
  --danger: #ef4444;
  --border: #213040;
  --bubble-me: #1f2b39;
  --bubble-other: #17222e;
  color-scheme: dark;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, Noto Sans, "Apple Color Emoji", "Segoe UI Emoji";
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #132235 0%, var(--bg) 60%) no-repeat, var(--bg);
  color: var(--text);
}

.view { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Buttons */
.btn { 
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; 
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  color: var(--text); cursor: pointer; transition: transform .08s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); border-color: #2a3a4a; }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(180deg, var(--primary), var(--primary-600)); border-color: transparent; }
.btn.success { background: linear-gradient(180deg, #34d399, var(--success)); border-color: transparent; }
.btn.danger { background: linear-gradient(180deg, #f87171, var(--danger)); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; }

/* Login */
.login-view { display: grid; place-items: center; min-height: 100dvh; padding: 32px; }
.login-card { background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(180deg, var(--primary), var(--primary-600)); color: #fff; font-weight: 700; letter-spacing: 0.5px; }
.brand-text h1 { font-size: 20px; margin: 0; }
.brand-text p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; gap: 12px; }
.field span { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
input, textarea { width: 100%; padding: 10px 12px; margin: 0; border: 1px solid var(--border); border-radius: 10px; background: #0c1420; color: var(--text); outline: none; }
input:focus, textarea:focus { border-color: #355170; box-shadow: 0 0 0 3px rgba(79,140,255,0.2); }
.error { color: #ff7aa7; margin-top: 10px; font-size: 14px; }

/* Panel */
.topbar { position: sticky; top: 0; z-index: 10; background: linear-gradient(180deg, rgba(10,16,22,0.7), rgba(10,16,22,0.4)); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 14px; }
.topbar-left { display: flex; gap: 12px; align-items: center; }
.titles h2 { margin: 0; font-size: 18px; }
.status { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; }

.layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; margin-top: 16px; }
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.content { min-height: calc(100dvh - 160px); }

.card { background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card .muted { color: var(--muted); font-size: 12px; }
.card .actions { display: flex; gap: 8px; margin-top: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }

.pre {
  background: #0c1420; border: 1px solid var(--border); padding: 10px; border-radius: 12px; overflow: auto; max-height: 260px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12px;
}

/* Chat */
.chat-card { height: calc(100dvh - 180px); display: flex; flex-direction: column; }
.chat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.chat-actions { display: flex; gap: 10px; align-items: center; }
.switch { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.chat { flex: 1; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 72%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); line-height: 1.4; box-shadow: inset 0 1px 0 rgba(255,255,255,0.02); }
.bubble .meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.bubble .sender { font-weight: 600; }
.bubble .phone { color: var(--primary); font-size: 11px; font-family: ui-monospace, monospace; }
.bubble .from { color: var(--muted); font-size: 12px; }
.bubble .time { color: var(--muted); font-size: 11px; margin-top: 6px; display: block; }
.me { align-self: flex-end; background: var(--bubble-me); }
.other { align-self: flex-start; background: var(--bubble-other); }

/* Responsive */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .content { min-height: auto; }
  .chat-card { height: 60dvh; }
}
