/* ============================================================
   Smarter Living — Command Center Dashboard
   ============================================================ */

:root {
  --yellow: #FFB829;
  --bg: #000;
  --card-bg: #111;
  --card-border: #222;
  --text: #fff;
  --text-muted: #888;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #3b82f6;
}

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

body {
  font-family: 'Roboto', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'League Gothic', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* LOGIN */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 48px 40px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.login-box h1 {
  font-size: 2rem;
  color: var(--yellow);
  margin-bottom: 4px;
}

.login-box p {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 1rem;
}

.login-box input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: 'Roboto', sans-serif;
}

.login-box input:focus {
  outline: none;
  border-color: var(--yellow);
}

.error-msg {
  color: var(--red);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* BUTTONS */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--yellow);
  color: #000;
  border: none;
  border-radius: 8px;
  font-family: 'League Gothic', sans-serif;
  font-size: 1.2rem;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 8px;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-small {
  padding: 8px 16px;
  background: var(--yellow);
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-small:hover { opacity: 0.9; }

.btn-icon {
  background: none;
  border: 1px solid #333;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { border-color: var(--yellow); color: var(--yellow); }

/* HEADER */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--card-border);
}

#dashboard { padding-bottom: 40px; }

.header-left { display: flex; align-items: center; gap: 12px; }
.header-left h1 { font-size: 1.6rem; color: var(--yellow); }
.header-right { display: flex; align-items: center; gap: 10px; }

.badge {
  background: #1a1a1a;
  border: 1px solid var(--card-border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.meta-text { font-size: 0.85rem; color: var(--text-muted); }

/* TABS */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--card-border);
  padding: 0 40px;
  overflow-x: auto;
}

.tab {
  padding: 14px 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'League Gothic', sans-serif;
  font-size: 1.15rem;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }

/* TAB CONTENT */
.tab-content { display: none; padding: 32px 40px; }
.tab-content.active { display: block; }

/* CARDS */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h2 { margin-bottom: 0; }

.card-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: -8px 0 16px;
}

.card-highlight {
  border-color: var(--yellow);
  border-width: 2px;
}

.card-muted {
  color: var(--text-muted);
  font-size: 1rem;
  text-align: center;
  padding: 32px;
}

/* STATS */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.stat-value {
  font-family: 'League Gothic', sans-serif;
  font-size: 2rem;
  color: var(--text);
}

.stat-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }

/* PROGRESS BAR */
.progress-bar {
  width: 100%;
  height: 6px;
  background: #222;
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--yellow);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* TABLES */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #1a1a1a;
  white-space: nowrap;
}

td.muted { color: var(--text-muted); text-align: center; white-space: normal; }

tfoot td {
  font-weight: 700;
  border-top: 1px solid var(--card-border);
  border-bottom: none;
}

/* Metric color classes */
.metric-good { color: var(--green); }
.metric-warn { color: var(--amber); }
.metric-bad { color: var(--red); }

/* ALERTS */
#alerts-container { margin-bottom: 20px; }
#alerts-container h2 {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.alert {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 1rem;
  border-left: 4px solid;
}

.alert-kill { background: rgba(239, 68, 68, 0.1); border-color: var(--red); }
.alert-scale { background: rgba(34, 197, 94, 0.1); border-color: var(--green); }
.alert-watch { background: rgba(245, 158, 11, 0.1); border-color: var(--amber); }
.alert-info { background: rgba(59, 130, 246, 0.1); border-color: var(--blue); }

/* AI BRIEFING */
#ai-briefing-content {
  font-size: 1rem;
  line-height: 1.7;
}

#ai-briefing-content .analysis-summary {
  font-size: 1.05rem;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}

/* AI TODOS */
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #1a1a1a;
  font-size: 1rem;
}

.todo-priority {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-top: 2px;
}

.todo-priority.high { background: rgba(239, 68, 68, 0.2); color: var(--red); }
.todo-priority.medium { background: rgba(245, 158, 11, 0.2); color: var(--amber); }
.todo-priority.low { background: rgba(59, 130, 246, 0.2); color: var(--blue); }

.todo-text { flex: 1; }
.todo-reason { color: var(--text-muted); font-size: 0.9rem; margin-top: 2px; }

/* TIMELINE */
.timeline {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.timeline-day {
  min-width: 130px;
  background: #1a1a1a;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 14px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.timeline-day.today {
  border-color: var(--yellow);
  background: rgba(255, 184, 41, 0.08);
}

.timeline-day.done { opacity: 0.5; }

.timeline-day .day-num {
  font-family: 'League Gothic', sans-serif;
  font-size: 1.2rem;
  color: var(--yellow);
  margin-bottom: 4px;
}

.timeline-day.done .day-num::after {
  content: ' ✓';
  color: var(--green);
  font-size: 0.8rem;
}

.timeline-day .day-task {
  color: var(--text-muted);
  line-height: 1.3;
}

/* WATERFALL FUNNEL */
.waterfall {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.waterfall-step {
  display: flex;
  align-items: center;
  gap: 12px;
}

.waterfall-label {
  width: 140px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

.waterfall-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.waterfall-bar {
  height: 28px;
  background: var(--yellow);
  border-radius: 4px;
  min-width: 2px;
  transition: width 0.5s ease;
}

.waterfall-value {
  font-size: 0.9rem;
  white-space: nowrap;
}

/* CRITERIA */
.criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.criteria-item {
  padding: 16px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.criteria-item strong {
  display: block;
  margin-bottom: 8px;
  font-family: 'League Gothic', sans-serif;
  font-size: 1rem;
}

.criteria-item ul { padding-left: 16px; }
.criteria-item li { margin-bottom: 4px; color: var(--text-muted); }

.criteria-kill { background: rgba(239, 68, 68, 0.08); }
.criteria-kill strong { color: var(--red); }
.criteria-scale { background: rgba(34, 197, 94, 0.08); }
.criteria-scale strong { color: var(--green); }
.criteria-watch { background: rgba(245, 158, 11, 0.08); }
.criteria-watch strong { color: var(--amber); }

/* SIMPLE BAR CHARTS */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.bar-label {
  width: 80px;
  text-align: right;
  color: var(--text-muted);
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 20px;
  background: #1a1a1a;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--yellow);
  border-radius: 4px;
  min-width: 2px;
}

.bar-value { width: 50px; flex-shrink: 0; }

/* HOURLY HEATMAP */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
}

.heatmap-cell {
  border-radius: 4px;
  padding: 8px 2px;
  text-align: center;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.heatmap-hour {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.heatmap-count {
  font-family: 'League Gothic', sans-serif;
  font-size: 1rem;
}

/* SELECT */
select {
  background: #1a1a1a;
  border: 1px solid #333;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: 'Roboto', sans-serif;
}

/* LOADING */
.loading-spinner {
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
  font-size: 1rem;
}

/* TWO COLUMN */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* CODE */
code {
  background: #1a1a1a;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.95rem;
}

/* PROJECT MANAGEMENT TODOS */
.pm-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.pm-add-row input {
  flex: 1;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: 'Roboto', sans-serif;
}

.pm-add-row input:focus { outline: none; border-color: var(--yellow); }

.pm-add-row input::placeholder { color: #555; }

.pm-todo-list { list-style: none; }

.pm-todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #1a1a1a;
}

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

.pm-todo-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--yellow);
  cursor: pointer;
  flex-shrink: 0;
}

.pm-todo-item .pm-text {
  flex: 1;
  font-size: 1rem;
  line-height: 1.4;
}

.pm-todo-item.done .pm-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.pm-todo-item .pm-delete {
  background: none;
  border: none;
  color: #555;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.pm-todo-item:hover .pm-delete { opacity: 1; }
.pm-todo-item .pm-delete:hover { color: var(--red); }

.pm-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
  font-size: 1rem;
}

.pm-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.pm-filter-btn {
  background: none;
  border: 1px solid #333;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
}

.pm-filter-btn:hover { border-color: var(--yellow); color: var(--text); }
.pm-filter-btn.active { background: var(--yellow); color: #000; border-color: var(--yellow); }

/* RESPONSIVE */
@media (max-width: 768px) {
  header { padding: 14px 16px; }
  .header-left h1 { font-size: 1.3rem; }
  .tabs { padding: 0 16px; }
  .tab { padding: 12px 16px; font-size: 1rem; }
  .tab-content { padding: 20px 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .timeline-day { min-width: 110px; }
  .stat-value { font-size: 1.5rem; }
  .waterfall-label { width: 110px; font-size: 0.85rem; }
  .heatmap-grid { grid-template-columns: repeat(12, 1fr); }
  .heatmap-hour { font-size: 0.65rem; }
  .heatmap-count { font-size: 0.85rem; }
}
