:root {
  --bg: #f3f8f7;
  --phone: #ffffff;
  --ink: #1d2430;
  --muted: #7a858f;
  --line: #d7e5e2;
  --brand: #63dda2;
  --brand-strong: #12a884;
  --brand-deep: #0f5f65;
  --blue-bubble: #d6f6ee;
  --sidebar: #f8fcfb;
  --sidebar-soft: #e5f7ef;
  --shadow: 0 18px 48px rgba(10, 44, 46, 0.16);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button,
label {
  cursor: pointer;
}

textarea {
  resize: none;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-panel {
  width: min(460px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand,
.sidebar-brand,
.top-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.login-brand {
  color: var(--brand-strong);
  font-weight: 800;
}

.login-brand img {
  width: min(320px, 80vw);
  height: auto;
}

.sidebar-brand img {
  width: 230px;
  height: auto;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #dff8eb;
  color: var(--brand-strong);
  font-weight: 900;
  font-size: 13px;
}

.login-panel h1 {
  margin: 20px 0 8px;
  font-size: 34px;
}

.login-panel p,
.site-link {
  color: #5f6974;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.password-row input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
}

.password-row button {
  border: 0;
  border-radius: 12px;
  background: var(--brand-strong);
  color: #fff;
  font-weight: 800;
  padding: 0 18px;
}

.site-link {
  display: inline-flex;
  margin-top: 18px;
  font-weight: 750;
  text-decoration: none;
}

.error-text {
  margin: 0;
  color: #b42318;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 18px 16px;
  background: linear-gradient(180deg, #fbfefd 0%, var(--sidebar) 48%, #eef8f5 100%);
  color: #20343a;
  overflow: hidden;
  transition: transform 180ms ease, opacity 180ms ease;
}

.app-shell.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
}

.sidebar-brand {
  display: none;
}

.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}

.sidebar-brand small {
  color: #607085;
  font-size: 13px;
}

.new-chat-button,
.ghost-button,
.session-button {
  border: 1px solid #c9dde2;
  border-radius: 12px;
  background: transparent;
  color: inherit;
}

.new-chat-button {
  min-height: 42px;
  background: #e9f8f1;
  color: var(--brand-deep);
  font-weight: 850;
}

.history-nav {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.history-title {
  color: #61706f;
  font-size: 12px;
  text-transform: uppercase;
}

.sessions-list {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  align-content: start;
  gap: 6px;
  padding-right: 2px;
}

.session-button {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  text-align: left;
  color: #24393e;
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.session-button.active,
.session-button:hover {
  background: var(--sidebar-soft);
  border-color: #bfe5d7;
}

.session-button strong,
.session-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-button small {
  margin-top: 2px;
  color: #687876;
  font-size: 12px;
}

.sidebar-footer {
  width: 100%;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  align-content: end;
  text-align: center;
}

.sidebar-footer a {
  color: var(--brand-deep);
  text-decoration: none;
  font-weight: 750;
  font-size: 13px;
}

.footer-logo {
  width: 100%;
  display: flex;
  justify-content: center;
}

.footer-logo img {
  width: min(150px, 72%);
  height: auto;
  display: block;
  margin: 0 auto;
}

.landing-link {
  opacity: 0.86;
}

.ghost-button {
  min-height: 38px;
}

.phone-shell {
  position: relative;
  justify-self: center;
  width: min(100%, 980px);
  height: 100vh;
  display: grid;
  grid-template-rows: 110px 1fr auto;
  background: var(--phone);
  box-shadow: 0 18px 56px rgba(38, 52, 71, 0.16);
  overflow: hidden;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 18px clamp(22px, 5vw, 46px) 10px;
  background: #fff;
  z-index: 2;
}

.top-logo {
  justify-content: flex-start;
  width: min(230px, 34vw);
  user-select: none;
}

.top-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.top-title {
  width: 0;
  overflow: hidden;
  color: transparent;
  font-size: 1px;
  user-select: none;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #eef7f4;
  color: #22242d;
  font-size: 34px;
  line-height: 1;
}

.top-spacer {
  width: 42px;
  height: 42px;
  margin-left: auto;
}

.menu-button {
  color: #253247;
  font-weight: 300;
  line-height: 1;
}

.menu-button span {
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: transparent;
  display: grid;
  place-items: center;
  transform: translateY(-1px);
}

.add-button {
  background: var(--brand);
  font-weight: 300;
}

.chat-stage {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px clamp(20px, 5vw, 44px) 14px;
  background: #fff;
  scroll-behavior: smooth;
}

.welcome-card {
  margin: auto;
  align-self: center;
  display: grid;
  justify-items: center;
  gap: 18px;
  color: #3d3d47;
  text-align: center;
}

.welcome-logo {
  display: none;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 24px;
  background: #eef8f7;
  color: var(--brand-strong);
  font-weight: 900;
}

.welcome-card h1 {
  margin: 0;
  font-size: clamp(44px, 8vw, 68px);
  font-weight: 360;
}

.welcome-card p {
  max-width: 560px;
  margin: -10px 0 0;
  font-size: clamp(30px, 6vw, 56px);
  font-weight: 320;
  line-height: 1.25;
}

.round-upload-button {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  margin-top: 24px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #20242c;
  font-size: 54px;
}

.message {
  max-width: min(740px, 88%);
  padding: 17px 20px;
  border-radius: 18px;
  line-height: 1.45;
  white-space: pre-wrap;
  font-size: clamp(15px, 1.4vw, 19px);
}

.message.user {
  align-self: flex-end;
  background: var(--blue-bubble);
  color: #111827;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: #f7fbfa;
  color: #2f3742;
  border: 1px solid #dcebe7;
  border-bottom-left-radius: 4px;
}

.message.thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-strong);
  animation: pulse-dot 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 160ms;
}

.typing-dot:nth-child(3) {
  animation-delay: 320ms;
}

@keyframes pulse-dot {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.message-media {
  align-self: flex-start;
  display: grid;
  gap: 8px;
  width: min(580px, 78%);
  color: #8a9099;
  text-align: center;
}

.message-media.user-media {
  align-self: flex-end;
  width: min(430px, 58%);
}

.message-media img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(18, 31, 38, 0.14);
  background: #f5f7f8;
}

.message-media strong {
  font-weight: 500;
  color: #9aa1aa;
}

.bottom-composer {
  display: grid;
  gap: 10px;
  padding: 8px clamp(20px, 5vw, 46px) 24px;
  background: #fff;
}

.composer-upload-button {
  justify-self: start;
  min-height: 38px;
  border: 1px solid #b8e4d6;
  border-radius: 999px;
  background: #f8fcfb;
  color: var(--brand-deep);
  font-weight: 750;
  padding: 0 14px;
}

.progress-wrap {
  display: grid;
  gap: 8px;
  margin-bottom: 2px;
}

.stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #9aa1aa;
  font-size: 14px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9f2f4;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-deep), var(--brand));
  transition: width 500ms ease;
}

.step-dots {
  display: flex;
  justify-content: center;
  gap: 11px;
  margin: 4px 0 2px;
}

.step-dots span {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--brand);
  opacity: 0.8;
}

.step-dots span.active {
  background: var(--brand-deep);
  opacity: 1;
}

.selected-file-bar {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 8px 10px;
  border: 1px solid #d9e5e8;
  border-radius: 18px;
  background: #f8fbfb;
}

.selected-file-bar img {
  width: 58px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
}

.selected-file-bar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #5f6974;
}

.selected-file-bar button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: #e8eef0;
  color: #3b4149;
  font-size: 24px;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: end;
}

.chat-form textarea {
  width: 100%;
  min-height: 60px;
  max-height: 150px;
  border: 2px solid #d7dadd;
  border-radius: 16px;
  padding: 16px 18px;
  outline: none;
  color: #343a43;
  font-size: 18px;
}

.send-button {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 999px;
  background: #bdf2fb;
  color: #1f2730;
  font-size: 38px;
  transform: rotate(-8deg);
}

.job-footnote {
  display: none;
  justify-content: space-between;
  gap: 12px;
  color: #a2a9b1;
  font-size: 12px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.36);
}

.upload-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 21;
  width: min(760px, 100vw);
  transform: translateX(-50%);
  display: grid;
  gap: 16px;
  padding: 18px 24px 34px;
  border-radius: 30px 30px 0 0;
  background: #eef9fb;
  box-shadow: 0 -20px 50px rgba(20, 34, 49, 0.18);
}

.sheet-handle {
  justify-self: center;
  width: 56px;
  height: 6px;
  border-radius: 999px;
  background: #2f313a;
  opacity: 0.8;
}

.sheet-option {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 18px;
  min-height: 90px;
  padding: 0 18px;
  border: 2px solid #aab3ba;
  border-radius: 16px;
  background: transparent;
  color: #5b616b;
  font-size: 24px;
}

.sheet-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #dff8eb;
  color: var(--brand-strong);
  font-size: 14px;
  font-weight: 900;
}

.upload-sheet input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
    background: #fff;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(292px, 82vw);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .phone-shell {
    width: 100%;
    height: 100vh;
    box-shadow: none;
  }

  .top-logo {
    visibility: visible;
    width: min(210px, 46vw);
  }
}

@media (min-width: 901px) {
  .phone-shell {
    border-left: 1px solid #d7e2e5;
    border-right: 1px solid #d7e2e5;
  }

  .app-shell.sidebar-collapsed .phone-shell {
    width: min(100%, 1040px);
  }
}

@media (max-width: 520px) {
  .phone-shell {
    grid-template-rows: 72px 1fr auto;
  }

  .app-topbar {
    padding: 14px 20px 8px;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

  .welcome-card h1 {
    font-size: 46px;
  }

  .welcome-card p {
    font-size: 34px;
  }

  .round-upload-button {
    width: 96px;
    height: 96px;
  }

  .message {
    max-width: 94%;
    font-size: 17px;
  }

  .sheet-option {
    min-height: 82px;
    font-size: 20px;
  }
}
