/* ── Reset & Base ─────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --card: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --text: #1a2332;
  --text-muted: #6b7a8d;
  --accent: #14b8a6;
  --accent-hover: #0d9488;
  --accent-glow: rgba(45, 212, 191, 0.25);
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  height: 100%;
}

body {
  position: fixed;
  inset: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  overflow: hidden;
}

/* ── Utility ─────────────────────────────────────── */
.hidden {
  display: none !important;
}

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

/* ── Buttons ─────────────────────────────────────── */
.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0.65rem 1.6rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 32px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ── Login Screen ────────────────────────────────── */
#login-screen {
  justify-content: center;
  align-items: center;
  background: #ffffff;
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
  width: 90%;
  padding: 4rem 2rem 3rem;
}

.logo-area {
  margin-bottom: 2.75rem;
}

.logo-img {
  width: 160px;
  height: auto;
  display: block;
  margin-bottom: 1.25rem;
}

.logo-img.sm {
  width: 72px;
  margin-bottom: 0;
}

.login-card h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1d1d1f;
}

.tagline {
  color: #6e6e73;
  font-size: 0.975rem;
  margin-top: 0.55rem;
  line-height: 1.55;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* Feature list */
.login-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
  text-align: left;
  width: 100%;
  max-width: 300px;
}

.login-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.9rem;
  color: #1d1d1f;
  line-height: 1.45;
}

.login-feature-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 0.05rem;
}

/* Button */
.login-card .btn-primary {
  width: 100%;
  max-width: 300px;
  padding: 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 14px;
  letter-spacing: -0.01em;
  box-shadow: none;
}

.login-card .btn-primary:hover {
  transform: none;
  box-shadow: none;
  opacity: 0.9;
}

/* Footnote */
.login-footnote {
  font-size: 0.78rem;
  color: #6e6e73;
  margin-top: 1.25rem;
  max-width: 260px;
  line-height: 1.55;
}

/* ── Top Bar ─────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.user-name {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Chat Layout ─────────────────────────────────── */
.chat-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

.message.ai {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.message.ai.thinking {
  color: var(--text-muted);
  font-style: italic;
}

/* ── Tool Indicator ──────────────────────────────── */
.tool-indicator {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.2rem 0.4rem;
}

.tool-indicator-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

/* ── Raw event panel ─────────────────────────────── */
.raw-panel {
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
}

.raw-panel summary {
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem 0;
  user-select: none;
}

#raw-log {
  background: #0f1117;
  color: #a8ff78;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Input bar ───────────────────────────────────── */
.input-bar {
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem 0 calc(1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

.chat-textarea {
  flex: 1;
  font-family: var(--font);
  font-size: 0.92rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  resize: none;
  line-height: 1.4;
  overflow-y: hidden;
}

.chat-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.input-bar .btn {
  align-self: flex-end;
}

/* ── Markdown messages ───────────────────────────── */
.message.ai.md {
  white-space: normal;
  max-width: 82%;
}

.message.ai.md p {
  margin: 0 0 0.55em;
  line-height: 1.65;
}

.message.ai.md p:last-child {
  margin-bottom: 0;
}

.message.ai.md ul,
.message.ai.md ol {
  margin: 0.35em 0 0.55em;
  padding-left: 1.35em;
}

.message.ai.md li {
  margin: 0.25em 0;
  line-height: 1.6;
}

.message.ai.md li > ul,
.message.ai.md li > ol {
  margin: 0.15em 0 0.1em;
}

.message.ai.md ul > li::marker {
  color: var(--accent);
}

.message.ai.md strong {
  font-weight: 650;
  color: var(--text);
}

.message.ai.md em {
  color: var(--text-muted);
}

.message.ai.md code {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.84em;
  background: rgba(0, 0, 0, 0.055);
  padding: 0.15em 0.38em;
  border-radius: 5px;
  color: var(--accent-hover);
}

.message.ai.md h1,
.message.ai.md h2,
.message.ai.md h3 {
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 0.6em 0 0.3em;
  line-height: 1.3;
}

.message.ai.md h1 { font-size: 1.1rem; }
.message.ai.md h2 { font-size: 1rem; }
.message.ai.md h3 { font-size: 0.95rem; }

/* Card styles live in css/<card-name>.css and are loaded
   via separate <link> tags in index.html. */

/* ── Mobile ──────────────────────────────────────── */
@media (max-width: 600px) {
  .topbar {
    padding: 0.6rem 1rem;
  }

  .user-name,
  #btn-switch-role {
    display: none;
  }

  .raw-panel {
    display: none;
  }

  .chat-layout {
    padding: 0 0.75rem;
  }

  .message {
    max-width: 88%;
  }

  .message.ai.md {
    max-width: 92%;
  }

  .input-bar {
    padding: 0.6rem 0 calc(0.6rem + env(safe-area-inset-bottom));
    gap: 0.5rem;
  }

  .chat-textarea {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .role-cards {
    flex-direction: column;
    align-items: center;
  }

  .role-card {
    width: 100%;
    max-width: 320px;
    flex-direction: row;
    padding: 1.25rem 1.5rem;
    text-align: left;
    gap: 1rem;
  }

  .role-card-icon {
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .role-card-desc {
    display: none;
  }

  .pro-split-layout {
    flex-direction: column;
  }

  .pro-sidebar {
    width: 100%;
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .pro-detail {
    padding: 1.25rem 1rem;
  }

  .saved-content {
    padding: 1rem;
    gap: 1rem;
  }
}

/* ── Centered card (not-invited / pro construction) ─ */
.centered-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  text-align: center;
}

.centered-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.screen-msg {
  font-size: 0.95rem;
  color: var(--text);
  max-width: 360px;
}

.screen-msg.muted {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.construction-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ── Role picker ─────────────────────────────────── */
.role-picker {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 2rem;
  background:
    radial-gradient(circle at 25% 35%, rgba(13, 148, 136, 0.05) 0%, transparent 55%),
    radial-gradient(circle at 75% 70%, rgba(13, 148, 136, 0.04) 0%, transparent 50%),
    var(--bg);
}

.role-picker-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.role-picker-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.role-cards {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.role-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.role-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.role-card-icon {
  width: 36px;
  height: 36px;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.role-card-title {
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
}

.role-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ── Owner panel ─────────────────────────────────── */
.owner-panel {
  flex: 1;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.panel-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.section-title {
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
}

.invite-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.text-input {
  font-family: var(--font);
  font-size: 0.92rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.radio-group {
  display: flex;
  gap: 1.5rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.radio-label input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.invite-msg {
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.invite-msg.success {
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent-hover);
}

.invite-msg.error {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

/* ── Users list ──────────────────────────────────── */
.users-list {
  display: flex;
  flex-direction: column;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.user-row:first-child { padding-top: 0; }
.user-row:last-child  { border-bottom: none; padding-bottom: 0; }

.user-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.user-row-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.role-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  letter-spacing: 0.01em;
}

.role-badge--owner  { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.role-badge--pro    { background: rgba(20, 184, 166, 0.1); color: var(--accent-hover); }
.role-badge--client { background: rgba(0, 0, 0, 0.05);     color: var(--text-muted); }

.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.9rem; }

.users-list-empty {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ── Client tab bar (Chat / Me) ──────────────────── */
.client-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.client-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: var(--font);
  margin-bottom: -1px;
}

.client-tab svg {
  transition: color 0.15s;
  opacity: 0.6;
}

.client-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.client-tab.active svg {
  opacity: 1;
}

.client-tab:hover:not(.active) {
  color: var(--text);
  background: rgba(0, 0, 0, 0.02);
}

.client-tab:hover:not(.active) svg {
  opacity: 0.85;
}

/* ── Saved view ───────────────────────────────────── */
.saved-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.saved-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 1.25rem;
  flex-shrink: 0;
  gap: 0.25rem;
}

.saved-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font);
  margin-bottom: -1px;
}

.saved-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.saved-tab:hover:not(.active) {
  color: var(--text);
}

/* Cards flow at their natural widths, wrapping onto new rows */
.saved-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-content: flex-start;
}

.saved-empty {
  width: 100%;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 3rem 1rem;
}


/* ── Card save button (shared across recipe / food / shopping-list cards) ── */
.card-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #8b6040;
  background: rgba(212, 169, 106, 0.12);
  border: 1px solid rgba(212, 169, 106, 0.35);
  border-radius: 20px;
  padding: 5px 11px 5px 9px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  font-family: var(--font);
  flex-shrink: 0;
}

.card-save-btn:hover {
  color: #5a3a1e;
  background: rgba(212, 169, 106, 0.22);
  border-color: rgba(212, 169, 106, 0.55);
}

.card-save-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

.card-save-btn--saved {
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.3);
}

/* ── Chat toolbar (New chat button) ─────────────── */
.chat-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0.6rem 0 0;
  flex-shrink: 0;
}

/* ── Chat history list (Chats tab) ───────────────── */
.chat-date-group-header {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.9rem 0.25rem 0.35rem;
  margin-top: 0.25rem;
}
.chat-date-group-header:first-child {
  padding-top: 0.25rem;
  margin-top: 0;
}

.chat-history-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 1rem;
}

.chat-history-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  min-width: 0;
}

.chat-history-label {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Pro Dashboard ───────────────────────────────── */

/* Tab bar — mirrors .client-tabs exactly */
.pro-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pro-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: var(--font);
  margin-bottom: -1px;
}

.pro-tab svg {
  transition: color 0.15s;
  opacity: 0.6;
}

.pro-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.pro-tab.active svg { opacity: 1; }

.pro-tab:hover:not(.active) {
  color: var(--text);
  background: rgba(0, 0, 0, 0.02);
}

.pro-tab:hover:not(.active) svg { opacity: 0.85; }

/* Split layout */
.pro-split-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* Sidebar */
.pro-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pro-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 0.5rem;
}

.pro-sidebar-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pro-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem;
}

.pro-list-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}

.pro-list-item:hover:not(.active) { background: rgba(0, 0, 0, 0.04); }

.pro-list-item.active {
  background: rgba(20, 184, 166, 0.1);
}

.pro-list-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pro-list-item.active .pro-list-item-name { color: var(--accent-hover); }

.pro-list-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pro-list-empty {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 1rem 0.75rem;
}

/* Detail panel */
.pro-detail {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  max-width: 760px;
}

.pro-empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.pro-detail-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pro-detail-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pro-title-input {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
  flex: 1;
  min-width: 0;
}
.pro-title-input:focus {
  outline: none;
  border-bottom: 2px solid var(--accent, #6366f1);
  border-radius: 0;
}

.pro-detail-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Sections — reuse owner-panel card style */
.pro-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.pro-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.pro-textarea {
  width: 100%;
  resize: vertical;
  font-size: 0.9rem;
  line-height: 1.55;
  min-height: 80px;
}

.pro-select {
  cursor: pointer;
  min-width: 160px;
}

.pro-plan-preview {
  font-size: 0.88rem;
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.save-msg {
  font-size: 0.82rem;
  color: var(--accent-hover);
}

/* Plan history */
.pro-history-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pro-history-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--bg);
}
.pro-history-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.pro-history-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.pro-history-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.pro-history-load {
  margin-left: auto;
}
.pro-history-snippet {
  font-size: 0.8rem;
  color: var(--muted, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Pro chat session list ────────────────────────── */
.pro-chat-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 0.4rem;
}

.pro-chat-session-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.pro-chat-session-date {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.pro-chat-session-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Pro chat viewer modal ────────────────────────── */
.pro-chat-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.pro-chat-modal {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.18);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pro-chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pro-chat-modal-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pro-chat-modal-messages .message {
  max-width: 78%;
}