/* ========================================
   SVIP AI Chat — Claude Code Style
   Deep black + warm orange accent
   Centered chat layout
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Inter:wght@300;400;500;600;700&display=swap');

/* ==================== Design Tokens ==================== */
:root {
  /* Core palette — Claude Code deep dark */
  --bg-primary: #0A0A0A;
  --bg-secondary: #111111;
  --bg-tertiary: #0D0D0D;
  --bg-surface: #161616;
  --bg-surface-hover: #1C1C1C;
  --bg-elevated: #1F1F1F;
  --bg-input: #1A1A1A;

  /* Brand accent — Anthropic warm orange */
  --accent: #E07A4F;
  --accent-hover: #EB9268;
  --accent-muted: rgba(224, 122, 79, 0.12);
  --accent-glow: rgba(224, 122, 79, 0.25);
  --accent-subtle: rgba(224, 122, 79, 0.06);

  /* Text scale */
  --text-primary: #EDEDED;
  --text-secondary: #8B8B8B;
  --text-muted: #5A5A5A;
  --text-inverse: #0A0A0A;

  /* Functional */
  --success: #4ADE80;
  --error: #F87171;
  --warning: #FBBF24;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-active: rgba(255, 255, 255, 0.10);
  --divider: rgba(255, 255, 255, 0.04);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.7);

  /* Typography */
  --font-sans: 'Microsoft YaHei', '微软雅黑', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;

  /* Layout */
  --chat-max-width: 768px;
  --sidebar-width: 280px;
  --top-bar-height: 52px;
}

/* ==================== Reset & Base ==================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

::selection {
  background: var(--accent-muted);
  color: var(--accent);
}

/* User message bubble: override selection to avoid orange-on-orange */
.message.user .message-bubble::selection {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.message.user .message-bubble *::selection {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ==================== App Layout — Centered Chat ==================== */
.app-layout {
  display: flex;
  height: 100vh;
  position: relative;
}

/* ==================== Sidebar ==================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
  z-index: 100;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-inverse);
}

.sidebar-brand-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.btn-new-chat {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: 1px dashed var(--border-active);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-new-chat:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-list-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-list-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 10px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.sidebar-item--empty {
  color: var(--text-muted);
  font-style: italic;
  cursor: default;
  padding-left: 32px;
}

.sidebar-item--empty:hover {
  background: transparent;
  color: var(--text-muted);
}

.sidebar-item-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item-delete {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  border-radius: 4px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  line-height: 1;
}

.sidebar-item:hover .sidebar-item-delete {
  display: flex;
}

.sidebar-item-delete:hover {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
}

/* ==================== Main Area — Centered ==================== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: var(--bg-primary);
}

/* ==================== Top Bar ==================== */
.top-bar {
  height: var(--top-bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  flex-shrink: 0;
  z-index: 10;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-toggle-sidebar {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.top-bar-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-account {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
/*  max-width: 120px;*/
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.user-badge.free {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.user-badge.pro {
  background: linear-gradient(135deg, rgba(224, 122, 79, 0.2), rgba(255, 183, 77, 0.15));
  color: #FFB74D;
  border: 1px solid rgba(255, 183, 77, 0.3);
  text-shadow: 0 0 8px rgba(255, 183, 77, 0.3);
}

.svip-days {
  font-size: 11px;
  font-weight: 600;
  color: #FFB74D;
  background: rgba(255, 183, 77, 0.1);
  border: 1px solid rgba(255, 183, 77, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.btn-upgrade {
  padding: 5px 14px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-upgrade:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-login-top {
  padding: 5px 16px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-login-top:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-logout {
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  border-color: var(--error);
  color: var(--error);
  background: rgba(248, 113, 113, 0.08);
}

/* ==================== Chat Center Wrapper ==================== */
.chat-center-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: var(--top-bar-height);
  min-height: 0;
  overflow: hidden;
}

/* ==================== Chat Area — Centered ==================== */
.chat-area {
  width: 100%;
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 0;
  position: relative;
}

/* Welcome background — fixed behind chat content, fades out when messages exist */
.chat-empty {
  position: fixed;
  top: var(--top-bar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.chat-empty.is-hidden {
  opacity: 0.3;
}

.chat-container {
  width: 100%;
  max-width: var(--chat-max-width);
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Welcome UI elements */
.chat-empty-icon {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 20px;
  opacity: 0.8;
}

.chat-empty h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.chat-empty p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.6;
}

/* ==================== Messages ==================== */
.message {
  padding: 8px 0;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

/* ---- User message: right-aligned orange bubble ---- */
.message.user .message-row {
  flex-direction: row-reverse;
}

.message.user .message-content {
  align-items: flex-end;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, #E07A4F, #D06A3F);
  color: #FFFFFF;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 16px;
  max-width: 85%;
  box-shadow: 0 2px 8px rgba(224, 122, 79, 0.2);
}

.message.user .message-bubble code:not(pre code) {
  background: rgba(255, 255, 255, 0.18);
  color: #FFF;
}

.message.user .message-bubble strong {
  color: #FFFFFF;
}

.message.user .message-bubble a {
  color: #FFD4C0;
}

.message.user .message-bubble a:hover {
  color: #FFFFFF;
}

.message.user .message-avatar {
/*  background: var(--accent-muted);*/
  color: var(--accent);
}

/* ---- AI message: left-aligned dark bubble ---- */
.message.assistant .message-content {
  align-items: flex-start;
}

.message.assistant .message-bubble {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 18px 18px 18px 4px;
  padding: 10px 16px;
  max-width: 90%;
  border: 1px solid var(--border);
}

.message.assistant .message-avatar {
/*  background: rgba(255, 255, 255, 0.06);*/
  color: var(--text-secondary);
}

.message-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.message-bubble {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  word-break: break-word;
}

/* Markdown content in messages */
.message-bubble p {
  margin-bottom: 12px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble h1, .message-bubble h2, .message-bubble h3,
.message-bubble h4, .message-bubble h5, .message-bubble h6 {
  margin: 20px 0 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.message-bubble h1 { font-size: 1.4em; }
.message-bubble h2 { font-size: 1.25em; }
.message-bubble h3 { font-size: 1.1em; }

.message-bubble ul, .message-bubble ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.message-bubble li {
  margin-bottom: 4px;
}

.message-bubble blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 12px 0;
  color: var(--text-secondary);
  background: var(--accent-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.message-bubble a {
  color: var(--accent);
  text-decoration: none;
}

.message-bubble a:hover {
  text-decoration: underline;
}

.message-bubble strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Horizontal rule (divider) */
.message-bubble hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--accent) 80%, transparent);
  opacity: 0.35;
  margin: 16px 0;
}

/* Inline code */
.message-bubble code:not(pre code) {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: var(--font-mono);
  color: var(--accent);
}

/* Code blocks */
.message-bubble pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 12px 0;
  overflow: hidden;
}

.message-bubble pre code {
  display: block;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}

/* Tables */
.message-bubble table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}

.message-bubble th, .message-bubble td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.message-bubble th {
  background: var(--bg-surface);
  font-weight: 600;
}

/* Typing cursor */
.typing-cursor {
  display: inline-block;
  width: 7px;
  height: 18px;
  background: var(--accent);
  border-radius: 1px;
  animation: blink 0.8s ease-in-out infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ==================== Input Area — Centered ==================== */
.input-area {
  width: 100%;
  max-width: var(--chat-max-width);
  margin: 0 auto;
  padding: 0 24px 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}



.input-wrapper {
  width: 100%;
}

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
  margin-top:10px;
}

.chat-input-container {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-fast);
}

.chat-input-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-muted);
}

.chat-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-sans);
  line-height: 1.6;
  padding: 16px 60px 16px 18px;
  resize: none;
  height: 100px;
  max-height: 200px;
  min-height: 100px;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.btn-send, .btn-stop {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-send {
  background: var(--accent);
  color: var(--text-inverse);
}

.btn-send:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-stop {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.btn-stop:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

/* ==================== Auth Modal ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.modal-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-error {
  font-size: 12px;
  color: var(--error);
  margin-bottom: 12px;
  min-height: 16px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.form-error.visible {
  opacity: 1;
}

.btn-submit {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-inverse);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.btn-submit:hover {
  background: var(--accent-hover);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== Modal Tabs ==================== */
.modal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.modal-tab {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-tab:hover {
  color: var(--text-secondary);
}

.modal-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ==================== Spinner ==================== */
.btn-submit-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== Auth Form Transition ==================== */
.auth-form {
  animation: fadeIn 0.2s ease;
}

/* ==================== Upgrade Modal ==================== */
.upgrade-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg), 0 0 80px rgba(255, 183, 77, 0.06);
  position: relative;
  animation: fadeIn 0.25s ease;
}

.upgrade-header {
  text-align: center;
  margin-bottom: 28px;
}

.upgrade-crown {
  font-size: 36px;
  margin-bottom: 8px;
  display: inline-block;
  background: linear-gradient(135deg, #FFB74D, #E07A4F);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(255, 183, 77, 0.3));
}

.upgrade-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.upgrade-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Plans grid */
.upgrade-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* Plan card */
.plan-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all var(--transition-normal);
}

.plan-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Recommended card — golden glow */
.plan-card--recommended {
  border-color: rgba(255, 183, 77, 0.3);
  background: linear-gradient(180deg, rgba(255, 183, 77, 0.04) 0%, var(--bg-primary) 100%);
}

.plan-card--recommended:hover {
  border-color: rgba(255, 183, 77, 0.5);
  box-shadow: 0 4px 24px rgba(255, 183, 77, 0.1);
}

/* Badge / Save tag */
.plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #FFB74D, #E07A4F);
  color: var(--text-inverse);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

.plan-save {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--success);
  color: #052e16;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Plan info */
.plan-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  margin-top: 4px;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-bottom: 4px;
}

.plan-currency {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.plan-amount {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.plan-period {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 2px;
}

.plan-equivalent {
  font-size: 12px;
  color: var(--success);
  font-weight: 500;
  margin-bottom: 16px;
}

/* Features list */
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  flex: 1;
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 5px 0;
  line-height: 1.4;
}

.plan-features li svg {
  flex-shrink: 0;
  color: var(--accent);
}

.plan-card--recommended .plan-features li svg {
  color: #FFB74D;
}

/* Plan buttons */
.plan-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #FFB74D, #E07A4F);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-inverse);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.plan-btn:hover {
  box-shadow: 0 0 20px rgba(255, 183, 77, 0.3);
  transform: translateY(-1px);
}

.plan-btn--outline {
  background: transparent;
  border: 1px solid rgba(255, 183, 77, 0.3);
  color: #FFB74D;
}

.plan-btn--outline:hover {
  background: rgba(255, 183, 77, 0.08);
  border-color: rgba(255, 183, 77, 0.5);
  box-shadow: 0 0 16px rgba(255, 183, 77, 0.1);
}

/* Agreement checkbox */
.upgrade-agreement {
/*  margin-bottom: 16px;*/
  padding-top: 35px;
  border-top: 1px solid var(--divider);
  text-align: center;
}

.agreement-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  position: relative;
}

.agreement-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.agreement-checkmark {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-active);
  border-radius: 4px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  margin-top: 1px;
}

.agreement-checkmark::after {
  content: '';
  display: none;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--text-inverse);
  border-bottom: 2px solid var(--text-inverse);
  transform: rotate(-45deg) translateY(-1px);
}

.agreement-checkbox:checked + .agreement-checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.agreement-checkbox:checked + .agreement-checkmark::after {
  display: block;
}

.agreement-checkbox:focus-visible + .agreement-checkmark {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.agreement-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.agreement-text a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.agreement-text a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Plan buttons — disabled when agreement not checked */
.plan-btn.disabled-agreement {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.plan-btn--outline.disabled-agreement {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Footer */
.upgrade-footer {
  text-align: center;
  padding-top: 4px;
}

.upgrade-footer p {
  font-size: 11px;
  color: var(--text-muted);
}

/* Upgrade modal responsive */
@media (max-width: 520px) {
  .upgrade-modal {
    max-width: 100%;
    margin: 12px;
    padding: 28px 20px 24px;
  }

  .upgrade-plans {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ==================== Utilities ==================== */
.hidden {
  display: none !important;
}

/* ==================== Quota Exceeded Modal ==================== */
.quota-modal {
  text-align: center;
}

.quota-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.quota-modal-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.9;
}

.quota-modal h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.quota-modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 300px;
}

.quota-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.quota-btn {
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  border: none;
}

.quota-btn--primary {
  background: var(--accent);
  color: var(--text-inverse);
}

.quota-btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 16px var(--accent-glow);
}

.quota-btn--outline {
  background: transparent;
  border: 1px solid rgba(255, 183, 77, 0.3);
  color: #FFB74D;
}

.quota-btn--outline:hover {
  background: rgba(255, 183, 77, 0.08);
  border-color: rgba(255, 183, 77, 0.5);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    display: none;
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .btn-toggle-sidebar {
    display: block;
  }

  .chat-container {
    padding: 16px 16px 0;
  }

  .input-area {
    padding: 0 16px 16px;
  }

  .chat-empty {
    left: 0;
  }
}

@media (max-width: 480px) {
  :root {
    --chat-max-width: 100%;
  }

  .modal {
    margin: 16px;
  }
}
