/* LushAIgent website chat — styled after the LushAIgent mobile app
   (2026-10-27 operator request: same look so app ↔ web isn't confusing):
   light grey canvas, white rounded cards, deep navy text, violet accent,
   grey icon circles with violet glyphs. Appearance can force light/dark;
   otherwise it follows the OS. */

:root {
  --bg: #f3f3f5;
  --surface: #ffffff;
  --drawer: #f4f4f6;
  --fg: #1e1748;
  --muted: #6c6985;
  --border: #e7e6ec;
  --accent: #6d3cf2;
  --accent-fg: #ffffff;
  --accent-soft: #efe9ff;
  --icon-bg: #ececf0;
  --user-bubble: #ffffff;
  --code-bg: #f1f0f5;
  --danger: #c4261d;
  --wa: #25d366;
  --shadow: 0 1px 2px rgba(30, 23, 72, .06), 0 4px 16px rgba(30, 23, 72, .05);
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0e15;
    --surface: #1a1823;
    --drawer: #14131b;
    --fg: #efeef6;
    --muted: #a3a0b6;
    --border: #2b2937;
    --accent: #8b63ff;
    --accent-fg: #ffffff;
    --accent-soft: #261d45;
    --icon-bg: #262433;
    --user-bubble: #262433;
    --code-bg: #22202c;
    --danger: #ff6e5e;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0e15;
  --surface: #1a1823;
  --drawer: #14131b;
  --fg: #efeef6;
  --muted: #a3a0b6;
  --border: #2b2937;
  --accent: #8b63ff;
  --accent-fg: #ffffff;
  --accent-soft: #261d45;
  --icon-bg: #262433;
  --user-bubble: #262433;
  --code-bg: #22202c;
  --danger: #ff6e5e;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* Logo lockup: light art on light theme, dark art on dark theme. */
.lockup-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lockup-light { display: none; }
  :root:not([data-theme="light"]) .lockup-dark { display: block; }
}
:root[data-theme="dark"] .lockup-light { display: none; }
:root[data-theme="dark"] .lockup-dark { display: block; }
.lockup { height: 40px; width: auto; }

/* ── Buttons ── */
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-fg); border: none; border-radius: 999px;
  padding: 13px 22px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.pill-btn:disabled { opacity: .55; cursor: default; }
.pill-btn.ghost { background: var(--icon-bg); color: var(--fg); }
.pill-btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.text-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 6px 0; font-weight: 500; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: none; background: none; border-radius: 12px; cursor: pointer; color: var(--fg);
}
.icon-btn:hover { background: var(--icon-bg); }
.round-btn {
  display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none;
  border: none; border-radius: 50%; background: var(--surface); color: var(--fg); cursor: pointer; box-shadow: var(--shadow);
}

.boot { height: 100%; display: grid; place-items: center; }
.boot img { border-radius: 14px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* ── Login ── */
.login { height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--surface); border-radius: 24px;
  padding: 32px 24px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.55rem; font-weight: 700; margin: 22px 0 6px; }
.login-card form { display: grid; gap: 12px; margin-top: 22px; }
.login-card label { font-size: .92rem; color: var(--muted); }
.login-card input {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg); outline: none;
}
.login-card input:focus { border-color: var(--accent); }
#code { letter-spacing: .4em; font-family: var(--mono); text-align: center; font-size: 1.3rem; }
.error { color: var(--danger); font-size: .92rem; margin: 14px 0 0; }
.hint { font-size: .88rem; color: var(--muted); margin: 22px 0 0; }

/* ── Shell ── */
.app { height: 100%; display: flex; }
.drawer {
  width: 320px; flex: none; display: flex; flex-direction: column;
  background: var(--drawer); border-right: 1px solid var(--border); padding: 16px 12px 16px 16px;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; min-height: 52px; margin-bottom: 10px; }
.drawer-logo { display: flex; }
.search-row { padding: 0 4px 10px 0; }
.search-row input {
  width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); outline: none;
}
.search-row input:focus { border-color: var(--accent); }
.drawer-nav { display: flex; flex-direction: column; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.drawer-item {
  display: flex; align-items: center; gap: 18px; width: 100%; text-align: left;
  background: none; border: none; padding: 12px 8px; border-radius: 12px; cursor: pointer; font-size: 1.05rem;
}
.drawer-item:hover, .drawer-item.active { background: var(--icon-bg); }
.drawer-item .wa { color: var(--wa); }
.conv-list { flex: 1; overflow-y: auto; padding: 8px 0; margin-right: -4px; }
.conv {
  display: flex; align-items: center; border-radius: 12px; padding-right: 4px;
}
.conv:hover, .conv.active { background: var(--icon-bg); }
.conv a {
  flex: 1; min-width: 0; padding: 12px 10px; color: var(--fg); text-decoration: none; font-size: 1.02rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv .del { opacity: 0; width: 34px; height: 34px; color: var(--muted); }
.conv:hover .del, .conv.active .del { opacity: 1; }
.conv .del:hover { color: var(--danger); background: none; }
.conv-empty { color: var(--muted); font-size: .92rem; padding: 12px 10px; }
.drawer-foot { display: flex; align-items: center; gap: 12px; padding-top: 12px; }
.new-chat { flex: 1; padding: 15px 20px; font-size: 1.05rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; min-height: 76px; }
.conv-title {
  flex: 1; min-width: 0; margin: 0; font-size: 1rem; font-weight: 600; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.scroller { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }

/* Home (fresh chat): greeting over the blurred logo, starters at the foot. */
.home { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px 12px; }
.home-hero { flex: 1; position: relative; display: grid; place-items: center; min-height: 260px; }
.home-glow {
  position: absolute; width: 300px; height: 300px; max-width: 70vw; max-height: 70vw;
  filter: blur(16px) saturate(1.2); opacity: .35; pointer-events: none; border-radius: 50%;
}
.greeting { position: relative; margin: 0; text-align: center; font-size: clamp(1.45rem, 3.4vw, 2rem); line-height: 1.35; font-weight: 700; }
.starters { display: flex; flex-direction: column; }
.starter {
  display: flex; align-items: center; gap: 18px; width: 100%; text-align: left;
  background: none; border: none; padding: 16px 8px; border-radius: 12px; cursor: pointer; font-size: 1.05rem;
}
.starter:hover { background: var(--icon-bg); }
.starter .lead { color: var(--accent); }
.starter .txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.starter .go { color: var(--muted); }

.thread { width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 20px 12px; }
.load-earlier { display: block; margin: 0 auto 16px; }
.messages { display: flex; flex-direction: column; gap: 20px; }

.msg { display: flex; flex-direction: column; gap: 8px; max-width: 100%; }
.msg.user { align-items: flex-end; }
.msg.user .bubble {
  background: var(--user-bubble); padding: 11px 16px; border-radius: 20px 20px 6px 20px;
  max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: var(--shadow);
}
.msg.assistant .bubble { overflow-wrap: anywhere; }
.msg.error .bubble { color: var(--danger); }
.msg-actions { display: flex; gap: 2px; margin-left: -8px; }
.msg-actions .icon-btn { width: 34px; height: 34px; color: var(--muted); }
.msg-actions .icon-btn svg.i { width: 18px; height: 18px; }
.msg-actions .icon-btn.on { color: var(--accent); }
.msg-actions .icon-btn.on svg.i { fill: currentColor; }

/* Rendered reply markup */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md h1, .md h2, .md h3, .md h4 { font-size: 1.05rem; margin: 1em 0 .4em; line-height: 1.3; }
.md h1 { font-size: 1.25rem; }
.md h2 { font-size: 1.15rem; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.4em; }
.md li { margin: .2em 0; }
.md li > ul, .md li > ol { margin: .2em 0; }
.md code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: .1em .35em; border-radius: 6px; }
.md pre { background: var(--code-bg); padding: 12px 14px; border-radius: 12px; overflow-x: auto; margin: 0 0 .7em; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 .7em; padding-left: 12px; border-left: 3px solid var(--border); color: var(--muted); }
.md .table-wrap { overflow-x: auto; margin: 0 0 .7em; }
.md table { border-collapse: collapse; font-size: .93rem; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--code-bg); }
.md hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--accent); color: var(--accent); background: transparent;
  border-radius: 999px; padding: 7px 15px; cursor: pointer; font-size: .92rem;
}
.chip:hover { background: var(--accent-soft); }
.chip:disabled { opacity: .5; cursor: default; }
.chip.approve { background: var(--accent); color: var(--accent-fg); }
.cta { align-self: flex-start; padding: 10px 18px; font-size: .95rem; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg);
  background: var(--surface); border-radius: 14px; padding: 10px 14px; font-size: .92rem; box-shadow: var(--shadow);
}
.attachment img { max-width: 260px; max-height: 260px; border-radius: 10px; display: block; }
.attachment.image { padding: 4px; }
.card { background: var(--surface); border-radius: 16px; padding: 14px 16px; font-size: .94rem; box-shadow: var(--shadow); }
.card .name { font-weight: 600; }
.approval p { margin: 0 0 10px; }

/* Composer: the app's rounded pill. */
.composer-wrap { padding: 8px 20px calc(14px + env(safe-area-inset-bottom)); }
.composer-wrap > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.status { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--muted); padding: 0 8px 10px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 30px; padding: 8px 8px 8px 22px;
  box-shadow: var(--shadow);
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1; border: none; outline: none; resize: none; background: transparent;
  max-height: 200px; padding: 11px 0; min-width: 0; font-size: 1.02rem;
}
.composer textarea::placeholder { color: var(--muted); }
.send {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: var(--accent-fg); display: grid; place-items: center;
}
.send svg.i { width: 20px; height: 20px; }
.send:disabled { background: var(--icon-bg); color: var(--muted); cursor: default; }

/* ── Panels (Profile, Settings, sub-screens) ── */
.panel { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 8px; width: 100%; max-width: 720px; margin: 0 auto; }
.panel-head h2 { margin: 0; font-size: 1.6rem; font-weight: 600; }
.panel-body { flex: 1; overflow-y: auto; }
.panel-inner { width: 100%; max-width: 720px; margin: 0 auto; padding: 12px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.group { background: var(--surface); border-radius: 22px; padding: 4px 0; box-shadow: var(--shadow); }
.row {
  display: flex; align-items: center; gap: 18px; width: 100%; text-align: left;
  background: none; border: none; padding: 14px 22px; cursor: pointer; font-size: 1.08rem; color: var(--fg); text-decoration: none;
}
.row + .row { border-top: 1px solid var(--border); }
.group .row:hover { background: var(--accent-soft); }
.group .row:first-child { border-radius: 22px 22px 0 0; }
.group .row:last-child { border-radius: 0 0 22px 22px; }
.group .row:only-child { border-radius: 22px; }
.row .ico {
  width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--icon-bg); color: var(--accent);
  display: grid; place-items: center;
}
.row .ico.danger { color: var(--danger); }
.row .label { flex: 1; min-width: 0; }
.row .sub { display: block; font-size: .86rem; color: var(--muted); margin-top: 2px; }
.row .val { color: var(--muted); font-size: .92rem; text-align: right; }
.row.static { cursor: default; }
.row.static:hover { background: none; }

.profile-head { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 8px; }
.avatar {
  width: 120px; height: 120px; border-radius: 50%; background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; overflow: hidden; margin-bottom: 10px;
}
.avatar svg.i { width: 46px; height: 46px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 1.35rem; font-weight: 600; }
.profile-phone { color: var(--muted); }
.brand-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 0 8px; color: var(--muted); }
.brand-foot .lockup { height: 52px; }

/* Forms + toggles inside panels */
.field { display: grid; gap: 6px; padding: 12px 22px; }
.field + .field { border-top: 1px solid var(--border); }
.field label { font-size: .88rem; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); outline: none;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .15s; pointer-events: none; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.radio-mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex: none; display: grid; place-items: center; }
.row.selected .radio-mark { border-color: var(--accent); }
.row.selected .radio-mark::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.note { color: var(--muted); font-size: .92rem; margin: 0 6px; }
.section-title { font-size: .85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 8px 6px -6px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.item-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item-text .sub { display: block; }
.item .icon-btn { color: var(--muted); }
.item .icon-btn:hover { color: var(--danger); }
.empty-note { text-align: center; color: var(--muted); padding: 40px 16px; }

.usage-big { padding: 20px 22px 6px; }
.usage-big .num { font-size: 2rem; font-weight: 700; }
.usage-bar { height: 10px; background: var(--icon-bg); border-radius: 5px; overflow: hidden; margin: 12px 22px 6px; }
.usage-bar div { height: 100%; background: var(--accent); border-radius: 5px; }
.usage-bar div.warn { background: var(--danger); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding: 12px 22px 18px; }
.spark div { flex: 1; background: var(--accent); opacity: .75; border-radius: 3px 3px 0 0; min-height: 2px; }

.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 50;
  background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .92rem;
}

.only-mobile { display: none; }
.scrim { display: none; }

@media (max-width: 860px) {
  .only-mobile { display: inline-grid; }
  .drawer {
    position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(340px, 86vw);
    transform: translateX(-100%); transition: transform .22s ease; border-right: none;
    border-radius: 0 28px 28px 0;
  }
  .app.nav-open .drawer { transform: none; box-shadow: 8px 0 32px rgba(0, 0, 0, .18); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(30, 23, 72, .35); }
  .topbar { padding: 12px 16px; min-height: 70px; }
  .thread, .home { padding-left: 16px; padding-right: 16px; }
  .composer-wrap { padding-left: 16px; padding-right: 16px; }
  .msg.user .bubble { max-width: 92%; }
  .conv .del { opacity: 1; }
  .row { padding: 14px 18px; gap: 16px; }
}
