:root {
  color-scheme: light;
  --bg: #f7fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d9e2ec;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b91c1c;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
  max-width: 460px;
  margin: 0 auto;
}

.brand-lock {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.login-view h1,
.app-header h1 {
  margin: 0;
  letter-spacing: 0;
}

.login-view h1 {
  font-size: 34px;
  line-height: 1.08;
}

.login-view p {
  color: var(--muted);
  margin: 12px 0 24px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  font-weight: 700;
}

.login-form input,
.composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}

.login-form input {
  min-height: 52px;
  padding: 0 14px;
  font-size: 20px;
}

.login-form input:focus,
.composer textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.login-form button,
.composer button {
  min-height: 52px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.chat-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.app-header h1 {
  font-size: 22px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #e6fffb;
  color: var(--accent-dark);
  font-weight: 900;
}

.quick-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.quick-actions button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: #eef6f6;
  color: var(--accent-dark);
  font-weight: 750;
}

.messages {
  padding: 16px;
  overflow-y: auto;
}

.message {
  max-width: 92%;
  padding: 12px 14px;
  margin: 0 0 12px;
  border-radius: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  margin-left: auto;
  background: var(--accent);
  color: white;
}

.message.assistant {
  margin-right: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.message.system {
  max-width: 100%;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #7c2d12;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
}

.composer textarea {
  min-height: 52px;
  max-height: 140px;
  resize: none;
  padding: 14px;
}

.composer button {
  min-width: 86px;
  padding: 0 14px;
}

.status-text {
  min-height: 24px;
  color: var(--danger);
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 760px) {
  .chat-view {
    max-width: 820px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: var(--bg);
  }
}

