/* Mobile-first on purpose -- finance-tracker's style.css has zero @media
   queries and was never meant to be used on a phone. This app is used
   daily on a phone, so the base (unqualified) rules below target a narrow
   screen, and layout only gets *more* elaborate at wider breakpoints
   (640px tablet, 1024px desktop) -- never the other way around. Same
   plain-CSS, no-framework approach and color palette as finance-tracker
   otherwise, so the two apps feel like siblings. */

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 16px;
  color: #1a1a1a;
  background: #fafafa;
}

a { color: #197eab; }

h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: #444; }

/* --- nav ------------------------------------------------------------- */
/* Stacked on mobile (brand row, then a horizontally-scrollable link row)
   rather than finance-tracker's fixed space-between flex row, which would
   force tiny cramped tap targets at phone width. */
nav {
  margin-bottom: 16px;
}
.nav-brand a {
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  color: #1a1a1a;
}
.nav-links {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
  padding-bottom: 4px;
}
.nav-links a, .nav-links .link-btn {
  flex: none;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: #197eab;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links .link-btn:hover { background: #eef6f9; }
.link-btn {
  background: none; border: none; cursor: pointer; font: inherit;
}

/* --- flashes ----------------------------------------------------------- */
.flashes { list-style: none; padding: 0; margin: 0 0 16px; }
.flashes li {
  background: #eef6f9; border: 1px solid #cfe6ee; border-radius: 6px;
  padding: 8px 12px; margin-bottom: 6px; font-size: 14px;
}

/* --- quick capture ------------------------------------------------------ */
.quick-capture {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.quick-capture input[type="text"] {
  flex: 1; padding: 10px 12px; border: 1px solid #ccc; border-radius: 6px;
  font-size: 16px; /* 16px prevents iOS Safari auto-zooming into the field */
}

/* --- cards --------------------------------------------------------------- */
.card {
  background: white; border-radius: 8px; padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 16px;
}
.area-overview { color: #444; margin-bottom: 16px; }

/* --- buttons / forms ----------------------------------------------------- */
.btn {
  display: inline-block; padding: 10px 16px; background: #197eab; color: white;
  border-radius: 6px; text-decoration: none; border: none; cursor: pointer;
  font-size: 14px; min-height: 44px; /* Apple HIG tap-target floor -- this gets used one-handed all day */
  line-height: 24px;
}
.btn-secondary { background: #6b7280; }
.btn-danger { background: #b84c51; }
/* First click on a .confirm-btn (see app.js) -- makes the "click again"
   state visually obvious, not just a text change, since the button's still
   the same size/position and a subtle change alone is easy to miss. */
.confirm-pending { background: #8f2f33; box-shadow: 0 0 0 2px rgba(184,76,81,0.4); }
.link-btn-small {
  background: none; border: none; color: #197eab; cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 4px 0; text-decoration: none;
}
form.inline { display: inline; }
.actions-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.actions { margin-top: 16px; display: flex; gap: 8px; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 14px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px;
  font-size: 16px; /* iOS zoom-prevention, same reasoning as quick-capture */
  font-family: inherit;
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.check-field label { font-weight: normal; }
.check-field input { width: auto; margin-right: 6px; }
.narrow-form { max-width: 480px; }
.inline-add-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.inline-add-form input[type="text"] { flex: 1; min-width: 160px; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 16px; }
.inline-add-form select { padding: 10px; border: 1px solid #ccc; border-radius: 6px; }

.hint { color: #888; font-size: 13px; margin: 4px 0; }
.warning { color: #b84c51; font-weight: 600; font-size: 14px; }
.empty { color: #888; padding: 8px 0; list-style: none; }

/* --- color categories ---------------------------------------------------
   A small solid dot conveys the category color without ever putting a
   background color behind text (which would create contrast problems for
   9 different hues, some pastel/some saturated, against arbitrary text).
   task-row/plain-list items additionally get a colored left border stripe
   using the same hex, applied inline via resolve_color() since it's
   per-row data, not something a CSS class can express. */
.color-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  flex: none; border: 1px solid rgba(0,0,0,0.08);
}
.color-select-swatch { display: flex; align-items: center; gap: 8px; }

/* --- tags ------------------------------------------------------------- */
.tag {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px;
  background: #eef6f9; color: #197eab; margin-left: 4px; white-space: nowrap;
}
.tag-muted { background: #f3f4f6; color: #666; }
.tag-danger { background: #fbeaea; color: #b84c51; }

/* --- task rows ---------------------------------------------------------- */
.task-list { list-style: none; padding: 0; margin: 0; }
.task-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 10px 0 10px 8px; border-bottom: 1px solid #eee;
  /* --cat-color is set inline per-row via resolve_color() -- this is the
     one shared place that turns it into an actual visible stripe, so every
     view (Today/Week/Areas/reports) gets the same look for free. */
  border-left: 4px solid var(--cat-color, transparent);
}
.task-row:last-child { border-bottom: none; }
.task-row.done .task-title, .task-row.done { opacity: 0.55; text-decoration: line-through; }
.task-row.overdue { background: #fff8f8; margin: 0 -8px; padding: 10px 8px; border-radius: 6px; }
.check-btn {
  background: none; border: none; cursor: pointer; font-size: 20px; padding: 0;
  min-width: 32px; min-height: 32px;
}
.task-title { text-decoration: none; color: #1a1a1a; font-weight: 500; flex: 1; min-width: 120px; }

/* Priority score badge: darker/bolder as the score climbs, so a glance at
   a list of numbers still reads as "which ones matter most" without having
   to actually do the multiplication in your head. Bucketed into a few
   bands rather than a continuous gradient -- easier to tell apart at a
   glance than fine-grained shades would be. */
.priority-score {
  background: #f3f4f6; color: #666; font-weight: 700; min-width: 22px;
  text-align: center;
}
.priority-score-high { background: #fbeaea; color: #b84c51; }
.priority-score-mid { background: #fdf3e0; color: #a0752c; }
.priority-inputs { display: flex; gap: 6px; align-items: center; }
.priority-inputs label {
  display: flex; align-items: center; gap: 2px; font-size: 11px; color: #888;
  font-weight: 600;
}
.priority-inputs input {
  width: 36px; padding: 3px 4px; border: 1px solid #ccc; border-radius: 4px;
  font-size: 13px; text-align: center;
}

.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.plain-list li:last-child { border-bottom: none; }

/* --- inbox --------------------------------------------------------------- */
.inbox-row { flex-direction: column; align-items: stretch; gap: 10px; }
.inbox-note-body p { margin: 4px 0; }
.inbox-actions { display: flex; gap: 12px; align-items: center; }

/* --- unprioritized callout ------------------------------------------------ */
.unprioritized { border: 1px solid #f0d9a8; background: #fffaf0; }


/* --- week grid --------------------------------------------------------
   Mobile: one column stacked per day. Tablet+: 2 columns. Desktop: 7. */
.week-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.day-column.is-today { border: 2px solid #197eab; }
.day-date { color: #888; font-weight: normal; font-size: 13px; }

/* --- areas grid ---------------------------------------------------------- */
.area-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.area-card { text-decoration: none; color: inherit; display: block; }
.area-card h2 { margin-top: 0; color: #197eab; }

/* --- report layout -------------------------------------------------------- */
.report-headline { margin-bottom: 12px; }
.headline { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.report-columns { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* ======================= tablet (>=640px) ======================= */
@media (min-width: 640px) {
  body { padding: 24px 32px; }
  nav { display: flex; justify-content: space-between; align-items: center; }
  .nav-links { margin-top: 0; overflow-x: visible; }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .area-grid { grid-template-columns: repeat(2, 1fr); }
  .report-columns { grid-template-columns: repeat(2, 1fr); }
}

/* ======================= desktop (>=1024px) ======================= */
@media (min-width: 1024px) {
  body { max-width: 1100px; margin: 0 auto; padding: 32px 40px; }
  h1 { font-size: 24px; }
  .week-grid { grid-template-columns: repeat(7, 1fr); }
  .area-grid { grid-template-columns: repeat(3, 1fr); }
  .report-columns { grid-template-columns: repeat(3, 1fr); }
}
