/* progress.the-value-matrix.com - modern light design */

:root {
  --bg:          #f7f8fa;
  --bg-elevated: #ffffff;
  --bg-subtle:   #f3f4f6;
  --border:      #e5e7eb;
  --border-strong: #d1d5db;
  --text:        #111827;
  --text-dim:    #4b5563;
  --text-muted:  #6b7280;
  --text-faint:  #9ca3af;

  --accent:      #4f46e5;
  --accent-hover:#4338ca;
  --accent-soft: #eef2ff;

  --success:     #059669;
  --success-soft:#ecfdf5;
  --warning:     #d97706;
  --warning-soft:#fffbeb;
  --danger:      #dc2626;
  --danger-soft: #fef2f2;

  --type-program: #0d9488;
  --type-project: #4f46e5;
  --type-hobby:   #d97706;
  --type-content: #db2777;

  --shadow-sm: 0 1px 2px rgba(17,24,39,0.05);
  --shadow-md: 0 4px 12px rgba(17,24,39,0.06), 0 1px 3px rgba(17,24,39,0.04);
  --shadow-lg: 0 10px 30px rgba(17,24,39,0.08), 0 2px 6px rgba(17,24,39,0.04);

  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  16px;
  --radius-pill: 999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { color: var(--text); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.75rem; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

p { margin: 0 0 0.75rem 0; color: var(--text-dim); }

/* ---------- Layout ---------- */

.app-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(8px);
}
.app-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.app-brand a { color: inherit; }
.app-brand__dot { color: var(--accent); }

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 100px;
}

.row { display: flex; gap: 12px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Cards ---------- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card--lg { padding: 28px; border-radius: var(--radius-lg); }
.card--flat { box-shadow: none; }
.card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}
.card__title h2, .card__title h3 { margin: 0; }

.section { margin-bottom: 28px; }
.section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section__header h2 { margin: 0; }

/* ---------- Grid ---------- */

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, transform 0.06s, border-color 0.12s;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--bg-subtle); color: var(--text); border-color: var(--border-strong); }
.btn--subtle {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn--subtle:hover { background: var(--accent); color: #fff; }
.btn--small { padding: 6px 12px; font-size: 0.85rem; }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #b91c1c; }
.btn--block { width: 100%; }

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"],
select, textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-text-fill-color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: 16px; }
.field--inline { display: flex; gap: 12px; align-items: center; }
.help { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.field-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* ---------- Flash ---------- */

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid;
  font-size: 0.9rem;
}
.flash--success { background: var(--success-soft); border-color: #a7f3d0; color: #065f46; }
.flash--error { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.flash--info { background: var(--accent-soft); border-color: #c7d2fe; color: #3730a3; }

/* ---------- Badges / Chips ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--border);
}
.badge--program { background: #ecfdf5; color: var(--type-program); border-color: #a7f3d0; }
.badge--project { background: #eef2ff; color: var(--type-project); border-color: #c7d2fe; }
.badge--hobby   { background: #fff7ed; color: var(--type-hobby);   border-color: #fed7aa; }
.badge--content { background: #fdf2f8; color: var(--type-content); border-color: #fbcfe8; }

.badge--status-active   { background: var(--success-soft); color: var(--success); border-color: #a7f3d0; }
.badge--status-paused   { background: var(--bg-subtle); color: var(--text-muted); border-color: var(--border); }
.badge--status-done     { background: var(--accent-soft); color: var(--accent); border-color: #c7d2fe; }
.badge--status-archived { background: var(--bg-subtle); color: var(--text-faint); border-color: var(--border); }

/* ---------- Progress ---------- */

.progress {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}
.progress__bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}
.progress--lg { height: 12px; }
.progress--sm { height: 6px; }
.progress__bar--success { background: var(--success); }
.progress__bar--warning { background: var(--warning); }

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.progress-row:last-child { border-bottom: none; }
.progress-row__main { flex: 1; min-width: 0; }
.progress-row__name { font-weight: 500; color: var(--text); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.progress-row__meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.progress-row__value { font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: 0.85rem; min-width: 60px; text-align: right; }

/* ---------- Track List Item ---------- */

.track-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.06s;
  display: block;
  color: inherit;
}
.track-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  color: inherit;
}
.track-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.track-card__title { font-weight: 600; color: var(--text); }
.track-card__desc { font-size: 0.88rem; color: var(--text-muted); margin: 0 0 12px 0; }
.track-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ---------- Streak chip ---------- */

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  color: var(--text-dim);
}
.streak-chip__count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ---------- Heatmap ---------- */

.heatmap {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(8, 1fr);
}
.heatmap__cell {
  aspect-ratio: 1;
  background: var(--bg-subtle);
  border-radius: 4px;
  border: 1px solid var(--border);
}
.heatmap__cell[data-level="1"] { background: #e0e7ff; border-color: #c7d2fe; }
.heatmap__cell[data-level="2"] { background: #a5b4fc; border-color: #818cf8; }
.heatmap__cell[data-level="3"] { background: #6366f1; border-color: #4f46e5; }
.heatmap__cell[data-level="4"] { background: #4338ca; border-color: #3730a3; }

/* Week grid view */
.week-grid {
  display: grid;
  grid-template-columns: 180px repeat(7, 1fr);
  gap: 4px;
  font-size: 0.85rem;
}
.week-grid__header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 0;
}
.week-grid__row-label {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  color: var(--text-dim);
  font-weight: 500;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.week-grid__cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-faint);
  font-size: 0.95rem;
}
.week-grid__cell[data-level="1"] { background: #e0e7ff; border-color: #c7d2fe; color: var(--accent); }
.week-grid__cell[data-level="2"] { background: #a5b4fc; border-color: #818cf8; color: #fff; }
.week-grid__cell[data-level="3"] { background: #4f46e5; border-color: #4338ca; color: #fff; }
.week-grid__cell[data-today="true"] { box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------- Milestone list ---------- */

.milestone-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.milestone-row:last-child { border-bottom: none; }
.milestone-row__check {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.12s, background 0.12s;
}
.milestone-row__check:hover { border-color: var(--accent); }
.milestone-row__check--done {
  background: var(--accent);
  border-color: var(--accent);
}
.milestone-row__check--done::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
  display: block;
}
.milestone-row__main { flex: 1; min-width: 0; }
.milestone-row__name { color: var(--text); font-weight: 500; }
.milestone-row__name--done { text-decoration: line-through; color: var(--text-faint); }
.milestone-row__meta { font-size: 0.82rem; color: var(--text-muted); }
.milestone-row__actions { display: flex; gap: 6px; }

/* ---------- Today view tiles ---------- */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .tile-grid { grid-template-columns: 1fr 1fr; } }

.tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tile__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.tile__value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.tile__sub { font-size: 0.82rem; color: var(--text-muted); }

/* ---------- Tabbar (mobile) ---------- */

.tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 8px env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  z-index: 40;
}
.tabbar > a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  color: var(--text-muted);
  font-size: 0.7rem;
}
.tabbar > a.active { color: var(--accent); }
.tabbar > a svg { width: 22px; height: 22px; }

@media (max-width: 900px) {
  .tabbar { display: flex; }
  .app-shell { padding-bottom: 100px; }
}

/* ---------- Side nav (desktop) ---------- */

.sidenav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.sidenav a {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.12s, color 0.12s;
}
.sidenav a:hover { background: var(--bg-subtle); color: var(--text); }
.sidenav a.active { background: var(--accent); color: #fff; }
.sidenav a.active:hover { background: var(--accent-hover); color: #fff; }

/* ---------- Detail header ---------- */

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.detail-header__main { min-width: 0; flex: 1; }
.detail-header__chips { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.detail-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Empty state ---------- */

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty h3 { color: var(--text-dim); margin-bottom: 8px; }

/* ---------- Login ---------- */

.login-wrap {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { margin-bottom: 6px; }
.login-card__sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }

/* ---------- Inline forms ---------- */

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline-form input, .inline-form select { padding: 8px 12px; font-size: 0.88rem; }

/* ---------- Misc ---------- */

.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-small { font-size: 0.85rem; }
.text-xs    { font-size: 0.75rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: none; }

.priority-pill {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}
.priority-pill[data-priority="1"] { background: var(--danger); }
.priority-pill[data-priority="2"] { background: var(--warning); }
.priority-pill[data-priority="3"] { background: var(--accent); }
.priority-pill[data-priority="4"] { background: var(--text-muted); }
.priority-pill[data-priority="5"] { background: var(--text-faint); }

/* ---------- Next Action (GTD) ---------- */

.next-action-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.next-action-row:last-child { border-bottom: none; }
.next-action-row__head { margin-bottom: 8px; }
.next-action-row__track {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.next-action-row__track:hover { color: var(--accent); }
.next-action-row__form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.next-action-row__input {
  flex: 1;
  font-size: 0.95rem;
  padding: 10px 14px;
}
.next-action-row--stuck .next-action-row__input {
  background: #fffbeb;
  border-color: #fde68a;
}
.next-action-row--stuck .next-action-row__input::placeholder {
  color: #b45309;
  opacity: 0.7;
}

.card--stuck {
  border-color: #fde68a;
  background: linear-gradient(0deg, #fffbeb 0%, #ffffff 100%);
}

/* ---------- Capture Bar (Inbox Quick-Add) ---------- */

.capture-bar { padding: 14px 18px; }
.capture-bar__form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.capture-bar__input {
  flex: 1;
  min-width: 240px;
  font-size: 1rem;
  padding: 12px 16px;
}

/* ---------- Inbox Item ---------- */

.inbox-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.inbox-item:last-child { border-bottom: none; }
.inbox-item__content {
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 4px;
}
.inbox-item__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.inbox-item__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.inbox-action { position: relative; }
.inbox-action summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
}
.inbox-action summary::-webkit-details-marker { display: none; }
.inbox-action[open] summary { background: var(--accent); color: #fff; }
.inbox-action__form {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 10px;
  display: flex;
  gap: 6px;
  z-index: 10;
  min-width: 280px;
  flex-wrap: wrap;
}
.inbox-action__form select,
.inbox-action__form input {
  font-size: 0.88rem;
  padding: 8px 12px;
  min-width: 180px;
  flex: 1;
}
