/* =====================================================
   AXIA — style.css v11.1
   ===================================================== */

/* --- CSS Variables --- */
:root {
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface2:     #21262d;
  --border:       #30363d;
  --accent:       #58a6ff;
  --accent-dim:   #1f6feb;
  --accent-glow:  rgba(88,166,255,0.12);
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --text-dim:     #484f58;
  --user-bg:      #1f6feb;
  --ai-bg:        #21262d;
  --error-bg:     #3d1a1a;
  --error-text:   #f85149;
  --success:      #3fb950;
  --warning:      #d29922;
  --diff-add-bg:  rgba(63,185,80,0.15);
  --diff-del-bg:  rgba(248,81,73,0.15);
  --diff-add-txt: #3fb950;
  --diff-del-txt: #f85149;
  --diff-hunk-bg: rgba(88,166,255,0.10);
  --diff-hunk-txt:#58a6ff;
  --diff-head-bg: rgba(255,255,255,0.04);
  --radius:       12px;
  --radius-sm:    8px;
  --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; min-height: 100dvh; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  margin: 0;
}
button { cursor: pointer; font-family: inherit; }
textarea { font-family: inherit; resize: none; }
ul { list-style: none; }

/* --- App Wrapper --- */
.app,
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- Header --- */
.header { background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 100; position: sticky; top: 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 56px; max-width: 1400px; margin: 0 auto; width: 100%; }
.header-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; white-space: nowrap; }
.header-icon { font-size: 20px; }
.version-badge { font-size: 10px; background: var(--accent-dim); color: #fff; padding: 2px 7px; border-radius: 20px; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 14px; }

/* --- Main Content --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* --- Panel --- */
.panel { display: none; flex: 1; flex-direction: column; min-height: 0; }
.panel.active { display: flex; min-height: 0; }

/* --- Chat Layout --- */
.chat-layout { display: flex; flex: 1; min-height: 0; }

/* --- Left Sidebar --- */
.left-sidebar { width: 240px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sidebar-title { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.sidebar-toggle-btn { background: none; border: none; color: var(--text-muted); font-size: 18px; padding: 2px 6px; border-radius: 4px; }
.sidebar-toggle-btn:hover { background: var(--surface2); color: var(--text); }
.sidebar-content { flex: 1; overflow-y: auto; padding: 8px; }
.sidebar-empty { color: var(--text-dim); font-size: 12px; text-align: center; padding: 20px 8px; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.sidebar-new-btn { width: 100%; padding: 8px; background: var(--accent-dim); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
.sidebar-new-btn:hover { background: var(--accent); }

/* --- Center Chat --- */
.center-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* --- Chat Area --- */
.chat-area,
#chatArea {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 160px;
}

/* --- Welcome Section --- */
.welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px 40px; text-align: center; min-height: 60vh; }
.welcome-icon { font-size: 48px; margin-bottom: 16px; }
.welcome h2 { font-size: 24px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.welcome p { font-size: 15px; color: var(--text-muted); margin-bottom: 28px; max-width: 480px; }
.example-prompts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.example-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 10px 18px; border-radius: 24px; font-size: 14px; cursor: pointer; transition: all .15s; }
.example-btn:hover { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.main-actions { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; }
.action-btn { display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: var(--accent-dim); color: #fff; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600; text-align: left; transition: all .15s; }
.action-btn:hover { background: var(--accent); transform: translateY(-1px); }
.btn-icon { font-size: 18px; }

/* --- Input Area --- */
.input-area {
  position: fixed;
  bottom: 0;
  left: 240px;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 12px 20px 16px;
  z-index: 200;
}
.input-inner { display: flex; align-items: flex-end; gap: 8px; max-width: 860px; margin: 0 auto; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.message-input { flex: 1; background: transparent; border: none; color: var(--text); font-size: 14px; line-height: 1.5; outline: none; max-height: 160px; overflow-y: auto; }
.message-input::placeholder { color: var(--text-dim); }
.input-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.voice-btn { background: none; border: none; color: var(--text-muted); font-size: 18px; padding: 4px; border-radius: 6px; transition: all .15s; }
.voice-btn:hover { color: var(--text); background: var(--surface); }
.voice-btn.active { color: var(--error-text); }
.send-btn { background: var(--accent-dim); border: none; color: #fff; padding: 8px; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.send-btn:hover { background: var(--accent); }
.stop-btn { background: var(--error-bg); border: 1px solid var(--error-text); color: var(--error-text); padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 700; transition: all .15s; }
.stop-btn:hover { background: var(--error-text); color: #fff; }
.suggestion-bar { display: flex; gap: 8px; flex-wrap: wrap; max-width: 860px; margin: 8px auto 0; }
.suggest-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); padding: 5px 12px; border-radius: 20px; font-size: 12px; transition: all .15s; }
.suggest-btn:hover { border-color: var(--accent); color: var(--accent); }
.input-hint { text-align: center; font-size: 11px; color: var(--text-dim); margin-top: 6px; max-width: 860px; margin-left: auto; margin-right: auto; }

/* --- Agent Mode Bar --- */
.agent-mode-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 860px; margin: 8px auto 0; }
.agent-mode-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.agent-mode-slider { width: 36px; height: 20px; background: var(--surface2); border-radius: 10px; position: relative; transition: background .2s; border: 1px solid var(--border); }
.agent-mode-slider::after { content: ''; position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: transform .2s; }
.agent-mode-toggle input:checked + .agent-mode-slider { background: var(--accent-dim); }
.agent-mode-toggle input:checked + .agent-mode-slider::after { transform: translateX(16px); }
.agent-mode-toggle input { display: none; }
.agent-mode-label { font-size: 13px; color: var(--text-muted); }
.agent-history-btn, .agent-dashboard-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); padding: 4px 10px; border-radius: 6px; font-size: 12px; }
.agent-history-btn:hover, .agent-dashboard-btn:hover { color: var(--text); border-color: var(--accent); }
.agent-safety-select { background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); padding: 4px 8px; border-radius: 6px; font-size: 12px; }

/* --- Stream Panel --- */
.stream-panel { background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0; max-height: 200px; display: flex; flex-direction: column; }
.stream-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.stream-panel-title { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.stream-toggle-btn { background: none; border: none; color: var(--text-muted); font-size: 14px; }
.stream-log { flex: 1; overflow-y: auto; padding: 8px 16px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

/* --- Spinner --- */
.spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* --- Chat Messages --- */
.message { display: flex; gap: 12px; padding: 16px 20px; max-width: 860px; margin: 0 auto; width: 100%; }
.message.user { flex-direction: row-reverse; }
.message-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; background: var(--surface2); }
.message.user .message-avatar { background: var(--user-bg); }
.message-body { flex: 1; min-width: 0; }
.message-content { background: var(--ai-bg); border-radius: var(--radius); padding: 12px 16px; font-size: 14px; line-height: 1.7; word-break: break-word; }
.message.user .message-content { background: var(--user-bg); color: #fff; }
.message-content pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; margin: 8px 0; }
.message-content code { font-family: var(--font-mono); font-size: 13px; }
.message-content p { margin: 6px 0; }
.message-content ul, .message-content ol { padding-left: 20px; margin: 6px 0; }

/* --- Auth Buttons --- */
.auth-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 6px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; transition: all .15s; }
.auth-btn:hover { border-color: var(--accent); color: var(--accent); }
.auth-btn-primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.auth-btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.auth-btn.hidden { display: none !important; }
.header-credits { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 5px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
.header-credits:hover { border-color: var(--warning); color: var(--warning); }
.header-notif-bell { background: none; border: none; font-size: 18px; color: var(--text-muted); padding: 4px; border-radius: 6px; position: relative; }
.header-notif-bell:hover { color: var(--text); background: var(--surface2); }
.notif-bell-badge { position: absolute; top: -2px; right: -2px; background: var(--error-text); color: #fff; font-size: 10px; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-role-badge { background: var(--warning); color: #000; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.header-user-email { font-size: 13px; color: var(--text-muted); }
.header-user-plan { background: var(--accent-dim); color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }

/* --- Tabs --- */
.tab-group { display: flex; gap: 4px; background: var(--bg); border-radius: var(--radius-sm); padding: 3px; border: 1px solid var(--border); }
.tab-btn { background: transparent; border: none; color: var(--text-muted); padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; transition: all .15s; white-space: nowrap; }
.tab-btn:hover { color: var(--text); background: var(--surface2); }
.tab-btn.active { background: var(--accent-dim); color: #fff; }

/* --- Status Badge --- */
.status-badge { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); transition: background .3s; }
.status-dot.idle    { background: var(--success); }
.status-dot.running { background: var(--warning); animation: pulse 1s infinite; }
.status-dot.error   { background: var(--error-text); }

/* --- Modal --- */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: var(--surface); border-radius: var(--radius); padding: 24px; width: min(480px, 95vw); max-height: 85vh; overflow-y: auto; border: 1px solid var(--border); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 20px; padding: 2px 6px; border-radius: 4px; }
.close-btn:hover { color: var(--text); background: var(--surface2); }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 24px; width: min(560px, 95vw); max-height: 85vh; overflow-y: auto; border: 1px solid var(--border); }
.modal-close-btn { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.modal-close-btn:hover { color: var(--text); }

/* --- Login Modal --- */
.login-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box { background: var(--surface); border-radius: var(--radius); padding: 32px; width: min(400px, 95vw); border: 1px solid var(--border); }
.login-box h2 { font-size: 20px; margin-bottom: 20px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.form-group input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.form-group input:focus { outline: none; border-color: var(--accent); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-primary { flex: 1; background: var(--accent-dim); color: #fff; border: none; padding: 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }
.btn-primary:hover { background: var(--accent); }
.btn-secondary { flex: 1; background: var(--surface2); color: var(--text); border: 1px solid var(--border); padding: 10px; border-radius: var(--radius-sm); font-size: 14px; }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* --- Diff View --- */
.diff-view { font-family: var(--font-mono); font-size: 12px; }
.diff-hunk { background: var(--diff-hunk-bg); color: var(--diff-hunk-txt); padding: 4px 8px; }
.diff-add { background: var(--diff-add-bg); color: var(--diff-add-txt); padding: 2px 8px; }
.diff-del { background: var(--diff-del-bg); color: var(--diff-del-txt); padding: 2px 8px; }
.diff-head { background: var(--diff-head-bg); padding: 4px 8px; color: var(--text-muted); }

/* --- Quality Gate Panel --- */
.quality-gate-panel { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* --- Agent Approval Panel --- */
#agentApprovalPanel { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* --- Upsell Toast --- */
.upsell-toast { position: fixed; bottom: 100px; right: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; width: min(320px, calc(100vw - 40px)); z-index: 500; box-shadow: 0 8px 32px rgba(0,0,0,.4); }
.upsell-toast-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.upsell-toast-message { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.upsell-toast-actions { display: flex; gap: 8px; }
.upsell-cta-btn { flex: 1; background: var(--accent-dim); color: #fff; border: none; padding: 8px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
.upsell-cta-btn:hover { background: var(--accent); }
.upsell-dismiss-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; }

/* --- Credit Modal --- */
.credit-pack-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.credit-pack-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; cursor: pointer; transition: all .15s; }
.credit-pack-card:hover { border-color: var(--accent); }
.credit-pack-card.selected { border-color: var(--accent); background: var(--accent-glow); }
.credit-pack-amount { font-size: 20px; font-weight: 700; color: var(--accent); }
.credit-pack-price { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.credit-pack-note { font-size: 11px; color: var(--success); margin-top: 4px; }

/* --- Auto Recharge Modal --- */
.auto-recharge-form { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.auto-recharge-form label { font-size: 13px; color: var(--text-muted); }
.auto-recharge-form select { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { display: none; }
.toggle-slider { position: absolute; inset: 0; background: var(--surface2); border-radius: 11px; border: 1px solid var(--border); transition: background .2s; }
.toggle-slider::after { content: ''; position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: transform .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent-dim); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(18px); }

/* --- LP Score Badge --- */
.lp-score-badge { display: inline-flex; align-items: center; gap: 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; font-size: 13px; margin-bottom: 8px; }
.lp-score-value { font-weight: 700; color: var(--success); }
.lp-score-value.low { color: var(--warning); }
.lp-score-arrow { color: var(--text-muted); }
.lp-improve-count { font-size: 11px; color: var(--text-muted); }

/* --- Image Engine UI --- */
.image-result-panel { max-width: 860px; margin: 12px auto; padding: 0 20px; }
.visual-score-badge { display: inline-flex; align-items: center; gap: 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; font-size: 13px; margin-bottom: 12px; }
.generated-image { width: 100%; max-width: 600px; border-radius: var(--radius); border: 1px solid var(--border); display: block; margin: 0 auto 12px; }
.add-images-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; transition: all .15s; }
.add-images-btn:hover { border-color: var(--accent); color: var(--accent); }

/* --- Ops Control --- */
.ops-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.ops-tab { background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); padding: 6px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.ops-tab.active { background: var(--accent-dim); color: #fff; border-color: var(--accent-dim); }
.ops-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ops-input { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.ops-btn { padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; border: none; }
.ops-btn-primary { background: var(--accent-dim); color: #fff; }
.ops-btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.ops-btn-danger { background: var(--error-bg); color: var(--error-text); border: 1px solid var(--error-text); }
.ops-result { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; font-size: 13px; color: var(--text-muted); min-height: 40px; margin-top: 8px; }

/* --- Release Panel --- */
.release-panel { display: flex; flex-direction: column; gap: 12px; }
.release-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.release-actions button { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.release-actions button:hover { border-color: var(--accent); color: var(--accent); }

/* --- PR Review Panel --- */
.pr-review-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 16px 20px; max-width: 860px; }
.pr-review-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pr-review-actions input { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; width: 120px; }
.pr-review-actions button { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; }

/* --- Admin Panel --- */
.admin-panel { padding: 20px; max-width: 860px; margin: 0 auto; }
.admin-section { margin-bottom: 24px; }
.admin-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.admin-table th { background: var(--surface2); color: var(--text-muted); }
.gcc-btn { background: var(--accent-dim); color: #fff; border: none; padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
.gcc-btn:hover { background: var(--accent); }
.gcc-btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.gcc-btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.gcc-btn-danger { background: var(--error-bg); color: var(--error-text); border: 1px solid var(--error-text); }

/* --- Notification Panel --- */
.notification-panel { position: fixed; top: 60px; right: 16px; width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); z-index: 500; box-shadow: 0 8px 32px rgba(0,0,0,.4); max-height: 400px; overflow-y: auto; }
.notification-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.notification-item:last-child { border-bottom: none; }
.notification-item.unread { background: var(--accent-glow); }

/* --- Dash Tabs --- */
.dash-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.dash-tab { background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); padding: 5px 12px; border-radius: var(--radius-sm); font-size: 12px; }
.dash-tab.active { background: var(--accent-dim); color: #fff; border-color: var(--accent-dim); }

/* --- Footer Section --- */
.footer-section {
  padding: 40px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.footer-inner { max-width: 960px; margin: 0 auto; }
.footer-section h2 { font-size: 15px; font-weight: 700; text-align: center; color: rgba(255,255,255,0.85); margin-bottom: 20px; }
.footer-review-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.footer-review-card { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius); padding: 14px; }
.footer-review-card h3 { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.9); margin-bottom: 8px; }
.footer-review-card p { font-size: 12px; line-height: 1.6; color: rgba(255,255,255,0.65); margin: 3px 0; }
.small-note { font-size: 11px !important; color: rgba(255,255,255,0.45) !important; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.footer-links a { font-size: 12px; color: rgba(147,197,253,0.9); text-decoration: underline; }
.footer-links a:hover { color: var(--accent); }

/* --- Stripe Review Info --- */
.stripe-review-info {
  width: min(calc(100% - 32px), 960px);
  margin: 32px auto 16px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.82);
  flex-shrink: 0;
}
.stripe-review-info h2 { margin: 0 0 14px; font-size: 15px; font-weight: 700; text-align: center; color: rgba(255,255,255,0.9); }
.review-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.review-info-card { padding: 12px; border-radius: 12px; background: rgba(15,23,42,0.45); border: 1px solid rgba(255,255,255,0.1); }
.review-info-card h3 { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.9); }
.review-info-card p { margin: 4px 0; font-size: 12px; line-height: 1.6; color: rgba(255,255,255,0.68); }
.review-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.review-links a { font-size: 12px; color: rgba(147,197,253,0.95); text-decoration: underline; }

body > .stripe-review-info,
body > .footer-review-info {
  display: block !important;
  visibility: visible !important;
}

/* --- Mobile --- */
@media (max-width: 768px) {
  .left-sidebar { display: none; }
  .input-area { left: 0; right: 0; padding: 10px 12px 14px; }
  .footer-review-grid, .review-info-grid { grid-template-columns: 1fr; }
  .footer-section { padding: 24px 12px; }
  .credit-pack-grid { grid-template-columns: 1fr; }
  .message { padding: 12px; }
  .stripe-review-info { width: calc(100% - 24px); margin: 24px auto 12px; padding: 14px; }
  .stripe-review-info h2 { font-size: 14px; }
  .review-info-card { padding: 10px; }
  .review-info-card p { font-size: 11px; }
}

/* ─── Phase 3: 不要サイドバー非表示 ──────────────────────── */
#sidebar,
.sidebar,
#chatSidebar,
.chat-sidebar,
#historySidebar,
.history-sidebar,
#chatHistoryPanel,
.chat-history-panel,
#newChatBtn,
#newChatButton,
.new-chat-button {
  display: none !important;
}

/* ─── Phase 8: site-footer ───────────────────────────────── */
.site-footer {
  width: min(100% - 32px, 980px);
  margin: 32px auto 24px;
  padding: 18px 16px;
  text-align: center;
  color: rgba(229,231,235,0.62);
}
.footer-note,
.footer-copy {
  margin: 6px 0;
  font-size: 12px;
  line-height: 1.6;
}

/* ─── Phase 8: legal-page / pricing-page ────────────────── */
.legal-page {
  min-height: 100vh;
  background: radial-gradient(circle at top, #111827 0, #020617 70%);
  color: #e5e7eb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.legal-container,
.pricing-page {
  width: min(100% - 32px, 960px);
  margin: 0 auto;
  padding: 48px 0;
}
.legal-header {
  text-align: center;
  margin-bottom: 28px;
}
.back-home {
  display: inline-block;
  margin-bottom: 22px;
  color: #93c5fd;
  text-decoration: underline;
  font-size: 14px;
}
.legal-container h1,
.pricing-page h1 {
  margin: 0 0 12px;
  font-size: 32px;
  font-weight: 900;
}
.legal-container h2,
.pricing-page h2 {
  margin-top: 28px;
  font-size: 20px;
  color: #bfdbfe;
}
.legal-container p,
.pricing-page p {
  line-height: 1.8;
  color: rgba(229,231,235,0.82);
}
.updated,
.small-note {
  font-size: 13px;
  color: rgba(229,231,235,0.58) !important;
}

/* ─── Phase 8: campaign-box ─────────────────────────────── */
.campaign-box {
  margin: 24px auto 28px;
  padding: 22px;
  border-radius: 18px;
  background: rgba(37,99,235,0.14);
  border: 1px solid rgba(96,165,250,0.35);
  text-align: center;
}
.campaign-badge {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: #2563eb;
  color: white;
  font-size: 12px;
  font-weight: 800;
}

/* ─── Phase 8: pricing-grid ─────────────────────────────── */
.pricing-grid-page {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0;
}
.pricing-card-page {
  position: relative;
  padding: 22px;
  border-radius: 20px;
  background: rgba(30,41,59,0.86);
  border: 1px solid rgba(255,255,255,0.12);
}
.pricing-card-page.featured {
  border-color: rgba(59,130,246,0.95);
  box-shadow: 0 18px 50px rgba(37,99,235,0.18);
}
.recommended-label {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: #2563eb;
  color: white;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 8px;
}
.price-large {
  margin: 12px 0;
  font-size: 30px;
  font-weight: 900;
  color: white;
}
.price-large span {
  font-size: 14px;
  color: rgba(229,231,235,0.7);
}
.discount-text {
  color: #93c5fd !important;
  font-size: 13px;
  font-weight: 800;
}
.pricing-card-page ul {
  margin: 16px 0 20px;
  padding-left: 18px;
  list-style: disc;
  line-height: 1.8;
  color: rgba(229,231,235,0.82);
}
.pricing-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: #2563eb;
  color: white;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}
.pricing-btn.secondary {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.14);
}
.pricing-notes {
  margin-top: 30px;
  padding: 22px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

/* ─── Phase 8: contact-form ─────────────────────────────── */
.contact-form {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}
.contact-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}
.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15,23,42,0.9);
  color: white;
  font-size: 14px;
}
.form-result {
  font-size: 14px;
}
.form-result.success {
  color: #86efac;
}
.form-result.error {
  color: #fca5a5;
}
.contact-alt {
  margin-top: 30px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

/* ─── Phase 8: legal-footer ─────────────────────────────── */
.legal-footer {
  margin-top: 40px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 20px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.footer-links a {
  font-size: 12px;
  color: #93c5fd;
  text-decoration: underline;
}

/* ─── Phase 8: Mobile responsive ────────────────────────── */
@media (max-width: 900px) {
  .pricing-grid-page {
    grid-template-columns: 1fr;
  }
  .legal-container,
  .pricing-page {
    width: min(100% - 24px, 960px);
    padding: 32px 0;
  }
  .legal-container h1,
  .pricing-page h1 {
    font-size: 26px;
  }
}
