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

:root {
  --ink: #1a2523;
  --muted: #687875;
  --line: #d8e1dd;
  --paper: #f7f5ef;
  --surface: #fffefa;
  --sage: #52796f;
  --sage-dark: #2f514d;
  --terracotta: #c86f4a;
  --mustard: #d2a039;
  --blue: #527da3;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

html {
  min-width: 320px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

#app {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input {
  font: inherit;
}

::selection {
  background: rgba(200, 111, 74, 0.22);
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(82, 121, 111, 0.12), transparent 34%),
    linear-gradient(245deg, rgba(200, 111, 74, 0.14), transparent 42%),
    var(--paper);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(47, 81, 77, 0.14);
  background: rgba(255, 254, 250, 0.9);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  width: calc(100% - 32px);
  max-width: 1120px;
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(47, 81, 77, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(82, 121, 111, 0.18), rgba(210, 160, 57, 0.18)),
    var(--surface);
  color: var(--sage-dark);
  flex: 0 0 auto;
}

.brand-mark img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.brand-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand-name {
  font-size: 0.98rem;
  font-weight: 800;
}

.brand-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.nav-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-link.login {
  padding: 0 12px;
  color: var(--sage-dark);
}

.nav-link.login:hover {
  border-color: rgba(82, 121, 111, 0.22);
  background: rgba(82, 121, 111, 0.08);
}

.nav-link.account {
  padding: 0 14px;
  color: #fff;
  background: var(--sage-dark);
  box-shadow: 0 12px 24px rgba(47, 81, 77, 0.18);
}

.nav-link.account:hover {
  background: #24423f;
}

.nav-link.account:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.nav-link.account:disabled:hover {
  background: var(--sage-dark);
}

.hero {
  width: calc(100% - 32px);
  max-width: 1120px;
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(340px, 0.74fr);
  align-items: center;
  gap: 56px;
  gap: clamp(36px, 7vw, 84px);
  padding: 64px 0;
  padding: clamp(40px, 8vw, 86px) 0;
}

.hero-copy {
  display: grid;
  gap: 24px;
}

.eyebrow {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(200, 111, 74, 0.28);
  border-radius: 8px;
  color: #8d4329;
  background: rgba(255, 254, 250, 0.7);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 10ch;
  color: var(--ink);
  font-size: 4.8rem;
  font-size: clamp(3rem, 7vw, 6.8rem);
  line-height: 0.94;
  font-weight: 800;
}

.lede {
  max-width: 640px;
  color: #4d5f5b;
  font-size: 1.16rem;
  font-size: clamp(1.04rem, 2vw, 1.28rem);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(82, 125, 163, 0.28);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.7);
  color: #385f7e;
  font-weight: 750;
}

.login-panel {
  width: 100%;
  max-width: 430px;
  padding: 24px;
  border: 1px solid rgba(47, 81, 77, 0.16);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.86);
  box-shadow: 0 28px 60px rgba(47, 81, 77, 0.13);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.panel-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(47, 81, 77, 0.16);
  border-radius: 8px;
  background: rgba(82, 121, 111, 0.1);
  color: var(--sage-dark);
}

h2,
.login-title {
  max-width: none;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.12;
  font-weight: 800;
}

.panel-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.92rem;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--sage-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(47, 81, 77, 0.2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: rgba(82, 125, 163, 0.7);
  box-shadow: 0 0 0 3px rgba(82, 125, 163, 0.16);
}

.form-button,
.google-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
}

.form-button {
  margin-top: 4px;
  color: white;
  background: var(--sage-dark);
  box-shadow: 0 14px 26px rgba(47, 81, 77, 0.18);
}

.form-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.google-button {
  width: 100%;
  color: var(--ink);
  background: var(--surface);
  border-color: rgba(47, 81, 77, 0.2);
}

.google-button:hover {
  border-color: rgba(82, 121, 111, 0.42);
  background: rgba(82, 121, 111, 0.06);
}

.google-mark {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #4285f4;
  font-size: 0.8rem;
  font-weight: 900;
}

.form-status {
  margin-top: 14px;
  color: var(--sage-dark);
  font-size: 0.9rem;
  font-weight: 750;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: rgba(47, 81, 77, 0.16);
}

.login-page {
  width: calc(100% - 32px);
  max-width: 1120px;
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(340px, 0.88fr);
  align-items: center;
  gap: 56px;
  gap: clamp(34px, 7vw, 84px);
  padding: 64px 0;
  padding: clamp(40px, 8vw, 86px) 0;
}

.visual {
  position: relative;
  min-height: 460px;
  display: grid;
  place-items: center;
}

.login-visual {
  min-height: 430px;
}

.planner-board {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 0.82;
  padding: 24px;
  border: 1px solid rgba(47, 81, 77, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 254, 250, 0.92)),
    repeating-linear-gradient(0deg, transparent 0 48px, rgba(47, 81, 77, 0.07) 49px 50px);
  box-shadow: 0 28px 60px rgba(47, 81, 77, 0.16);
  transform: rotate(1.6deg);
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.board-title {
  display: grid;
  gap: 5px;
}

.board-title strong {
  font-size: 1rem;
}

.board-title span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.dial {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 9px solid rgba(82, 121, 111, 0.2);
  border-top-color: var(--terracotta);
  border-right-color: var(--mustard);
}

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

.meal-tile {
  min-height: 102px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  border: 1px solid rgba(47, 81, 77, 0.12);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.82);
}

.meal-tile span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.meal-line {
  height: 9px;
  border-radius: 999px;
  background: var(--sage);
}

.meal-line.short {
  width: 62%;
  background: var(--terracotta);
}

.meal-line.medium {
  width: 78%;
  background: var(--blue);
}

.meal-line.gold {
  width: 54%;
  background: var(--mustard);
}

.visual-caption {
  position: absolute;
  right: 0;
  bottom: 18px;
  width: 62%;
  max-width: 240px;
  padding: 16px;
  border: 1px solid rgba(47, 81, 77, 0.14);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.92);
  box-shadow: 0 18px 40px rgba(47, 81, 77, 0.14);
  color: var(--sage-dark);
  font-weight: 800;
}

/* ---------------------------------------------------------------------------
   Trial banner
--------------------------------------------------------------------------- */

.trial-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(82, 125, 163, 0.12);
  border-bottom: 1px solid rgba(82, 125, 163, 0.2);
  font-size: 0.86rem;
  font-weight: 700;
  color: #385f7e;
}

.trial-banner--urgent {
  background: rgba(200, 111, 74, 0.12);
  border-bottom-color: rgba(200, 111, 74, 0.2);
  color: #8d4329;
}

.trial-banner-cta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 12px;
  border-radius: 6px;
  background: #385f7e;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

.trial-banner--urgent .trial-banner-cta {
  background: var(--terracotta);
}

/* ---------------------------------------------------------------------------
   Workspace layout
--------------------------------------------------------------------------- */

.workspace {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--paper);
}

.workspace-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.workspace-sidebar {
  width: 220px;
  flex: 0 0 220px;
  min-height: calc(100vh - 41px);
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 12px 16px;
}

.ws-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.ws-brand .brand-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink);
}

.ws-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.ws-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  position: relative;
}

.ws-nav-item:hover {
  background: rgba(82, 121, 111, 0.08);
  color: var(--sage-dark);
}

.ws-nav-item.active {
  background: rgba(82, 121, 111, 0.12);
  color: var(--sage-dark);
}

.ws-nav-item.locked {
  opacity: 0.55;
  cursor: default;
}

.ws-lock-icon {
  margin-left: auto;
  color: var(--muted);
}

.ws-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.ws-logout:hover {
  color: var(--terracotta);
}

.workspace-main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px;
  overflow-y: auto;
}

/* When the assistant is mounted, workspace-main becomes a flex passthrough
   and the assistant manages its own scroll + padding. */
.workspace-main:has(.asst-page) {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------------------
   Workspace: Profile section
--------------------------------------------------------------------------- */

.ws-profile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 480px;
}

.ws-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--sage), var(--blue));
  color: #fff;
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.ws-profile-name {
  max-width: none;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
}

.ws-profile-email {
  color: var(--muted);
  font-size: 0.95rem;
}

.ws-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ws-tier-badge--trial {
  background: rgba(82, 125, 163, 0.12);
  color: #385f7e;
}

.ws-tier-badge--paid {
  background: rgba(82, 121, 111, 0.14);
  color: var(--sage-dark);
}

.ws-tier-badge--admin {
  background: rgba(210, 160, 57, 0.16);
  color: #7a5a10;
}

.ws-tier-badge--none {
  background: rgba(100, 100, 100, 0.1);
  color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Workspace: content areas
--------------------------------------------------------------------------- */

.ws-content-area {
  max-width: 720px;
}

.ws-content-area h2 {
  max-width: none;
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 12px;
}

/* ---------------------------------------------------------------------------
   Connections section
--------------------------------------------------------------------------- */

.conn-page {
  max-width: 580px;
}

.conn-intro {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 6px;
  margin-bottom: 28px;
}

.conn-service-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 24px;
  box-shadow: 0 1px 4px rgba(47, 81, 77, 0.06);
}

.conn-service-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.conn-service-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.conn-service-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(82, 121, 111, 0.1);
  color: var(--sage-dark);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.conn-service-name {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.conn-service-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.conn-badge--on {
  background: rgba(82, 121, 111, 0.12);
  color: var(--sage-dark);
}

.conn-badge--off {
  background: rgba(100, 100, 100, 0.08);
  color: var(--muted);
}

.conn-badge--expired {
  background: rgba(210, 160, 57, 0.14);
  color: #7a5a10;
}

.conn-expired-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 20px;
  padding: 11px 14px;
  border-radius: 8px;
  background: rgba(210, 160, 57, 0.08);
  border: 1px solid rgba(210, 160, 57, 0.25);
  color: #7a5a10;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
}

.conn-expired-notice svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.conn-body-text {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 18px;
}

.conn-body-text strong {
  color: var(--ink);
  font-weight: 700;
}

.conn-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.conn-connected-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.conn-verify-result {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
}

.conn-verify-result svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.conn-verify-result--ok {
  background: rgba(82, 121, 111, 0.08);
  border: 1px solid rgba(82, 121, 111, 0.2);
  color: var(--sage-dark);
}

.conn-verify-result--fail {
  background: rgba(200, 111, 74, 0.08);
  border: 1px solid rgba(200, 111, 74, 0.2);
  color: #8d4329;
}

.conn-mode-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.conn-security-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 7px;
  background: rgba(82, 121, 111, 0.07);
  border: 1px solid rgba(82, 121, 111, 0.15);
  color: var(--sage-dark);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.conn-security-note svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.conn-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.conn-field span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.conn-field input,
.conn-field textarea {
  padding: 8px 11px;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.12s;
  width: 100%;
}

.conn-field input:focus,
.conn-field textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(82, 121, 111, 0.1);
}

.conn-token-area {
  resize: vertical;
  min-height: 90px;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.75rem !important;
  line-height: 1.6;
}

.conn-hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
}

.conn-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.conn-save-btn {
  display: inline-flex;
  padding: 0 22px;
  min-width: 130px;
  justify-content: center;
}

.conn-verify-btn {
  display: inline-flex;
  padding: 0 20px;
  min-width: 130px;
  justify-content: center;
  height: 40px;
  border-radius: 8px;
  border: 1.5px solid var(--sage);
  background: transparent;
  color: var(--sage-dark);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
  align-items: center;
}

.conn-verify-btn:hover:not(:disabled) {
  background: rgba(82, 121, 111, 0.08);
}

.conn-verify-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.conn-disconnect-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.12s;
}

.conn-disconnect-btn:hover:not(:disabled) {
  color: var(--terracotta);
}

.conn-disconnect-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.conn-save-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--sage-dark);
}

.conn-save-err {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--terracotta);
}

/* ---------------------------------------------------------------------------
   Assistant section
--------------------------------------------------------------------------- */

/* Full-panel layout — fills workspace-main completely */
.asst-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Narrow inner column keeps text readable; centers on wide screens */
.asst-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 40px;
}

@media (max-width: 760px) {
  .asst-inner { padding: 0 16px; }
}

.asst-header {
  flex-shrink: 0;
  padding: 28px 0 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.asst-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.asst-header p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 12px;
}

.asst-chat {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 0 8px;
  min-height: 0;
}

/* Welcome state */
.asst-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex: 1;
  padding: 56px 16px 32px;
  text-align: center;
}

.asst-welcome-badge {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--sage), var(--sage-dark));
  box-shadow: 0 8px 22px rgba(47, 81, 77, 0.28);
}

.asst-welcome-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.asst-wave {
  display: inline-block;
  animation: asst-wave 1.6s ease-in-out 2;
  transform-origin: 70% 70%;
}

@keyframes asst-wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  15%, 45% { transform: rotate(16deg); }
  30% { transform: rotate(-8deg); }
}

.asst-welcome-icon {
  color: var(--muted);
  opacity: 0.4;
}

.asst-welcome-text {
  font-size: 0.96rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--muted);
  max-width: 440px;
}

.asst-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 600px;
}

.asst-suggestion {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.asst-suggestion:hover {
  border-color: var(--sage);
  color: var(--sage-dark);
  background: rgba(82, 121, 111, 0.05);
}

/* Messages — turn layout */
.asst-turn {
  display: flex;
  animation: asst-turn-in 0.18s ease;
}

@keyframes asst-turn-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.asst-turn--user { justify-content: flex-end; }

.asst-turn--assistant {
  justify-content: flex-start;
  gap: 11px;
}

/* Column wrapper: activity + bubble + recipe cards stacked */
.asst-turn-col {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  max-width: calc(100% - 48px);
}

.asst-bubble {
  max-width: 100%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.65;
  word-break: break-word;
}

.asst-turn--user .asst-bubble--user { max-width: min(78%, 560px); }

.asst-bubble--user {
  background: var(--sage-dark);
  color: #fff;
  border-bottom-right-radius: 5px;
  /* plain text — preserve user's line breaks */
  white-space: pre-wrap;
}

.asst-bubble--assistant {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 5px;
  box-shadow: 0 1px 2px rgba(20, 30, 28, 0.03);
  /* rendered markdown — let block elements control their own whitespace */
  white-space: normal;
}

.asst-bubble--thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.asst-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: asst-bounce 1.2s ease-in-out infinite;
}
.asst-dot:nth-child(2) { animation-delay: 0.2s; }
.asst-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes asst-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

.asst-error {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-radius: 8px;
  background: rgba(200, 111, 74, 0.08);
  border: 1px solid rgba(200, 111, 74, 0.2);
  color: #8d4329;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Input bar — pinned to bottom of inner column */
.asst-footer {
  flex-shrink: 0;
  padding: 12px 0 20px;
  border-top: 1px solid var(--line);
}

.asst-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 7px 7px 8px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 4px 18px rgba(20, 30, 28, 0.06);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.asst-input-row:focus-within {
  border-color: var(--sage);
  box-shadow: 0 4px 18px rgba(20, 30, 28, 0.06), 0 0 0 3px rgba(82, 121, 111, 0.1);
}

.asst-input {
  flex: 1;
  min-height: 32px;
  max-height: 160px;
  padding: 8px 6px 8px 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.92rem;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  field-sizing: content;
}

.asst-input:focus { outline: none; }

.asst-input:disabled { opacity: 0.6; background: transparent; }

.asst-send {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border: none;
  background: var(--sage-dark);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, opacity 0.12s;
}

.asst-send:hover:not(:disabled) { background: var(--sage); }
.asst-send:disabled { opacity: 0.35; cursor: default; }

.asst-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--muted);
}

/* Tool activity strip */
.asst-activity {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.asst-activity-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(82, 121, 111, 0.07);
  border: 1px solid rgba(82, 121, 111, 0.15);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sage-dark);
  width: fit-content;
}

.asst-activity-item--done {
  background: rgba(82, 121, 111, 0.04);
  border-color: var(--line);
  color: var(--muted);
}

.asst-activity-icon { font-size: 0.85rem; line-height: 1; }

.asst-activity-text { flex: 1; }

.asst-activity-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(82, 121, 111, 0.2);
  border-top-color: var(--sage);
  animation: asst-spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* Streaming cursor */
.asst-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--sage);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: asst-blink 0.8s step-end infinite;
}

@keyframes asst-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Markdown inside assistant bubbles (rendered by Streamdown) */
.asst-md { display: block; }
.asst-md > :first-child { margin-top: 0; }
.asst-md > :last-child { margin-bottom: 0; }

.asst-md-pre {
  margin: 0.5em 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4f1ea;
  border: 1px solid var(--line);
  overflow-x: auto;
  font-size: 0.82em;
  line-height: 1.5;
}
.asst-md-pre .asst-md-code { background: none; padding: 0; }

.asst-md-p { margin-bottom: 0.5em; }
.asst-md-p:last-child { margin-bottom: 0; }

.asst-md-h {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0.75em 0 0.3em;
  color: var(--ink);
}

.asst-md-h3 {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0.6em 0 0.25em;
  color: var(--ink);
}

.asst-md-ul,
.asst-md-ol {
  padding-left: 1.2em;
  margin: 0.3em 0 0.5em;
}

.asst-md-li { margin-bottom: 0.25em; }

.asst-md-code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(82, 121, 111, 0.08);
  font-family: ui-monospace, monospace;
  font-size: 0.82em;
}

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

.asst-md-table-wrap {
  overflow-x: auto;
  margin: 0.5em 0;
}

.asst-md-table {
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 100%;
}

.asst-md-th,
.asst-md-td {
  padding: 6px 12px;
  border: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.asst-md-th {
  background: rgba(82, 121, 111, 0.07);
  font-weight: 700;
  color: var(--ink);
}

.asst-md-table tbody tr:hover {
  background: rgba(82, 121, 111, 0.03);
}

.asst-bubble--assistant a {
  color: var(--sage-dark);
  text-decoration: underline;
  text-decoration-color: rgba(82, 121, 111, 0.4);
  text-underline-offset: 2px;
}

.asst-bubble--assistant a:hover {
  text-decoration-color: var(--sage-dark);
}

/* ---------------------------------------------------------------------------
   Calendar section
--------------------------------------------------------------------------- */

.ws-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 340px;
  text-align: center;
  color: var(--muted);
  max-width: 360px;
  margin: 0 auto;
}

.ws-locked h2 {
  max-width: none;
  font-size: 1.2rem;
  color: var(--ink);
}

.ws-locked p {
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------------------
   Responsive: workspace
--------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .workspace-sidebar {
    width: 64px;
    flex: 0 0 64px;
    padding: 16px 8px;
    align-items: center;
  }

  .ws-brand .brand-name,
  .ws-nav-item span,
  .ws-logout span {
    display: none;
  }

  .ws-brand {
    padding: 0 0 16px;
    justify-content: center;
  }

  .ws-nav-item {
    padding: 0;
    justify-content: center;
    width: 44px;
    height: 44px;
  }

  .workspace-main {
    padding: 24px 20px;
  }
}

/* ---------------------------------------------------------------------------
   Existing responsive
--------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .topbar-inner {
    width: calc(100% - 24px);
    max-width: 1120px;
    min-height: 64px;
  }

  .brand-kicker,
  .nav-link span {
    display: none;
  }

  .nav-link {
    width: 42px;
    padding: 0;
  }

  .hero {
    width: calc(100% - 24px);
    max-width: 1120px;
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 38px 0 52px;
  }

  .login-panel {
    width: 100%;
    padding: 18px;
  }

  .panel-heading {
    gap: 12px;
  }

  .login-page {
    width: calc(100% - 24px);
    max-width: 1120px;
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 38px 0 52px;
  }

  h1 {
    max-width: 9ch;
    font-size: 3rem;
  }

  .visual {
    min-height: 380px;
  }

  .planner-board {
    width: 100%;
    max-width: 340px;
    padding: 18px;
  }

  .visual-caption {
    right: 10px;
    bottom: 0;
  }
}

/* ===========================================================================
   Assistant v2 — full-featured layout with conversation sidebar + recipe panel
=========================================================================== */

/* When the assistant is mounted, lock the whole workspace to the viewport so it
   behaves like a fixed app frame (sidebars + composer stay put, only the chat
   and recipe panel scroll internally) instead of growing the page downward. */
.workspace:has(.asst-page-v2) {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.workspace:has(.asst-page-v2) .workspace-body {
  min-height: 0;
  overflow: hidden;
}
.workspace:has(.asst-page-v2) .workspace-sidebar {
  min-height: 0;
}

/* Override workspace-main when new assistant is mounted */
.workspace-main:has(.asst-page-v2) {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.asst-page-v2 {
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
}

/* ---------------------------------------------------------------------------
   Conversation sidebar
--------------------------------------------------------------------------- */

.conv-sidebar {
  width: 230px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 8px;
  gap: 8px;
  overflow: hidden;
}

.conv-new-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  background: var(--sage-dark);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.conv-new-btn:hover { background: var(--sage); }

.conv-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-loading {
  display: flex;
  justify-content: center;
  padding: 16px 0;
  color: var(--muted);
}

.conv-empty {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 16px 8px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.conv-item:hover { background: var(--line); }
.conv-item.active { background: #e4ede9; }

.conv-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-item-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.conv-item-time {
  font-size: 0.7rem;
  color: var(--muted);
}

.conv-item-delete {
  opacity: 0;
  padding: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: opacity 0.12s, color 0.12s;
  flex-shrink: 0;
}
.conv-item:hover .conv-item-delete { opacity: 1; }
.conv-item-delete:hover { color: var(--terracotta); background: #f5e8e3; }

/* ---------------------------------------------------------------------------
   Main chat area
--------------------------------------------------------------------------- */

.asst-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: flex 0.25s ease;
}

.chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

/* Assistant avatar to the left of assistant turns */
.asst-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--sage), var(--sage-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  box-shadow: 0 2px 6px rgba(47, 81, 77, 0.2);
}

.chat-footer {
  flex-shrink: 0;
  padding: 10px 24px 20px;
  background: transparent;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

/* Footer row: hint on the left, usage meter on the right */
.asst-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Usage limit banner above the composer */
.asst-limit-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 9px 13px;
  border-radius: 9px;
  background: rgba(200, 111, 74, 0.08);
  border: 1px solid rgba(200, 111, 74, 0.25);
  color: #8d4329;
  font-size: 0.83rem;
  font-weight: 600;
}

/* Usage meter (token quotas) */
.usage-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--muted);
}
.usage-meter-icon { color: var(--muted); flex-shrink: 0; }

.usage-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: default;
}

.usage-bar-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.usage-bar-track {
  width: 54px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.usage-bar-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--sage);
  transition: width 0.3s ease, background 0.2s;
}

.usage-bar-num { font-variant-numeric: tabular-nums; color: var(--muted); }

.usage-bar--high .usage-bar-fill { background: var(--mustard); }
.usage-bar--over .usage-bar-fill { background: var(--terracotta); }
.usage-bar--over .usage-bar-num { color: var(--terracotta); font-weight: 700; }

/* Stop button (while streaming) */
.asst-send--stop {
  background: var(--terracotta);
}
.asst-send--stop:hover { background: #b15f3d; }

.asst-input-row--blocked { opacity: 0.7; }

/* ---------------------------------------------------------------------------
   Thinking steps (replaces old ToolActivity)
--------------------------------------------------------------------------- */

.thinking-steps {
  margin-bottom: 2px;
}

.thinking-lead { flex-shrink: 0; color: var(--muted); }
.thinking-steps--running .thinking-lead,
.thinking-steps--running .thinking-label { color: var(--sage-dark); }
.thinking-steps--running .thinking-label {
  background: linear-gradient(90deg, var(--muted) 30%, var(--sage) 50%, var(--muted) 70%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: thinking-shimmer 1.6s linear infinite;
}

@keyframes thinking-shimmer {
  to { background-position: -200% center; }
}

.thinking-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px 4px 4px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  text-align: left;
}
.thinking-toggle:hover { background: var(--line); color: var(--ink); }

.thinking-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.2s;
}
.thinking-dot--active {
  background: var(--sage);
  animation: thinking-pulse 1.2s ease-in-out infinite;
}

@keyframes thinking-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.thinking-label { flex-shrink: 0; }

.thinking-count {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.75;
}

.thinking-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
}
.thinking-chevron.open { transform: rotate(180deg); }

.thinking-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.thinking-reasoning {
  white-space: pre-wrap;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
  padding: 9px 11px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 2px solid var(--sage);
  border-radius: 8px;
  max-height: 280px;
  overflow-y: auto;
}

/* Tool step (interleaved with reasoning) */
.thinking-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink);
  padding: 7px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.thinking-step-icon { flex-shrink: 0; color: var(--muted); }
.thinking-step-icon.done { color: var(--sage); }

.thinking-step-name { font-weight: 600; }

.thinking-step-summary {
  color: var(--muted);
  font-weight: 500;
}
.thinking-step-summary::before {
  content: '·';
  margin-right: 6px;
  color: var(--line);
}

/* Collapsed summary: a tidy row of tool chips */
.thinking-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.thinking-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(82, 121, 111, 0.08);
  border: 1px solid rgba(82, 121, 111, 0.16);
  color: var(--sage-dark);
  font-size: 0.72rem;
  font-weight: 600;
}
.thinking-chip svg { color: var(--sage); }

/* ---------------------------------------------------------------------------
   Recipe panel (side panel / artifact)
--------------------------------------------------------------------------- */

.recipe-panel {
  width: 372px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  animation: panel-slide-in 0.2s ease;
}

.recipe-panel-scroll {
  flex: 1;
  overflow-y: auto;
}

@keyframes panel-slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.recipe-panel-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.recipe-panel-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.recipe-panel-icon {
  color: var(--sage);
  flex-shrink: 0;
  margin-top: 2px;
}

.recipe-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.recipe-panel-close {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
  border-radius: 5px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.recipe-panel-close:hover { background: var(--line); color: var(--ink); }

.recipe-panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
}

.recipe-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.recipe-meta-diff {
  color: var(--sage-dark);
  border-color: var(--sage);
  background: #eef3f0;
}

.recipe-panel-nutrition {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 16px 12px;
}

.recipe-nutr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 8px;
  text-align: center;
}

.recipe-nutr-kcal { background: #fef3e8; }
.recipe-nutr-p    { background: #e8f3f0; }
.recipe-nutr-f    { background: #f3ece8; }
.recipe-nutr-c    { background: #edf0f8; }

.recipe-nutr-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.recipe-nutr-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recipe-nutr-kcal svg { color: var(--terracotta); margin-bottom: 2px; }

.recipe-weight-note {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0 4px;
}

.recipe-section {
  padding: 0 16px 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.recipe-section + .recipe-section { border-top: 1px solid var(--line); }

.recipe-section-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sage-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.recipe-ingredients {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recipe-ingredient {
  font-size: 0.83rem;
  color: var(--ink);
  padding: 5px 8px;
  background: var(--paper);
  border-radius: 5px;
  line-height: 1.3;
}

.recipe-ingredient::before {
  content: '· ';
  color: var(--sage);
}

.recipe-steps { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.recipe-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.83rem;
  color: var(--ink);
  line-height: 1.4;
}

.recipe-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sage-dark);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.recipe-panel-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 16px 16px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--sage-dark);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s;
}
.recipe-panel-link:hover { background: #eef3f0; border-color: var(--sage); }

/* "Get preparation steps" — primary live-fetch action above the Cookidoo link */
.recipe-getsteps { margin: 8px 16px 0; }
.recipe-getsteps-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  background: var(--sage-dark);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.12s;
}
.recipe-getsteps-btn:hover { opacity: 0.92; }
.recipe-getsteps-btn:disabled { opacity: 0.7; cursor: default; }
.recipe-getsteps-error {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: #b3261e;
}

/* ---------------------------------------------------------------------------
   Recipe card list (inline in chat — clickable to open panel)
--------------------------------------------------------------------------- */

.recipe-card-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  max-width: 540px;
}

.recipe-card {
  display: flex;
  align-items: stretch;
  gap: 11px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
  width: 100%;
}

.recipe-card-thumb {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
  display: grid;
  place-items: center;
}

.recipe-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-card-thumb--ph { color: var(--line); }

.recipe-card-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.recipe-card:hover {
  border-color: var(--sage);
  background: #eef3f0;
  box-shadow: 0 1px 6px rgba(82, 121, 111, 0.12);
}

.recipe-card--active {
  border-color: var(--sage);
  background: #eef3f0;
  box-shadow: inset 3px 0 0 var(--sage-dark);
}

.recipe-card-title {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.recipe-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.recipe-card-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.recipe-card-cta {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sage-dark);
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}

/* ---------------------------------------------------------------------------
   Cursor animations for new component classes
--------------------------------------------------------------------------- */

.asst-cursor-blink {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--sage);
  border-radius: 1px;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: asst-blink 0.8s step-end infinite;
}

/* Spinning utility */
.spinning {
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================================================================
   Diary (meal plan) — week / month / list / history + side panel
   =========================================================================== */

.diary-shell {
  display: flex;
  gap: 0;
  align-items: flex-start;
  margin: -40px -48px;            /* bleed into workspace-main padding */
}

.diary-main {
  flex: 1;
  min-width: 0;
  padding: 40px 40px 48px 48px;
}

.diary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.diary-head h2 { margin: 0; }

.diary-viewtabs {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.diary-viewtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
}

.diary-viewtab:hover { color: var(--ink); }

.diary-viewtab.active {
  background: var(--surface);
  color: var(--sage-dark);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.diary-notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 16px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 14px;
}

.diary-notice svg { flex-shrink: 0; margin-top: 1px; }

.diary-notice--warn {
  background: rgba(210, 160, 57, 0.1);
  border: 1px solid rgba(210, 160, 57, 0.28);
  color: #7a5a10;
}

/* --- Toolbar: navigation + period totals --- */
.diary-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

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

.diary-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: border-color 0.12s, color 0.12s;
}

.diary-nav-btn:hover { border-color: var(--sage); color: var(--sage-dark); }

.diary-nav-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 132px;
  text-align: center;
}

.diary-today-btn {
  margin-left: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sage-dark);
  transition: border-color 0.12s, background 0.12s;
}

.diary-today-btn:hover { border-color: var(--sage); background: var(--paper); }

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

.diary-totals-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.diary-totals-pills { display: flex; gap: 6px; flex-wrap: wrap; }

.diary-total {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink);
}

.diary-total-kcal {
  background: #fef3e8;
  border-color: rgba(200, 111, 74, 0.25);
  color: var(--terracotta);
}

.diary-totals-empty { color: var(--line); font-weight: 700; }

.diary-loading { display: grid; place-items: center; padding: 60px 0; color: var(--sage); }

/* --- Week grid --- */
.diary-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.diary-day {
  min-height: 190px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.diary-day--today { border-color: var(--sage); box-shadow: 0 0 0 1px var(--sage); }

.diary-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 10px 7px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.diary-day--today .diary-day-head { background: var(--sage-dark); border-bottom-color: var(--sage-dark); }

.diary-day-name {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.diary-day--today .diary-day-name { color: rgba(255, 255, 255, 0.78); }

.diary-day-num { font-size: 1rem; font-weight: 800; color: var(--ink); }
.diary-day--today .diary-day-num { color: #fff; }

.diary-day-body {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diary-day-foot {
  padding: 6px 10px;
  border-top: 1px dashed var(--line);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--terracotta);
  text-align: right;
  min-height: 14px;
}

.diary-empty { color: var(--line); font-size: 0.95rem; margin: auto; }

/* --- Recipe chip --- */
.diary-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(82, 121, 111, 0.14);
  border-radius: 9px;
  background: rgba(82, 121, 111, 0.05);
  text-align: left;
  width: 100%;
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
}

.diary-chip:hover {
  border-color: var(--sage);
  background: rgba(82, 121, 111, 0.1);
}

.diary-chip:active { transform: scale(0.99); }

.diary-chip-thumb {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--paper);
  display: grid;
  place-items: center;
}

.diary-chip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.diary-chip-thumb--ph { color: var(--line); }

.diary-chip-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.diary-chip-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.diary-chip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}

.diary-chip-meta span { display: inline-flex; align-items: center; gap: 3px; }

.diary-chip--compact { padding: 0; border: none; background: none; width: auto; }
.diary-chip--compact:hover { background: none; }
.diary-chip--compact .diary-chip-thumb { width: 26px; height: 26px; border-radius: 6px; }
.diary-chip--compact .diary-chip-thumb { box-shadow: 0 0 0 1.5px var(--surface); }

/* --- Month grid --- */
.diary-month-dow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 6px;
}

.diary-month-dow span {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: center;
}

.diary-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.diary-mcell {
  min-height: 92px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.diary-mcell--out { background: var(--paper); opacity: 0.55; }
.diary-mcell--today { border-color: var(--sage); box-shadow: 0 0 0 1px var(--sage); }

.diary-mcell-head { display: flex; align-items: center; justify-content: space-between; }
.diary-mcell-num { font-size: 0.82rem; font-weight: 800; color: var(--ink); }

.diary-mcell-kcal {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--terracotta);
  background: #fef3e8;
  padding: 1px 6px;
  border-radius: 999px;
}

.diary-mcell-thumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.diary-mcell-more {
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--muted);
  align-self: center;
}

/* --- List / agenda --- */
.diary-list { display: flex; flex-direction: column; gap: 18px; max-width: 720px; }

.diary-list-day { }

.diary-list-dayhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.diary-list-date { font-size: 0.92rem; font-weight: 800; color: var(--ink); }
.diary-list-date--today { color: var(--sage-dark); }

.diary-list-recipes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.diary-empty-block { color: var(--muted); font-size: 0.9rem; padding: 24px 0; }

/* --- History --- */
.diary-history { max-width: 640px; }

.diary-search-row { display: flex; gap: 10px; align-items: center; }

.diary-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
}

.diary-search:focus-within { border-color: var(--sage); }
.diary-search input { flex: 1; border: none; outline: none; background: none; font-size: 0.92rem; color: var(--ink); }

.diary-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sage-dark);
  flex-shrink: 0;
  transition: border-color 0.12s, background 0.12s;
}

.diary-sync-btn:hover:not(:disabled) { border-color: var(--sage); background: var(--paper); }
.diary-sync-btn:disabled { opacity: 0.6; }

.diary-search-hint { font-size: 0.8rem; color: var(--muted); margin: 10px 2px 16px; }
.diary-search-hint strong { color: var(--sage-dark); font-weight: 700; }

.diary-link-btn {
  border: none;
  background: none;
  color: var(--sage);
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: underline;
  padding: 0;
}

.diary-results { display: flex; flex-direction: column; gap: 8px; }

.diary-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  text-align: left;
  transition: border-color 0.12s, background 0.12s;
}

.diary-result:hover { border-color: var(--sage); background: var(--paper); }
.diary-result .diary-chip-thumb { width: 46px; height: 46px; }
.diary-result-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.diary-result-name { font-size: 0.9rem; font-weight: 700; color: var(--ink); }
.diary-result-when { font-size: 0.74rem; color: var(--muted); }

.diary-result-kcal {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--terracotta);
  flex-shrink: 0;
}

/* --- Side panel placement inside the diary --- */
.diary-shell .recipe-panel {
  position: sticky;
  top: 0;
  align-self: stretch;
  max-height: 100vh;
}

/* --- Panel additions (also used by the Assistant) --- */
.recipe-panel-banner {
  width: 100%;
  height: 168px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--paper);
}

.recipe-panel-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }

.recipe-ingredient.has-icon {
  display: flex;
  align-items: center;
  gap: 9px;
}

.recipe-ingredient.has-icon::before { display: none; }

.recipe-ingredient-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface);
}

.recipe-missing-note {
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--paper);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.recipe-missing-note p { font-size: 0.82rem; color: var(--muted); margin: 0 0 8px; line-height: 1.4; }

.recipe-loadfull-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: var(--sage-dark);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.recipe-loadfull-btn:disabled { opacity: 0.7; }

@media (max-width: 900px) {
  .diary-shell { flex-direction: column; margin: -40px -48px; }
  .diary-shell .recipe-panel {
    position: relative;
    width: 100%;
    max-height: none;
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .diary-week-grid { grid-template-columns: repeat(7, minmax(96px, 1fr)); overflow-x: auto; }
}

/* ---------------------------------------------------------------------------
   Profile page
--------------------------------------------------------------------------- */

.profile-page { max-width: 860px; display: flex; flex-direction: column; gap: 18px; }
.profile-loading, .profile-error { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.profile-error { color: #b3261e; }

/* Header card */
.profile-header {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(135deg, rgba(82,121,111,0.10), rgba(82,125,163,0.08));
  border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px;
}
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar {
  position: relative; width: 84px; height: 84px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: linear-gradient(135deg, var(--sage), var(--blue));
  color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-initials { font-size: 1.7rem; font-weight: 800; }
.profile-avatar-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.35); color: #fff; }
.profile-avatar-edit {
  position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--sage-dark); color: #fff; border: 2px solid var(--surface);
}
.profile-avatar-edit:hover { background: var(--sage); }
.profile-avatar-edit:disabled { opacity: 0.6; cursor: default; }
.profile-header-id { flex: 1; min-width: 0; }
.profile-header-name { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.profile-header-email { color: var(--muted); font-size: 0.9rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.profile-header-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.profile-avatar-remove {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  background: none; border: none; color: var(--muted); font-size: 0.78rem; font-weight: 600;
}
.profile-avatar-remove:hover { color: #b3261e; }
.profile-logout {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.profile-logout:hover { border-color: var(--sage); color: var(--sage-dark); }

/* Tabs */
.profile-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.profile-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; cursor: pointer; background: none; border: none;
  color: var(--muted); font-size: 0.9rem; font-weight: 700;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.profile-tab:hover { color: var(--sage-dark); }
.profile-tab.is-active { color: var(--sage-dark); border-bottom-color: var(--sage); }

.profile-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px;
}
.profile-body-layout {
  display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start;
}

.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.profile-field { display: flex; flex-direction: column; gap: 5px; }
.profile-field--wide { grid-column: 1 / -1; }
.profile-field > span { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.profile-field input, .profile-field select {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); font-size: 0.9rem;
}
.profile-field input:disabled { color: var(--muted); cursor: not-allowed; }
.profile-field input:focus, .profile-field select:focus { outline: none; border-color: var(--sage); }

/* Targets panel + macro donut */
.profile-targets-panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.profile-targets-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px;
}
.macro-donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.macro-donut { width: 150px; height: 150px; }
.macro-donut-kcal { font-size: 1.45rem; font-weight: 800; fill: var(--ink); }
.macro-donut-unit { font-size: 0.62rem; font-weight: 700; fill: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.macro-legend { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.macro-legend-row { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; }
.macro-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.macro-legend-label { flex: 1; font-weight: 600; color: var(--ink); }
.macro-legend-val { font-weight: 700; color: var(--ink); }
.macro-legend-pct { width: 38px; text-align: right; color: var(--muted); font-weight: 600; }
.profile-hint { color: var(--muted); font-size: 0.86rem; line-height: 1.5; }

.profile-prefgroup { margin-top: 18px; }
.profile-prefgroup:first-of-type { margin-top: 0; }
.profile-preflabel {
  display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-bottom: 8px;
}
.profile-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.profile-chip {
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.profile-chip:hover { border-color: var(--sage); }
.profile-chip.is-on { background: var(--sage); border-color: var(--sage); color: #fff; }

.profile-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.profile-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 6px 5px 11px; border-radius: 999px;
  background: rgba(82, 121, 111, 0.12); color: var(--sage-dark);
  font-size: 0.82rem; font-weight: 600;
}
.profile-tag button {
  display: grid; place-items: center; cursor: pointer;
  border: none; background: none; color: var(--sage-dark); opacity: 0.7; padding: 0;
}
.profile-tag button:hover { opacity: 1; }
.profile-tag-add { display: flex; gap: 8px; }
.profile-tag-add input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); font-size: 0.88rem;
}
.profile-tag-add input:focus { outline: none; border-color: var(--sage); }
.profile-tag-add button {
  padding: 8px 14px; border-radius: 8px; border: none;
  background: var(--sage-dark); color: #fff; font-weight: 700; font-size: 0.84rem; cursor: pointer;
}

.profile-savebar {
  position: sticky; bottom: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 12px 0;
}
.profile-saved { display: inline-flex; align-items: center; gap: 5px; color: var(--sage-dark); font-weight: 700; font-size: 0.85rem; }
.profile-save-btn {
  padding: 10px 20px; border-radius: 9px; border: none;
  background: var(--sage-dark); color: #fff; font-weight: 800; font-size: 0.88rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.profile-save-btn:disabled { opacity: 0.7; cursor: default; }

@media (max-width: 760px) {
  .profile-body-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-header { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------------------
   Search page
--------------------------------------------------------------------------- */

.search-shell {
  display: flex; align-items: flex-start; gap: 0;
  margin: -40px -48px;            /* bleed into workspace-main padding */
}
.search-main { flex: 1; min-width: 0; padding: 40px 40px 48px 48px; }
.search-head { margin-bottom: 16px; }
.search-head h2 { font-size: 1.4rem; font-weight: 800; }

.search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 46px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
}
.search-bar:focus-within { border-color: var(--sage); }
.search-bar-icon { color: var(--muted); flex-shrink: 0; }
.search-bar input { flex: 1; border: none; background: none; font-size: 0.98rem; color: var(--ink); }
.search-bar input:focus { outline: none; }
.search-bar-spin { color: var(--sage); }

.search-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.search-select {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 0.86rem; font-weight: 600; cursor: pointer;
}
.search-select:focus { outline: none; border-color: var(--sage); }
.search-filter-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 0.86rem; font-weight: 700;
}
.search-filter-toggle:hover { border-color: var(--sage); color: var(--sage-dark); }
.search-filter-toggle.is-on { background: var(--sage); border-color: var(--sage); color: #fff; }

.search-filters {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 12px; padding: 14px 16px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
}
.search-filters label { display: flex; flex-direction: column; gap: 5px; }
.search-filters label span { font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.search-filters input {
  width: 130px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font-size: 0.88rem;
}
.search-filters input:focus { outline: none; border-color: var(--sage); }

/* Category chip row — horizontally scrollable, sprite-icon chips */
/* Category chips wrap to the page width (no horizontal scroll) */
.cat-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.cat-chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 6px 12px 6px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: 0.82rem; font-weight: 600; white-space: nowrap;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.cat-chip:hover { border-color: var(--sage); }
.cat-chip.is-on { background: var(--sage); border-color: var(--sage); color: #fff; }
/* Stroke-based line icons in a 48-unit space (svg carries viewBox="0 0 48 48"). */
.cat-chip-icon { width: 17px; height: 17px; flex: 0 0 auto; color: var(--sage-dark); }
.cat-chip.is-on .cat-chip-icon { color: #fff; }
.cat-chip-icon path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Filter chip groups (time, difficulty) inside the filters panel */
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group-label { font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip {
  cursor: pointer; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: 0.82rem; font-weight: 600;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.fchip:hover { border-color: var(--sage); }
.fchip.is-on { background: var(--sage); border-color: var(--sage); color: #fff; }

.search-pill--diff { text-transform: capitalize; }

.search-meta { margin: 16px 0 10px; color: var(--muted); font-size: 0.84rem; font-weight: 600; }

.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 12px; }
.search-card {
  display: flex; flex-direction: column; gap: 10px; text-align: left; cursor: pointer;
  padding: 14px 15px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.search-card:hover { border-color: var(--sage); box-shadow: 0 3px 12px rgba(0,0,0,0.06); }
.search-card:active { transform: scale(0.995); }
.search-card.is-active { border-color: var(--sage); box-shadow: 0 0 0 1px var(--sage); }

/* Image-backed card: recipe photo fills the tile, dark gradient keeps text legible */
.search-card.has-image {
  position: relative; min-height: 168px; justify-content: flex-end;
  border: none; overflow: hidden; color: #fff;
}
.search-card-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
.search-card.has-image::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(20,22,20,0.86) 0%, rgba(20,22,20,0.42) 48%, rgba(20,22,20,0.04) 100%);
}
.search-card.has-image .search-card-title,
.search-card.has-image .search-card-meta { position: relative; z-index: 2; }
.search-card.has-image .search-card-title { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.55); }
.search-card.has-image .search-pill { background: rgba(0,0,0,0.42); color: #fff; backdrop-filter: blur(2px); }
.search-card.has-image .search-pill--meal { background: rgba(0,0,0,0.42); color: #fff; }
.search-card.has-image:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.18); }
.search-card.has-image.is-active { box-shadow: 0 0 0 2px var(--sage); }

.search-card-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; color: var(--ink); }
.search-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.search-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--paper); color: var(--muted);
  font-size: 0.74rem; font-weight: 700;
}
.search-pill--meal { background: rgba(82, 121, 111, 0.14); color: var(--sage-dark); text-transform: capitalize; }
.search-empty { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 28px 0; }

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