/* ============================================
   Insight Lab — 內容創作工作台
   配色：暖米色 + 橄欖綠 + 暖棕輔色
   參考：文字複利計畫 Threads 流量診斷
   ============================================ */

:root {
  --bg: #faf9f6;
  --bg-alt: #f4f3ec;
  --primary: #6b7b5a;
  --primary-light: #8a9b6a;
  --primary-dark: #5a6b4a;
  --accent: #a08060;
  --text: #333;
  --text-light: #777;
  --text-muted: #aaa;
  --card: #ffffff;
  --border: #e4e3dc;
  --sidebar-w: 240px;
  --topnav-h: 56px;
  --bottomtab-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, 'Noto Sans TC', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* 書法襯線字體 — 用於大標題和品牌名 */
.font-serif {
  font-family: 'Noto Serif TC', 'Source Han Serif TC', 'PMingLiU', serif;
  font-weight: 700;
}

/* ── Top Navigation ── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topnav-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.topnav-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: -0.5px;
}
.brand-name { font-family: 'Noto Serif TC', 'Source Han Serif TC', serif; font-weight: 700; font-size: 17px; color: var(--text); display: block; }
.brand-handle { font-size: 11px; color: var(--text-light); letter-spacing: 0.5px; }

.topnav-right { display: flex; align-items: center; gap: 12px; }
.api-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-muted);
}
.api-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #d1d5db;
}
.api-status.online .api-dot { background: #10b981; }
.api-status.online .api-label { color: #059669; }
.api-status.online { color: #059669; }
.mobile-menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
}
.mobile-menu-btn span {
  display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.2s;
}

/* ── App Layout ── */
.app-layout {
  display: flex;
  margin-top: var(--topnav-h);
  min-height: calc(100vh - var(--topnav-h));
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: fixed; top: var(--topnav-h); bottom: 0;
  overflow-y: auto;
}
.sidebar-section { margin-bottom: 20px; }
.sidebar-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 0 12px; margin-bottom: 6px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-size: 14px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.sidebar-item:hover { background: var(--bg-alt); }
.sidebar-item.active { background: var(--primary); color: white; font-weight: 500; }
.sidebar-icon { font-size: 16px; width: 20px; text-align: center; }

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 40px 80px;
  max-width: 860px;
  margin-right: auto;
  margin-left: calc(var(--sidebar-w) + (100% - var(--sidebar-w) - 860px) / 2);
}
@media (max-width: 1200px) {
  .main-content {
    margin-left: var(--sidebar-w);
    margin-right: auto;
  }
}

/* ── Page System ── */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Page Hero ── */
.page-hero { text-align: center; margin-bottom: 36px; }
.page-subtitle {
  font-size: 11px; letter-spacing: 3px; color: var(--text-light);
  text-transform: uppercase; margin-bottom: 8px;
}
.page-title {
  font-family: 'Noto Serif TC', 'Source Han Serif TC', serif;
  font-size: 32px; font-weight: 900; color: var(--text);
  line-height: 1.3; margin-bottom: 12px;
  letter-spacing: 1px;
}
.text-accent { color: var(--primary); }
.page-desc { font-size: 14px; color: var(--text-light); line-height: 1.7; }

/* ── Tool Card ── */
.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  transition: box-shadow 0.2s;
}
.tool-card:focus-within {
  box-shadow: 0 0 0 2px rgba(107, 123, 90, 0.15);
  border-color: var(--primary-light);
}
.tool-card-header {
  padding: 14px 20px;
  font-size: 13px; font-weight: 600; color: var(--text-light);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.tool-card-icon { font-size: 14px; }
.tool-textarea {
  width: 100%; min-height: 200px; padding: 16px 20px;
  border: none; outline: none; resize: vertical;
  font-family: inherit; font-size: 14px; line-height: 1.7;
  color: var(--text); background: var(--card);
}
.tool-textarea::placeholder { color: var(--text-muted); }
.tool-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.footer-hint { font-size: 12px; color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--text-muted); cursor: not-allowed; transform: none; }
.btn-icon { font-size: 14px; }

/* ── Loading State ── */
.loading-state {
  text-align: center; padding: 48px 0;
}
.loading-icon { margin-bottom: 16px; }
.loading-spinner { animation: spin 1.5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 15px; color: var(--text); font-weight: 500; margin-bottom: 12px; }
.loading-bar {
  width: 200px; height: 3px; background: var(--border);
  border-radius: 2px; margin: 0 auto 12px; overflow: hidden;
}
.loading-bar-fill {
  height: 100%; width: 0%; background: var(--primary);
  border-radius: 2px; transition: width 0.5s ease;
}
.loading-hint { font-size: 12px; color: var(--text-muted); }

/* ── Stats Bar ── */
.stats-bar {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; justify-content: center; gap: 80px;
  margin-bottom: 24px;
}
.stat-item { text-align: center; }
.stat-number { display: block; font-size: 28px; font-weight: 800; color: white; }
.stat-label { font-size: 12px; color: rgba(255,255,255,0.8); }

/* ── Result Cards ── */
.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.result-card-header {
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  transition: background 0.15s;
}
.result-card-header:hover { background: var(--bg-alt); }
.result-card-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; margin-right: 12px; flex-shrink: 0;
}
.result-card-title { font-weight: 600; font-size: 15px; flex: 1; }
.result-card-toggle {
  font-size: 12px; color: var(--text-muted); transition: transform 0.2s;
}
.result-card.open .result-card-toggle { transform: rotate(180deg); }
.result-card-body {
  display: none; padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}
.result-card.open .result-card-body { display: block; padding-top: 16px; }

.result-section { margin-bottom: 16px; }
.result-section-title {
  font-size: 12px; font-weight: 600; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.result-content {
  font-size: 14px; line-height: 1.8; color: var(--text);
  background: var(--bg-alt); border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.result-content ol, .result-content ul { padding-left: 20px; }
.result-content li { margin-bottom: 4px; }
.result-engagement {
  display: flex; gap: 16px; font-size: 13px; color: var(--text-light);
}

/* ── Coming Soon ── */
.coming-soon {
  text-align: center; padding: 80px 0; color: var(--text-muted);
}
.coming-soon-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.coming-soon p { font-size: 14px; }

/* ── Pill Group (for topic selection) ── */
.pill-group {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 16px 20px;
}
.pill {
  padding: 8px 18px; border-radius: 20px;
  border: 1.5px solid var(--border); background: var(--bg);
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-light); cursor: pointer;
  transition: all 0.15s;
}
.pill:hover { border-color: var(--primary); color: var(--primary); }
.pill.active { background: var(--primary); color: white; border-color: var(--primary); }
.pill-sm { padding: 5px 12px; font-size: 12px; }

/* ── Form Elements ── */
.form-select-wrap { padding: 12px 20px; }
.form-select {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--bg); cursor: pointer; outline: none;
}
.form-select:focus { border-color: var(--primary); }
.form-input {
  flex: 1; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--card); outline: none;
}
.form-input:focus { border-color: var(--primary); }
.search-input-row {
  display: flex; gap: 10px; padding: 16px 20px;
}

/* ── Phase Steps (Carousel) ── */
.phase-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin: 24px 0;
}
.phase-step {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 16px;
}
.phase-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.phase-label { font-size: 13px; font-weight: 500; color: var(--text); }
.phase-arrow { color: var(--text-muted); font-size: 18px; }

/* ── Info Box ── */
.info-box {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  text-align: center; color: var(--text-light); font-size: 13px;
  line-height: 1.8; margin-top: 16px;
}

/* ── Bucket Tabs (Matrix) ── */
.bucket-tabs {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.bucket-tab {
  flex: 1; padding: 10px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card);
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-light); cursor: pointer; text-align: center;
  transition: all 0.15s;
}
.bucket-tab:hover { border-color: var(--primary); }
.bucket-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Matrix Table ── */
.matrix-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card);
}
.matrix-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px; line-height: 1.6;
}
.matrix-table th, .matrix-table td {
  padding: 12px 14px; border: 1px solid var(--border);
  text-align: left; vertical-align: top;
}
.matrix-corner {
  background: var(--bg-alt); font-weight: 600; color: var(--text-light);
  font-size: 11px; width: 80px; max-width: 80px;
  text-align: center; vertical-align: middle;
}
.matrix-table thead th {
  background: var(--primary); color: white;
  font-weight: 600; font-size: 13px; text-align: center; vertical-align: middle;
  position: sticky; top: 0;
}
.matrix-table thead th:first-child { background: var(--bg-alt); color: var(--text-light); }
.matrix-table tbody td:first-child {
  font-weight: 600; background: var(--bg-alt);
  font-size: 11px; width: 80px; max-width: 80px;
  text-align: center; vertical-align: middle;
}
.matrix-table tbody td:not(:first-child) {
  color: var(--text-light); font-size: 12px;
  cursor: pointer; transition: background 0.15s;
}
.matrix-table tbody td:not(:first-child):hover {
  background: rgba(107, 123, 90, 0.08);
}
.matrix-badge {
  display: inline-block; font-size: 10px; padding: 1px 6px;
  border-radius: 10px; font-weight: 600; margin-right: 4px;
}
.matrix-badge-star { background: #fef3c7; color: #92400e; }

/* ── Schedule Template Bar ── */
.schedule-template {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 8px;
}
.template-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.template-day {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.template-type {
  font-size: 10px; font-weight: 600; padding: 3px 8px;
  border-radius: 10px; white-space: nowrap;
}
.type-bazi { background: #fef3c7; color: #92400e; }
.type-life { background: #dbeafe; color: #1e40af; }
.type-ig { background: #d1fae5; color: #065f46; }
.type-rest { background: var(--bg-alt); color: var(--text-muted); }

/* ── Week Grid (Schedule) ── */
.week-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; margin-bottom: 20px;
}
.week-label {
  font-family: 'Noto Serif TC', serif; font-size: 18px; font-weight: 700;
  color: var(--text);
}
.btn-outline {
  padding: 8px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card);
  font-family: inherit; font-size: 13px; color: var(--text-light);
  cursor: pointer; transition: all 0.15s;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.week-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px;
}
.day-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  min-height: 120px; transition: border-color 0.15s;
}
.day-card:hover { border-color: var(--primary); }
.day-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.day-name { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.day-date { font-size: 18px; font-weight: 700; color: var(--text); }
.day-card.today { border-color: var(--primary); border-width: 2px; }
.day-card.today .day-date { color: var(--primary); }
.day-bucket {
  font-size: 11px; padding: 3px 8px;
  border-radius: 10px; display: inline-block; margin-top: 4px;
}
.day-bucket-sun { background: #fef3c7; color: #92400e; }
.day-bucket-cac { background: #d1fae5; color: #065f46; }
.day-bucket-pine { background: #dbeafe; color: #1e40af; }

/* ── Settings ── */
.settings-section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 16px;
}
.settings-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; font-size: 13px;
}
.settings-label { color: var(--text-light); }
.settings-value { color: var(--text); font-weight: 500; }
.status-unknown { color: var(--text-muted); }
.status-ok { color: #059669; }
.status-expired { color: #dc2626; }

/* ── AI Collaboration Flow ── */
.ai-flow {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-bottom: 16px; flex-wrap: wrap;
}
.ai-flow-step {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--card);
  min-width: 56px;
}
.ai-flow-step.done { border-color: var(--primary); background: rgba(107,123,90,0.06); }
.ai-flow-step.ai { border-color: var(--accent); background: rgba(160,128,96,0.06); }
.ai-flow-who {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.ai-flow-step.done .ai-flow-who { color: var(--primary); }
.ai-flow-step.ai .ai-flow-who { color: var(--accent); }
.ai-flow-label { font-size: 12px; font-weight: 500; color: var(--text); }
.ai-flow-arrow { color: var(--text-muted); font-size: 14px; }
@media (max-width: 480px) {
  .ai-flow-arrow { display: none; }
  .ai-flow { gap: 4px; }
  .ai-flow-step { padding: 6px 10px; min-width: 48px; }
}

/* ── Back Link ── */
.back-link {
  display: inline-flex; align-items: center;
  font-size: 13px; color: var(--text-light);
  text-decoration: none; margin-bottom: 16px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--primary); }

/* ── Selected Format Badge (Copywriter) ── */
.selected-format {
  background: var(--card); border: 1.5px solid var(--primary);
  border-radius: var(--radius); padding: 14px 20px;
  margin-bottom: 16px;
}
.selected-format-inner {
  display: flex; align-items: center; gap: 10px;
}
.selected-format-pillar {
  padding: 4px 12px; border-radius: 12px;
  background: var(--primary); color: white;
  font-size: 12px; font-weight: 600;
}
.selected-format-name {
  font-size: 14px; font-weight: 600; color: var(--text); flex: 1;
}
.selected-format-clear {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 0 4px;
}
.selected-format-clear:hover { color: #dc2626; }
.selected-format-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 4px;
}
.matrix-cta {
  text-align: center; padding: 16px;
  background: var(--bg-alt); border-radius: var(--radius);
  margin-bottom: 16px; font-size: 14px; color: var(--text-light);
}
.matrix-cta-link {
  color: var(--primary); font-weight: 600; text-decoration: underline;
  cursor: pointer;
}

/* ── Copy Output & Actions ── */
.copy-output { white-space: pre-line; }
.copy-actions {
  margin-top: 12px; display: flex; gap: 8px;
}
.btn-copy { font-size: 13px; padding: 8px 16px; }

/* ── Matrix Cell Click ── */
.matrix-cell-link { cursor: pointer; }
.matrix-cell-link:hover {
  background: rgba(107, 123, 90, 0.12) !important;
  color: var(--primary);
}
.matrix-empty { color: var(--text-muted); cursor: default; }

/* ── Inspiration List ── */
.inspiration-list { margin-top: 16px; }
.insp-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  margin-bottom: 8px; display: flex; justify-content: space-between;
  align-items: flex-start; gap: 12px;
}
.insp-item-text { flex: 1; font-size: 13px; line-height: 1.6; color: var(--text); }
.insp-item-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.insp-item-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-alt); color: var(--text-light); margin-right: 4px;
}
.insp-item-actions { display: flex; gap: 4px; margin-top: 6px; }

/* ── Trending Wall ── */
.trending-list { margin-top: 16px; }
.trending-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 12px; animation: slideUp 0.3s ease;
}
.trending-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.trending-level { font-size: 14px; }
.trending-likes { font-size: 13px; font-weight: 600; color: var(--primary); }
.trending-text {
  font-size: 14px; line-height: 1.7; color: var(--text);
  margin-bottom: 8px;
}
.trending-meta {
  display: flex; gap: 8px; font-size: 11px; color: var(--text-muted);
  margin-bottom: 10px;
}
.trending-meta span {
  padding: 2px 8px; border-radius: 10px;
  background: var(--bg-alt);
}
.trending-actions { display: flex; gap: 8px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Mobile overrides for new components ── */
@media (max-width: 768px) {
  .phase-steps { flex-wrap: wrap; gap: 8px; }
  .phase-arrow { display: none; }
  .week-grid { grid-template-columns: 1fr; }
  .day-card { min-height: auto; }
  .bucket-tabs { flex-direction: column; }
  .search-input-row { flex-direction: column; }
  .matrix-table { font-size: 11px; }
  .matrix-table th, .matrix-table td { padding: 8px 10px; }
}

/* ── Attach Button & Inline Previews ── */
.footer-left {
  display: flex; align-items: center; gap: 10px;
}
.attach-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s;
}
.attach-btn:hover { background: var(--bg-alt); color: var(--primary); }
.attach-previews {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 20px 4px;
}
.attach-thumb {
  position: relative; width: 72px; height: 72px;
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
}
.attach-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.attach-thumb-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: white;
  border: none; cursor: pointer; font-size: 10px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.attach-thumb-remove:hover { background: rgba(220,38,38,0.8); }
.attach-file-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--bg-alt); border: 1px solid var(--border);
  font-size: 12px; color: var(--text);
}
.attach-file-icon { font-size: 16px; }
.attach-file-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip-remove {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; padding: 0 2px;
}
.attach-chip-remove:hover { color: #dc2626; }

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

/* ── Footer ── */
.app-footer {
  background: var(--primary-light);
  color: rgba(255,255,255,0.85);
  text-align: center; padding: 14px;
  font-size: 12px; letter-spacing: 0.5px;
  margin-left: var(--sidebar-w);
}

/* ── Bottom Tab Bar (Mobile) ── */
.bottom-tabs {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--bottomtab-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  justify-content: space-around; align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--text-muted); font-size: 10px;
  padding: 6px 0; min-width: 56px; transition: color 0.15s;
}
.tab-item.active { color: var(--primary); }
.tab-icon { font-size: 20px; }
.tab-label { font-weight: 500; }

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open {
    display: block; position: fixed; top: var(--topnav-h); left: 0; right: 0; bottom: var(--bottomtab-h);
    width: 100%; z-index: 90; background: var(--card);
  }
  .mobile-menu-btn { display: flex; }
  .main-content { margin-left: 0; padding: 20px 16px 100px; }
  .app-footer { margin-left: 0; margin-bottom: var(--bottomtab-h); }
  .bottom-tabs { display: flex; }
  .page-title { font-size: 22px; }
  .page-desc { font-size: 13px; line-height: 1.8; }
  .page-desc br { display: none; }
  .page-hero { margin-bottom: 24px; }
  .page-subtitle { font-size: 10px; letter-spacing: 2px; }
  .stats-bar { gap: 40px; padding: 16px; }
  .stat-number { font-size: 22px; }
  .tool-textarea { min-height: 140px; font-size: 14px; line-height: 1.8; }
  .tool-card-header { font-size: 13px; padding: 12px 16px; }
  .tool-card-footer { padding: 10px 16px; }
  .result-content { font-size: 13px; line-height: 1.9; }
  .trending-text { font-size: 13px; line-height: 1.8; }
  .ai-flow { gap: 3px; }
  .ai-flow-step { padding: 5px 8px; min-width: 44px; }
  .ai-flow-label { font-size: 10px; }
  .api-status { display: none; }
}

@media (max-width: 480px) {
  .page-title { font-size: 20px; }
  .main-content { padding: 16px 12px 100px; }
  .tool-card-footer { flex-direction: column; gap: 10px; }
  .footer-hint { display: none; }
  .btn { width: 100%; justify-content: center; }
}
