/* Rocklab Ops Dashboard — base styles */

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

:root {
  --bg:         #0d0d0d;
  --sidebar:    #121212;
  --surface:    #1a1a1a;
  --surface2:   #202020;
  --border:     #272727;
  --text:       #e0e0e0;
  --text-muted: #666;
  --text-dim:   #888;
  --accent:     #ff3e3e;
  --green:      #22c55e;
  --yellow:     #f59e0b;
  --red:        #ef4444;
  --blue:       #3b82f6;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  display: flex;
}

/* ── Layout ── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 36px;
  max-width: 960px;
}

/* ── Sidebar ── */
.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.sidebar-logo span { color: var(--accent); }

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

.nav-section {
  padding: 8px 12px 4px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: .875rem;
  border-left: 3px solid transparent;
  transition: color .1s, background .1s, border-color .1s;
}
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active { color: var(--text); border-left-color: var(--domain-color, var(--accent)); background: var(--surface); }

.nav-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--domain-color, #555);
  flex-shrink: 0;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.4px;
}
.page-sub { font-size: .85rem; color: var(--text-muted); }

/* ── Briefing cards ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.stat-num {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-num.red    { color: var(--red); }
.stat-num.yellow { color: var(--yellow); }
.stat-num.green  { color: var(--green); }
.stat-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* ── Section headings ── */
.section-head {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  margin-top: 28px;
}
.section-head:first-child { margin-top: 0; }

/* ── Domain grid on briefing ── */
.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.domain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  border-left: 3px solid var(--domain-color, #555);
  transition: background .1s;
}
.domain-card:hover { background: var(--surface2); }
.domain-card-name { font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
.domain-card-count { font-size: .78rem; color: var(--text-muted); }

/* ── Task list ── */
.task-list { display: flex; flex-direction: column; gap: 4px; }

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: background .1s;
}
.task-row:hover { background: var(--surface2); }
.task-row.done { opacity: .45; }

.task-check {
  flex-shrink: 0;
  width: 16px; height: 16px;
  margin-top: 1px;
  accent-color: var(--accent);
  cursor: pointer;
}

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: .9rem; line-height: 1.3; }
.task-title.done { text-decoration: line-through; color: var(--text-muted); }
.task-meta { display: flex; gap: 10px; margin-top: 3px; flex-wrap: wrap; }
.task-due  { font-size: .73rem; color: var(--text-muted); }
.task-due.overdue { color: var(--red); }

.task-actions { flex-shrink: 0; display: flex; gap: 4px; align-items: center; }
.task-del-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .8rem; padding: 2px 4px; border-radius: 4px;
  opacity: 0; transition: opacity .1s;
}
.task-row:hover .task-del-btn { opacity: 1; }
.task-del-btn:hover { color: var(--red); }

/* ── Priority badge ── */
.badge {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.badge.p1 { background: #3a1010; color: #f87171; }
.badge.p2 { background: #2e1e08; color: #fbbf24; }
.badge.p3 { background: #1a1a1a; color: #555; }

/* ── Note list ── */
.note-list { display: flex; flex-direction: column; gap: 6px; }

.note-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  position: relative;
}
.note-body { font-size: .88rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.note-meta { font-size: .72rem; color: var(--text-muted); margin-top: 5px; }
.note-del-btn {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .8rem; padding: 2px 4px; border-radius: 4px;
  opacity: 0; transition: opacity .1s;
}
.note-row:hover .note-del-btn { opacity: 1; }
.note-del-btn:hover { color: var(--red); }

/* ── Project list ── */
.project-list { display: flex; flex-direction: column; gap: 6px; }

.project-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px;
}
.project-name { flex: 1; font-size: .9rem; font-weight: 500; }
.project-status-badge { font-size: .7rem; padding: 2px 8px; border-radius: 20px; }
.project-status-badge.active    { background: #0f2a14; color: #5ecf7c; }
.project-status-badge.paused    { background: #1e1e08; color: #c4a84a; }
.project-status-badge.completed { background: #111; color: #555; }

/* ── Forms ── */
.add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row input, .form-row select, .form-row textarea,
.add-form input, .add-form select, .add-form textarea {
  background: #111;
  border: 1px solid #2e2e2e;
  border-radius: 7px;
  color: var(--text);
  font-size: .88rem;
  padding: 7px 10px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s;
}
.add-form input:focus, .add-form select:focus, .add-form textarea:focus { border-color: var(--accent); }
.add-form textarea { resize: vertical; min-height: 60px; }
.input-main { flex: 1; min-width: 180px; }
.input-sm   { width: 100px; }
.input-md   { width: 140px; }

/* ── Buttons ── */
.btn {
  border: none; border-radius: 7px; cursor: pointer;
  font-size: .85rem; font-weight: 600; padding: 7px 14px;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { background: #e83535; }
.btn-ghost { background: var(--surface2); color: var(--text-dim); }
.btn-ghost:not(:disabled):hover { background: #2e2e2e; }

/* ── Collapsible add forms ── */
.toggle-add-btn {
  background: none; border: 1px dashed #2a2a2a;
  border-radius: 8px; color: var(--text-muted);
  cursor: pointer; font-size: .82rem; padding: 7px 12px;
  width: 100%; text-align: left;
  transition: color .1s, border-color .1s;
}
.toggle-add-btn:hover { color: var(--text); border-color: #444; }

/* ── Filter tabs ── */
.filter-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.filter-tab {
  text-decoration: none; font-size: .8rem; font-weight: 600;
  padding: 5px 12px; border-radius: 6px; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  transition: color .1s, background .1s;
}
.filter-tab:hover { color: var(--text); }
.filter-tab.active { color: var(--text); background: var(--surface2); border-color: #444; }

/* ── Overdue highlight on briefing ── */
.task-row.overdue { border-left: 3px solid var(--red); }

/* ── Responsive: collapse sidebar on small screens ── */
@media (max-width: 700px) {
  .sidebar { width: 100%; min-height: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  body { flex-direction: column; }
  .main { padding: 20px 16px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}

/* ── HTMX loading indicator ── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator  { display: inline; }
