/* ===== 租寓內容工廠 — Global Styles ===== */
:root {
  --green: #5FBE91;
  --yellow: #FFE450;
  --blue: #2D8FD2;
  --gray: #3C4650;
  --sidebar-bg: #1e2430;
  --sidebar-hover: #2a3140;
  --sidebar-active: #323b4d;
  --bg: #f3f5f8;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c9b;
  --border: #e4e8ed;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
}

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

body {
  font-family: 'Noto Sans TC', 'Avenir', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 230px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: #c8d0dc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo span { color: var(--green); }

.sidebar-nav { flex: 1; padding: 12px 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: #a0aab8;
  text-decoration: none;
  font-size: 14px;
  transition: all .15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #dce3ec;
}
.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--green);
}
.sidebar-nav a .icon { font-size: 17px; width: 22px; text-align: center; }

/* ===== Main Content ===== */
.main {
  margin-left: 230px;
  flex: 1;
  min-height: 100vh;
  padding: 28px 32px;
}

/* ===== Page Header ===== */
.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.page-header .subtitle {
  font-size: 14px;
  color: var(--text-light);
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

/* ===== Stat Cards ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.stat-card .label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.stat-card .value {
  font-size: 28px;
  font-weight: 700;
}
.stat-card .value.green { color: var(--green); }
.stat-card .value.blue { color: var(--blue); }

/* ===== Alerts / Reminders ===== */
.alert-list { margin-bottom: 24px; }
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #fff8e1;
  border-left: 4px solid #ffc107;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
}
.alert-item:hover { background: #fff3cd; }
.alert-item .badge {
  background: #ffc107;
  color: #333;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.filter-bar select,
.filter-bar input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
}
.filter-bar .tag-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.filter-bar .tag-btn:hover,
.filter-bar .tag-btn.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

/* ===== Case Card Wall ===== */
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.case-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.case-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
}
.case-card-img {
  height: 160px;
  background: linear-gradient(135deg, #e8ecf1, #d5dce6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 13px;
  position: relative;
}
.case-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.case-card-body { padding: 14px 16px; }
.case-card-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.case-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.tag-green { background: #e8f8f0; color: #2a8b5e; }
.tag-blue { background: #e3f0fc; color: #1a6fb5; }
.tag-orange { background: #fff3e0; color: #c67100; }
.tag-red { background: #fde8e8; color: #c0392b; }
.tag-gray { background: #eef0f3; color: #5a6674; }

.case-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-light);
}

.warn-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #fff3cd;
  color: #856404;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-primary {
  background: var(--green);
  color: #fff;
}
.btn-primary:hover { background: #4daa7d; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: #f0f2f5; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-ghost {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 13px;
}
.btn-ghost:hover { color: var(--text); }

/* ===== Topic Suggestion Cards ===== */
.suggestion-list { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.suggestion-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.suggestion-card .info { flex: 1; }
.suggestion-card .info h3 { font-size: 15px; margin-bottom: 6px; }
.suggestion-card .info p { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.suggestion-card .actions { display: flex; gap: 8px; flex-shrink: 0; }
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}
.score-high { background: var(--green); }
.score-mid { background: var(--yellow); color: #333; }
.score-low { background: var(--text-light); }

/* ===== Kanban ===== */
.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
}
.kanban-col {
  min-width: 260px;
  max-width: 300px;
  flex: 1;
  background: #eef1f5;
  border-radius: 10px;
  padding: 12px;
}
.kanban-col-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}
.kanban-col-header .count {
  background: #d5dce6;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
}
.kanban-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  cursor: grab;
  font-size: 13px;
  transition: box-shadow .15s;
}
.kanban-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.1); }
.kanban-card h4 { font-size: 13px; margin-bottom: 4px; }
.kanban-card .meta { font-size: 11px; color: var(--text-light); }

/* ===== Script Workspace ===== */
.workspace {
  display: grid;
  grid-template-columns: 300px 1fr 340px;
  gap: 16px;
  min-height: 70vh;
}
.workspace-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  overflow-y: auto;
  max-height: 80vh;
}
.workspace-panel h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.workspace-panel .field {
  margin-bottom: 12px;
}
.workspace-panel .field label {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 3px;
  font-weight: 600;
}
.workspace-panel .field .val {
  font-size: 13px;
}
.workspace textarea {
  width: 100%;
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  font-family: inherit;
}
.workspace textarea:focus {
  outline: none;
  border-color: var(--green);
}

/* ===== AI Suggestion Panel ===== */
.ai-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ai-controls select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.ai-result-block {
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #f7f9fb;
  border-radius: 8px;
}
.ai-result-block .label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 4px;
}
.ai-result-block .content {
  font-size: 13px;
  line-height: 1.6;
}
.ai-result-block .actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

/* ===== View Toggles ===== */
.view-toggle {
  display: inline-flex;
  background: #e8ecf1;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}
.view-toggle button {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-light);
  font-weight: 600;
  transition: all .15s;
}
.view-toggle button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* ===== Calendar ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.calendar-header-cell {
  background: #eef1f5;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
}
.calendar-cell {
  background: #fff;
  min-height: 100px;
  padding: 6px 8px;
  font-size: 12px;
}
.calendar-cell .day {
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 4px;
}
.calendar-cell.today .day { color: var(--green); }
.calendar-cell.other-month { background: #f9fafb; }
.calendar-event {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-event.long { background: #e3f0fc; color: #1a6fb5; }
.calendar-event.short { background: #e8f8f0; color: #2a8b5e; }

/* ===== List View ===== */
.list-table {
  width: 100%;
  border-collapse: collapse;
}
.list-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.list-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.list-table tr:hover td { background: #f7f9fb; }

/* ===== Toolkit ===== */
.toolkit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.toolkit-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: transform .15s;
}
.toolkit-card:hover { transform: translateY(-1px); }
.toolkit-card .icon-box {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.toolkit-card .icon-box.norm { background: #e3f0fc; }
.toolkit-card .icon-box.asset { background: #e8f8f0; }
.toolkit-card .icon-box.tool { background: #fff3e0; }
.toolkit-card .icon-box.other { background: #f3e8ff; }
.toolkit-card .info h4 { font-size: 14px; margin-bottom: 2px; }
.toolkit-card .info p { font-size: 12px; color: var(--text-light); }
.toolkit-card .info a { color: var(--blue); text-decoration: none; font-size: 12px; }
.toolkit-card .info a:hover { text-decoration: underline; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; margin-bottom: 16px; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal .form-group { margin-bottom: 14px; }
.modal .form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text-light); }
.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ===== Loading ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-light);
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-nav a span { display: none; }
  .sidebar-logo { font-size: 0; }
  .sidebar-logo span { font-size: 16px; }
  .main { margin-left: 60px; padding: 16px; }
  .workspace { grid-template-columns: 1fr; }
}

/* ===== Project Detail Layout ===== */
.proj-detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}
.proj-detail-sidebar {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.proj-info-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.proj-info-section:last-of-type { border-bottom: none; }
.proj-info-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: .3px;
  margin-bottom: 10px;
}
.proj-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}
.proj-info-row > span:first-child {
  width: 60px;
  flex-shrink: 0;
  color: var(--text-light);
  font-size: 13px;
}
.proj-info-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 14px;
  background: transparent;
  transition: border-color .15s, background .15s;
}
.proj-info-input:hover { background: #f7f9fb; }
.proj-info-input:focus {
  outline: none;
  border-color: var(--green);
  background: #fff;
}
select.proj-info-input { cursor: pointer; }

.proj-detail-main {
  min-height: 600px;
  padding-bottom: 80px;
}
.proj-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
}
.proj-tab {
  padding: 12px 22px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.proj-tab:hover { color: var(--text); }
.proj-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}
.proj-tab-content {
  display: none;
  padding: 20px 0;
}
.proj-tab-content.active { display: block; }

.proj-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.6;
}
.proj-textarea:focus {
  outline: none;
  border-color: var(--green);
}

@media (max-width: 1000px) {
  .proj-detail-layout { grid-template-columns: 1fr; }
  .proj-detail-sidebar { position: static; max-height: none; }
}

/* ===== Publish Bar (fixed bottom) ===== */
.publish-bar {
  position: fixed;
  bottom: 0;
  left: 230px;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  z-index: 90;
  padding: 12px 32px;
}
.publish-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.publish-bar-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
}
.publish-bar-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.publish-bar-check {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .publish-bar { left: 60px; padding: 10px 16px; }
}

/* ===== Form Groups (project detail) ===== */
.form-group { margin-bottom: 0; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green);
}

/* ===== Project Gallery ===== */
.proj-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.proj-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.proj-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.proj-card-thumb {
  height: 130px;
  background: linear-gradient(135deg, #e8ecf1, #d5dce6);
  position: relative;
  overflow: hidden;
}
.proj-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.proj-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #b0bac6;
  background: linear-gradient(135deg, #e8ecf1 0%, #d0d8e2 100%);
}
.proj-card-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.proj-card-status {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.proj-card-status.tag-green { background: rgba(95,190,145,.9); color: #fff; }
.proj-card-status.tag-orange { background: rgba(255,152,0,.85); color: #fff; }
.proj-card-status.tag-blue { background: rgba(45,143,210,.85); color: #fff; }
.proj-card-info {
  padding: 10px 12px 12px;
}
.proj-card-info h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.proj-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-light);
}

/* ===== Completed Section ===== */
.completed-section {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

/* ===== Rich Text Editor ===== */
.richtext-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: #f9fafb;
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
}
.rt-btn {
  padding: 4px 10px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background .15s;
}
.rt-btn:hover { background: #e4e8ed; }
.rt-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}
.richtext-editor {
  min-height: 500px;
  padding: 24px 28px;
  font-size: 16px;
  line-height: 1.8;
  outline: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
.richtext-editor:empty::before {
  content: attr(placeholder);
  color: var(--text-light);
  pointer-events: none;
}
.richtext-editor h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.richtext-editor h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 16px 0 6px;
}
.richtext-editor p { margin: 8px 0; }
.richtext-editor img {
  max-width: 100%;
  border-radius: 8px;
  margin: 12px 0;
  display: block;
}
.richtext-editor a { color: var(--blue); }
.richtext-editor ul, .richtext-editor ol {
  padding-left: 24px;
  margin: 8px 0;
}
.richtext-editor li { margin: 4px 0; }
.richtext-editor hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
.richtext-editor blockquote {
  border-left: 3px solid var(--green);
  padding-left: 14px;
  color: var(--text-light);
  margin: 12px 0;
}

/* ===== Discussion Panel ===== */
.discussion-panel {
  background: #f7f9fb;
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}
.discussion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.discussion-header h4 {
  font-size: 14px;
  font-weight: 700;
}
.discussion-count {
  background: var(--green);
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
}
.discussion-user-select select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
}
.discussion-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 320px;
  overflow-y: auto;
}
.discussion-item {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  border-left: 3px solid transparent;
}
.discussion-item.pinned {
  border-left-color: var(--yellow);
  background: #fffdf0;
}
.discussion-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.discussion-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.discussion-time {
  font-size: 11px;
  color: var(--text-light);
}
.discussion-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
}
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: .5;
  transition: opacity .15s;
}
.btn-icon:hover { opacity: 1; }
.discussion-text {
  font-size: 13px;
  line-height: 1.5;
}
.discussion-text .mention {
  background: #e3f0fc;
  color: var(--blue);
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 12px;
}
.discussion-empty {
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: var(--text-light);
}
.discussion-input {
  background: #fff;
  border-radius: 8px;
  padding: 10px;
}
.discussion-input textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  line-height: 1.5;
}
.discussion-input textarea:focus {
  outline: none;
  border-color: var(--green);
}
.discussion-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

/* ===== Utility ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-light); }
.hidden { display: none !important; }
