:root {
  --ink: #29251f;
  --muted: #776d60;
  --paper: #fffaf1;
  --paper-soft: rgba(255, 250, 241, 0.76);
  --line: rgba(86, 67, 46, 0.15);
  --orange: #d86d42;
  --orange-dark: #a94e2d;
  --sage: #9cad88;
  --bot: #fff0df;
  --user: #2f2a22;
  --shadow: 0 30px 80px rgba(78, 54, 30, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "SUIT", sans-serif;
  background:
    radial-gradient(circle at 8% 12%, rgba(216, 109, 66, 0.24), transparent 27%),
    radial-gradient(circle at 90% 88%, rgba(156, 173, 136, 0.24), transparent 28%),
    linear-gradient(135deg, #faf5eb 0%, #eee0cd 100%);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 64px);
  margin: 32px auto;
  display: grid;
  grid-template-columns: 0.88fr 1.32fr;
  gap: 22px;
}

.hero-panel, .chat-panel {
  border: 1px solid var(--line);
  border-radius: 34px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 52px);
  background: var(--paper-soft);
}

.hero-panel::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -80px;
  width: 260px;
  height: 260px;
  border-radius: 42% 58% 65% 35%;
  background: linear-gradient(140deg, rgba(216, 109, 66, 0.28), rgba(255, 250, 241, 0));
  transform: rotate(22deg);
}

.signal-line, .eyebrow, .chat-kicker {
  color: var(--orange-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.signal-line { display: flex; align-items: center; gap: 8px; margin-bottom: 56px; }
.signal-line span { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 5px rgba(156, 173, 136, 0.18); }
.eyebrow { margin: 0 0 14px; }
h1 { margin: 0; font-size: clamp(2.8rem, 5vw, 5.4rem); line-height: 0.98; letter-spacing: -0.07em; }
h1 em { color: var(--orange); font-style: normal; }
.hero-copy { max-width: 31rem; margin: 28px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.8; word-break: keep-all; }

.identity-card { position: relative; z-index: 1; display: flex; gap: 14px; align-items: center; max-width: 340px; margin-top: 40px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 250, 241, 0.72); }
.jini-mark, .jini-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 16px; background: var(--ink); color: #fff9ee; font-weight: 800; }
.jini-mark { width: 42px; height: 42px; font-size: 1.2rem; }
.identity-card strong, .identity-card span { display: block; }
.identity-card strong { font-size: 0.88rem; }
.identity-card span { margin-top: 4px; color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.hero-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; margin-top: 30px; }
.admin-link { color: var(--muted); font-size: 0.82rem; text-decoration: none; }
.status-subtle { color: var(--muted); font-size: 0.76rem; }

.chat-panel { min-height: 78vh; display: grid; grid-template-rows: auto 1fr; padding: 24px; background: rgba(255, 252, 246, 0.86); }
.chat-header { display: flex; align-items: center; gap: 13px; padding: 8px 8px 22px; border-bottom: 1px solid var(--line); }
.jini-avatar { width: 48px; height: 48px; border-radius: 18px; font-size: 1.25rem; background: var(--orange); }
.chat-kicker { margin: 0 0 3px; font-size: 0.64rem; }
.chat-header h2 { margin: 0; font-size: 1.35rem; letter-spacing: -0.04em; }
.chat-header p:last-child { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; }
.mode-badge { margin-left: auto; padding: 8px 11px; border-radius: 99px; background: rgba(156, 173, 136, 0.18); color: #687759; font-size: 0.72rem; font-weight: 700; }

.auth-panel { align-self: center; max-width: 460px; width: 100%; margin: 20px auto; padding: 28px; border: 1px solid var(--line); border-radius: 26px; background: rgba(255, 248, 236, 0.75); }
.auth-intro { display: flex; gap: 12px; align-items: start; }
.auth-dot { width: 11px; height: 11px; margin-top: 5px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 6px rgba(216, 109, 66, 0.12); }
.auth-intro strong { font-size: 1.04rem; }
.auth-intro p { margin: 5px 0 0; color: var(--muted); font-size: 0.82rem; }
.auth-tabs { display: flex; gap: 6px; margin: 28px 0 18px; padding: 4px; border-radius: 14px; background: rgba(86, 67, 46, 0.06); }
.auth-tab { flex: 1; border: 0; border-radius: 10px; padding: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 0.84rem; cursor: pointer; }
.auth-tab.active { background: var(--paper); color: var(--ink); box-shadow: 0 3px 10px rgba(78, 54, 30, 0.08); font-weight: 700; }
.auth-form { display: grid; gap: 9px; }
.auth-form label { color: var(--muted); font-size: 0.79rem; font-weight: 700; }
.auth-form input, textarea { width: 100%; border: 1px solid transparent; border-radius: 14px; background: var(--paper); color: var(--ink); font: inherit; }
.auth-form input { padding: 13px 14px; }
.auth-form input:focus, textarea:focus { outline: none; border-color: rgba(216, 109, 66, 0.55); box-shadow: 0 0 0 4px rgba(216, 109, 66, 0.11); }
.send-button { min-height: 50px; border: 0; border-radius: 15px; background: var(--orange); color: white; font: inherit; font-weight: 800; cursor: pointer; }
.send-button:hover { background: var(--orange-dark); }
.send-button:disabled { opacity: .6; cursor: wait; }
.form-message { min-height: 1.3em; margin: 4px 0 0; color: var(--muted); font-size: 0.78rem; }
.form-message.error { color: #a84435; }

.conversation-panel { min-height: 0; display: grid; grid-template-rows: auto 1fr auto auto; }
.conversation-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 8px 10px; color: var(--muted); font-size: 0.82rem; }
.text-button { border: 0; background: transparent; color: var(--orange-dark); font: inherit; font-size: 0.78rem; cursor: pointer; }
.messages { display: flex; flex-direction: column; gap: 13px; overflow-y: auto; padding: 8px 8px 16px; }
.message { max-width: min(82%, 650px); padding: 15px 17px; border-radius: 20px; line-height: 1.62; animation: fade-up 220ms ease; }
.message p { margin: 7px 0 0; white-space: pre-wrap; word-break: keep-all; }
.message.bot { background: var(--bot); border: 1px solid rgba(216, 109, 66, 0.17); }
.message.user { margin-left: auto; background: var(--user); color: white; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 99px; background: rgba(45, 36, 24, 0.08); font-size: 0.66rem; font-weight: 800; letter-spacing: .06em; }
.message.user .badge { background: rgba(255, 255, 255, 0.16); }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 11px 0 0; border-top: 1px solid var(--line); }
textarea { min-height: 56px; max-height: 150px; resize: none; padding: 16px; }
.composer .send-button { min-width: 92px; padding: 0 18px; }
.status-text { min-height: 1.2em; margin: 8px 3px 0; color: var(--muted); font-size: 0.74rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 920px) { .app-shell { grid-template-columns: 1fr; } .hero-panel { min-height: auto; } .chat-panel { min-height: 72vh; } }
@media (max-width: 640px) { .app-shell { width: calc(100% - 16px); margin: 8px auto; } .hero-panel, .chat-panel { border-radius: 23px; } .hero-panel { padding: 28px 22px; } .signal-line { margin-bottom: 38px; } h1 { font-size: 3.2rem; } .chat-panel { padding: 14px; } .auth-panel { padding: 22px 18px; } .composer { grid-template-columns: 1fr; } .composer .send-button { min-height: 50px; } .message { max-width: 92%; } }
