/* === SOW Dashboard — Dark Theme === */
:root {
  --bg: #0f1117;
  --card: #1a1d27;
  --card-border: #2a2d3a;
  --text: #e4e6ed;
  --text-muted: #8b8fa3;
  --accent: #6c5ce7;
  --accent-hover: #7c6ef7;
  --green: #2ed573;
  --yellow: #ffa502;
  --red: #ff4757;
  --blue: #3742fa;
  --progress-bg: #2a2d3a;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.header-left { display: flex; align-items: baseline; gap: 12px; }
.header-left h1 { font-size: 1.2rem; font-weight: 700; white-space: nowrap; }
.subtitle { color: var(--text-muted); font-size: 0.85rem; }

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

select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
  min-width: 200px;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--card-border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* Main */
main { max-width: 1100px; margin: 0 auto; padding: 20px; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); font-size: 1.1rem; }

.hidden { display: none !important; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card h3 { font-size: 1rem; margin-bottom: 14px; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-header h3 { margin-bottom: 0; }

/* Progress */
.progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.progress-header h2 { font-size: 1.15rem; }

.pct-badge {
  background: var(--accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.section-pct {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--progress-bg);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar.sm { height: 5px; margin-bottom: 14px; }

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

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

.overview-item {
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
}
.overview-item .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.overview-item .value { font-size: 0.95rem; font-weight: 600; word-break: break-word; }
.overview-item a { color: var(--accent); text-decoration: none; }
.overview-item a:hover { text-decoration: underline; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--card-border);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--card-border);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(108, 92, 231, 0.05); }

/* Priority badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-p1 { background: rgba(255, 71, 87, 0.15); color: var(--red); }
.badge-p2 { background: rgba(255, 165, 2, 0.15); color: var(--yellow); }
.badge-p3 { background: rgba(46, 213, 115, 0.15); color: var(--green); }
.badge-primary { background: rgba(55, 66, 250, 0.15); color: #5b7cfa; }
.badge-secondary { background: rgba(108, 92, 231, 0.1); color: var(--accent); }
.badge-tertiary { background: rgba(139, 143, 163, 0.15); color: var(--text-muted); }
.badge-regional { background: rgba(46, 213, 115, 0.1); color: var(--green); }

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-connected { background: rgba(46, 213, 115, 0.15); color: var(--green); }
.status-pending { background: rgba(255, 165, 2, 0.15); color: var(--yellow); }
.status-no_access, .status-needed { background: rgba(255, 71, 87, 0.15); color: var(--red); }
.status-done { background: rgba(46, 213, 115, 0.15); color: var(--green); }
.status-partial { background: rgba(255, 165, 2, 0.15); color: var(--yellow); }
.status-active { background: rgba(46, 213, 115, 0.15); color: var(--green); }
.status-warning { background: rgba(255, 165, 2, 0.15); color: var(--yellow); }
.status-none { background: rgba(139, 143, 163, 0.15); color: var(--text-muted); }
.status-open { background: rgba(255, 71, 87, 0.15); color: var(--red); }
.status-resolved { background: rgba(46, 213, 115, 0.15); color: var(--green); }

/* Severity */
.severity-critical { color: var(--red); font-weight: 700; }
.severity-medium { color: var(--yellow); font-weight: 600; }
.severity-low { color: var(--green); }

/* Checkboxes */
.task-check {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--card-border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s;
}
.task-check:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.task-check:checked::after {
  content: '✓';
  position: absolute;
  top: -1px;
  left: 2px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.task-done { text-decoration: line-through; color: var(--text-muted); }

/* Week 1 days */
.day-block { margin-bottom: 16px; }
.day-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 8px; color: var(--accent); }
.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.task-label { font-size: 0.88rem; cursor: pointer; }

/* Muted */
.muted { color: var(--text-muted); font-style: italic; padding: 10px 0; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 440px;
}
.modal-content h2 { margin-bottom: 20px; font-size: 1.1rem; }
.modal-content label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.modal-content input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}
.modal-content input:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Mobile */
@media (max-width: 700px) {
  header { flex-direction: column; align-items: stretch; }
  .header-left { justify-content: center; }
  .header-right { justify-content: center; }
  select { min-width: 0; flex: 1; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  table { font-size: 0.82rem; }
  thead th, tbody td { padding: 6px 6px; }
  .card { padding: 14px; }
}

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

/* Print */
@media print {
  body { background: #fff; color: #111; }
  header { position: static; background: #fff; border-bottom: 2px solid #111; }
  .btn, select { display: none; }
  .header-left h1 { color: #111; }
  .subtitle { color: #555; }
  .card { background: #fff; border: 1px solid #ccc; break-inside: avoid; }
  .progress-fill { background: #333 !important; }
  .badge, .status { border: 1px solid #999; }
  .task-check:checked { background: #333; border-color: #333; }
}
