/* ============================================================
   components.css — chips, cards, buttons, inputs, toast, modal,
   login screen, vitals, feed, filters
   ============================================================ */

/* ---- Typography helpers ---- */
.label-caps {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text2);
}

.mono {
  font-family: var(--mono);
  font-size: 13px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-lg { padding: 14px 22px; font-size: 15px; }

.btn-primary {
  background: var(--amber);
  color: #0A0C12;
  font-weight: 700;
}
.btn-primary:hover { background: #ffba1a; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text2); }

.btn-danger {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.12); }

/* ============================================================
   Inputs
   ============================================================ */
.input,
.textarea,
.select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--amber);
  outline: none;
  background: #21263492;
}
.input-lg { padding: 16px 18px; font-size: 16px; }
.textarea { min-height: 110px; line-height: 1.5; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5L6 7.5L9 4.5' stroke='%238B90A0' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (min-width: 768px) {
  .field-row { flex-direction: row; }
  .field-row .field { flex: 1; }
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
}
.card-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ============================================================
   Status chips
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1;
  border: 1px solid transparent;
}
.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.chip-active   { color: var(--green); background: rgba(34, 197, 94, 0.10);  border-color: rgba(34, 197, 94, 0.25); }
.chip-paused   { color: var(--amber); background: rgba(240, 165, 0, 0.10);  border-color: rgba(240, 165, 0, 0.25); }
.chip-planned  { color: var(--text3); background: rgba(85, 90, 106, 0.14);  border-color: rgba(85, 90, 106, 0.30); }
.chip-complete { color: var(--blue);  background: rgba(79, 142, 247, 0.10); border-color: rgba(79, 142, 247, 0.25); }

/* Type chip (intel) — neutral pill, no dot */
.type-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border2);
}

/* ============================================================
   Login screen
   ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 22px;
}
.login-wordmark {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.34em;
  padding-left: 0.34em;
  margin-bottom: 8px;
}
.login-tagline {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 32px;
}
.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 2px;
}
.login-foot {
  margin-top: 28px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 12px;
}

/* ============================================================
   Vitals (Mission Control)
   ============================================================ */
.vitals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.vital {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vital-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 7px;
}
.vital-label {
  font-size: 12px;
  color: var(--text2);
  letter-spacing: 0.04em;
}
.vital-streak .vital-value { color: var(--amber); }

@media (max-width: 520px) {
  .vital-value { font-size: 21px; }
  .vital { padding: 13px; }
}

/* ============================================================
   Feed / Intel rows
   ============================================================ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.feed {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.feed-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
.feed-row:last-child { border-bottom: none; }
.feed-row:hover { background: var(--surface2); }

.feed-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.feed-topic {
  font-weight: 500;
  font-size: 14px;
}
.feed-meta {
  color: var(--text2);
  font-size: 12.5px;
  font-family: var(--mono);
}
.feed-dot { color: var(--text3); }
.feed-time { color: var(--text3); font-family: var(--mono); font-size: 12px; margin-left: auto; }
.feed-row-head { cursor: pointer; }
.feed-edit-btn { font-size: 12px; padding: 4px 10px; }

.feed-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feed-field { display: flex; flex-direction: column; gap: 2px; }
.feed-field-label {
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text3);
}
.feed-field-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}

/* ============================================================
   Empty / loading / error states
   ============================================================ */
.state {
  padding: 32px 20px;
  text-align: center;
  color: var(--text2);
  font-size: 14px;
}
.state-mono { font-family: var(--mono); font-size: 13px; color: var(--text3); }
.state-error { color: var(--red); }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   Filter bar (Intel)
   ============================================================ */
.filterbar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  position: sticky;
  top: 0;
  z-index: 5;
  -webkit-overflow-scrolling: touch;
}
.filterbar .select {
  width: auto;
  min-width: 140px;
  flex: 0 0 auto;
  padding-top: 9px;
  padding-bottom: 9px;
  font-size: 13.5px;
  background-color: var(--surface);
}

/* ============================================================
   Toast
   ============================================================ */
.toast-root {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  background: var(--surface2);
  border: 1px solid var(--border2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.22s ease forwards;
}
.toast.toast-out { animation: toast-out 0.22s ease forwards; }
.toast-success { border-color: rgba(34, 197, 94, 0.4); color: var(--green); }
.toast-error   { border-color: rgba(239, 68, 68, 0.4); color: var(--red); }
.toast::before { content: ""; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(5, 6, 10, 0.7);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fade-in 0.18s ease;
}
@media (min-width: 768px) {
  .modal-overlay { align-items: center; padding: 24px; }
}
.modal {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 22px;
  animation: modal-up 0.22s ease;
  max-height: 92vh;
  overflow-y: auto;
}
@media (min-width: 768px) {
  .modal { border-radius: var(--r-lg); animation: modal-pop 0.18s ease; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--text2);
  font-size: 20px;
  line-height: 1;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}
@keyframes fade-in   { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-up  { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes modal-pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; }
}

/* ============================================================
   Floating Capture Button (FAB)
   ============================================================ */
.fab-capture {
  position: fixed;
  right: 24px;
  bottom: 88px; /* clear mobile bottom nav */
  z-index: 100;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--amber);
  color: #0A0C12;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 20px rgba(240, 165, 0, 0.35);
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.fab-capture:hover {
  background: #ffba1a;
  transform: scale(1.07);
  box-shadow: 0 6px 26px rgba(240, 165, 0, 0.5);
}
.fab-capture:active { transform: scale(0.96); }

@media (min-width: 768px) {
  .fab-capture { bottom: 32px; } /* no bottom nav on desktop */
}

/* ============================================================
   Quick Capture popup helpers
   ============================================================ */
.cp-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--text3);
  margin-left: 4px;
}

.cp-textarea { min-height: 130px; }

.cp-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  width: 100%;
}

/* ============================================================
   Inbox page — triage view
   ============================================================ */
.inbox-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.inbox-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
}
.inbox-hint {
  color: var(--text2);
  font-size: 13px;
  margin: 0 0 20px;
}
.inbox-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.inbox-row:last-child { border-bottom: none; }
.inbox-row--done {
  opacity: 0;
  transform: translateX(12px);
  pointer-events: none;
}
.inbox-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.inbox-row-body {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
  white-space: pre-wrap;
  margin-bottom: 12px;
  max-height: 80px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.inbox-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inbox-btn {
  font-size: 12px;
  padding: 5px 12px;
}
