/* ══════════════════════════════════════════════════════════════════
   T29 Social Dashboard — Apple-Inspired Dark Mode
   ══════════════════════════════════════════════════════════════════ */

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

:root {
  --bg: #000000;
  --panel-bg: rgba(255,255,255,0.05);
  --card-bg: rgba(255,255,255,0.03);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);
  --red: #FF2D55;
  --red-gradient: linear-gradient(135deg, #FF2D55, #FF6B6B);
  --blue: #0A84FF;
  --gold: #FFD60A;
  --text: #FFFFFF;
  --text-secondary: rgba(255,255,255,0.5);
  --text-tertiary: rgba(255,255,255,0.3);
  --text-label: rgba(255,255,255,0.4);
  --radius-panel: 20px;
  --radius-card: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

body {
  padding-top: 56px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header ─────────────────────────────────────────────────────── */
header {
  height: 48px;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

header h1 .subtitle {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: 8px;
}

.header-right { display: flex; align-items: center; gap: 16px; }

.btn-post {
  background: var(--red-gradient);
  color: white;
  border: none;
  padding: 6px 20px;
  border-radius: 100px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(255,45,85,0.3);
}
.btn-post:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255,45,85,0.4);
}
.btn-post:active { transform: scale(0.97); }

.last-update {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

/* ── Layout ─────────────────────────────────────────────────────── */
.dashboard {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.top-row {
  display: grid;
  grid-template-columns: 65fr 35fr;
  gap: 20px;
  min-height: 65vh;
}

/* ── Panels ─────────────────────────────────────────────────────── */
.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 24px;
  box-shadow: var(--shadow);
  overflow-y: auto;
  transition: border-color 0.2s ease;
}

.panel h2 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-label);
  margin-bottom: 20px;
  padding-bottom: 0;
  border-bottom: none;
}

.panel h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-label);
  margin: 20px 0 12px;
}

/* ── Calendar ───────────────────────────────────────────────────── */
.panel-calendar { overflow: hidden; display: flex; flex-direction: column; }
#calendar { flex: 1; min-height: 0; }

.fc { font-size: 0.82rem; height: 100% !important; }
.fc .fc-toolbar { margin-bottom: 16px !important; }
.fc .fc-toolbar-title {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  color: var(--text) !important;
}
.fc .fc-button {
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: var(--text) !important;
  font-size: 0.78rem !important;
  border-radius: 8px !important;
  padding: 4px 12px !important;
  transition: all 0.2s ease !important;
}
.fc .fc-button:hover { background: rgba(255,255,255,0.12) !important; }
.fc .fc-button-active, .fc .fc-button:active {
  background: var(--red) !important;
  border-color: var(--red) !important;
}
.fc .fc-daygrid-day {
  background: transparent;
  border-color: rgba(255,255,255,0.04) !important;
}
.fc .fc-day-today {
  background: rgba(255,45,85,0.08) !important;
}
.fc .fc-daygrid-day-number {
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 8px !important;
}
.fc .fc-day-today .fc-daygrid-day-number { color: var(--red); font-weight: 600; }
.fc .fc-col-header-cell {
  background: transparent;
  color: #1a1a1a;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-color: rgba(255,255,255,0.04) !important;
}
.fc .fc-scrollgrid { border-color: rgba(255,255,255,0.04) !important; }
.fc .fc-scrollgrid td, .fc .fc-scrollgrid th { border-color: rgba(255,255,255,0.04) !important; }
.fc .fc-event {
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.72rem;
  border: none;
  border-radius: 4px;
  font-weight: 500;
}
.fc .fc-daygrid-event-dot { display: none; }
.fc .fc-h-event { border: none; }
.fc-theme-standard td, .fc-theme-standard th { border-color: rgba(255,255,255,0.04); }
.fc-theme-standard .fc-scrollgrid { border-color: rgba(255,255,255,0.04); }

/* ── Analytics ──────────────────────────────────────────────────── */
.panel-analytics { overflow-y: auto; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border: none;
  border-left: 3px solid var(--red);
  border-radius: var(--radius-card);
  padding: 16px;
  text-align: left;
  transition: all 0.2s ease;
}
.stat-card:hover { background: rgba(255,255,255,0.05); }

.stat-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-label);
  margin-top: 4px;
}

.chart-container {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.2s ease;
}
.chart-container:hover { border-color: var(--border-hover); }
.chart-container canvas { max-height: 160px; }

/* ── Heatmap ────────────────────────────────────────────────────── */
.heatmap {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  gap: 2px;
  font-size: 0.65rem;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: var(--text-tertiary);
}
.heatmap-label {
  display: flex;
  align-items: center;
  font-size: 0.6rem;
  color: var(--text-tertiary);
}

/* ── Top Posts ───────────────────────────────────────────────────── */
.top-post {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.top-post:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.top-post img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
}
.top-post-info { flex: 1; min-width: 0; }
.top-post-text {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.top-post-stats {
  font-size: 0.72rem;
  color: var(--gold);
  margin-top: 4px;
}

/* ── News Feed ──────────────────────────────────────────────────── */
.panel-news { width: 100%; }

.news-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.news-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: all 0.2s ease;
}
.news-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.news-card a { text-decoration: none; color: inherit; display: block; }
.news-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}
.news-card-body {
  padding-top: 56px; padding: 14px; }
.news-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
}
.news-card-meta {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  display: flex;
  justify-content: space-between;
}
.news-card-source {
  color: var(--red);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

.loading {
  text-align: center;
  color: var(--text-tertiary);
  padding: 60px;
  font-size: 0.85rem;
}

/* ── Modal ──────────────────────────────────────────────────────── */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: rgba(30,30,30,0.95);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  max-width: 560px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-tertiary);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  transition: all 0.2s ease;
}
.modal-close:hover {
  background: rgba(255,255,255,0.15);
  color: var(--text);
}
.modal-img { width: 100%; border-radius: var(--radius-card); margin-bottom: 16px; }
.modal-text { font-size: 0.9rem; line-height: 1.6; margin-bottom: 16px; color: var(--text-secondary); }
.modal-stats { display: flex; gap: 20px; font-size: 0.85rem; color: var(--gold); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .top-row { grid-template-columns: 1fr 1fr; min-height: auto; }
  .panel-calendar { min-height: 500px; }
}
@media (max-width: 768px) {
  .top-row { grid-template-columns: 1fr; }
  .dashboard { padding: 12px; }
  .panel { padding: 16px; border-radius: 16px; }
  .stats-row { grid-template-columns: 1fr; }
  .news-feed { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .news-feed { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════
   KANBAN BOARD STYLES
   ══════════════════════════════════════════════════════════════════ */

/* ── Header Tabs ────────────────────────────────────────────────── */
.header-tabs { display: flex; gap: 4px; }
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.tab-btn:hover { color: var(--text-secondary); background: rgba(255,255,255,0.05); }
.tab-btn.active { color: var(--text); background: rgba(255,255,255,0.1); }

/* ── Kanban Layout ──────────────────────────────────────────────── */
.kanban-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-header-left { display: flex; align-items: center; gap: 12px; }

.board-select {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}
.board-select option { background: #1a1a1a; color: #fff; }

.btn-sm {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-sm:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.kanban-board {
  display: flex;
  gap: 16px;
  padding: 0 24px 24px;
  overflow-x: auto;
  min-height: calc(100vh - 120px);
  align-items: flex-start;
}

/* ── Columns ────────────────────────────────────────────────────── */
.kanban-col {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-col-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  flex: 1;
}
.kanban-col-count {
  font-size: 0.65rem;
  background: rgba(255,255,255,0.08);
  color: var(--text-tertiary);
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 500;
}
.kanban-col-menu {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.kanban-col-menu:hover { background: rgba(255,255,255,0.08); color: var(--text-secondary); }

.kanban-col-body {
  padding-top: 56px;
  padding: 0 12px;
  flex: 1;
  min-height: 40px;
  transition: background 0.2s ease;
}
.kanban-col-body.drag-over {
  background: rgba(255,45,85,0.04);
  border-radius: 8px;
}

.kanban-add-card {
  background: none;
  border: none;
  color: var(--text-tertiary);
  padding: 12px 16px;
  font-size: 0.78rem;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s ease;
  font-family: inherit;
}
.kanban-add-card:hover { color: var(--text-secondary); }

/* ── Done column collapse ── */
.kanban-col-collapsed {
  min-width: 180px;
  max-width: 180px;
}
.kanban-col-header-done {
  cursor: pointer;
}
.kanban-col-header-done:hover {
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
}
.kanban-col-collapse {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s ease;
  flex-shrink: 0;
  line-height: 1;
}
.kanban-col-collapse:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
}

.kanban-col-add {
  min-width: 200px;
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.08);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0;
}
.kanban-add-col {
  background: none;
  border: none;
  color: var(--text-tertiary);
  padding: 16px;
  font-size: 0.82rem;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: color 0.2s ease;
  font-family: inherit;
}
.kanban-add-col:hover { color: var(--text-secondary); }

/* ── Cards ──────────────────────────────────────────────────────── */
.kanban-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: grab;
  transition: all 0.2s ease;
  user-select: none;
}
.kanban-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging {
  opacity: 0.4;
  transform: rotate(2deg);
}

.card-top { display: flex; align-items: flex-start; gap: 6px; }
.card-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.card-priority.urgent { font-size: 0.75rem; flex-shrink: 0; }
.card-priority.low {
  width: 6px; height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.card-meta:empty { display: none; }

.card-tag {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(255,45,85,0.12);
  color: var(--red);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.card-due {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 3px;
}
.card-due::before { content: '📅'; font-size: 0.6rem; }
.card-assignee {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-left: auto;
}
.card-assignee::before { content: '👤'; font-size: 0.6rem; margin-right: 2px; }

/* ── Card Edit Modal ────────────────────────────────────────────── */
.modal-card-edit { max-width: 480px; }
.modal-card-edit h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-label);
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--red);
}
.form-group textarea { resize: vertical; }
.form-group select option { background: #1a1a1a; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-save {
  background: var(--red-gradient);
  color: white;
  border: none;
  padding: 8px 24px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 0 2px 12px rgba(255,45,85,0.3);
}
.btn-save:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(255,45,85,0.4); }

.btn-delete {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(255,45,85,0.3);
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-delete:hover { background: rgba(255,45,85,0.1); }

/* ══════ TODAY TAB ══════ */
#tab-today {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Quick Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.quick-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  backdrop-filter: blur(20px);
}
.quick-stat .qs-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.quick-stat .qs-label {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.quick-stat.stat-alert .qs-value { color: #FF2D55; }

/* Inbox */
.inbox-panel {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  backdrop-filter: blur(20px);
  display: flex;
  gap: 10px;
}
.inbox-panel input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.inbox-panel input:focus {
  border-color: #FF2D55;
}
.inbox-panel input::placeholder { color: rgba(255,255,255,0.3); }
.inbox-panel button {
  background: #FF2D55;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}
.inbox-panel button:hover { background: #e0264c; }

/* Two column layout */
.today-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Section panels */
.today-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  backdrop-filter: blur(20px);
}
.today-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.section-count {
  color: #FF2D55;
  font-weight: 700;
}

/* Order cards */
.order-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-left: 3px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.order-card.order-urgent {
  border-left-color: #FF2D55;
}
.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.order-number {
  font-weight: 700;
  color: #fff;
  font-size: 14px;
}
.order-price {
  color: #4CD964;
  font-weight: 600;
  font-size: 14px;
}
.order-details {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}
.order-age {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 4px;
}
.age-urgent { color: #FF2D55; font-weight: 600; }

/* Task items */
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: opacity 0.3s;
}
.task-item:last-child { border-bottom: none; }
.task-overdue { }
.task-check {
  background: none;
  border: 1.5px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.4);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  padding: 0;
}
.task-check:hover { border-color: #4CD964; color: #4CD964; }
.task-check.done { background: #4CD964; border-color: #4CD964; color: #000; }
.task-info { flex: 1; min-width: 0; }
.task-title {
  display: block;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
.task-meta {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 2px;
}
.task-overdue .task-meta { color: #FF2D55; }

/* Upcoming */
.upcoming-day { margin-bottom: 12px; }
.upcoming-day-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}
.upcoming-task {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.upcoming-task .task-title { font-size: 13px; }
.upcoming-task .task-meta { font-size: 11px; color: rgba(255,255,255,0.35); }

.empty-state {
  color: rgba(255,255,255,0.3);
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}

/* Mobile */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .today-columns { grid-template-columns: 1fr; }
  .quick-stat .qs-value { font-size: 22px; }
  #tab-today { padding: 12px; }
}

/* ══════════════════════════════════════════════════════════════════
   PHASE 2 & 3 — Calendar, Playbooks, Social Stats, Inventory
   ══════════════════════════════════════════════════════════════════ */

/* Stats grid 5 columns */
.stats-grid { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Calendar Tab ──────────────────────────────────────────────── */
#tab-calendar {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  flex-direction: column;
}
.calendar-container {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 24px;
  backdrop-filter: blur(20px);
}
.calendar-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.btn-add-event {
  background: var(--red-gradient);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-add-event:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(255,45,85,0.4); }
.calendar-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Collapsible Sections ──────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.section-header h3 { margin: 0; }
.section-toggle {
  color: var(--text-tertiary);
  font-size: 12px;
  transition: transform 0.2s;
}

/* ── Inventory Alerts ──────────────────────────────────────────── */
.inv-summary {
  padding: 8px 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  margin-bottom: 8px;
}
.inv-zero {
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
}
.inv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 13px;
}
.inv-name {
  flex: 1;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-count {
  color: #FF9500;
  font-weight: 600;
  white-space: nowrap;
}
.inv-critical { color: var(--red); }
.inv-link {
  color: var(--blue);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}
.inv-link:hover { text-decoration: underline; }

/* ── Playbooks ─────────────────────────────────────────────────── */
.playbooks-section {
  padding: 24px;
}
.playbooks-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-label);
  margin-bottom: 16px;
}
.playbooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.playbook-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: border-color 0.2s;
}
.playbook-card:hover { border-color: var(--border-hover); }
.playbook-header {
  padding: 16px;
  cursor: pointer;
  user-select: none;
}
.playbook-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.playbook-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.playbook-progress {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  padding: 2px 10px;
  border-radius: 100px;
}
.playbook-desc {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.playbook-bar {
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
.playbook-bar-fill {
  height: 100%;
  background: var(--red-gradient);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.playbook-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}
.playbook-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.playbook-item:last-of-type { border-bottom: none; }
.playbook-item input[type="checkbox"] {
  accent-color: var(--red);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.playbook-item input:checked + span {
  text-decoration: line-through;
  color: var(--text-tertiary);
}
.playbook-reset {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-tertiary);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  margin-top: 12px;
  font-family: inherit;
  transition: all 0.2s;
}
.playbook-reset:hover { border-color: var(--red); color: var(--red); }

/* ── Social Stats Bar ──────────────────────────────────────────── */
.social-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}
.social-stat-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  text-align: center;
  backdrop-filter: blur(20px);
  transition: border-color 0.2s;
}
.social-stat-card:hover { border-color: var(--border-hover); }
.social-stat-icon { font-size: 1.5rem; margin-bottom: 4px; }
.social-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.social-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-label);
  margin-top: 4px;
}

#recentPostsSection {
  margin: 0 20px;
  max-width: 1560px;
}
.recent-post-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.recent-post-item:last-child { border-bottom: none; }
.rp-platform {
  font-weight: 600;
  color: var(--text-secondary);
  width: 40px;
  flex-shrink: 0;
}
.rp-text {
  flex: 1;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rp-stats {
  color: var(--gold);
  font-size: 12px;
  white-space: nowrap;
}
.rp-link {
  color: var(--blue);
  text-decoration: none;
  font-size: 14px;
}

/* Revenue chart section */
#revenueChartSection canvas { max-height: 140px; }

@media (max-width: 768px) {
  .social-stats-bar { grid-template-columns: repeat(2, 1fr); padding: 12px; }
  #recentPostsSection { margin: 0 12px; }
  .playbooks-grid { grid-template-columns: 1fr; }
}

/* ── Momentum Alerts ──────────────────────────────────────────── */
.section-header-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.inv-badge { font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 100px; background: rgba(255,149,0,0.15); color: #FF9500; }
.inv-badge.inv-ok { background: rgba(52,199,89,0.15); color: #34C759; }
.inv-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; margin-bottom: 6px; text-decoration: none; color: inherit; transition: all 0.2s; }
.inv-item:hover { border-color: rgba(255,149,0,0.3); background: rgba(255,149,0,0.05); }
.inv-item-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.inv-name { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-velocity { font-size: 0.72rem; color: rgba(255,255,255,0.4); }
.inv-count { font-size: 0.85rem; font-weight: 700; color: #34C759; margin-left: 12px; white-space: nowrap; }
.inv-count.inv-warn { color: #FF9500; }
.inv-count.inv-critical { color: #FF2D55; }

/* ══ Things View ══ */
.things-sections { padding: 8px 0; }
.things-section { border-radius: 12px; margin-bottom: 2px; }
.things-section.active { background: #1a1a1a; }
.things-section-row { display: flex; align-items: center; padding: 14px 16px; cursor: pointer; border-radius: 12px; transition: background 0.15s; }
.things-section-row:hover { background: rgba(255,255,255,0.05); }
.things-icon { font-size: 20px; margin-right: 12px; width: 28px; text-align: center; }
.things-name { flex: 1; font-size: 15px; font-weight: 500; color: #fff; }
.things-count { font-size: 13px; color: rgba(255,255,255,0.35); font-weight: 500; min-width: 24px; text-align: right; }
.things-tasks { padding: 0 8px 12px 48px; }
.things-empty { color: rgba(255,255,255,0.25); font-size: 13px; padding: 8px 0; }
.things-task { display: flex; align-items: center; padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,0.06); transition: opacity 0.4s, transform 0.4s; }
.things-task:last-child { border-bottom: none; }
.things-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); margin-right: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; flex-shrink: 0; transition: all 0.2s; min-width: 22px; min-height: 22px; -webkit-tap-highlight-color: transparent; }
.things-check:hover { border-color: #34C759; }
.things-check.done { background: #34C759; border-color: #34C759; }
.things-task-info { flex: 1; cursor: pointer; min-width: 0; }
.things-task-title { font-size: 14px; color: rgba(255,255,255,0.85); }
.things-pri-urgent { color: #FF2D55; font-weight: 700; margin-left: 6px; font-size: 13px; }
.things-due { font-size: 12px; color: rgba(255,255,255,0.3); margin-left: 8px; white-space: nowrap; }
.things-add-bar { padding: 8px 16px 16px; }
.things-add-bar input { width: 100%; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 12px 16px; color: #fff; font-size: 14px; outline: none; }
.things-add-bar input:focus { border-color: #FF2D55; }
.things-add-bar input::placeholder { color: rgba(255,255,255,0.3); }
.things-kanban-divider { text-align: center; padding: 16px 0; border-top: 1px solid rgba(255,255,255,0.08); margin-top: 8px; }
#toggleKanban { background: none; border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.4); padding: 8px 20px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all 0.2s; }
#toggleKanban:hover { color: #fff; border-color: rgba(255,255,255,0.3); }
/* Things detail overlay */
.things-detail-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.things-detail { background: #1c1c1e; border-radius: 16px; padding: 24px; max-width: 480px; width: 100%; max-height: 80vh; overflow-y: auto; }
.things-detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.things-detail-header h3 { font-size: 18px; font-weight: 600; color: #fff; margin: 0; flex: 1; }
.things-detail-close { color: rgba(255,255,255,0.4); cursor: pointer; font-size: 18px; padding: 4px 8px; }
.things-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.things-detail-tag { font-size: 12px; background: rgba(255,255,255,0.08); padding: 4px 10px; border-radius: 6px; color: rgba(255,255,255,0.6); }
.things-detail-desc { font-size: 14px; color: rgba(255,255,255,0.6); line-height: 1.6; white-space: pre-wrap; }
@media (max-width: 600px) {
  .things-check { width: 28px; height: 28px; min-width: 28px; min-height: 28px; }
  .things-task { padding: 12px 8px; }
  .things-section-row { padding: 16px; }
}

/* ── Playbook Enhancements ─────────────────────────────────────── */
.playbook-actions {
  display: flex;
  gap: 6px;
}
.pb-action {
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.4;
  transition: opacity 0.2s;
  padding: 2px 4px;
}
.pb-action:hover { opacity: 1; }
.playbook-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.playbook-progress-row .playbook-bar {
  flex: 1;
  margin-top: 0;
}
.playbook-new {
  border-style: dashed;
  border-color: rgba(255,255,255,0.1);
  min-height: 140px;
}
.playbook-new:hover {
  border-color: var(--red);
}
.playbook-footer-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.playbook-send-tasks {
  background: var(--red-gradient);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(255,45,85,0.2);
}
.playbook-send-tasks:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255,45,85,0.3);
}

/* Playbook modal item rows */
.pb-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.pb-drag {
  cursor: grab;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  opacity: 0.4;
  user-select: none;
}
.pb-item-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
}
.pb-item-input:focus {
  outline: none;
  border-color: var(--red);
}
.pb-remove-item {
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  padding: 4px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.pb-remove-item:hover { opacity: 1; color: var(--red); }
.pb-add-item {
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.1);
  color: var(--text-tertiary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  margin-top: 6px;
  width: 100%;
  font-family: inherit;
  transition: all 0.2s;
}
.pb-add-item:hover { border-color: var(--red); color: var(--red); }

/* Toast */
.pb-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 24px;
  border-radius: 100px;
  font-size: 0.82rem;
  z-index: 2000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: none;
}
.pb-toast-error {
  border-color: var(--red);
  color: var(--red);
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE OVERHAUL
   ══════════════════════════════════════════════════════════════════ */

/* ── Base mobile resets ──────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
* { -webkit-tap-highlight-color: transparent; }

/* ── Header ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  header {
    padding: 0 12px;
    height: 52px;
  }
  header h1 { font-size: 0.95rem; }
  header h1 .subtitle { display: none; }
  .header-right { gap: 8px; }
  .btn-post { padding: 5px 14px; font-size: 0.78rem; }
  .last-update { display: none; }
}

/* ── Tab navigation — scrollable on mobile ───────────────────────── */
@media (max-width: 768px) {
  .header-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 2px;
    padding: 0 2px;
    flex-shrink: 1;
    min-width: 0;
  }
  .header-tabs::-webkit-scrollbar { display: none; }
  .tab-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ── Tab content padding ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .tab-content { padding-top: 52px; }
  #tab-today { padding: 10px; padding-top: 4px; }
  #tab-calendar { padding: 10px; }
  #tab-social { padding: 10px; }
}

/* ── Today tab ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .quick-stat { padding: 12px; }
  .quick-stat .qs-value { font-size: 20px; }
  .quick-stat .qs-label { font-size: 0.65rem; }

  .today-columns {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .inbox-panel { padding: 12px; }
  .inbox-panel input { font-size: 16px; /* prevents iOS zoom */ }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 6px; }
  .quick-stat { padding: 10px; }
  .quick-stat .qs-value { font-size: 18px; }
}

/* ── Kanban board — horizontal scroll ───────────────────────────── */
@media (max-width: 900px) {
  #tab-projects { padding: 0; }

  .kanban-header { padding: 12px 14px; }
  .kanban-header-left h2 { font-size: 0.85rem; }

  .kanban-board {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    gap: 12px;
    /* Snap scrolling for mobile */
    scroll-snap-type: x mandatory;
  }

  .kanban-col {
    min-width: 280px;
    max-width: 280px;
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  .kanban-col-title { font-size: 0.8rem; }
  .kanban-card { padding: 10px 12px; }
  .kanban-card-title { font-size: 0.85rem; }
}

@media (max-width: 480px) {
  .kanban-col {
    min-width: 260px;
    max-width: 260px;
  }
}

/* ── Things view ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .things-sections { padding: 4px 0; }
  .things-section-row { padding: 14px 12px; }
  .things-tasks { padding: 0 4px 10px 44px; }
  .things-task { padding: 12px 6px; }
  .things-check { width: 26px; height: 26px; min-width: 26px; min-height: 26px; margin-right: 14px; }
  .things-task-title { font-size: 15px; }
  .things-add-bar { padding: 8px 12px 14px; }
  .things-add-bar input { font-size: 16px; /* prevent iOS zoom */ padding: 14px 16px; }
  .things-detail { max-width: 100%; border-radius: 20px 20px 0 0; }
  .things-detail-overlay { align-items: flex-end; padding: 0; }
}

/* ── Social tab ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .social-stats-bar {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
    padding: 10px;
  }
  .social-stat-card { padding: 14px 12px; }
  .social-stat-card .stat-value { font-size: 1.4rem; }

  .top-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .panel { padding: 14px; }
  .panel h2 { font-size: 0.65rem; }

  .stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 1.3rem; }

  #recentPostsSection { margin: 0 !important; }
  .top-post { padding: 10px; }
  .top-post-img { width: 50px; height: 50px; }
}

@media (max-width: 480px) {
  .social-stats-bar { grid-template-columns: repeat(2, 1fr) !important; }
  .stats-row { grid-template-columns: repeat(2, 1fr) !important; }
  .news-feed { grid-template-columns: 1fr !important; }
}

/* ── Calendar tab ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #tab-calendar { padding: 10px !important; }
  .calendar-container { padding: 12px; border-radius: 16px; }
  .calendar-header-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .calendar-legend { flex-wrap: wrap; gap: 6px; }
  .legend-item { font-size: 0.72rem; }
  #gcalStatus { margin-left: 0 !important; }

  /* FullCalendar mobile fixes */
  .fc .fc-toolbar { flex-wrap: wrap; gap: 6px; }
  .fc .fc-toolbar-title { font-size: 0.9rem !important; }
  .fc .fc-button { font-size: 0.72rem !important; padding: 4px 8px !important; }
  .fc .fc-daygrid-day-number { font-size: 0.72rem; padding: 4px !important; }
  .fc .fc-col-header-cell { font-size: 0.65rem; }
  .fc .fc-event { font-size: 0.65rem; padding: 1px 4px; }
}

/* ── Modals — full screen on mobile ─────────────────────────────── */
@media (max-width: 600px) {
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    padding: 20px 16px;
    overflow-y: auto;
    margin: 0;
  }
  .modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal-card-edit { width: 100% !important; }

  /* Stack form rows */
  .form-row { flex-direction: column !important; gap: 8px; }
  .form-row > * { width: 100% !important; }

  /* Larger inputs to prevent iOS zoom */
  input[type="text"],
  input[type="date"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ── Inventory / alert items ─────────────────────────────────────── */
@media (max-width: 768px) {
  .inv-item { padding: 10px; }
  .inv-name { font-size: 0.8rem; }
}

/* ── General spacing reductions ──────────────────────────────────── */
@media (max-width: 480px) {
  .dashboard { padding: 8px !important; gap: 10px !important; }
  .panel { padding: 12px !important; border-radius: 14px !important; }
  .kanban-header { padding: 10px 12px; }
}

/* ── Safe area padding (iPhone notch/home bar) ────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  header { padding-top: env(safe-area-inset-top); }
}

/* ── Header mobile: 2-row layout ─────────────────────────────────── */
@media (max-width: 600px) {
  header {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 12px 0;
    gap: 0;
  }

  .header-left {
    flex: 1;
    min-width: 0;
  }

  .header-right {
    flex-shrink: 0;
  }

  /* Tabs move to their own full-width row */
  .header-tabs {
    order: 3;
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 8px;
    padding: 6px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    display: flex;
    gap: 2px;
  }
  .header-tabs::-webkit-scrollbar { display: none; }

  .tab-btn {
    padding: 7px 16px;
    font-size: 0.82rem;
    flex-shrink: 0;
    border-radius: 8px;
  }

  /* Offset for taller header */
  .tab-content {
    padding-top: 86px !important;
  }

  #tab-today { padding-top: 4px !important; }
}

/* Extra small — shrink title */
@media (max-width: 380px) {
  header h1 { font-size: 0.85rem; }
  .btn-post { padding: 5px 10px; font-size: 0.75rem; }
}

/* ══════════════════════════════════════════════════════════════════
   OVERFLOW & CLIPPING FIXES
   ══════════════════════════════════════════════════════════════════ */

/* Hard clamp — nothing escapes the viewport */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* All main containers must stay within bounds */
header,
.tab-content,
main,
.dashboard,
.today-section,
.today-columns,
.stats-grid,
.inbox-panel,
.panel,
.social-stats-bar {
  max-width: 100%;
  box-sizing: border-box;
}

/* ── Fix header overflow ─────────────────────────────────────────── */
@media (max-width: 600px) {
  header {
    overflow: hidden;
    width: 100%;
  }
  .header-left {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
  }
  .header-right {
    flex-shrink: 0;
  }
  /* Shorten button text on tiny screens */
  .btn-post {
    padding: 6px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
  }
}

/* ── Fix inbox Capture button overflow ───────────────────────────── */
@media (max-width: 600px) {
  .inbox-panel {
    width: 100%;
    overflow: hidden;
  }
  .inbox-panel input {
    min-width: 0;
    flex: 1 1 0;
  }
  .inbox-panel button {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* ── Fix section headers with badges overflowing ─────────────────── */
.section-header {
  overflow: hidden;
}
.section-header-left {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
#invSummary {
  overflow: hidden;
  max-width: 100%;
}

/* ── Today columns full-width ────────────────────────────────────── */
@media (max-width: 768px) {
  .today-columns {
    width: 100%;
    overflow: hidden;
  }
  .today-section {
    width: 100%;
    overflow: hidden;
  }
}

/* ── Kanban scroll container — don't bleed into body ─────────────── */
@media (max-width: 900px) {
  #tab-projects {
    overflow-x: hidden;
  }
  .kanban-board {
    width: 100%;
    max-width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════
   OVERFLOW & CLIPPING FIXES
   ══════════════════════════════════════════════════════════════════ */

/* Hard clamp — nothing escapes the viewport */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* All main containers must stay within bounds */
header,
.tab-content,
main,
.dashboard,
.today-section,
.today-columns,
.stats-grid,
.inbox-panel,
.panel,
.social-stats-bar {
  max-width: 100%;
  box-sizing: border-box;
}

/* ── Fix header overflow ─────────────────────────────────────────── */
@media (max-width: 600px) {
  header {
    overflow: hidden;
    width: 100%;
  }
  .header-left {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
  }
  .header-right {
    flex-shrink: 0;
  }
  /* Shorten button text on tiny screens */
  .btn-post {
    padding: 6px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
  }
}

/* ── Fix inbox Capture button overflow ───────────────────────────── */
@media (max-width: 600px) {
  .inbox-panel {
    width: 100%;
    overflow: hidden;
  }
  .inbox-panel input {
    min-width: 0;
    flex: 1 1 0;
  }
  .inbox-panel button {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* ── Fix section headers with badges overflowing ─────────────────── */
.section-header {
  overflow: hidden;
}
.section-header-left {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
#invSummary {
  overflow: hidden;
  max-width: 100%;
}

/* ── Today columns full-width ────────────────────────────────────── */
@media (max-width: 768px) {
  .today-columns {
    width: 100%;
    overflow: hidden;
  }
  .today-section {
    width: 100%;
    overflow: hidden;
  }
}

/* ── Kanban scroll container — don't bleed into body ─────────────── */
@media (max-width: 900px) {
  #tab-projects {
    overflow-x: hidden;
  }
  .kanban-board {
    width: 100%;
    max-width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════
   OVERFLOW & CLIPPING FIXES
   ══════════════════════════════════════════════════════════════════ */

/* Hard clamp — nothing escapes the viewport */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* All main containers must stay within bounds */
header,
.tab-content,
main,
.dashboard,
.today-section,
.today-columns,
.stats-grid,
.inbox-panel,
.panel,
.social-stats-bar {
  max-width: 100%;
  box-sizing: border-box;
}

/* ── Fix header overflow ─────────────────────────────────────────── */
@media (max-width: 600px) {
  header {
    overflow: hidden;
    width: 100%;
  }
  .header-left {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
  }
  .header-right {
    flex-shrink: 0;
  }
  /* Shorten button text on tiny screens */
  .btn-post {
    padding: 6px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
  }
}

/* ── Fix inbox Capture button overflow ───────────────────────────── */
@media (max-width: 600px) {
  .inbox-panel {
    width: 100%;
    overflow: hidden;
  }
  .inbox-panel input {
    min-width: 0;
    flex: 1 1 0;
  }
  .inbox-panel button {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* ── Fix section headers with badges overflowing ─────────────────── */
.section-header {
  overflow: hidden;
}
.section-header-left {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
#invSummary {
  overflow: hidden;
  max-width: 100%;
}

/* ── Today columns full-width ────────────────────────────────────── */
@media (max-width: 768px) {
  .today-columns {
    width: 100%;
    overflow: hidden;
  }
  .today-section {
    width: 100%;
    overflow: hidden;
  }
}

/* ── Kanban scroll container — don't bleed into body ─────────────── */
@media (max-width: 900px) {
  #tab-projects {
    overflow-x: hidden;
  }
  .kanban-board {
    width: 100%;
    max-width: 100%;
  }
}

/* Replace Capture button text with icon on mobile */
@media (max-width: 480px) {
  .inbox-panel button {
    padding: 10px 16px;
    font-size: 0;
    min-width: 44px;
    position: relative;
  }
  .inbox-panel button::after {
    content: '+';
    font-size: 20px;
    font-weight: 300;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

/* ═══ TWEETS TAB ═══ */
.tweets-container { max-width: 700px; margin: 0 auto; padding: 20px 16px; }
.tweets-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.tweets-title { font-size: 1.4rem; font-weight: 700; color: #fff; margin: 0; }
.tweets-date { font-size: 0.85rem; color: rgba(255,255,255,0.5); margin: 4px 0 2px; }
.tweets-sub { font-size: 0.75rem; color: rgba(255,255,255,0.35); margin: 0; }
.btn-refresh-tweets { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); color: #fff; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 0.85rem; white-space: nowrap; }
.btn-refresh-tweets:hover { background: rgba(255,255,255,0.14); }
.tweets-grid { display: flex; flex-direction: column; gap: 12px; }
.tweet-card { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; padding: 16px; backdrop-filter: blur(20px); }
.tweet-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tweet-badge { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 10px; border-radius: 20px; color: #fff; }
.tweet-chars { font-size: 0.75rem; color: rgba(255,255,255,0.4); }
.tweet-chars.over { color: #FF453A; font-weight: 600; }
.tweet-text { font-size: 0.95rem; line-height: 1.5; color: rgba(255,255,255,0.88); margin: 0 0 12px; word-break: break-word; }
.tweet-copy-btn { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.7); padding: 6px 20px; border-radius: 20px; cursor: pointer; font-size: 0.8rem; float: right; transition: all 0.2s; }
.tweet-copy-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.tweet-copy-btn.copied { background: rgba(48,209,88,0.2); border-color: #30D158; color: #30D158; }
.tweets-empty { text-align: center; padding: 60px 20px; color: rgba(255,255,255,0.4); font-size: 1.1rem; }

/* ═══ TWEET QUEUE (inside Projects tab) ═══ */
.tweets-section { padding: 0 24px 32px; }
.tweets-section .tweets-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.tweets-sub { font-size: 0.72rem; color: var(--text-label); margin-top: 2px; }

/* ═══ INVENTORY FLAGS (in Projects tab) ═══ */
.inventory-flags-section { padding: 0 24px 8px; }
.inventory-flags-section .tweets-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

/* Tweet actions row */
.tweet-actions { display: flex; gap: 8px; margin-top: 12px; }
.tweet-delete-btn { background: transparent; border: 1px solid rgba(255,255,255,0.15); color: #666; padding: 6px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; transition: all 0.15s; }
.tweet-delete-btn:hover { border-color: #FF2D55; color: #FF2D55; }

/* Content Calendar Hero — full width at top of Social tab */
.panel-calendar-hero {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}
.panel-calendar-hero .fc {
  font-size: 0.85rem;
}
.panel-calendar-hero .fc-toolbar {
  flex-wrap: wrap;
  gap: 8px;
}
@media(max-width:600px) {
  .panel-calendar-hero {
    padding: 12px 8px;
    border-radius: 12px;
  }
  .panel-calendar-hero .fc-toolbar {
    font-size: 0.75rem;
  }
  .panel-calendar-hero .fc-toolbar-title {
    font-size: 1rem !important;
  }
  .panel-calendar-hero .fc-button {
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
  }
  .panel-calendar-hero .fc-daygrid-event {
    font-size: 0.7rem;
    padding: 1px 3px;
  }
}

/* Fix calendar height on mobile */
.panel-calendar-hero #calendar {
  min-height: 400px;
}
.panel-calendar-hero .fc-view-harness {
  min-height: 350px !important;
}
.panel-calendar-hero .fc-daygrid-body {
  min-height: auto !important;
}
@media(max-width:600px) {
  .panel-calendar-hero #calendar {
    min-height: 350px;
  }
  .panel-calendar-hero .fc-view-harness {
    min-height: 300px !important;
  }
  .panel-calendar-hero .fc-scrollgrid {
    overflow-x: auto;
  }
  .panel-calendar-hero .fc-toolbar {
    gap: 4px;
  }
  .panel-calendar-hero .fc-toolbar-chunk {
    display: flex;
    align-items: center;
  }
}
