@import url('data:text/css,');

:root {
  color-scheme: light;
  --ink: #1d2927;
  --muted: #677672;
  --paper: #f3f5f2;
  --surface: #ffffff;
  --line: #dce4df;
  --teal: #176f65;
  --teal-dark: #10584f;
  --coral: #c85e47;
  --user: #e7f2ef;
  --shadow: 0 18px 55px rgba(28, 54, 48, .09);
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 18% 0%, #dcebe5 0, transparent 42%), var(--paper); }
.login-panel { width: min(100%, 410px); padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 7px; background: var(--teal); color: white; font-family: Georgia, serif; font-size: 24px; font-weight: 700; }
.eyebrow { margin: 24px 0 8px; color: var(--coral); font-size: 11px; font-weight: 750; letter-spacing: .12em; }
h1 { margin: 0; font-size: 25px; line-height: 1.2; }
.muted { color: var(--muted); font-size: 13px; }
.login-panel form { display: grid; gap: 12px; margin-top: 28px; }
.login-panel label { font-size: 13px; font-weight: 650; }
.login-panel input { height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 5px; background: #fcfdfc; font-size: 20px; letter-spacing: .2em; }
.otp-setup { display: grid; justify-items: center; gap: 8px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.otp-setup img { width: 176px; height: 176px; image-rendering: pixelated; }
.otp-setup p { max-width: 290px; margin: 0; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.45; }
.primary-button { min-height: 42px; padding: 0 18px; border: 0; border-radius: 5px; background: var(--teal); color: white; font-weight: 650; }
.primary-button:hover { background: var(--teal-dark); }
.error-text { min-height: 18px; margin: 0; color: #a63e32; font-size: 13px; }

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(20px, calc((100vw - 1060px) / 2)); background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--teal-dark); font-size: 18px; line-height: 1; }
.icon-button:hover { background: #edf4f1; }
.brand { display: flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; }
.brand .brand-mark { width: 34px; height: 34px; font-size: 20px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.connection-status { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; }
.connection-status i { width: 8px; height: 8px; border-radius: 50%; background: #3b9a75; }
.quiet-button { min-height: 36px; padding: 0 12px; color: var(--teal-dark); background: transparent; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; font-weight: 600; }
.quiet-button:hover { background: #edf4f1; }
.chat-layout { width: min(100%, 820px); min-height: 0; flex: 1; display: flex; flex-direction: column; margin: 0 auto; padding: 30px 24px 20px; }
.conversation-heading { display: flex; justify-content: space-between; align-items: end; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.conversation-heading .eyebrow { margin: 0 0 7px; }
.conversation-heading h1 { font-size: 21px; }
.messages { flex: 1; min-height: 220px; overflow-y: auto; padding: 24px 0; }
.message { max-width: 88%; margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 3px 12px rgba(28,54,48,.035); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 14px; }
.message.user { margin-left: auto; background: var(--user); border-color: #cee3dc; }
.message-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.message.error { border-color: #ecc4bd; color: #8d392f; }
.empty-state { margin: auto; padding: 35px 20px; text-align: center; }
.empty-state strong { display: block; margin-bottom: 8px; font-family: Georgia, serif; font-size: 23px; font-weight: 500; }
.composer { padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); }
.composer textarea { display: block; width: 100%; min-height: 56px; max-height: 220px; padding: 9px 10px; resize: vertical; border: 0; outline: 0; color: var(--ink); background: transparent; line-height: 1.5; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 7px; border-top: 1px solid #eef1ee; }
.composer-footer .muted { font-size: 11px; }
button:disabled { opacity: .55; cursor: wait; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.danger-button { color: #a63e32; border-color: #e7cdc7; }
.danger-button:hover { background: #f7ece9; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(20, 38, 34, .42); }
.drawer { position: fixed; top: 0; left: 0; z-index: 50; display: flex; flex-direction: column; width: min(86vw, 340px); height: 100dvh; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(-100%); transition: transform .22s ease; overflow: hidden; }
.drawer.open { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; }
.drawer-header .eyebrow { margin: 0; }
.drawer-new { width: 100%; margin: 16px 0 12px; }
.conversation-list { flex: 1; min-height: 0; margin: 0; padding: 0; list-style: none; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.conversation-item { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 7px; background: #fcfdfc; overflow: hidden; }
.conversation-item.active { border-color: var(--teal); background: var(--user); }
.conversation-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 11px 12px; border: 0; background: transparent; text-align: left; color: inherit; }
.conversation-open:hover { background: #edf4f1; }
.conversation-item.active .conversation-open:hover { background: transparent; }
.conversation-item-title { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-item-meta { color: var(--muted); font-size: 11px; }
.conversation-remove { width: 42px; flex: none; border: 0; border-left: 1px solid var(--line); background: transparent; color: #a63e32; font-size: 17px; }
.conversation-remove:hover { background: #f7ece9; }
.conversation-empty { padding: 14px 4px; color: var(--muted); font-size: 13px; }

@media (max-width: 600px) {
  .topbar { height: 60px; padding: 0 15px; }
  .top-actions { gap: 10px; }
  .connection-status { font-size: 11px; }
  .quiet-button { padding: 0 9px; }
  .chat-layout { padding: 22px 14px max(14px, env(safe-area-inset-bottom)); }
  .messages { padding: 18px 0; }
  .message { max-width: 96%; }
  .login-panel { padding: 26px 22px; }
}
