:root {
  --bg: #fbf5ea;
  --bg-2: #f5ecdc;
  --surface: #fffdf8;
  --ink: #46362d;
  --ink-soft: #7c6a5e;
  --muted: #b3a294;
  --accent: #ff6b5e;
  --accent-deep: #e85448;
  --accent-soft: #ffe3dd;
  --mint: #7ec8b7;
  --mint-soft: #dff3ed;
  --butter: #f6c95f;
  --butter-soft: #fbedc4;
  --sky: #86b7e8;
  --sky-soft: #dcebfa;
  --line: #efe3d1;
  --shadow: 0 6px 20px rgba(122, 88, 60, 0.08);
  --shadow-lg: 0 16px 40px rgba(122, 88, 60, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #d6c6b0 transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: #d6c6b0;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #c2ae93;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:active {
  background-color: var(--accent);
  background-clip: padding-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: radial-gradient(1200px 600px at 100% -10%, #fdeee0 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #e8f6f0 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.6;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------ */
/* Topbar                                                              */
/* ------------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  flex-shrink: 0;
}

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

.brand-text h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 1.5px;
  color: var(--ink);
}

.brand-text p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.topnav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.tabs {
  display: none;
  align-items: center;
  gap: 2px;
  background: rgba(70, 54, 45, 0.07);
  border-radius: 999px;
  padding: 3px;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  width: 34px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.tab-btn svg {
  display: block;
}

.tab-btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(122, 88, 60, 0.16);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  font-family: var(--font-body);
  font-weight: 500;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  color: var(--ink);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(145deg, var(--accent), #ff8566);
  color: #fff;
  box-shadow: 0 6px 16px rgba(255, 107, 94, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(145deg, var(--accent-deep), #ff7a5c);
  box-shadow: 0 8px 20px rgba(255, 107, 94, 0.45);
}

.btn-ghost {
  background: var(--surface);
  border: 1.5px solid var(--line);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
  box-shadow: var(--shadow);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
}

.btn-icon svg {
  display: block;
}

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 40px) 16px;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ */
/* Chat                                                                */
/* ------------------------------------------------------------------ */

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--ink-soft);
  animation: fadeUp 0.6s ease both;
}

.chat-empty-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 22px;
  background: linear-gradient(145deg, var(--butter), #ffd98a);
  color: #fff;
  font-family: var(--font-display);
  font-size: 40px;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(246, 201, 95, 0.4);
  transform: rotate(-5deg);
}

.chat-empty h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
}

.chat-empty p {
  margin: 0;
  font-size: 13px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.msg.enter {
  animation: fadeUp 0.35s ease both;
}

.msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.msg .role {
  font-size: 11px;
  color: var(--muted);
}

.bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user .bubble {
  background: linear-gradient(145deg, var(--accent), #ff8566);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 14px rgba(255, 107, 94, 0.28);
}

.msg.assistant .bubble {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(122, 88, 60, 0.08);
}

/* Markdown content inside assistant bubbles */
.bubble.md {
  white-space: normal;
}

.bubble.md > :first-child {
  margin-top: 0;
}

.bubble.md > :last-child {
  margin-bottom: 0;
}

.bubble.md p {
  margin: 0 0 8px;
}

.bubble.md h1,
.bubble.md h2,
.bubble.md h3,
.bubble.md h4 {
  margin: 12px 0 6px;
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1.4;
}

.bubble.md ul,
.bubble.md ol {
  margin: 0 0 8px;
  padding-left: 20px;
}

.bubble.md li {
  margin: 2px 0;
}

.bubble.md li > p {
  margin: 0;
}

.bubble.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: rgba(70, 54, 45, 0.08);
  padding: 1px 5px;
  border-radius: 5px;
}

.bubble.md pre {
  margin: 0 0 10px;
  padding: 12px 14px;
  background: #2f2a26;
  color: #f5ecdc;
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.5;
}

.bubble.md pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.85em;
}

.bubble.md blockquote {
  margin: 0 0 8px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--mint);
  color: var(--ink-soft);
}

.bubble.md a {
  color: #c14a37;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bubble.md img {
  max-width: 100%;
  border-radius: 8px;
}

.bubble.md table {
  border-collapse: collapse;
  margin: 0 0 8px;
  font-size: 0.9em;
}

.bubble.md th,
.bubble.md td {
  border: 1px solid var(--line);
  padding: 4px 8px;
}

.bubble.md hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 10px 0;
}

/* ------------------------------------------------------------------ */
/* Thinking (reasoning)                                                */
/* ------------------------------------------------------------------ */

.thinking-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 1px 8px;
  border-radius: 999px;
  line-height: 1.6;
  user-select: none;
}

.thinking-toggle:hover {
  background: rgba(70, 54, 45, 0.07);
  color: var(--ink-soft);
}

.thinking-spinner {
  width: 11px;
  height: 11px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.thinking-live .thinking-spinner {
  animation: spin 0.8s linear infinite;
}

.thinking-chevron {
  display: inline-grid;
  place-items: center;
  transition: transform 0.15s ease;
}

.msg.thinking-open .thinking-chevron {
  transform: rotate(180deg);
}

.thinking-body {
  display: none;
  margin: 0 0 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
  background: #f4efe3;
  border-left: 2px solid var(--line);
  border-radius: 0 10px 10px 0;
}

.msg.thinking-open .thinking-body {
  display: block;
}

/* ------------------------------------------------------------------ */
/* Recommendations                                                     */
/* ------------------------------------------------------------------ */

.recs {
  background: var(--mint-soft);
  border: 1.5px dashed #bfe6da;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 12px;
  animation: fadeUp 0.4s ease both;
}

.recs-title {
  font-family: var(--font-display);
  font-size: 15px;
  color: #2f766a;
  margin-bottom: 10px;
}

.rec-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.rec-item:hover {
  border-color: var(--mint);
  box-shadow: var(--shadow);
}

.rec-item.selected {
  border-color: var(--mint);
  background: #f3fbf8;
}

.rec-item.disabled {
  cursor: default;
}

.rec-item.disabled:hover {
  border-color: transparent;
  box-shadow: none;
}

.rec-item.disabled .rec-title,
.rec-item.disabled .rec-note {
  opacity: 0.75;
}

.check {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid #cfc5b6;
  background: #fff;
  display: grid;
  place-items: center;
  color: transparent;
  transition: border 0.12s ease, background 0.12s ease, color 0.12s ease,
    transform 0.12s ease;
}

.rec-item.selected .check,
.check.checked {
  border-color: var(--mint);
  background: var(--mint);
  color: #fff;
}

.rec-item:not(.disabled):hover .check {
  transform: scale(1.08);
}

.check svg {
  display: block;
}

.rec-body {
  flex: 1;
}

.rec-title {
  font-weight: 500;
  color: var(--ink);
}

.rec-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.rec-cat {
  display: inline-block;
  font-size: 11px;
  color: #2f766a;
  background: var(--mint-soft);
  border-radius: 999px;
  padding: 1px 8px;
  margin-top: 4px;
}

.recs-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.recs-actions .btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
}

.recs-actions .btn svg {
  display: block;
}

.recs-status {
  margin-top: 6px;
  font-size: 12px;
  color: #2f766a;
}

/* ------------------------------------------------------------------ */
/* Composer                                                            */
/* ------------------------------------------------------------------ */

.composer {
  border-top: 1.5px solid var(--line);
  padding: 14px 16px 16px;
  background: #fffdf8;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.quick-chip {
  font-size: 12px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.quick-chip:hover {
  background: #ffd2ca;
  transform: translateY(-1px);
}

.composer-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.composer-row textarea {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  max-height: 120px;
  outline: none;
  transition: border 0.12s ease, box-shadow 0.12s ease;
}

.composer-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer-row .btn-primary {
  height: 46px;
  width: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Side panel                                                          */
/* ------------------------------------------------------------------ */

.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.calendar-panel,
.sessions-panel {
  padding: 14px;
}

.calendar-panel {
  flex-shrink: 0;
}

.sessions-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.calendar-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 1px;
}

.cal-nav {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border 0.12s ease, color 0.12s ease;
}

.cal-nav:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 4px;
}

.weekdays span {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  padding: 2px 0;
}

.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.day {
  aspect-ratio: 1.25 / 1;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 11px;
  cursor: pointer;
  background: #f4ede1;
  color: var(--ink-soft);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  position: relative;
}

.day:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow);
}

.day.empty {
  background: transparent;
  cursor: default;
}

.day.empty:hover {
  transform: none;
  box-shadow: none;
}

.day.today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.day.h0 { background: #f4ede1; color: var(--ink-soft); }
.day.h1 { background: #ffd9d1; color: #b3432f; }
.day.h2 { background: #ffbcae; color: #9c3625; }
.day.h3 { background: #ff9c8a; color: #fff; }
.day.h4 { background: #ff7a63; color: #fff; }

.legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.legend-cell {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-cell.l0 { background: #f4ede1; }
.legend-cell.l1 { background: #ffd9d1; }
.legend-cell.l2 { background: #ffbcae; }
.legend-cell.l3 { background: #ff9c8a; }
.legend-cell.l4 { background: #ff7a63; }

/* ------------------------------------------------------------------ */
/* Sessions                                                            */
/* ------------------------------------------------------------------ */

.sessions-head h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 1px;
}

.sessions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.sessions-list::-webkit-scrollbar {
  display: none;
}

.session {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border 0.12s ease, background 0.12s ease;
}

.session:hover {
  background: #faf4e9;
}

.session.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.session-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  line-height: 1.3;
}

.session-del {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
}

.session-regen {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: grid;
  place-items: center;
}

.session-regen.spinning svg {
  animation: spin 0.9s linear infinite;
}

.session-del:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.session-regen:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sessions-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

/* ------------------------------------------------------------------ */
/* Modal                                                               */
/* ------------------------------------------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(70, 54, 45, 0.35);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease both;
}

.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 22px;
  animation: popIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 1px;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--accent-deep);
}

/* Day records */

.day-add {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: stretch;
}

.day-add input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 16px;
  outline: none;
}

.day-add .btn {
  width: 46px;
  height: auto;
  flex-shrink: 0;
}

.day-add input:focus {
  border-color: var(--accent);
}

.day-records {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.day-records::-webkit-scrollbar {
  display: none;
}

.day-record {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #faf5ec;
  border-radius: 12px;
}

.day-record .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 7px;
  flex-shrink: 0;
}

.day-record .dot.ai {
  background: var(--mint);
}

.day-record-body {
  flex: 1;
}

.day-record-content {
  font-size: 14px;
}

.day-record-cat {
  font-size: 11px;
  color: var(--muted);
}

.day-record-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.day-record-time {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

.day-record-del {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 6px;
}

.day-record-del:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

/* Settings form */

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.settings-form::-webkit-scrollbar {
  display: none;
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
}

.settings-form input,
.settings-form textarea {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  outline: none;
  background: #fff;
}

.settings-form input:focus,
.settings-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.settings-form .hint {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
}

/* Auth (login / register) */

.auth-card {
  position: relative;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 30px 28px;
  animation: popIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  overflow: hidden;
}

.auth-brand {
  text-align: center;
  margin-bottom: 22px;
}

.auth-brand .chat-empty-mark {
  margin-bottom: 12px;
}

.auth-brand h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 1.5px;
  color: var(--ink);
}

.auth-brand p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
}

.auth-field[hidden] {
  display: none;
}

.auth-field .hint {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}

.auth-field input {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  outline: none;
  background: #fff;
  width: 100%;
}

.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-submit {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.auth-switch {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.auth-link {
  border: none;
  background: transparent;
  color: var(--accent-deep);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  font-weight: 500;
}

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

.auth-error {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 10px;
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* Toast                                                               */
/* ------------------------------------------------------------------ */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: fadeUp 0.25s ease both;
}

.toast[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Animations                                                          */
/* ------------------------------------------------------------------ */

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes typing {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .topbar {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .brand-text p {
    display: none;
  }

  .tabs {
    display: inline-flex;
  }

  .layout {
    display: block;
    overflow: hidden;
    padding: 0;
  }

  body.tab-history .layout {
    padding: 12px 12px 16px;
  }

  .chat-panel,
  .side {
    height: 100%;
  }

  .chat-panel {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .side {
    overflow-y: auto;
  }

  body.tab-chat .side {
    display: none;
  }

  body.tab-history .chat-panel {
    display: none;
  }

  .sessions-panel {
    flex: none;
  }

  .sessions-list {
    flex: none;
    max-height: none;
    overflow: visible;
  }

  .day {
    aspect-ratio: 1;
  }
}
