/* Dashboard layout — matches PhantomPenOS design tokens from theme.css */

/* ===== LAYOUT ===== */
.dashboard-body {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  padding: 1.6rem 1.5rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo a {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.logo-os {
  color: var(--accent);
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.nav-icon {
  font-size: 1rem;
  opacity: 0.8;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.sidebar-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--accent-secondary);
  opacity: 0.7;
}

/* ===== MAIN ===== */
.dash-main {
  margin-left: 220px;
  flex: 1;
  overflow-y: auto;
  min-height: 100vh;
  background: var(--bg);
}

/* ===== VIEWS ===== */
.view {
  display: none;
  padding: 2.5rem 2rem;
  max-width: 1100px;
}

.view.active {
  display: block;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.view-title {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.view-sub {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-ghost:hover {
  border-color: rgba(255,255,255,0.2);
  color: var(--fg);
}

.btn-danger {
  background: transparent;
  color: #f87171;
  border: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover {
  background: rgba(248,113,113,0.1);
}

.btn-sm {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-sm:hover {
  border-color: rgba(255,255,255,0.2);
  color: var(--fg);
}

/* ===== LOADING / EMPTY ===== */
.loading-state, .empty-state {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.empty-icon {
  font-size: 2.5rem;
  color: var(--accent);
  opacity: 0.3;
  margin-bottom: 1rem;
}

/* ===== TABLE ===== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  border-bottom: 1px solid var(--border);
}

.data-table th {
  text-align: left;
  padding: 0.9rem 1.1rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  text-transform: uppercase;
  background: var(--bg-elevated);
  font-weight: 400;
}

.data-table td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--bg-elevated);
}

.client-name-cell {
  font-weight: 600;
  color: var(--fg);
}

.client-biz {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 0.2rem;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.badge-active   { background: rgba(196,240,255,0.12); color: var(--accent); }
.badge-paused   { background: rgba(167,139,250,0.12); color: var(--accent-secondary); }
.badge-onboarding { background: rgba(251,191,36,0.12); color: #fbbf24; }
.badge-churned  { background: rgba(248,113,113,0.10); color: #f87171; }

.post-counts {
  display: flex;
  gap: 0.5rem;
}

.count-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.count-chip.pending   { background: rgba(251,191,36,0.12); color: #fbbf24; }
.count-chip.approved  { background: rgba(167,139,250,0.12); color: var(--accent-secondary); }
.count-chip.published { background: rgba(74,222,128,0.12); color: #4ade80; }

.row-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

/* ===== PIPELINE ===== */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.pipeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.pipeline-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  gap: 0.5rem;
}

.pipeline-client-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.pipeline-biz {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.pipeline-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pipeline-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pipeline-bar-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  width: 72px;
  flex-shrink: 0;
}

.pipeline-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.pipeline-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.fill-pending   { background: #fbbf24; }
.fill-approved  { background: var(--accent-secondary); }
.fill-published { background: #4ade80; }

.pipeline-bar-num {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--fg-muted);
  min-width: 24px;
  text-align: right;
}

.pipeline-delivery {
  margin-top: 1.2rem;
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
}

.pipeline-delivery span {
  color: var(--accent);
}

.pipeline-add-post {
  margin-top: 0.75rem;
}

/* ===== CALENDAR ===== */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cal-month-label {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--fg);
  min-width: 140px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cal-day-header {
  background: var(--bg-elevated);
  padding: 0.6rem;
  text-align: center;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.cal-day {
  background: var(--bg);
  min-height: 110px;
  padding: 0.5rem;
  position: relative;
  vertical-align: top;
}

.cal-day.other-month {
  background: var(--bg-elevated);
  opacity: 0.5;
}

.cal-day.today {
  background: rgba(196,240,255,0.04);
}

.cal-day-num {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
  display: block;
}

.cal-day.today .cal-day-num {
  color: var(--accent);
  font-weight: 700;
}

.cal-post-chip {
  display: block;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  margin-bottom: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.cal-post-chip.pending   { background: rgba(251,191,36,0.15); color: #fbbf24; }
.cal-post-chip.approved  { background: rgba(167,139,250,0.15); color: var(--accent-secondary); }
.cal-post-chip.published { background: rgba(74,222,128,0.15); color: #4ade80; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  padding: 2rem;
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.15s;
}

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

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: rgba(196,240,255,0.35);
}

.form-group select option {
  background: var(--bg-card);
}

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

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .sidebar-logo, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; padding: 0.65rem; }
  .nav-item span:last-child { display: none; }
  .dash-main { margin-left: 60px; }
  .view { padding: 1.5rem 1rem; }
  .pipeline-grid { grid-template-columns: 1fr; }
  .calendar-grid { grid-template-columns: repeat(7, 1fr); }
  .cal-day { min-height: 60px; }
  .form-row { grid-template-columns: 1fr; }
}
