/* DripOff AI — "Calm Command" theme. Classic left sidebar, conversation-first. */
:root {
  --sidebar-bg: #1c2942;
  --sidebar-bg-2: #16213a;
  --sidebar-text: #b9c6de;
  --sidebar-text-dim: #7d8cab;
  --app-bg: #f3f5f9;
  --card: #ffffff;
  --border: #e3e8f0;
  --ink: #101c2e;
  --muted: #5d6b82;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: #eef0ff;
  --voice: #0e9f8a;
  --voice-soft: #e6f7f3;
  --warn: #b45309;
  --warn-soft: #fdf3e7;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 28, 46, 0.05), 0 8px 24px rgba(16, 28, 46, 0.06);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--app-bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
#app { height: 100%; }
.noscript { padding: 40px; text-align: center; }

/* ---------- auth / centered screens ---------- */
.center-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #e8ecf7 0%, var(--app-bg) 60%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 40px 36px;
  text-align: center;
}
.brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #7c6cf8);
  color: #fff; font-weight: 800; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.brand h1 { font-size: 24px; margin: 0; letter-spacing: -0.02em; }
.tagline { color: var(--muted); margin: 6px 0 28px; font-size: 15px; line-height: 1.5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 10px; cursor: pointer;
  font-family: var(--font); font-size: 15px; font-weight: 600;
  padding: 12px 20px; transition: transform 0.06s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none; color: inherit; background: #eef1f6;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-google { background: #fff; border: 1px solid var(--border); color: var(--ink); width: 100%; padding: 13px 20px; box-shadow: var(--shadow); }
.btn-google:hover { background: #f8fafc; }
.btn-voice { background: var(--voice); color: #fff; }
.btn-voice:hover { filter: brightness(0.94); }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-ghost:hover { background: #f1f4f9; }
.btn-danger { background: #fdecec; color: var(--danger); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.auth-error {
  background: #fdecec; color: #991b1b; border: 1px solid #f5c2c2;
  border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px;
}
.fineprint { margin-top: 22px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

/* ---------- step screens (health check / onboarding) ---------- */
.step-card {
  width: 100%; max-width: 620px;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); padding: 36px;
}
.step-progress { display: flex; gap: 8px; margin-bottom: 24px; }
.step-progress span { flex: 1; height: 6px; border-radius: 3px; background: #e7ebf2; }
.step-progress span.done { background: var(--accent); }
.step-card h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.01em; }
.step-card p.lead { color: var(--muted); margin: 0 0 24px; font-size: 15px; line-height: 1.6; }
.check-row {
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; background: #fbfcfe;
}
.check-row .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.check-row .grow { flex: 1; }
.check-row h3 { margin: 0 0 4px; font-size: 15px; }
.check-row p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.status-pill { font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.status-pill.ok { background: #e6f7f3; color: #0b7a68; }
.status-pill.live { background: var(--voice-soft); color: var(--voice); }
.meter { height: 10px; border-radius: 5px; background: #e7ebf2; overflow: hidden; margin-top: 10px; }
.meter > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--voice), #34d399); border-radius: 5px; transition: width 0.08s linear; }
.step-actions { display: flex; gap: 12px; margin-top: 26px; }
.step-actions .btn { flex: 1; }
.link-quiet { background: none; border: 0; color: var(--muted); font-size: 13.5px; cursor: pointer; text-decoration: underline; padding: 0; font-family: var(--font); }

.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.field input, .field textarea {
  width: 100%; font-family: var(--font); font-size: 16px;
  border: 1.5px solid var(--border); border-radius: 10px; padding: 13px 15px;
  background: #fbfcfe; color: var(--ink); outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12); }
.field textarea { min-height: 110px; resize: vertical; }
.question { font-size: 19px; font-weight: 650; margin: 0 0 18px; line-height: 1.45; }

/* approval gate */
.approval {
  border: 2px solid var(--accent); border-radius: var(--radius);
  background: linear-gradient(180deg, #fafbff, #f3f4ff);
  padding: 24px; margin-top: 8px;
}
.approval h3 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.approval .readback {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; margin: 14px 0; font-size: 14.5px; line-height: 1.7; white-space: pre-line;
}
.approval .row { display: flex; gap: 12px; }
.approval .row .btn { flex: 1; }
.approval .hint { font-size: 13px; color: var(--muted); margin-top: 12px; text-align: center; }

/* ---------- app shell ---------- */
.shell { display: flex; height: 100%; }
.sidebar {
  width: 264px; flex: none;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.sidebar .brand { justify-content: flex-start; padding: 0 10px; margin-bottom: 22px; }
.sidebar .brand h1 { color: #fff; font-size: 19px; }
.sidebar .brand .brand-mark { width: 36px; height: 36px; font-size: 18px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sidebar-text-dim); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; color: var(--sidebar-text);
  text-decoration: none; font-size: 14.5px; font-weight: 500; margin-bottom: 2px;
  border: 0; background: none; width: 100%; cursor: pointer; font-family: var(--font); text-align: left;
}
.nav-item svg { flex: none; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 650; }
.sidebar .spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06);
}
.user-chip img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #33415e; }
.user-chip .who { flex: 1; min-width: 0; }
.user-chip .who b { display: block; color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { font-size: 12px; color: var(--sidebar-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.icon-btn { background: none; border: 0; color: var(--sidebar-text-dim); cursor: pointer; padding: 8px; border-radius: 8px; display: inline-flex; }
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--border);
}
.topbar h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; flex: 1; }
.mode-toggle {
  display: flex; background: #eef1f6; border-radius: 999px; padding: 4px; gap: 2px;
}
.mode-toggle button {
  border: 0; background: none; border-radius: 999px; padding: 8px 18px;
  font-family: var(--font); font-size: 13.5px; font-weight: 650; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.mode-toggle button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(16, 28, 46, 0.12); }
.pending-flag {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--warn-soft); color: var(--warn); border: 1px solid #f3ddb8;
  font-size: 13px; font-weight: 650; border-radius: 999px; padding: 7px 14px; cursor: pointer;
}

.content { flex: 1; overflow-y: auto; padding: 28px; }
.narrow { max-width: 780px; margin: 0 auto; }

/* conversation */
.thread { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 78%; padding: 13px 17px; border-radius: 16px;
  font-size: 15px; line-height: 1.6;
}
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.agent .bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(16,28,46,0.04); }
.msg.system .bubble { background: var(--accent-soft); color: var(--accent-dark); font-size: 13.5px; margin: 0 auto; text-align: center; }
.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #a5b0c5; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.composer-zone { background: var(--card); border-top: 1px solid var(--border); padding: 16px 28px 20px; }
.composer { max-width: 780px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; font-family: var(--font); font-size: 15px; resize: none;
  border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 15px;
  min-height: 48px; max-height: 140px; outline: none; background: #fbfcfe; color: var(--ink);
}
.composer textarea:focus { border-color: var(--accent); background: #fff; }
.mic-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.mic-btn:hover { background: #e2e7ff; }
.mic-btn.listening { background: var(--voice); color: #fff; }
.mic-btn.listening::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 3px solid var(--voice); opacity: 0.5; animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(0.9); opacity: 0.6; } 100% { transform: scale(1.25); opacity: 0; } }
.mic-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.send-btn { height: 52px; }
.voice-hint { max-width: 780px; margin: 10px auto 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.voice-hint b { color: var(--voice); }

/* dashboard cards */
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: 0 1px 2px rgba(16,28,46,0.04); }
.card h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.card .big { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; margin: 2px 0 6px; }
.card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.card .row-btn { margin-top: 14px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; font-size: 14px; margin-top: 6px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 550; }
.section-title { font-size: 20px; margin: 0 0 4px; letter-spacing: -0.01em; }
.section-sub { color: var(--muted); margin: 0 0 20px; font-size: 14.5px; }
.notice { border-radius: var(--radius); padding: 16px 18px; font-size: 14px; line-height: 1.6; margin-bottom: 16px; border: 1px solid; }
.notice.info { background: var(--accent-soft); border-color: #d8dcff; color: #3730a3; }
.notice.ok { background: var(--voice-soft); border-color: #bfe9df; color: #0b6e5f; }
.notice.warn { background: var(--warn-soft); border-color: #f3ddb8; color: #92400e; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.badge.ok { background: #e6f7f3; color: #0b7a68; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.off { background: #eef1f6; color: var(--muted); }

@media (max-width: 900px) {
  .sidebar { width: 76px; padding: 16px 10px; }
  .sidebar .brand h1, .nav-item span, .nav-label, .user-chip .who { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 12px 16px; }
}
