/* Life OS Hub — Dashboard Styles
   Hand-drawn aesthetic matching the wireframe.
   Caveat font family, paper textures, ink borders. */

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

:root {
  --ink: #1c1c1c;
  --ink2: #555;
  --paper: #f5f2ec;
  --paper2: #ede9e0;
  --blue: #3d6fc9;
  --blue-light: #dde8f8;
  --orange: #d97840;
  --orange-light: #faebd8;
  --green: #3a9c6e;
  --green-light: #d8f0e6;
  --red: #c0392b;
  --purple: #7040b0;
  --border: #b0a898;
  --border-dark: #7a6e60;
}

body {
  font-family: 'Caveat', cursive;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  min-height: 100vh;
}

/* --- Navigation --- */
.nav-bar {
  background: var(--ink);
  color: #f5f2ec;
  display: flex;
  align-items: center;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--orange);
}
.nav-bar::-webkit-scrollbar { display: none; }
.nav-brand {
  font-family: 'Caveat Brush', cursive;
  font-size: 22px;
  color: var(--orange);
  padding: 10px 20px 10px 0;
  white-space: nowrap;
  border-right: 2px solid #444;
  margin-right: 8px;
}
.nav-tab {
  padding: 12px 14px;
  cursor: pointer;
  font-family: 'Caveat', cursive;
  font-size: 15px;
  white-space: nowrap;
  border: none;
  border-bottom: 3px solid transparent;
  color: #ccc;
  margin-bottom: -3px;
  background: none;
}
.nav-tab:hover { color: #fff; }
.nav-tab.active { color: var(--orange); border-bottom-color: var(--orange); }

/* --- Top bar --- */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Masonry layout --- */
.masonry {
  columns: 4 260px;
  column-gap: 14px;
  padding: 14px;
}
.masonry > * {
  break-inside: avoid;
  margin-bottom: 14px;
}

/* --- Card --- */
.wf-card {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 10px;
  position: relative;
  box-shadow: 3px 3px 0 var(--ink);
}
.wf-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px dashed var(--border);
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.wf-card-title {
  font-size: 18px;
  font-weight: 700;
}

/* --- Buttons --- */
.wf-btn {
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: 'Caveat', cursive;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
  box-shadow: 1px 1px 0 var(--ink);
  white-space: nowrap;
}
.wf-btn.primary { background: var(--ink); color: #fff; }
.wf-btn.blue { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }
.wf-btn.orange { background: var(--orange-light); border-color: var(--orange); color: var(--orange); }

/* --- Tags / Badges --- */
.ph-tag {
  display: inline-block;
  background: var(--blue-light);
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 13px;
  margin: 2px;
}
.ph-tag.orange { background: var(--orange-light); border-color: var(--orange); color: var(--orange); }
.ph-tag.green { background: var(--green-light); border-color: var(--green); color: var(--green); }
.ph-tag.red { background: #fde8e6; border-color: var(--red); color: var(--red); }
.ph-tag.purple { background: #ede0f8; border-color: var(--purple); color: var(--purple); }

.badge {
  background: var(--red);
  color: #fff;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.badge.blue { background: var(--blue); }
.badge.green { background: var(--green); }
.badge.orange { background: var(--orange); }

/* --- Progress bar --- */
.prog-bar {
  height: 8px;
  background: var(--paper2);
  border: 1.5px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* --- Sparkline --- */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
}
.spark-bar {
  background: var(--blue);
  border-radius: 2px 2px 0 0;
  flex: 1;
  opacity: 0.75;
}

/* --- Tab bar --- */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--ink);
  gap: 0;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.tab {
  padding: 5px 12px;
  cursor: pointer;
  font-family: 'Caveat', cursive;
  font-size: 15px;
  border: 2px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: none;
  color: var(--ink2);
  margin-bottom: -2px;
}
.tab.active { background: #fff; border-color: var(--ink); color: var(--ink); font-weight: 700; }

/* --- Layout helpers --- */
.row { display: flex; gap: 8px; align-items: flex-start; }
.row.center { align-items: center; }
.col { display: flex; flex-direction: column; gap: 6px; }
.flex1 { flex: 1; }
.mb4 { margin-bottom: 4px; }
.mb8 { margin-bottom: 8px; }
.mt4 { margin-top: 4px; }
.mt8 { margin-top: 8px; }

/* --- Checkbox --- */
.cb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
  position: relative;
}
.cb.checked { background: var(--ink); }
.cb.checked::after {
  content: '\2713';
  color: #fff;
  font-size: 10px;
  position: absolute;
  top: -2px;
  left: 1px;
}

/* --- Day pill --- */
.day-pill {
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 14px;
  cursor: pointer;
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Caveat', cursive;
  transition: all 0.15s;
}
.day-pill.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.day-pill:hover { transform: translateY(-1px); }

/* --- Input --- */
.inp {
  border: 1.5px solid var(--border-dark);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: 'Caveat', cursive;
  font-size: 14px;
  background: #fff;
  width: 100%;
}

/* --- Notification --- */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
  margin-top: 3px;
}
.notif-dot.orange { background: var(--orange); }

/* --- Insight card --- */
.insight-card {
  background: var(--paper2);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}

/* --- Diary entry --- */
.diary-entry {
  border-left: 3px solid var(--blue);
  padding: 6px 10px;
  margin-bottom: 8px;
  background: var(--blue-light);
  border-radius: 0 4px 4px 0;
  font-size: 14px;
}

/* --- Finance table --- */
.fin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fin-table th, .fin-table td { border: 1px solid var(--border); padding: 4px 8px; }
.fin-table th { background: var(--paper2); font-weight: 700; }

/* --- AI assistant --- */
.ai-full {
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 16px;
  margin: 0 14px 14px;
}
.ai-message {
  background: #2d2d2d;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.ai-message.user { background: #1a3a5c; }

/* --- Placeholder line --- */
.ph-line {
  height: 10px;
  background: var(--paper2);
  border-radius: 3px;
  margin-bottom: 6px;
}

/* --- Loading state --- */
.loading-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .masonry { columns: 1; }
}
