:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4bd1;
  --primary-light: #a29bfe;
  --accent: #fd79a8;
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #1a1a2e;
  --bg-sidebar-hover: #16213e;
  --text: #2d3436;
  --text-secondary: #636e72;
  --text-light: #b2bec3;
  --border: #e1e5e9;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e17055;
  --info: #74b9ff;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 260px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.logo-text {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
  transition: var(--transition);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-item:hover {
  color: #fff;
  background: var(--bg-sidebar-hover);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px rgba(0, 184, 148, 0.5);
}

.status-dot.disconnected {
  background: var(--danger);
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-sidebar);
  color: #fff;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
  z-index: 90;
}

.menu-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.5rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.page-subtitle {
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
}

.card-link:hover {
  color: var(--primary-dark);
}

.card-body {
  padding: 1.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  font-size: 0.85rem;
  font-weight: 500;
}

.quick-action-btn i {
  font-size: 1.3rem;
  color: var(--primary);
}

.quick-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108, 92, 231, 0.05);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-light);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  opacity: 0.85;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.form-input,
.select-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--bg-card);
  color: var(--text);
}

.form-input:focus,
.select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

/* Compose */
.compose-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
}

.compose-textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: var(--transition);
  line-height: 1.6;
}

.compose-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.compose-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.75rem;
  padding: 0.5rem 0;
}

/* Thread item styles */
.thread-item {
  position: relative;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
}

.thread-item + .thread-item {
  border-top: 2px dashed var(--border);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}

.thread-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.thread-item-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
}

.thread-item .compose-textarea {
  min-height: 120px;
}

.compose-footer-mini {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.char-count-mini {
  font-size: 0.75rem;
  color: var(--text-light);
}

.add-thread-btn {
  width: 100%;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-light);
}

.add-thread-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108, 92, 231, 0.05);
}

.remove-thread-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-light);
  cursor: pointer;
}

.remove-thread-btn:hover {
  background: #ffe0e0;
  border-color: #e17055;
  color: #e17055;
}

.char-count {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 500;
}

.compose-options {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.schedule-picker {
  animation: fadeIn 0.3s ease;
}

.schedule-picker input {
  padding: 0.4rem 0.65rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
}

.compose-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* Threads Preview */
.threads-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.preview-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.preview-user {
  display: flex;
  flex-direction: column;
}

.preview-username {
  font-weight: 600;
  font-size: 0.85rem;
}

.preview-time {
  font-size: 0.75rem;
  color: var(--text-light);
}

.preview-content {
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-placeholder {
  color: var(--text-light);
  font-style: italic;
}

.preview-actions-bar {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: 1rem;
}

/* AI Layout */
.ai-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 1.5rem;
}

/* AI Result Card */
.ai-result-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  transition: var(--transition);
}

.ai-result-item:hover {
  box-shadow: var(--shadow);
}

.ai-result-text {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
  white-space: pre-wrap;
}

.ai-result-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Post List Items */
.post-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.post-item:last-child {
  border-bottom: none;
}

.post-status {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.post-status.published {
  background: rgba(0, 184, 148, 0.1);
  color: var(--success);
}

.post-status.scheduled {
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary);
}

.post-status.draft {
  background: rgba(99, 110, 114, 0.1);
  color: var(--text-secondary);
}

.post-status.failed {
  background: rgba(225, 112, 85, 0.1);
  color: var(--danger);
}

.post-content {
  flex: 1;
  min-width: 0;
}

.post-text {
  font-size: 0.9rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-light);
}

.post-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Auto Reply */
.reply-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.reply-item:last-child {
  border-bottom: none;
}

.reply-keyword {
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.reply-content {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.reply-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.reply-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.reply-toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  transition: var(--transition);
}

.reply-toggle .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

.reply-toggle input:checked + .slider {
  background: var(--success);
}

.reply-toggle input:checked + .slider::before {
  transform: translateX(20px);
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.settings-grid > .card:last-child {
  grid-column: 1 / -1;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.setup-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-number {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.step-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.step-content a {
  color: var(--primary);
}

.info-box {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(108, 92, 231, 0.05);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.info-box i {
  color: var(--primary);
  margin-top: 2px;
}

.info-box a {
  color: var(--primary);
}

/* Account Switcher */
.account-switcher {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.account-current {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.account-current:hover {
  background: var(--bg-sidebar-hover);
}

.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.account-info {
  flex: 1;
  min-width: 0;
}

.account-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-sub {
  display: block;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
}

.account-chevron {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  transition: var(--transition);
}

.account-chevron.open {
  transform: rotate(180deg);
}

.account-dropdown {
  display: none;
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  top: 100%;
  background: #222244;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  z-index: 200;
  overflow: hidden;
}

.account-dropdown.open {
  display: block;
  animation: fadeIn 0.2s ease;
}

.account-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.8rem;
}

.account-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.account-dropdown-item.active {
  background: rgba(108, 92, 231, 0.3);
}

.account-dropdown-item .account-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.account-dropdown-item .account-dot.connected {
  background: var(--success);
}

.account-dropdown-item .account-dot.disconnected {
  background: var(--text-light);
}

.account-dropdown-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem;
}

.account-add-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: none;
  background: none;
  color: var(--primary-light);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: var(--transition);
}

.account-add-btn:hover {
  background: rgba(108, 92, 231, 0.15);
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0.5rem 1rem;
}

/* Banner */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.banner-info {
  background: rgba(108, 92, 231, 0.08);
  border: 1px solid rgba(108, 92, 231, 0.2);
  color: var(--text);
}

.banner-info i {
  color: var(--primary);
  font-size: 1.2rem;
  margin-top: 2px;
}

.banner a {
  color: var(--primary);
  font-weight: 600;
}

/* Setup Guide Styles */
.guide-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

.guide-flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 100px;
}

.flow-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.guide-flow-arrow {
  color: var(--text-light);
  font-size: 1rem;
}

.guide-step-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.guide-checklist {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guide-check-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.guide-check-item i {
  color: var(--success);
  font-size: 1.1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.guide-check-item strong {
  display: block;
  margin-bottom: 0.15rem;
}

.guide-check-item p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.guide-check-item a {
  color: var(--primary);
}

.guide-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.guide-why {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(74, 175, 254, 0.08);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--info);
  font-size: 0.85rem;
  line-height: 1.5;
}

.guide-why i {
  color: var(--info);
  font-size: 1.1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.guide-instructions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guide-instruction {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.instruction-number {
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.instruction-content {
  flex: 1;
}

.instruction-content h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.instruction-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.instruction-content code {
  background: rgba(108, 92, 231, 0.08);
  color: var(--primary-dark);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.guide-url-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
}

.guide-url-box a {
  color: var(--primary);
  word-break: break-all;
  font-size: 0.85rem;
}

.guide-code-box {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
}

.guide-code-box code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
  white-space: pre-wrap;
  word-break: break-all;
}

.guide-highlight {
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.2);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.guide-tip {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(253, 203, 110, 0.1);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warning);
  font-size: 0.85rem;
  line-height: 1.5;
}

.guide-tip i {
  color: var(--warning);
  font-size: 1.1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.guide-important {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(225, 112, 85, 0.08);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--danger);
  font-size: 0.85rem;
  line-height: 1.5;
}

.guide-important i {
  color: var(--danger);
  font-size: 1.1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.guide-permission-list {
  list-style: none;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.guide-permission-list li {
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
  background: var(--bg);
  border-radius: 4px;
}

.guide-permission-list li code {
  font-weight: 600;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.guide-table th,
.guide-table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.guide-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 0.8rem;
}

.guide-faq {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-item summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: '+';
  display: inline-block;
  width: 20px;
  font-weight: 700;
  color: var(--primary);
}

.faq-item[open] summary::before {
  content: '-';
}

.faq-item summary:hover {
  background: var(--bg);
}

.faq-item p {
  padding: 0 1rem 0.85rem 2rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.faq-item code {
  background: rgba(108, 92, 231, 0.08);
  color: var(--primary-dark);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.faq-item a {
  color: var(--primary);
}

/* Settings Account List */
.account-settings-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.account-settings-item:last-child {
  border-bottom: none;
}

.account-settings-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.account-settings-info {
  flex: 1;
}

.account-settings-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.account-settings-status {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.15rem;
}

.account-settings-actions {
  display: flex;
  gap: 0.5rem;
}

.badge-active {
  display: inline-block;
  background: rgba(0, 184, 148, 0.1);
  color: var(--success);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.settings-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.settings-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.settings-section-title i {
  margin-right: 0.35rem;
  color: var(--primary);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 3s forwards;
  max-width: 350px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .compose-layout,
  .ai-layout {
    grid-template-columns: 1fr;
  }

  .settings-grid,
  .settings-edit-grid {
    grid-template-columns: 1fr;
  }

  .guide-flow {
    gap: 0.25rem;
  }

  .guide-flow-step {
    min-width: 70px;
    font-size: 0.65rem;
  }

  .flow-icon {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-top: 75px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-row {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════ */
/* ── Modal Base (missing fix) ──        */
/* ══════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════ */
/* ── OAuth Connect ──                   */
/* ══════════════════════════════════════ */
.oauth-connect-section {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.oauth-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.oauth-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

.oauth-badge.connected {
  background: #d1fae5;
  color: #065f46;
}

.oauth-badge.disconnected {
  background: #fee2e2;
  color: #991b1b;
}

.oauth-user-id {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.btn-threads {
  background: linear-gradient(135deg, #000, #333);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
}

.btn-threads:hover {
  background: linear-gradient(135deg, #333, #555);
  transform: translateY(-1px);
}

.manual-token-toggle {
  margin-top: 12px;
}

.manual-token-toggle summary {
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
}

.manual-token-toggle summary:hover {
  color: var(--primary);
}

/* ── Connection Status Bar ── */
.connection-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.connection-status-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.token-expiry {
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.token-ok { color: var(--success); }
.token-warn { color: #f59e0b; }
.token-expired { color: var(--danger); }

/* ── Setup Wizard ── */
.setup-wizard {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.wizard-step {
  position: relative;
  padding: 16px 20px 16px 60px;
  border-left: 2px solid var(--border);
  margin-left: 14px;
}

.wizard-step:last-child {
  border-left-color: transparent;
}

.wizard-step-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.wizard-step-header strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text);
}

.wizard-step-header .text-muted {
  font-size: 0.78rem;
}

.wizard-step-num {
  position: absolute;
  left: -14px;
  top: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  z-index: 1;
}

.wizard-step-highlight .wizard-step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.wizard-step-optional .wizard-step-num {
  background: var(--bg);
  border-color: var(--border);
  border-style: dashed;
  color: var(--text-light);
}

.wizard-step-body {
  padding-left: 0;
}

.wizard-step-highlight {
  background: linear-gradient(135deg, rgba(108,92,231,0.04), rgba(108,92,231,0.02));
  border-radius: 12px;
  margin-left: 14px;
  border-left: 2px solid var(--primary-light);
}

.wizard-step-optional {
  opacity: 0.85;
}

.wizard-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .wizard-step {
    padding-left: 48px;
  }

  .connection-status-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ══════════════════════════════════════ */
/* ── Auto-Reply Monitor ──              */
/* ══════════════════════════════════════ */
.auto-reply-monitor {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.monitor-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.monitor-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.monitor-indicator.active {
  color: var(--success);
}

.monitor-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-light);
}

.monitor-indicator.active .monitor-dot {
  background: var(--success);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.monitor-info {
  display: flex;
  gap: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.monitor-info span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #c0392b;
}

/* ── Reply Log ── */
.reply-log-item {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.reply-log-original {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.reply-log-original i {
  color: var(--info);
  margin-right: 4px;
}

.reply-log-sent {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 6px;
}

.reply-log-sent i {
  color: var(--primary);
  margin-right: 4px;
}

.reply-log-meta {
  display: flex;
  gap: 8px;
}

/* ══════════════════════════════════════ */
/* ── Nav Section Label ──               */
/* ══════════════════════════════════════ */
.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: 0 20px;
  margin-top: 4px;
}

/* ══════════════════════════════════════ */
/* ── Reference Library (ネタ帳) ──       */
/* ══════════════════════════════════════ */
.ref-actions-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ref-count {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.ref-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ref-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid var(--border-color);
  position: relative;
  transition: border-color 0.2s;
}

.ref-card:hover {
  border-color: var(--primary);
}

.ref-content {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-wrap;
  margin-bottom: 10px;
}

.ref-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ref-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.ref-tag i { font-size: 0.65rem; }

.ref-delete-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  transition: all 0.2s;
}

.ref-card:hover .ref-delete-btn { opacity: 1; }
.ref-delete-btn:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* ── Import Modal ── */
.modal-wide { max-width: 680px; }

.import-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 16px;
}

.import-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.import-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.import-tab-content { display: none; }
.import-tab-content.active { display: block; }

/* ══════════════════════════════════════ */
/* ── Learning AI Stats ──               */
/* ══════════════════════════════════════ */
.learning-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.stat-icon {
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 500;
}

/* ── AI Results ── */
.ai-results h4 {
  margin-bottom: 12px;
  color: var(--text-primary);
}

.ai-result-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.ai-result-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.ai-result-content {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.ai-result-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-direction: column;
}

.btn-sm {
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 6px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

/* ── Analysis Report ── */
.analysis-report {
  margin-top: 20px;
}

.analysis-summary {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  font-size: 0.92rem;
  border-left: 4px solid var(--primary);
}

.analysis-section {
  margin-bottom: 16px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid var(--border-color);
}

.analysis-section h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.analysis-section.success h4 { color: var(--success); }
.analysis-section.warning h4 { color: #f59e0b; }
.analysis-section.info h4 { color: var(--primary); }
.analysis-section.accent h4 { color: #8b5cf6; }

.analysis-section ul {
  margin: 0;
  padding-left: 20px;
}

.analysis-section li {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 4px;
}

/* ── Responsive for new sections ── */
@media (max-width: 768px) {
  .learning-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .ai-result-card {
    flex-direction: column;
  }

  .ai-result-actions {
    flex-direction: row;
  }

  .ref-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .ref-count {
    margin-left: 0;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .learning-stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* ══════════════════════════════════════ */
/* ── Guide Banners ──                   */
/* ══════════════════════════════════════ */
.guide-banner {
  display: flex;
  gap: 16px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e8f4fd 100%);
  border: 1px solid #bae6fd;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
}

.guide-banner-accent {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  border-color: #d8b4fe;
}

.guide-banner-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59,130,246,0.12);
}

.guide-banner-accent .guide-banner-icon {
  color: #8b5cf6;
  box-shadow: 0 2px 8px rgba(139,92,246,0.12);
}

.guide-banner-body { flex: 1; }

.guide-banner-body h4 {
  margin: 0 0 8px 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
}

.guide-banner-body > p {
  margin: 0 0 14px 0;
  font-size: 0.88rem;
  line-height: 1.7;
  color: #475569;
}

.guide-banner-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.guide-banner-close:hover { color: #64748b; }

.guide-banner-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.guide-mini-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.5;
}

.mini-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.guide-banner-accent .mini-step-num {
  background: #8b5cf6;
}

.guide-banner-tip {
  margin: 0 !important;
  font-size: 0.8rem !important;
  color: #64748b !important;
  background: rgba(255,255,255,0.6);
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-banner-tip i { color: #3b82f6; }

/* ── Learning AI Flow Diagram ── */
.guide-flow-horizontal {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.guide-flow-item {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
  border: 1px solid #e2e8f0;
  min-width: 100px;
  flex: 1;
  max-width: 140px;
}

.guide-flow-item strong {
  display: block;
  font-size: 0.8rem;
  color: #1e293b;
  margin: 6px 0 2px;
}

.guide-flow-item span {
  font-size: 0.7rem;
  color: #64748b;
  line-height: 1.4;
}

.guide-flow-icon {
  font-size: 1.2rem;
  color: #8b5cf6;
}

.guide-flow-plus {
  font-size: 1.2rem;
  font-weight: 800;
  color: #a78bfa;
  flex-shrink: 0;
}

.guide-flow-result {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  border-color: transparent;
}

.guide-flow-result strong,
.guide-flow-result span { color: #fff; }
.guide-flow-result .guide-flow-icon { color: #fbbf24; }

/* ── Checklist ── */
.guide-checklist {
  background: rgba(255,255,255,0.6);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.guide-checklist h5 {
  margin: 0 0 10px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
}

.guide-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: #334155;
  padding: 5px 0;
}

.guide-check-item i {
  color: #a78bfa;
  font-size: 1rem;
}

.guide-check-item a {
  color: #7c3aed;
  font-weight: 600;
  text-decoration: none;
  margin-left: 4px;
}

.guide-check-item a:hover { text-decoration: underline; }

/* ── Feature Explain ── */
.feature-explain {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
}

.feature-explain p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #475569;
}

.feature-explain i {
  color: #3b82f6;
  margin-right: 4px;
}

/* ── Responsive for guide banners ── */
@media (max-width: 768px) {
  .guide-banner {
    flex-direction: column;
  }

  .guide-flow-horizontal {
    flex-direction: column;
    gap: 6px;
  }

  .guide-flow-item {
    max-width: 100%;
    width: 100%;
  }

  .guide-flow-plus {
    transform: rotate(90deg);
  }
}

@media (max-width: 480px) {
  .guide-banner {
    padding: 16px;
  }

  .guide-banner-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
}

/* =============================================
   Compose v2 (new design)
   ============================================= */
.compose-card-v2 {
  max-width: 640px;
}

.compose-body-v2 {
  padding: 0;
}

#threadItemsContainer {
  padding: 1.25rem 1.25rem 0;
}

.thread-item-v2 {
  display: flex;
  gap: 12px;
  padding-bottom: 1rem;
}

.thread-item-v2 + .thread-item-v2 {
  padding-top: 0.75rem;
}

.tav-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 36px;
}

.tav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a29bfe);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.tav-line {
  width: 2px;
  background: var(--border);
  flex: 1;
  margin: 6px 0;
  border-radius: 1px;
  min-height: 20px;
}

.thread-item-v2:last-child .tav-line {
  display: none;
}

.tav-body {
  flex: 1;
  min-width: 0;
}

.tav-username {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.tav-remove-btn {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-light);
  cursor: pointer;
}
.tav-remove-btn:hover {
  background: #ffe0e0;
  border-color: #e17055;
  color: #e17055;
}

.tav-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.compose-textarea-v2 {
  width: 100%;
  min-height: 100px;
  border: none;
  outline: none;
  resize: none;
  font-size: 1rem;
  line-height: 1.6;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  padding: 0;
}

.compose-textarea-v2::placeholder {
  color: #b2bec3;
}

/* Compose action bar */
.compose-bar-v2 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 1.25rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.cbar-left {
  flex-shrink: 0;
}

.cbar-mid {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.cbar-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.cbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.cbar-icon-btn:hover:not(:disabled) {
  background: rgba(108, 92, 231, 0.08);
  color: var(--primary);
  border-color: var(--primary);
}

.cbar-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cbar-tree-btn {
  border-color: var(--primary);
  color: var(--primary);
}

.cbar-charcount {
  font-size: 0.78rem;
  color: var(--text-light);
  white-space: nowrap;
  min-width: 48px;
}

.cbar-datetime {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
}

.cbar-datetime:focus {
  outline: none;
  border-color: var(--primary);
}

/* =============================================
   Scheduled posts grouped view
   ============================================= */
.scheduled-date-group {
  margin-bottom: 1.25rem;
}

.scheduled-date-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.scheduled-post-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  background: var(--surface);
  transition: border-color 0.15s;
}

.scheduled-post-card:hover {
  border-color: var(--primary);
}

.spc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a29bfe);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.spc-body {
  flex: 1;
  min-width: 0;
}

.spc-user {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 4px;
}

.spc-content {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.spc-time {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.spc-edit-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.85rem;
}

.spc-edit-btn:hover {
  background: rgba(108, 92, 231, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

.thread-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary);
  border-radius: 99px;
  padding: 1px 8px;
  margin-top: 4px;
}
