/* Task manager — Ink wash */

:root {
  --ink: #4A4A4A;
  --stone: #CBCBCB;
  --paper: #FFFFE3;
  --slate: #6D8196;
  --slate-soft: rgba(109, 129, 150, 0.12);
  --danger: #A45544;
  --success: #6F8A6B;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* ---------- layout ---------- */

.app {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}

.app header.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--stone);
}

.app header.top h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.05;
}
.h1-primary { display: block; }
.h1-secondary {
  display: block;
  font-size: 12px;
  font-weight: 400;
  font-style: italic;
  color: var(--slate);
  opacity: 0.75;
  margin-top: 1px;
}

.app header.top .date {
  font-size: 12px;
  color: var(--slate);
  text-align: right;
  line-height: 1.1;
}
.date-primary { font-weight: 600; color: var(--ink); }
.date-secondary { font-style: italic; opacity: 0.75; margin-top: 1px; }

/* Tabs */

nav.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--stone);
  margin-bottom: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;        /* Edge legacy */
}
nav.tabs::-webkit-scrollbar { display: none; }

nav.tabs button {
  padding: 6px 12px 8px;
  color: var(--ink);
  opacity: 0.55;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  line-height: 1.05;
  text-align: left;
}

nav.tabs.primary button { opacity: 0.9; color: var(--ink); }
nav.tabs.primary button.active { opacity: 1; color: var(--slate); }

nav.tabs button.active {
  opacity: 1;
  color: var(--slate);
  border-bottom-color: var(--slate);
}

nav.tabs .t-primary {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
nav.tabs .t-secondary {
  display: block;
  font-size: 9px;
  font-style: italic;
  opacity: 0.65;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 1px;
}
nav.tabs button.active .t-secondary { opacity: 0.85; }

/* Section heading */

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
  opacity: 0.7;
  margin: 0 0 8px;
  font-weight: 600;
  line-height: 1.1;
}
.sh-primary { display: inline; }
.sh-secondary {
  display: inline;
  margin-left: 6px;
  font-size: 10px;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  opacity: 0.65;
}
.lane section h3 { line-height: 1.1; }
.lane section h3 .sh-primary { display: inline; }
.lane section h3 .sh-secondary { display: inline; margin-left: 5px; font-size: 9px; font-style: italic; opacity: 0.55; text-transform: none; letter-spacing: 0; font-weight: 400; }

.section + .section { margin-top: 20px; }

/* ---------- ficha ---------- */

.ficha {
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  padding: 11px 12px;
  margin-bottom: 6px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.ficha .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
  background: var(--slate);
}

.ficha .body { flex: 1; min-width: 0; }

.ficha .title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

/* Bilingual title rendering: primary bold, secondary grey italic below. */
.title-bilingual { line-height: 1.2; }
.title-primary {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.title-secondary {
  font-size: 12px;
  font-style: italic;
  color: var(--slate);
  opacity: 0.85;
  margin-top: 1px;
}
.chip-secondary {
  display: inline;
  margin-left: 4px;
  font-style: italic;
  opacity: 0.75;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.lane-title { display: flex; flex-direction: column; min-width: 0; }
.lane .title-primary { font-size: 14px; font-weight: 600; }
.lane .title-secondary { font-size: 11px; }
.ficha.recurring { border-left: 3px solid var(--moss, #7A8A5C); }
.ficha.recurring .dot { opacity: 0.7; }

.ficha .meta {
  font-size: 12px;
  color: var(--slate);
  margin-top: 2px;
}

.ficha .chip {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--slate-soft);
  color: var(--slate);
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.ficha .check {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--stone);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 3px;
  cursor: pointer;
  background: var(--paper);
  position: relative;
}

.ficha.done { opacity: 0.55; }
.ficha.done .title { text-decoration: line-through; }
.ficha.done .check {
  background: var(--success);
  border-color: var(--success);
}
.ficha.done .check::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.ficha.overdue { border-color: var(--danger); }
.ficha.overdue .meta { color: var(--danger); }

/* ---------- v6: action stack (snooze + park + check) ---------- */
.ficha-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.ficha-snooze, .ficha-park {
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.12s ease, background 0.12s ease;
  color: var(--slate);
}
.ficha-snooze:hover, .ficha-park:hover {
  opacity: 1;
  background: rgba(109, 129, 150, 0.12);
  border-color: rgba(109, 129, 150, 0.3);
}
/* Inside event-filled cards the buttons get inverted contrast. */
.ficha.type-event .ficha-snooze,
.ficha.type-event .ficha-park { color: rgba(255,255,255,0.85); }
.ficha.type-event .ficha-snooze:hover,
.ficha.type-event .ficha-park:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
}

/* Snooze popover — a small floating menu of preset offsets. */
.snooze-menu {
  position: absolute;
  z-index: 1000;
  width: 180px;
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  padding: 4px;
}
.snooze-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  gap: 1px;
}
.snooze-item:hover { background: rgba(109, 129, 150, 0.12); }
.snooze-eu { font-size: 13px; font-weight: 500; color: var(--ink); }
.snooze-en { font-size: 11px; color: var(--slate); font-style: italic; }

/* Section variant for Beranduago (Someday) — same compact horizontal scroll
 * as Sartutakoak (Inbox), just lower visual weight to read as parked. */
.section-someday { margin-top: 8px; margin-bottom: 16px; }
.section-someday .section-title { opacity: 0.6; font-size: 12px; }
.section-someday .ficha { background: rgba(255, 255, 255, 0.25); }

/* ---------- v8: Today timeline strip ---------- */

.section-timeline { margin-bottom: 18px; }
.today-timeline {
  position: relative;
  margin-left: 0;
  padding-left: 48px;
  border-left: 1px solid var(--stone);
  background: rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  overflow: hidden;
}
.tt-gutter {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 48px;
  border-right: 1px dashed var(--stone);
  pointer-events: none;
}
.tt-hour {
  position: absolute;
  right: 6px;
  font-size: 10px;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
  transform: translateY(-50%);
}
.tt-body {
  position: relative;
  height: 100%;
  margin-right: 8px;
}
.tt-event {
  position: absolute;
  left: 4px;
  right: 0;
  border-radius: 6px;
  padding: 4px 8px;
  color: #fff;
  font-size: 11px;
  line-height: 1.25;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.tt-event:hover { transform: translateX(1px); }
.tt-event-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-event-meta {
  font-size: 10px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- v8: Gaur footer peek ---------- */

.gaur-peek {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px dashed var(--stone);
}
.gaur-peek-link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--stone);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  color: var(--ink);
}
.gaur-peek-link:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--slate);
}
.gaur-peek-count {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--slate);
  line-height: 1;
}
.gaur-peek-label {
  font-size: 11px;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- v8: Datorrena (Upcoming) ---------- */

.section-datorrena .ficha { margin-bottom: 8px; }
.datorrena-day {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--stone);
}
.datorrena-dow {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.datorrena-date {
  font-size: 12px;
  color: var(--slate);
  font-style: italic;
}
.datorrena-beyond-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  cursor: pointer;
  user-select: none;
  color: var(--slate);
  font-size: 12px;
  border-top: 1px dashed var(--stone);
}
.datorrena-beyond-toggle:hover { color: var(--ink); }
.datorrena-beyond-chev { font-size: 10px; opacity: 0.7; }
.datorrena-beyond-label { font-style: italic; }

/* ---------- v8: ficha mini-action "→ Today" ---------- */

.ficha-pull-today {
  flex: 0 0 auto;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(109, 129, 150, 0.1);
  border: 1px solid rgba(109, 129, 150, 0.25);
  border-radius: 999px;
  color: var(--slate);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease;
}
.ficha-pull-today:hover {
  background: var(--slate);
  color: #fff;
  border-color: var(--slate);
}
/* On filled event cards, invert. */
.ficha.type-event .ficha-pull-today {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* ---------- v8: Sartutakoak (Inbox) — vertical triage ---------- */

.section-snoozed .section-title,
.section-someday-list .section-title {
  opacity: 0.65;
}
.section-snoozed .ficha,
.section-someday-list .ficha {
  background: rgba(255, 255, 255, 0.3);
}
.section-snoozed .ficha {
  opacity: 0.7;
  border-style: dashed;
}

/* ---------- v8: Proiektuak hero cards ---------- */

.section-heading-mini { margin: 18px 0 6px; }
.section-heading-mini .section-title { font-size: 12px; opacity: 0.65; }

.project-hero-row {
  /* v13.x: horizontal scroll strip instead of a wrapping grid. Once you
     have more than 2-3 active projects, a grid eats too much vertical
     space; a side-scrolling row keeps the page compact and matches the
     "carousel of active things" feel of Apple Reminders' lists picker. */
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 6px;            /* breathing room for the scrollbar  */
  scrollbar-width: thin;          /* Firefox: subtle scrollbar         */
  -webkit-overflow-scrolling: touch;  /* iOS momentum scroll           */
  scroll-snap-type: x proximity;  /* gentle snap to card edges         */
}
.project-hero-row::-webkit-scrollbar { height: 6px; }
.project-hero-row::-webkit-scrollbar-thumb {
  background: var(--stone);
  border-radius: 3px;
}
.project-hero {
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid var(--stone);
  border-left-width: 5px;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  flex: 0 0 260px;        /* fixed-width cards — keeps them readable on scroll */
  scroll-snap-align: start;
}
.project-hero:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.project-hero-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.project-hero-head .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-top: 4px;
  flex-shrink: 0;
}
.project-hero .lane-title .title-primary { font-size: 15px; font-weight: 700; }
.project-hero .lane-title .title-secondary { font-size: 11px; }
.project-hero-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11px;
}
.project-hero-tasks {
  font-size: 10px;
  color: var(--slate);
  font-style: italic;
  margin-left: auto;
}

.ficha.meeting { border-left: 3px solid var(--slate); }

.ficha.priority-high { box-shadow: inset 3px 0 0 var(--slate); }

/* ---------- v4 ficha: type badges + habit grace ---------- */

/* Small inline glyph that sits between the project dot and the body.
 * Distinct colors per type give at-a-glance recognition without a label. */
.ficha-type-badge {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  margin-top: 2px;
  margin-right: 2px;
  opacity: 0.85;
}
.ficha-type-badge.type-habit    { background: rgba(111, 138, 107, 0.18); color: var(--success); }
.ficha-type-badge.type-event    { background: rgba(109, 129, 150, 0.18); color: var(--slate); }
.ficha-type-badge.type-deadline { background: rgba(164, 85, 68, 0.16);  color: var(--danger); }

/* ---------- Event fichas: calendar-style filled card ---------- */
/* Events get the project color as the card background (set inline by JS),
 * white text, and a translucent-white chip so the project label stays
 * readable. Reads as a calendar block rather than a todo row. */
.ficha.type-event { color: #fff; }
.ficha.type-event .title-primary { color: #fff; font-weight: 600; }
.ficha.type-event .title-secondary { color: rgba(255, 255, 255, 0.78); }
.ficha.type-event .meta { color: rgba(255, 255, 255, 0.88); }
.ficha.type-event .chip {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}
.ficha.type-event .chip-secondary { color: rgba(255, 255, 255, 0.78); }
/* Type badge flips to a transparent white so it reads against the fill. */
.ficha.type-event .ficha-type-badge.type-event {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
/* The completion check needs to contrast too — white border on filled bg. */
.ficha.type-event .check { border-color: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.12); }
.ficha.type-event .check:hover { background: rgba(255, 255, 255, 0.25); }
.ficha.type-event .check::after { border-color: #fff; }
/* Collapsed mini-title variant (Proiektuak collapsed column): keep inherited
 * colors — the event fill doesn't apply there because the title is rendered
 * as plain text, not a full ficha. */

/* Habit grace window — faded row with a soft dashed underline on the meta
 * clock glyph. No red. No border accent. Reads as "yesterday's thing still
 * hanging around" without demanding attention. */
.ficha.habit-grace { opacity: 0.6; }
.ficha.habit-grace .meta { color: var(--slate); font-style: italic; }
.ficha.habit-grace .title-primary { color: rgba(74, 74, 74, 0.8); }

/* Inbox section — dateless plain tasks. Moved to the top of Egiteko in v5.1
 * and rendered as a horizontally-scrollable strip of compact cards so it
 * takes minimal vertical space. Lower visual weight (quieter heading,
 * slightly translucent cards) so it reads as "holding pen" not "do now." */
.section-inbox { margin-top: 0; margin-bottom: 20px; }
.section-inbox .section-title { opacity: 0.75; font-size: 13px; }

.inbox-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 10px;
  /* Bleed to the page edges on narrow viewports so the scroll hint is
   * obvious — you can see cards cut off at the right side. */
  margin: 0 -4px;
  scrollbar-width: thin;
  scrollbar-color: var(--stone) transparent;
  scroll-snap-type: x proximity;
}
.inbox-scroll::-webkit-scrollbar { height: 6px; }
.inbox-scroll::-webkit-scrollbar-track { background: transparent; }
.inbox-scroll::-webkit-scrollbar-thumb { background: var(--stone); border-radius: 3px; }

.inbox-scroll .ficha {
  flex: 0 0 170px;
  max-width: 170px;
  min-width: 170px;
  padding: 8px 10px;
  margin-bottom: 0;
  gap: 6px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.45);
  scroll-snap-align: start;
}
/* Hide the project-color dot and type badge inside inbox cards — save the
 * width for actual title text. The project chip still appears inside the
 * body so the project is identifiable. */
.inbox-scroll .ficha .dot,
.inbox-scroll .ficha .ficha-type-badge { display: none; }

.inbox-scroll .ficha .body { min-width: 0; flex: 1 1 auto; }
.inbox-scroll .ficha .title-primary {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  /* Allow wrapping to 2-3 lines inside the card. */
  white-space: normal;
  overflow-wrap: break-word;
}
.inbox-scroll .ficha .title-secondary {
  font-size: 10px;
  line-height: 1.25;
  margin-top: 2px;
  white-space: normal;
  overflow-wrap: break-word;
}
.inbox-scroll .ficha .chip {
  font-size: 9px;
  padding: 1px 6px;
  margin-top: 4px;
  margin-left: 0;
}
.inbox-scroll .ficha .meta { font-size: 10px; margin-top: 3px; }
.inbox-scroll .ficha .check { flex: 0 0 auto; align-self: flex-start; }

/* ---------- v4 Proiektuak: subproject rows + collapse toggle ---------- */

/* The rowhead stacks vertically now: title on top, collapse button below
 * (for parents only). Flex-column gives the button room without crowding
 * the title or shrinking the color-dot + text horizontally. */
.pm-rowhead {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.pm-rowhead-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Subproject rows indent their row-head under the parent and quiet the
 * typography so the hierarchy reads immediately. */
.pm-row-sub .pm-rowhead-top { padding-left: 18px; }
.pm-row-sub .pm-rowhead .title-primary { font-size: 12px; font-weight: 500; }
.pm-row-sub .pm-rowhead .title-secondary { font-size: 10px; }
.pm-row-sub .swatch { width: 6px; height: 6px; }
.pm-row-parent .pm-rowhead .title-primary { font-weight: 600; }

/* Compact pill collapse button below the title — just "▾ N" so it fits
 * inside the 130px rowhead column on any viewport. Full-text tooltip on
 * hover. */
.pm-collapse-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  margin: 0;
  font-size: 11px;
  line-height: 1;
  color: var(--slate);
  background: rgba(109, 129, 150, 0.08);
  border: 1px solid rgba(109, 129, 150, 0.18);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease;
  min-width: 0;
}
.pm-collapse-toggle:hover { background: rgba(109, 129, 150, 0.18); }
.pm-collapse-toggle .pm-collapse-chevron { font-size: 9px; opacity: 0.9; }
.pm-collapse-toggle .pm-collapse-label { white-space: nowrap; font-weight: 600; }

.pm-row-sub.collapsed { display: none; }

/* ---------- v7: project rowhead (kind=project) + progress bar ---------- */

.pm-rowhead-project .pm-rowhead-top { cursor: pointer; }
.pm-rowhead-project .pm-rowhead-top:hover .lane-title .title-primary { text-decoration: underline; }

.pm-project-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
  flex-wrap: wrap;
}
.pm-progress {
  flex: 1 1 60px;
  min-width: 50px;
  height: 6px;
  background: rgba(109, 129, 150, 0.18);
  border-radius: 3px;
  overflow: hidden;
}
.pm-progress-fill {
  height: 100%;
  background: var(--success, #6F8A6B);
  transition: width 0.2s ease;
}
.pm-progress-pct {
  font-size: 10px;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.pm-target-date {
  font-size: 10px;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  font-style: italic;
}

/* ---------- v7: milestone chip on fichas ---------- */

/* Milestone chip stacks after the project chip on the title line. Dashed
 * border + slate italic so it reads as a "phase tag" and not duplicate
 * project info. */
.chip.chip-milestone {
  background: transparent;
  border: 1px dashed var(--slate);
  color: var(--slate);
  font-style: italic;
  margin-left: 4px;
}
.chip.chip-milestone .chip-secondary { color: var(--slate); opacity: 0.85; }
/* On event fichas (filled colored cards) the chip needs white-on-translucent. */
.ficha.type-event .chip.chip-milestone {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.95);
}
.ficha.type-event .chip.chip-milestone .chip-secondary { color: rgba(255, 255, 255, 0.78); }

/* ---------- v7: project detail screen ---------- */

.project-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  margin-bottom: 12px;
  background: transparent;
  border: 1px solid var(--stone);
  border-radius: 6px;
  color: var(--slate);
  font-size: 12px;
  cursor: pointer;
}
.project-detail-back:hover { background: rgba(109, 129, 150, 0.1); }

.project-detail-header {
  margin-bottom: 18px;
}
.project-detail-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.project-detail-title .swatch {
  width: 14px; height: 14px;
  border-radius: 4px;
  margin-top: 6px;
  flex-shrink: 0;
}
.project-detail-title .title-primary { font-size: 22px; font-weight: 700; line-height: 1.1; }
.project-detail-title .title-secondary { font-size: 14px; opacity: 0.7; }

.project-detail-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 26px;
  flex-wrap: wrap;
}
.pm-progress.pm-progress-detail {
  flex: 0 0 200px;
  height: 8px;
  border-radius: 4px;
}
.project-detail-kind-warning {
  font-size: 11px;
  color: var(--danger);
  font-style: italic;
  flex-basis: 100%;
}

/* Each milestone is a vertical block with header + tasks underneath. */
.milestone {
  border: 1px solid var(--stone);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.milestone-done { background: rgba(111, 138, 107, 0.06); opacity: 0.85; }
.milestone-dropped { opacity: 0.5; }
.milestone-orphan { background: rgba(0, 0, 0, 0.02); border-style: dashed; }

.milestone-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.milestone-status {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(109, 129, 150, 0.12);
  color: var(--slate);
  font-size: 14px;
  font-weight: 600;
}
.milestone-done .milestone-status { background: var(--success, #6F8A6B); color: #fff; }
.milestone-name { flex: 1 1 auto; min-width: 0; }
.milestone-name-eu { font-size: 15px; font-weight: 600; line-height: 1.2; }
.milestone-name-en { font-size: 11px; font-style: italic; color: var(--slate); margin-top: 1px; }
.milestone-target {
  font-size: 11px;
  color: var(--slate);
  font-style: italic;
  font-variant-numeric: tabular-nums;
}
.milestone-completed {
  font-size: 11px;
  color: var(--success);
  font-style: italic;
}
.milestone-tasks { margin-left: 32px; }
.milestone-tasks .ficha { margin-bottom: 6px; }
.milestone-empty {
  font-size: 11px;
  color: var(--stone);
  font-style: italic;
  margin-left: 32px;
}

/* ---------- Produktibitatea: "now" indicator (1 EGUN only) ---------- */
.prod-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--slate);
  opacity: 0.55;
  z-index: 3;
  pointer-events: none;
}
.prod-now-line::before {
  content: '';
  position: absolute;
  left: -3px; top: -2px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--slate);
  opacity: 0.9;
}

/* ---------- Projects lanes ---------- */

.lanes {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}

.lane {
  flex: 0 0 260px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--stone);
  border-radius: 12px;
  padding: 10px 10px 6px;
}

.lane > header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.lane > header .swatch {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.lane section { margin-top: 10px; }
.lane section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
  opacity: 0.5;
  margin: 0 0 4px;
  font-weight: 600;
}

.lane .ficha { padding: 7px 9px; margin-bottom: 5px; }
.lane .ficha .title { font-size: 13px; }
.lane .ficha .meta { font-size: 11px; }

/* ---------- empty state ---------- */

.empty {
  padding: 20px 0;
  color: var(--slate);
  font-size: 13px;
  text-align: center;
  font-style: italic;
}

/* ---------- quick-add bar ---------- */

.quickbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--paper);
  border-top: 1px solid var(--stone);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.quickbar-meta {
  display: flex;
  gap: 6px;
  align-items: center;
}

.quickbar-meta select,
.quickbar-meta input[type=date],
.quickbar-meta input[type=time] {
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--stone);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.quickbar-meta select { flex: 1 1 auto; min-width: 0; }
.quickbar-meta input[type=date] { flex: 0 0 auto; }
.quickbar-meta input[type=time] { flex: 0 0 auto; }

.quickbar-meta select:focus,
.quickbar-meta input[type=date]:focus,
.quickbar-meta input[type=time]:focus {
  border-color: var(--slate);
  background: var(--slate-soft);
}

.quickbar-main {
  display: flex;
  gap: 8px;
  align-items: center;
}

.quickbar-main input[type=text] {
  flex: 1;
  font: inherit;
  padding: 9px 14px;
  border: 1px solid var(--stone);
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}

.quickbar-main input[type=text]:focus {
  border-color: var(--slate);
  background: var(--slate-soft);
}

.quickbar-main button.send {
  background: var(--slate);
  color: var(--paper);
  border-radius: 22px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--slate);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 70px; left: 50%; transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.toast.show { opacity: 1; }

/* ─────────────────────────────────────────────────────────────────── */
/* v10: Apple-Reminders-style row + add modal + horizon toggles +
 * project backlog tab strip. The bottom quickbar (.quickbar*) was
 * removed from the HTML; its old styles are dead but harmless. */
/* ─────────────────────────────────────────────────────────────────── */

/* Top-right + button next to the date. */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.add-fab {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--slate);
  color: #fff;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}
.add-fab:hover { background: var(--ink); transform: scale(1.05); }
.add-fab:active { transform: scale(0.95); }

/* Modal — backdrop + centered sheet */
.add-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: opacity 0.18s;
}
.add-modal.hidden { display: none; }
.add-modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--paper);
  border-radius: 14px;
  padding: 18px 18px 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
  max-height: 90vh;
  overflow-y: auto;
}
.add-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.add-modal-title { font-size: 20px; font-weight: 700; margin: 0; }
.add-modal-title-en { font-size: 13px; font-weight: 400; opacity: 0.55; }
.add-modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  font-size: 18px;
  cursor: pointer;
  color: var(--ink);
}
.add-modal-close:hover { background: rgba(0, 0, 0, 0.12); }

.add-modal-types {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px;
  border-radius: 10px;
}
.add-type {
  flex: 1;
  padding: 8px 6px;
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--ink);
  transition: background 0.12s;
}
.add-type:hover { background: rgba(0, 0, 0, 0.04); }
.add-type.active { background: var(--paper); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
.add-type-eu { font-size: 13px; font-weight: 600; }
.add-type-en { font-size: 10px; opacity: 0.6; font-style: italic; }

.add-form { display: flex; flex-direction: column; gap: 10px; }
.add-field { display: flex; flex-direction: column; gap: 4px; }
.add-label { font-size: 11px; color: var(--slate); font-weight: 500; }
.add-optional { opacity: 0.6; font-style: italic; font-weight: 400; }
.add-field input,
.add-field select {
  padding: 8px 10px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--stone);
  border-radius: 7px;
  font-family: inherit;
  color: var(--ink);
}
.add-field input:focus,
.add-field select:focus {
  outline: none;
  border-color: var(--slate);
  background: #fff;
}

.add-modal-footer {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}
.add-btn-cancel,
.add-btn-save {
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
  border: none;
}
.add-btn-cancel {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}
.add-btn-cancel:hover { background: rgba(0, 0, 0, 0.12); }
.add-btn-save {
  background: var(--slate);
  color: #fff;
  font-weight: 600;
}
.add-btn-save:hover { background: var(--ink); }

/* ── Reminders-style row ── */

.rem-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  transition: background 0.12s;
}
.rem-row:last-child { border-bottom: none; }
.rem-row:hover { background: rgba(0, 0, 0, 0.02); }
.rem-row-grace { opacity: 0.55; }
.rem-row-done .rem-title { text-decoration: line-through; opacity: 0.5; }

.rem-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--slate);
  cursor: pointer;
  margin-top: 1px;
  background: transparent;
  transition: background 0.12s, border-color 0.12s;
}
.rem-check:hover {
  border-color: var(--ink);
  background: rgba(109, 129, 150, 0.08);
}
.rem-check-done {
  background: var(--slate);
  position: relative;
}
.rem-check-done::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.rem-check-template {
  border-style: dashed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--slate);
  cursor: default;
}

.rem-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.rem-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
  word-break: break-word;
}
.rem-title-en {
  font-size: 12px;
  font-style: italic;
  color: var(--slate);
  margin-top: 1px;
  opacity: 0.85;
}
.rem-sub {
  font-size: 12px;
  color: var(--slate);
  margin-top: 3px;
}
.rem-sub-overdue { color: var(--danger); font-weight: 600; }
.rem-sub-today { color: var(--danger); }

.rem-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 4px;
}
.rem-action {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.5;
  color: var(--slate);
  transition: opacity 0.12s, background 0.12s;
}
.rem-action:hover { opacity: 1; background: rgba(109, 129, 150, 0.12); }
.rem-action-surface { font-weight: 700; }

/* Section heading inside the Reminders pages */
.rem-head {
  margin-bottom: 14px;
}
.rem-title-h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: var(--slate);
  letter-spacing: -0.02em;
}

.rem-section {
  margin-bottom: 18px;
}
.rem-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate);
  font-weight: 600;
  margin: 0 0 6px 4px;
  opacity: 0.75;
}
.rem-section-berandu .rem-section-title {
  color: var(--danger);
  opacity: 1;
}
.rem-empty {
  padding: 12px 4px;
  font-size: 12px;
  color: var(--stone);
  font-style: italic;
}

/* Horizon / tab pills (used on Inbox + Habits) */
.rem-horizon {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  margin-bottom: 4px;
  overflow-x: auto;
}
.rem-horizon-pill {
  flex: 1;
  min-width: 70px;
  padding: 7px 8px;
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--ink);
  transition: background 0.12s;
}
.rem-horizon-pill:hover { background: rgba(0, 0, 0, 0.04); }
.rem-horizon-pill.active { background: var(--paper); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.rem-horizon-eu { font-size: 12px; font-weight: 600; }
.rem-horizon-en { font-size: 10px; opacity: 0.55; font-style: italic; }

/* ── Project backlog tab strip ── */

.backlog-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 4px 2px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--stone);
}
.backlog-tabs::-webkit-scrollbar { height: 4px; }
.backlog-tabs::-webkit-scrollbar-thumb { background: var(--stone); border-radius: 2px; }

.backlog-tab {
  flex: 0 0 auto;
  padding: 6px 12px 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--stone);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.backlog-tab:hover { background: rgba(255, 255, 255, 0.7); border-color: var(--slate); }
.backlog-tab.active {
  background: var(--slate);
  color: #fff;
  border-color: var(--slate);
}
.backlog-tab.empty { opacity: 0.55; }
.backlog-tab.active.empty { opacity: 1; }

.backlog-tab-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.backlog-tab-label { font-weight: 500; }
.backlog-tab-count {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.1);
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 2px;
}
.backlog-tab.active .backlog-tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ── Hide the now-defunct bottom quickbar ── */
.quickbar { display: none !important; }

/* ─────────────────────────────────────────────────────────────────── */

/* ---------- responsive ---------- */

@media (min-width: 720px) {
  .app { padding: 24px 32px 96px; }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
  .two-col > .section + .section { margin-top: 0; }
}

/* ============================================================
   v3: subtabs, projects matrix, productivity grid, settings
   ============================================================ */

nav.tabs.primary button.gear {
  margin-left: auto;
  font-size: 18px;
  padding: 6px 10px;
}

nav.tabs.subtabs {
  border-bottom: 1px solid var(--stone);
  margin-top: -18px;
  margin-bottom: 16px;
  padding-top: 4px;
  min-height: 0;
}
nav.tabs.subtabs:empty { display: none; }
nav.tabs.subtabs button { padding: 4px 12px; line-height: 1.2; }
nav.tabs.subtabs .t-primary {
  display: inline;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
nav.tabs.subtabs .t-secondary {
  display: inline;
  font-size: 10px;
  font-style: italic;
  opacity: 0.65;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 0;
}
nav.tabs.subtabs .t-secondary::before {
  content: ' | ';
  margin: 0 3px;
  font-style: normal;
  opacity: 0.5;
}

/* ---------- Projects matrix ---------- */

.projects-matrix {
  display: grid;
  grid-auto-rows: auto;
  border: 1px solid var(--stone);
  border-radius: 10px;
  background: rgba(255,255,255,0.3);
  margin: 0;
  padding: 0;
  width: 100%;
  overflow: hidden;
}

/* Desktop breakout — on wide screens the matrix escapes the 820px .app
 * centering and takes up to 1400px of viewport width, so columns have
 * room to breathe. Mobile falls through the default (100% of .app). */
@media (min-width: 1100px) {
  .projects-matrix {
    position: relative;
    width: min(1400px, calc(100vw - 40px));
    left: 50%;
    transform: translateX(-50%);
  }
}

.pm-row {
  display: grid;
  /* Last column width is driven by --pm-last-col so the "Hurrengo hilab."
   * column can collapse to a narrow strip without touching the other
   * columns' sizing. Default: equal share (1fr). Collapsed: 48px. */
  grid-template-columns: 130px 1fr 1fr 1fr var(--pm-last-col, 1fr);
  gap: 0;
  border-top: 1px solid var(--stone);
  min-width: 0;
}
.late-section {
  border: 1px solid var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 20px;
  background: rgba(164, 85, 68, 0.04);
}
.late-section .section-title { color: var(--danger); opacity: 1; }
.pm-row:first-child { border-top: none; }
.pm-row.pm-header {
  position: sticky; top: 0;
  background: var(--paper);
  z-index: 2;
}

.pm-cell {
  padding: 8px 10px;
  border-left: 1px solid var(--stone);
  min-width: 0;
}
.pm-cell:first-child { border-left: none; }
.pm-rowhead {
  display: flex; gap: 8px; align-items: flex-start;
  background: rgba(255,255,255,0.4);
  position: sticky; left: 0;
  z-index: 1;
}
.pm-rowhead .swatch { width: 10px; height: 10px; border-radius: 3px; margin-top: 4px; flex-shrink: 0; }
.pm-rowhead .lane-title { min-width: 0; }
.pm-rowhead .title-primary { font-size: 13px; font-weight: 600; }
.pm-rowhead .title-secondary { font-size: 10px; }
.pm-colhead {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  opacity: 0.7;
  font-weight: 600;
  background: rgba(255,255,255,0.4);
}
.pm-colhead .sh-primary { display: block; margin-left: 0; }
.pm-colhead .sh-secondary { display: block; margin-left: 0; font-size: 9px; font-style: italic; text-transform: none; letter-spacing: 0; opacity: 0.6; font-weight: 400; }
.pm-data .ficha { padding: 6px 8px; margin-bottom: 4px; }
.pm-data .ficha .title-primary { font-size: 12px; }
.pm-data .ficha .title-secondary { font-size: 10px; }
.pm-data .ficha .meta { font-size: 10px; }
.pm-empty { color: var(--stone); font-size: 11px; text-align: center; padding: 4px 0; }

/* Per-cell internal scroll. A single project's "Hurrengo hilab." column
 * might hold 10+ events — without this, the row's common height blows up
 * and every other cell wastes vertical space. Mobile: no cap (pinch-scroll
 * the page instead). Desktop+: cap + internal scroll. */
@media (min-width: 700px) {
  .pm-data {
    max-height: 55vh;
    overflow-y: auto;
  }
}

/* Column-collapse toggle on the header row. The collapsible column (last
 * one, "Hurrengo hilab.") gets a small chevron next to its label; state is
 * persisted per-column in localStorage and drives --pm-last-col above. */
.pm-colhead.pm-col-collapsible {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.pm-col-collapse-toggle {
  font-size: 9px;
  opacity: 0.6;
  margin-left: 4px;
  vertical-align: middle;
}
.pm-colhead.pm-col-collapsible:hover .pm-col-collapse-toggle { opacity: 1; }

/* When a column is collapsed, its cells shrink to the narrow strip; the
 * data cells swap to a count pill so the user can see at a glance what's
 * hidden. Tap the header chevron to re-expand. */
.pm-col-collapsed .sh-secondary { display: none; }
.pm-col-collapsed .sh-primary { font-size: 10px; }
.pm-data.pm-col-collapsed { padding: 4px 6px; text-align: left; }

/* Stacked truncated titles in a collapsed column cell. 140px column width
 * with text-overflow ellipsis — readable at a glance, cheap to skim. */
.pm-col-mini-title {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  padding: 3px 2px;
  color: var(--ink);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px dashed rgba(0,0,0,0.06);
  cursor: pointer;
}
.pm-col-mini-title:last-child { border-bottom: none; }
.pm-col-mini-title:hover { opacity: 1; background: rgba(0,0,0,0.03); }

.late-section {
  border: 1px solid var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 20px;
  background: rgba(164, 85, 68, 0.04);
}
.late-section .section-title { color: var(--danger); opacity: 1; }

/* ---------- Productivity grid ---------- */

.prod-wrap {
  border: 1px solid var(--stone);
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
}
.prod-head {
  display: grid;
  grid-template-columns: 44px repeat(var(--prod-cols, 1), 1fr);
  background: rgba(255,255,255,0.5);
  border-bottom: 1px solid var(--stone);
}
.prod-corner { border-right: 1px solid var(--stone); background: rgba(255,255,255,0.35); }
.prod-day-h {
  padding: 6px 4px;
  text-align: center;
  border-left: 1px solid var(--stone);
  font-size: 11px;
}
.prod-day-h:first-child { border-left: none; }
.prod-day-label { color: var(--slate); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.prod-day-num { font-weight: 600; font-size: 14px; }

/* 1/3/7-day inline header: "AL - 20" on a single row. Tight padding — this
 * row sits flush against the project-totals strip above. */
.prod-day-h-inline { display: flex; align-items: baseline; justify-content: center; gap: 4px; padding: 3px 4px; line-height: 1.2; }
.prod-day-h-inline .prod-day-label { font-size: 10px; }
.prod-day-h-inline .prod-day-sep { color: var(--slate); font-size: 10px; }
.prod-day-h-inline .prod-day-num { font-size: 12px; }
.prod-grid {
  display: grid;
  grid-template-columns: 44px repeat(var(--prod-cols, 1), 1fr);
  height: 600px;
}
.prod-timerail {
  position: relative;
  border-right: 1px solid var(--stone);
  background: rgba(255,255,255,0.25);
}
.prod-hour {
  position: absolute;
  right: 6px;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  line-height: 1;
}
.prod-col {
  position: relative;
  border-left: 1px solid var(--stone);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(100% / 24 - 1px),
    rgba(203,203,203,0.5) calc(100% / 24 - 1px),
    rgba(203,203,203,0.5) calc(100% / 24)
  );
}
.prod-col:first-child { border-left: none; }
/* Calendar frame: narrower calendar flanked by floating side arrows. */
.prod-frame {
  display: flex;
  align-items: stretch;
  gap: 12px;
  justify-content: center;
  max-width: 100%;
}
.prod-frame .prod-wrap {
  max-width: 820px;
  width: 100%;
  flex: 1 1 820px;
  min-width: 0;
}
.prod-side-arrow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.5;
  color: var(--ink);
  user-select: none;
  min-width: 44px;
  align-self: stretch;
}
.prod-side-arrow:hover { opacity: 1; background: rgba(0,0,0,0.06); }

/* Totals per project over the visible window, shown between the nav arrows
 * and the calendar grid. Colored swatch, Basque primary + English italic
 * secondary, right-aligned hour count. */
.prod-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 6px 12px;
  margin: 0 0 2px 0;                /* flush against the grid below */
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.06);
  font-size: 11px;
  align-items: center;
  justify-content: space-between;   /* spread items edge-to-edge */
}
.prod-summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;                   /* each item claims its share */
  justify-content: flex-start;
}
.prod-summary-swatch {
  display: inline-block;
  width: 3px;                        /* vertical colored line */
  height: 22px;
  border-radius: 1.5px;
  flex: 0 0 auto;
}
.prod-summary-label {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.15;
  min-width: 0;
}
.prod-summary-name {
  font-weight: 600;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  white-space: nowrap;
}
.prod-summary-name-en {
  font-style: italic;
  opacity: 0.55;
  font-size: 9px;
  white-space: nowrap;
}
.prod-summary-hours {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  opacity: 0.8;
  margin-left: 4px;
}

/* Event blocks — timed meetings / deadlines / reminders. Dashed border in
 * the project color distinguishes them from real time-entry activity blocks. */
.prod-event {
  position: absolute;
  left: 2px; right: 2px;
  border: 1.5px dashed;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.4);
}
.prod-event-label { display: flex; align-items: center; gap: 4px; line-height: 1.2; }
.prod-event-icon { font-size: 10px; opacity: 0.8; }
.prod-event-title {
  font-weight: 600;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Completion pills — short badges at completed_at showing "✓ task title" in
 * the project color. Compact font, distinct from time-entry blocks. */
/* Completion pill — sits INSIDE the column near its right edge at
 * completed_at, with solid project-color background + high z-index so it
 * reads above any time-entry block underneath. pointer-events:none so clicks
 * pass through to the underlying block. */
.prod-done-pill {
  position: absolute;
  right: 3px;
  left: auto;
  z-index: 4;
  transform: translateY(-50%);   /* anchor pill at completed_at */
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px 1px 4px;
  border-radius: 9px;
  color: #fff;
  font-size: 9px;
  font-style: italic;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.22);
  pointer-events: none;
  max-width: 60%;                /* keeps left-side of block readable */
  overflow: hidden;
  text-overflow: ellipsis;
}
.prod-done-check { font-size: 10px; font-weight: 700; font-style: normal; }
.prod-done-title { overflow: hidden; text-overflow: ellipsis; }

.section-done .ficha { opacity: 0.7; }
.section-done .ficha.done { text-decoration: line-through; text-decoration-color: rgba(0,0,0,0.3); }

/* Section-title rows become flex so the slide toggle can sit on the right
 * of the heading (Gaur / Today    [✓ Eginda ●━━○]). */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title .sh-primary,
.section-title .sh-secondary { flex: 0 0 auto; }

/* Slide toggle — label + track with a circular thumb that slides L→R. */
.slide-toggle {
  margin-left: auto;            /* pushed to the right end of the header */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 10px;
  opacity: 0.55;
}
.slide-toggle:hover { opacity: 1; }
.slide-toggle input { display: none; }
.slide-toggle-txt {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: right;
}
.slide-toggle-eu {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-style: italic;
  font-size: 9px;
}
.slide-toggle-en { font-style: italic; opacity: 0.6; font-size: 8px; }
.slide-toggle-track {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 16px;
  background: rgba(0,0,0,0.15);
  border-radius: 8px;
  transition: background 0.15s ease;
}
.slide-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: left 0.15s ease, background 0.15s ease;
}
.slide-toggle.on .slide-toggle-track { background: var(--sage, #8EAF8D); }
.slide-toggle.on .slide-toggle-thumb { left: 14px; }

/* Undo button — same shape as the check but with a ↺ glyph, rotated into a
 * different colour palette so it doesn't look like a completion action. */
.check-undo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.15);
  color: var(--ink);
  opacity: 0.55;
  font-size: 14px;
  cursor: pointer;
}
.check-undo:hover { opacity: 1; background: rgba(0,0,0,0.05); }
.prod-block {
  position: absolute;
  left: 2px; right: 2px;
  border-radius: 4px;
  color: #fff;
  font-size: 10px;
  padding: 3px 5px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
/* Each solid block has a two-column label: Basque primary on the left, English
 * secondary on the right in greyed italic. Hides gracefully when there's not
 * enough horizontal room on phone. */
.prod-block-label { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.prod-label-left { min-width: 0; flex: 1 1 auto; }
.prod-label-right {
  text-align: right;
  font-style: italic;
  opacity: 0.55;                 /* greyer than the Basque primary */
  color: rgba(255,255,255,0.85);
  flex: 0 1 auto;
  min-width: 0;
  max-width: 50%;
}
.prod-label-right .prod-sec-line {
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* First line of the English secondary = project name. Uppercase it so it
 * visually pairs with the Basque "ERAMAN LANA" on the left while staying
 * lower-contrast. */
.prod-label-right .prod-sec-line:first-child {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Compact layout: short blocks (< 60 min) don't have room to stack 2 rows,
 * so each side flattens to a single horizontal line with the second piece of
 * info after a "|" separator. Styles on each text span stay intact — caps
 * where they were, italic where they were — only the layout collapses. */
.prod-block-compact .prod-label-left,
.prod-block-compact .prod-label-right {
  display: flex;
  flex-direction: row;
  gap: 5px;
  align-items: baseline;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.prod-block-compact .prod-label-left .prod-project,
.prod-block-compact .prod-label-left .prod-task,
.prod-block-compact .prod-label-right .prod-sec-line {
  overflow: hidden;
  text-overflow: ellipsis;
}
.prod-block-compact .prod-label-left .prod-task { margin-top: 0; }
.prod-block-compact .prod-label-left .prod-task::before,
.prod-block-compact .prod-label-right .prod-sec-line:not(:first-child)::before {
  content: "|";
  opacity: 0.4;
  margin-right: 4px;
  font-weight: normal;
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
}
.prod-block-label .prod-project {
  font-weight: 600;
  font-size: 10px;
  line-height: 1.15;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.prod-block-label .prod-task {
  font-size: 10px;
  opacity: 0.85;
  margin-top: 1px;
  line-height: 1.15;
  font-style: italic;
}

/* Overlap label: stacks BOTH entries, each with the same left/right layout as
 * solid blocks (Basque CAPS-italic on left, English grey-italic on right).
 * text-shadow for legibility over the striped background. */
.prod-block-overlap-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
  height: 100%;
  box-sizing: border-box;
  text-shadow: 0 0 4px rgba(0,0,0,0.6);
}
.prod-overlap-entry {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

/* ---------- Ezarpenak ---------- */

.settings-link {
  display: block;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--stone);
  border-radius: 8px;
  color: var(--slate);
  text-decoration: none;
}
.settings-link:hover { background: var(--slate-soft); }
.settings-subsection { margin-top: 20px; }
.settings-subsection h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  opacity: 0.6;
  margin: 0 0 8px;
  font-weight: 600;
}
.settings-item {
  padding: 8px 12px;
  border: 1px solid var(--stone);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.settings-addform {
  display: flex; gap: 6px; margin-bottom: 10px;
}
.settings-addform input[type=text] {
  flex: 1; font: inherit; font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--stone); border-radius: 8px;
  background: var(--paper); outline: none;
}
.settings-addform input[type=text]:focus { border-color: var(--slate); background: var(--slate-soft); }
.settings-add-btn {
  padding: 6px 14px; border-radius: 8px;
  background: var(--slate); color: var(--paper); font-weight: 600;
  border: 1px solid var(--slate);
}
.user-item .user-name { font-weight: 600; margin-bottom: 4px; }
.user-link-row { display: flex; gap: 6px; align-items: center; }
.user-login-link {
  flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; padding: 4px 8px;
  border: 1px solid var(--stone); border-radius: 6px;
  background: var(--paper); color: var(--slate);
  user-select: all;
}
.user-copy-btn {
  padding: 4px 12px; border-radius: 6px;
  background: var(--slate-soft); color: var(--slate);
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--stone);
}

.day-secti

/* ---------- v14: per-project diary (Notes panel) ---------- */

/* The notes toggle pill on rowheads / hero cards. Sits next to the
 * subproject collapse toggle and milestone progress bar. Small visual
 * weight so it doesn't compete with task-action affordances. */
.pn-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 22px;
  border: 1px solid var(--stone); border-radius: 6px;
  background: var(--paper);
  color: var(--slate);
  font-size: 13px;
  margin-left: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.pn-toggle:hover { background: var(--slate-soft); border-color: var(--slate); }
.pn-toggle.pn-toggle-open { background: var(--slate-soft); border-color: var(--slate); }
.pn-toggle-icon { font-size: 12px; line-height: 1; filter: grayscale(0.2); }

/* The notes row inside the projects matrix. Spans every column so the
 * panel can stretch full-width — fights the matrix's grid template by
 * using grid-column: 1 / -1 on the single inner cell. */
.pm-row.pm-row-notes {
  grid-template-columns: 1fr;     /* override: one wide cell instead of matrix cols */
  background: rgba(109, 129, 150, 0.04);
  border-top: 1px dashed var(--stone);
  border-bottom: 1px dashed var(--stone);
}
.pm-row.pm-row-notes .pm-notes-cell {
  grid-column: 1 / -1;
  padding: 12px 14px 16px;
}

/* Hero-card notes: the panel renders inside the card itself, so it just
 * needs spacing from the meta row above. */
.project-hero-notes-slot {
  width: 100%;
  margin-top: 10px;
  cursor: default;
}
.project-hero-notes-slot:empty { margin-top: 0; }

/* Common panel container. */
.project-notes {
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.project-notes-head {
  display: flex; align-items: baseline; gap: 8px;
  border-bottom: 1px solid var(--stone);
  padding-bottom: 6px; margin-bottom: 10px;
}
.project-notes-title { font-weight: 700; font-size: 14px; }
.project-notes-title-sec { color: var(--slate); font-size: 11px; font-style: italic; }
.project-notes-loading { color: var(--slate); font-style: italic; padding: 8px 0; font-size: 12px; }

.pn-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate);
}
.pn-meta {
  font-size: 10px; color: var(--slate); font-style: italic;
}

/* Summary block. The top "what & why" — typically just one of these per
 * project, edited in place. */
.pn-summary {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--stone);
}
.pn-summary-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 6px;
}

/* Entries block. A stream of dated addendums, newest first. */
.pn-entries-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 8px;
}

.pn-composer {
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(109, 129, 150, 0.04);
  border: 1px solid var(--stone);
  border-radius: 8px;
}
.pn-composer .pn-textarea { min-height: 60px; }

.pn-empty {
  color: var(--slate); font-style: italic; font-size: 12px;
  padding: 8px 0;
}

/* Single entry row. */
.pn-entry {
  border-top: 1px solid var(--stone);
  padding: 10px 0;
}
.pn-entry:first-child { border-top: none; padding-top: 4px; }
.pn-entry-head {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-bottom: 4px;
  font-size: 11px;
}
.pn-entry-date { font-weight: 600; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pn-entry-author { color: var(--slate); }
.pn-entry-edited { color: var(--slate); font-style: italic; }
.pn-entry-actions { margin-left: auto; display: flex; gap: 8px; }

.pn-link {
  background: none; border: none; padding: 0;
  color: var(--slate); font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}
.pn-link:hover { color: var(--ink); }
.pn-link-danger { color: var(--danger); }
.pn-link-danger:hover { color: var(--danger); }

/* Editor textareas — used for both summary and entries. */
.pn-textarea {
  width: 100%;
  min-height: 100px;
  padding: 8px 10px;
  border: 1px solid var(--stone); border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}
.pn-textarea:focus { outline: none; border-color: var(--slate); background: rgba(109, 129, 150, 0.04); }

.pn-actions {
  display: flex; gap: 8px; margin-top: 6px;
}
.pn-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--stone);
  cursor: pointer;
}
.pn-btn-primary {
  background: var(--slate); color: var(--paper); border-color: var(--slate);
}
.pn-btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.pn-btn-light {
  background: var(--paper); color: var(--ink);
}
.pn-btn-light:hover { background: var(--slate-soft); }
.pn-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Markdown rendering — minimal but readable. */
.pn-md { font-size: 13.5px; line-height: 1.55; color: var(--ink); }
.pn-md .md-h1 { font-size: 16px; font-weight: 700; margin: 8px 0 6px; }
.pn-md .md-h2 { font-size: 14px; font-weight: 700; margin: 8px 0 4px; }
.pn-md .md-h3 { font-size: 13px; font-weight: 600; margin: 6px 0 4px; color: var(--slate); }
.pn-md .md-p  { margin: 6px 0; }
.pn-md .md-empty { color: var(--slate); }
.pn-md .md-ul { margin: 6px 0 6px 18px; padding: 0; }
.pn-md .md-ul li { margin: 2px 0; }
.pn-md .md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: rgba(109, 129, 150, 0.10);
  padding: 1px 5px; border-radius: 4px;
}
.pn-md .md-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: rgba(109, 129, 150, 0.08);
  border: 1px solid var(--stone);
  padding: 8px 10px; border-radius: 6px;
  overflow-x: auto;
  white-space: pre;
  margin: 8px 0;
}
.pn-md .md-quote {
  border-left: 3px solid var(--stone);
  padding: 2px 10px;
  color: var(--slate);
  font-style: italic;
  margin: 6px 0;
}

@media (max-width: 720px) {
  .pn-entry-actions { margin-left: 0; flex-basis: 100%; }
  .pn-textarea { font-size: 12px; }
  .project-notes { padding: 10px; }
}

/* On the project detail screen the notes panel is collapsible — a
 * clickable header bar shows the title + chevron, the body slides in
 * underneath when expanded. Defaults to collapsed; state persists in
 * localStorage. */
.project-detail-notes {
  margin: 12px 0 16px;
}
.project-detail-notes-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.project-detail-notes-toggle:hover {
  background: var(--slate-soft);
  border-color: var(--slate);
}
.project-detail-notes-toggle.open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}
.project-detail-notes-chev {
  width: 12px;
  display: inline-block;
  color: var(--slate);
  font-size: 12px;
}
.project-detail-notes-icon { font-size: 13px; }
.project-detail-notes-title {
  font-weight: 700;
  font-size: 13px;
}
.project-detail-notes-title-sec {
  color: var(--slate);
  font-size: 11px;
  font-style: italic;
}
.project-detail-notes-body .project-notes {
  /* When expanded, the panel hangs off the bottom of the toggle bar —
   * merge their borders so it reads as one connected block. */
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
/* The toggle bar above already shows "📝 Oharrak · Notes", so the
 * panel's own internal header is redundant on the detail screen. Keep
 * it on the Proiektuak overview where there's no outer header. */
.project-detail-notes-body .project-notes-head { display: none; }
.project-detail-notes-body .project-notes { padding-top: 10px; }
