* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  background: #0a0a0f;
  color: #c8c8d0;
  line-height: 1.6;
  font-size: 14px;
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 24px 16px;
  border-bottom: 1px solid #1a1a2e;
  position: sticky;
  top: 0;
  background: #0a0a0f;
  z-index: 10;
}
.header h1 { font-size: 18px; color: #7b8cde; letter-spacing: 0.5px; }
.header-meta { display: flex; gap: 12px; align-items: center; }
.meta-tag { font-size: 12px; color: #666; background: #1a1a2e; padding: 4px 10px; border-radius: 4px; }
.btn {
  padding: 8px 18px;
  border: 1px solid #333;
  background: #1a1a2e;
  color: #c8c8d0;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s ease;
}
.btn:hover { background: #252540; border-color: #555; }
.btn-primary { background: #4a5a9e; border-color: #5a6aad; color: #fff; }
.btn-primary:hover { background: #5a6aad; }
.btn[disabled] { opacity: 0.4; cursor: default; }
.btn-unsaved { background: #c47a2a !important; border-color: #d48a3a !important; color: #fff !important; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

.tabs {
  display: flex;
  gap: 0;
  padding: 0 24px;
  background: #0d0d14;
  border-bottom: 1px solid #1a1a2e;
  overflow-x: auto;
}
.tab {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.tab:hover { color: #c8c8d0; }
.tab.active { color: #7b8cde; border-bottom-color: #7b8cde; background: #13132a; }

/* --- Sections --- */
.section {
  display: none;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}
.section.active { display: block; }

/* --- Cards --- */
.card {
  background: #111120;
  border: 1px solid #1a1a2e;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 15px; color: #7b8cde; margin-bottom: 12px; }
.card h3 { font-size: 13px; color: #9a9ab0; margin-bottom: 8px; }

/* --- Posture (Dashboard) --- */
.posture-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.posture-badge,
.posture-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.posture-badge { background: #2d3a6e; color: #a0b0ff; }
.posture-status[data-status="On track"] { background: #1a3a1a; color: #7bd07b; }
.posture-status[data-status="At risk"] { background: #3a3a1a; color: #ffd77b; }
.posture-status[data-status="Off track"] { background: #3a1a1a; color: #ff7b7b; }
.posture-focus { margin: 8px 0 4px; color: #e0e0ef; }
.posture-reason { font-size: 13px; color: #888899; margin-bottom: 4px; }
.posture-owner { font-size: 12px; color: #666; margin-top: 6px; }

/* --- Two column layout --- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 700px) {
  .two-col { grid-template-columns: 1fr; }
}

/* --- Summary --- */
.summary-list {
  list-style: none;
  display: grid;
  gap: 8px;
}
.summary-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #1a1a2e;
}
.summary-list li:last-child { border-bottom: none; }

/* --- Priority grid (Dashboard) --- */
.priority-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dash-priority {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: #0d0d18;
  border-left: 3px solid #2d3a6e;
  border-radius: 4px;
}
.dash-priority.overdue { border-left-color: #ff7b7b; }
.dash-priority.soon { border-left-color: #ffd77b; }
.pri-id {
  font-size: 11px;
  font-weight: 700;
  color: #7b8cde;
  background: #1a1a2e;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
  margin-top: 2px;
}
.pri-title { font-size: 14px; color: #e0e0ef; flex: 1; }
.pri-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  margin-top: 4px;
}
.badge-owner { color: #9a9ab0; }
.badge-due { color: #ffd77b; }
.badge-due.overdue { color: #ff7b7b; }

/* --- Editable items (editors) --- */
.editable-item {
  background: #0d0d18;
  border: 1px solid #1a1a2e;
  border-radius: 4px;
  padding: 14px;
  margin-bottom: 12px;
}
.editable-item input,
.editable-item textarea,
.editable-item select {
  background: #0a0a0f;
  border: 1px solid #2a2a3a;
  border-radius: 3px;
  padding: 6px 10px;
  color: #c8c8d0;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}
.editable-item input:focus,
.editable-item textarea:focus,
.editable-item select:focus {
  outline: none;
  border-color: #7b8cde;
  box-shadow: 0 0 0 2px rgba(123, 140, 222, 0.15);
}
.editable-item textarea { min-height: 50px; resize: vertical; }
.editable-item field,
.editable-item .field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}
.editable-item .field:last-child { margin-bottom: 0; }
.editable-item label {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field-inline {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  margin-right: 12px;
  margin-bottom: 8px;
  vertical-align: top;
}
.field-inline input,
.field-inline select {
  background: #0a0a0f;
  border: 1px solid #2a2a3a;
  border-radius: 3px;
  padding: 6px 10px;
  color: #c8c8d0;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}

/* --- Completed items --- */
.completed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #1a1a2e;
  opacity: 0.6;
}
.completed-item:last-child { border-bottom: none; }

/* --- Change items --- */
.change-item {
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid #1a1a2e;
}
.change-item:last-child { border-bottom: none; }

/* --- Archive note --- */
.archive-note {
  font-size: 12px;
  color: #666;
  padding: 10px;
  background: #0a0a0f;
  border-radius: 4px;
  margin-top: 12px;
  line-height: 1.5;
}

/* --- Section hint --- */
.section-hint {
  font-size: 12px;
  color: #555;
  margin-bottom: 12px;
  font-style: italic;
}

/* --- Validation toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #2a1a1a;
  border: 1px solid #5a2a2a;
  border-radius: 6px;
  padding: 16px 20px;
  max-width: 420px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: opacity 0.3s ease;
}
.toast.hidden { display: none; }
.toast h4 { font-size: 14px; color: #ff7b7b; margin-bottom: 8px; }
.toast ul { margin-left: 16px; }
.toast li { font-size: 12px; color: #c8a0a0; margin-bottom: 4px; }

/* --- List style for recent changes view --- */
.editable-list { display: flex; flex-direction: column; gap: 6px; }

/* Refresh button */
.refresh-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 1rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.refresh-btn:hover {
  background: var(--bg-hover);
}
.refresh-btn.spinning {
  animation: spin 0.6s ease;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
