:root {
  --bg-1: #f8f4ec;
  --bg-2: #e5efe9;
  --panel: rgba(255, 255, 255, 0.78);
  --line: rgba(18, 41, 32, 0.14);
  --text: #1a2f26;
  --muted: #4d6459;
  --accent: #0f7a62;
  --accent-2: #ff9f43;
  --danger: #a43434;
  --shadow: 0 14px 45px rgba(18, 48, 37, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background: radial-gradient(1300px 700px at 15% 0%, #fff4d4, transparent),
    radial-gradient(1000px 600px at 80% 10%, #caefe1, transparent),
    linear-gradient(150deg, var(--bg-1), var(--bg-2));
  overflow: hidden;
}

body.side-open {
  overflow: hidden;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: radial-gradient(#000 0.55px, transparent 0.55px);
  background-size: 3px 3px;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
}

.panel {
  backdrop-filter: blur(10px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.side-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(360px, 92vw);
  padding: 14px 18px 18px;
  overflow: auto;
  display: block;
  border-radius: 0 18px 18px 0;
  border-left: none;
  transform: translateX(-106%);
  transition: transform 0.22s ease;
  z-index: 60;
}

.side-panel-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.side-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
}

.side-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 27, 21, 0.34);
  backdrop-filter: blur(2px);
  z-index: 55;
}

body.side-open .side-panel {
  transform: translateX(0);
}

body.side-open .side-backdrop {
  display: block !important;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 0;
  height: 100vh;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.brand h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.brand-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(125deg, var(--accent), var(--accent-2));
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.card-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.card-toggle h2 {
  margin: 0;
}

.toggle-icon {
  font-size: 1rem;
  color: var(--muted);
  transition: transform 0.16s ease;
}

.card-toggle[aria-expanded="true"] .toggle-icon {
  transform: rotate(180deg);
}

.card-body {
  margin-top: 10px;
}

.card-body.is-collapsed {
  display: none;
}

.card.compact {
  padding-bottom: 14px;
}

.meta-list {
  margin: 0;
}

.meta-list div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding: 6px 0;
  font-size: 0.92rem;
}

.meta-list div:last-child {
  border-bottom: none;
}

.meta-list dt {
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
  font-weight: 600;
}

.row {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

label {
  color: var(--muted);
  font-size: 0.85rem;
}

select,
input[type="email"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px;
  font: inherit;
  background: #fff;
}

.chat-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-head h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.chat-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.chat-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.messages {
  padding: 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: 0 0 34px;
  box-shadow: 0 3px 10px rgba(18, 48, 37, 0.16);
}

.msg {
  max-width: min(720px, 88%);
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.42;
  white-space: pre-wrap;
  animation: rise 0.22s ease;
}

.msg.user {
  background: linear-gradient(135deg, #0f7a62, #149c73);
  color: #effff8;
}

.msg.assistant {
  background: #ffffff;
  border: 1px solid var(--line);
}

.msg-tools {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.msg-tools button {
  font-size: 0.78rem;
  padding: 5px 9px;
}

.correction {
  border: 1px solid #f8d5d5;
  background: #fff4f4;
  color: #5f2e2e;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.audio-player {
  margin-top: 8px;
  width: 100%;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 10px;
}

textarea {
  width: 100%;
  min-height: 78px;
  max-height: 160px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font: inherit;
  background: rgba(255, 255, 255, 0.9);
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.voice-wave {
  display: none;
  border: 1px solid rgba(37, 92, 145, 0.28);
  background: linear-gradient(140deg, rgba(246, 251, 255, 0.92), rgba(233, 245, 255, 0.95));
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.voice-wave.active {
  display: block;
  animation: rise 0.2s ease;
}

.voice-wave-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: #2b4f78;
  margin-bottom: 6px;
}

.voice-wave-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #df3f61;
  box-shadow: 0 0 0 0 rgba(223, 63, 97, 0.5);
  animation: recordPulse 1.2s infinite;
}

.voice-wave-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: #26527e;
}

#voiceWaveCanvas {
  display: block;
  width: 100%;
  height: 50px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(239, 247, 255, 0.8));
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: 0.18s ease;
}

.btn-full {
  width: 100%;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), #13a37d);
  color: #fff;
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 122, 98, 0.25);
}

.btn.ghost {
  background: linear-gradient(120deg, #3684cf, #2a69ab);
  border-color: rgba(30, 86, 140, 0.35);
  color: #fff;
}

.btn.ghost:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(42, 105, 171, 0.26);
}

.btn.recording {
  background: #ffe6e6;
  border-color: #e8aaaa;
  color: var(--danger);
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  font-size: 1.15rem;
}

#recordBtn {
  background: linear-gradient(120deg, #e34a5a, #c6367e);
  border-color: rgba(150, 30, 85, 0.35);
}

#sendBtn,
#saveSettingsBtn {
  background: linear-gradient(120deg, var(--accent), #13a37d);
}

#clearHintsBtn {
  background: linear-gradient(120deg, #ff9f43, #f07f29);
  border-color: rgba(176, 92, 26, 0.35);
}

#refreshStatsBtn {
  background: linear-gradient(120deg, #4e7de6, #2b63d1);
  border-color: rgba(35, 79, 167, 0.35);
}

#authOpenBtnTop {
  background: linear-gradient(120deg, #6c86e8, #406ddf);
  border-color: rgba(46, 77, 172, 0.35);
}

#authOpenBtnSide {
  margin-top: 10px;
}

.msg-tools .btn.ghost {
  background: linear-gradient(120deg, #00a28a, #0b7f98);
  border-color: rgba(0, 110, 110, 0.35);
}

@keyframes recordPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(223, 63, 97, 0.55);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(223, 63, 97, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(223, 63, 97, 0);
  }
}

.suggestions {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--line);
}

.suggestions h3 {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
}

.suggestion-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.suggestion-card h4 {
  margin: 0 0 6px;
  font-size: 0.86rem;
  font-family: "Space Grotesk", sans-serif;
  color: var(--accent);
}

.suggestion-card p {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.suggestion-card small {
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 12, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  width: min(640px, 100%);
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 18px;
}

.modal-card h2 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 32, 25, 0.38);
  backdrop-filter: blur(4px);
}

.auth-card {
  position: relative;
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 50px rgba(17, 38, 30, 0.24);
  padding: 18px;
  animation: rise 0.2s ease;
}

.auth-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--muted);
}

.auth-card h3 {
  margin: 4px 0 2px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
}

.auth-subtitle {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.auth-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.auth-tab.is-active {
  background: linear-gradient(130deg, #ebf9f4, #f2fbf7);
  color: var(--accent);
  border-color: rgba(15, 122, 98, 0.35);
}

.auth-form {
  display: grid;
  gap: 8px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: #2f74bf;
  padding: 2px 4px;
  text-align: left;
  font-weight: 500;
}

.link-btn:hover {
  text-decoration: underline;
}

.auth-hint {
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 0.88rem;
  background: #f4fbf8;
  border: 1px solid rgba(15, 122, 98, 0.24);
  color: #0f6b56;
}

.auth-hint.error {
  background: #fff3f3;
  border-color: rgba(164, 52, 52, 0.26);
  color: #8d2f2f;
}

.auth-session {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.pricing-offer-card {
  width: min(680px, 100%);
}

.pricing-offer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pricing-offer-plan {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.pricing-offer-plan.featured {
  border-color: rgba(15, 122, 98, 0.35);
  box-shadow: 0 10px 28px rgba(15, 122, 98, 0.12);
}

.pricing-offer-plan-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
}

.pricing-offer-pill {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.pricing-offer-price {
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
}

.pricing-offer-caption {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 0.83rem;
}

.hidden {
  display: none !important;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    padding: 0;
  }

  .chat-panel {
    min-height: 100vh;
  }

  .suggestions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .pricing-offer-grid {
    grid-template-columns: 1fr;
  }
}
