/* Board / calendar / matrix views (FE-VIEWS). Uses tokens.css variables only. */

/* ---------- shared ---------- */
.vw { --vw-gap: 12px; color: var(--label); font: var(--t-body); letter-spacing: var(--tr-body); }
.vw-icon { flex: none; display: block; }
.vw-spacer { flex: 1 1 auto; }
.vw-count {
  flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--fill-3); color: var(--label-2); font: var(--t-caption); line-height: 20px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.vw-icon-btn {
  flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--label-2); cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.vw-icon-btn:hover { background: var(--fill-3); color: var(--label); }
.vw-btn {
  height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: var(--fill-3);
  color: var(--label); font: var(--t-headline); font-size: 13px; cursor: pointer;
}
.vw-btn:hover { background: var(--fill-2); }
.vw-btn-primary { background: var(--accent-fill); color: #fff; }
.vw-btn-primary:hover { background: var(--accent-fill-hover); }
.vw-btn-danger { background: var(--red-fill); color: #fff; }
.vw :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.vw-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: var(--r-xs);
  background: var(--fill-4); color: var(--label-2); font: var(--t-caption); white-space: nowrap;
}
.vw-label { color: var(--purple-text); background: var(--fill-4); }
.vw-label::before { content: "@"; opacity: .6; margin-right: -2px; }
.vw-plain { background: transparent; padding: 0 2px; }
.vw-sub.is-complete { color: var(--green-text); }
.vw-due.tone-overdue { color: var(--red); background: var(--red-soft); }
.vw-due.tone-today { color: var(--green-text); background: var(--green-soft); }
.vw-due.tone-tomorrow { color: var(--orange-text); background: var(--orange-soft); }
.vw-due.tone-soon { color: var(--purple-text); }
.vw-due.tone-later { color: var(--label-2); }

.vw-avatar {
  flex: none; display: inline-grid; place-items: center; border-radius: 50%; background: var(--av, var(--c0));
  color: #fff; font: 600 10px/1 var(--font-text); letter-spacing: .02em; box-shadow: 0 0 0 1.5px var(--surface);
}
.vw-avatar-sm { width: 22px; height: 22px; }
.vw-avatar-md { width: 28px; height: 28px; font-size: 12px; }

.vw-check {
  --ring: var(--label-3);
  flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin: 1px 0 0; padding: 0;
  border: 1.5px solid var(--ring); border-radius: 50%; background: transparent; color: transparent; cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1), transform var(--dur-press);
}
.vw-check.prio-1 { --ring: var(--p1); } .vw-check.prio-2 { --ring: var(--p2); } .vw-check.prio-3 { --ring: var(--p3); }
.vw-check:hover { color: var(--ring); background: var(--fill-4); }
.vw-check:active { transform: scale(.88); }
.vw-check.is-done { border-color: var(--green); background: var(--green); color: #fff; }

.vw-empty { padding: 18px 12px; text-align: center; color: var(--label-2); }
.vw-empty-title { font: var(--t-headline); font-size: 13px; color: var(--label-2); }
.vw-empty-hint { font: var(--t-footnote); color: var(--label-3); margin-top: 2px; }

.vw-composer { display: grid; gap: 4px; }
.vw-composer-input {
  width: 100%; box-sizing: border-box; height: 36px; padding: 0 10px; border: 1px solid var(--tint);
  border-radius: var(--r-md); background: var(--field-bg); color: var(--label); font: var(--t-body);
  box-shadow: 0 0 0 3px var(--accent-soft); outline: none;
}
.vw-composer.is-error .vw-composer-input { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.vw-composer-hint { padding: 0 4px; font: var(--t-caption); color: var(--label-3); min-height: 14px; }
.vw-composer-hint.has-preview { color: var(--tint-text); }

.vw-menu {
  position: absolute; z-index: 30; top: 40px; right: 6px; min-width: 210px; max-width: 260px; padding: 6px;
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-pop);
  animation: vw-pop var(--dur-2) var(--ease-spring);
}
.vw-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--label); font: var(--t-body); text-align: left; cursor: pointer;
}
.vw-menu-item:hover { background: var(--fill-3); }
.vw-menu-item.is-danger { color: var(--red); }
.vw-menu-text { padding: 6px 8px 10px; font: var(--t-callout); color: var(--label-2); }
.vw-menu-actions { display: flex; justify-content: flex-end; gap: 6px; }

.vw-seg { display: inline-flex; padding: 2px; border-radius: var(--r-sm); background: var(--fill-3); }
.vw-seg-btn {
  height: 26px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; color: var(--label);
  font: var(--t-headline); font-size: 13px; cursor: pointer;
}
.vw-seg-btn[aria-selected="true"] { background: var(--seg-thumb); box-shadow: var(--shadow-1); }

/* drag & drop */
.vw .is-draggable { touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.vw .is-pressing { transform: scale(.98); transition: transform var(--dur-2) var(--ease-out); }
.vw-ghost-layer {
  position: fixed !important; inset: 0; z-index: 1000; display: block !important; width: auto !important;
  height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important;
  overflow: visible !important; pointer-events: none; background: none !important; box-shadow: none !important;
}
.vw-ghost {
  position: fixed !important; top: 0; left: 0; z-index: 1000; margin: 0 !important; pointer-events: none;
  border-radius: var(--r-lg); background: var(--surface); overflow: hidden;
  box-sizing: border-box; box-shadow: var(--shadow-pop) !important; opacity: .96; rotate: 1.5deg; scale: 1.03;
  will-change: transform; transition: rotate var(--dur-2) var(--ease-spring), scale var(--dur-2) var(--ease-spring);
}
.vw-placeholder {
  flex: none; box-sizing: border-box; border: 2px dashed var(--tint); border-radius: var(--r-lg);
  background: var(--accent-soft); opacity: .7;
}
.vw .is-drag-source { opacity: .35; }
.bv .bv-card.is-drag-source { display: none; }
html.vw-dragging, html.vw-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.vw .is-dropped { animation: vw-drop var(--dur-4) var(--ease-spring); }
@keyframes vw-drop {
  0% { transform: scale(.94); box-shadow: 0 0 0 2px var(--tint); }
  100% { transform: none; }
}
@keyframes vw-pop { from { opacity: 0; transform: scale(.94) translateY(-4px); } }

/* ---------- board ---------- */
.bv {
  display: flex; align-items: flex-start; gap: var(--vw-gap); height: 100%; min-height: 420px; box-sizing: border-box;
  padding: 4px 16px 16px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scroll-padding-inline: 16px;
}
.bv-col {
  position: relative; flex: 0 0 292px; display: flex; flex-direction: column; max-height: 100%; box-sizing: border-box;
  border-radius: var(--r-xl); background: var(--fill-4); transition: background var(--dur-1), box-shadow var(--dur-1);
}
.bv-col.is-over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--tint); }
.bv-col-head { position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px 14px; min-height: 30px; }
.bv-col-title { flex: 0 1 auto; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: var(--t-headline); }
.bv-col-head .vw-icon-btn { margin-left: auto; }
.bv-col-head .vw-count + .vw-icon-btn { margin-left: auto; }
.bv-done-dot { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff; }
.bv-rename {
  flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--tint); border-radius: var(--r-sm);
  background: var(--field-bg); color: var(--label); font: var(--t-headline); outline: none; box-shadow: 0 0 0 3px var(--accent-soft);
}
.bv-list {
  display: flex; flex-direction: column; gap: 8px; min-height: 64px; padding: 4px 8px 8px; overflow-y: auto;
  overscroll-behavior-y: contain;
}
.bv-card {
  position: relative; display: grid; gap: 7px; padding: 10px 12px 10px 14px; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-1); cursor: pointer; overflow: hidden;
  transition: box-shadow var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.bv-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; }
.bv-card.prio-1::before { background: var(--p1); }
.bv-card.prio-2::before { background: var(--p2); }
.bv-card.prio-3::before { background: var(--p3); }
@media (hover: hover) { .bv-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); } }
.bv-card-row { display: flex; align-items: flex-start; gap: 9px; }
.bv-card-title { flex: 1; min-width: 0; font: var(--t-body); overflow-wrap: anywhere; }
.bv-card-labels, .bv-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding-left: 27px; }
.bv-card.is-done .bv-card-title { color: var(--label-2); text-decoration: line-through; text-decoration-color: var(--label-3); }
.bv-card.is-done::before { background: transparent; }
.is-done-col .bv-card { box-shadow: var(--shadow-1); opacity: .82; }
.bv-add {
  display: flex; align-items: center; gap: 6px; margin: 0 8px 8px; padding: 8px 8px; border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--label-2); font: var(--t-callout); cursor: pointer; text-align: left;
}
.bv-add:hover { background: var(--fill-3); color: var(--tint-text); }
.bv-composer { margin: 0 8px 8px; }
.bv-col-ghost {
  flex: 0 0 220px; flex-direction: row; align-items: center; justify-content: center; gap: 6px; min-height: 52px;
  border: 1.5px dashed var(--separator-opaque); background: transparent; color: var(--label-2); font: var(--t-headline);
  cursor: pointer;
}
.bv-col-ghost:hover { border-color: var(--tint); color: var(--tint-text); background: var(--accent-soft); }
.bv-col-new { padding: 10px; }
.bv-new-form { display: grid; gap: 8px; }
.bv .vw-empty { border: 1.5px dashed var(--separator); border-radius: var(--r-lg); padding: 14px 10px; }

/* ---------- calendar ---------- */
.cv { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 16px; box-sizing: border-box; }
.cv-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.cv-title { margin: 0 auto 0 0; font: var(--t-title2); letter-spacing: var(--tr-title2); }
.cv-nav { display: flex; align-items: center; gap: 4px; }
.cv-step { background: var(--fill-3); color: var(--label); }
.cv.is-loading .cv-body { opacity: .6; transition: opacity var(--dur-2); }
.cv-month { border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.cv-weekdays, .cv-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cv-weekdays > div {
  padding: 8px 10px; font: var(--t-caption); color: var(--label-2); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: var(--hairline) solid var(--separator);
}
.cv-weekdays > .is-weekend { color: var(--label-3); }
.cv-day {
  position: relative; display: flex; flex-direction: column; gap: 3px; min-height: 108px; padding: 6px 6px 8px;
  border-right: var(--hairline) solid var(--separator); border-bottom: var(--hairline) solid var(--separator);
  box-sizing: border-box; cursor: default; transition: background var(--dur-1);
}
.cv-day:nth-child(7n) { border-right: 0; }
.cv-day:nth-last-child(-n+7) { border-bottom: 0; }
.cv-day.is-weekend { background: var(--fill-4); }
.cv-day.is-other .cv-num { color: var(--label-3); }
.cv-day.is-over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--tint); }
.cv-day-head { display: flex; justify-content: flex-end; }
.cv-num {
  min-width: 24px; height: 24px; padding: 0 6px; box-sizing: border-box; border-radius: var(--r-pill);
  font: var(--t-headline); font-size: 13px; line-height: 24px; text-align: center; font-variant-numeric: tabular-nums;
}
.cv-day.is-today .cv-num { background: var(--red-fill); color: #fff; }
.cv-pills { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cv-pill {
  --pc: var(--label-3);
  display: flex; align-items: center; gap: 5px; min-width: 0; height: 22px; padding: 0 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--pc) 14%, transparent); color: var(--label); font: var(--t-footnote);
  font-size: 12px; cursor: pointer; transition: background var(--dur-1);
}
.cv-pill:hover { background: color-mix(in srgb, var(--pc) 24%, transparent); }
.cv-pill-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--pc); }
.cv-pill-time { flex: none; color: var(--label-2); font-variant-numeric: tabular-nums; }
.cv-pill-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-pill.is-overdue { background: var(--red-soft); color: var(--red); }
.cv-pill.is-overdue .cv-pill-dot { background: var(--red); }
.cv-pill.is-done { opacity: .55; }
.cv-pill.is-done .cv-pill-title { text-decoration: line-through; }
.cv-more {
  align-self: flex-start; padding: 1px 6px; border: 0; border-radius: 6px; background: transparent;
  color: var(--label-2); font: var(--t-caption); cursor: pointer;
}
.cv-more:hover { background: var(--fill-3); color: var(--label); }
.cv-day.is-expanded {
  z-index: 20; min-height: 100%; height: max-content; margin: -4px; padding: 10px; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-pop); animation: vw-pop var(--dur-2) var(--ease-out);
}
.cv-composer { margin-top: 2px; }
.cv-composer .vw-composer-input { height: 28px; padding: 0 8px; font: var(--t-footnote); }
.cv-composer .vw-composer-hint { display: none; }

.cv-agenda { display: flex; flex-direction: column; gap: 10px; max-width: 760px; margin: 0 auto; width: 100%; }
.cv-aday { border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-1); padding: 4px 0 6px; transition: box-shadow var(--dur-1); }
.cv-aday.is-over { box-shadow: inset 0 0 0 2px var(--tint), var(--shadow-1); background: var(--accent-soft); }
.cv-aday-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 6px 14px; }
.cv-aday-num {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  font: var(--t-title3); font-variant-numeric: tabular-nums; background: var(--fill-4);
}
.cv-aday.is-today .cv-aday-num { background: var(--red-fill); color: #fff; }
.cv-aday-name { display: grid; flex: 1; min-width: 0; }
.cv-aday-wd { font: var(--t-headline); }
.cv-aday-month { font: var(--t-footnote); color: var(--label-2); }
.cv-aday.is-today .cv-aday-month { color: var(--red); }
.cv-aday.is-past:not(.is-today) .cv-aday-head { opacity: .6; }
.cv-aday-list { display: flex; flex-direction: column; padding: 0 6px; }
.cv-aday-empty { padding: 2px 8px 8px 58px; font: var(--t-footnote); color: var(--label-3); }
.cv-item, .mx-item { position: relative; }
.cv-item + .cv-item::before, .mx-item + .mx-item::before {
  content: ""; position: absolute; top: 0; left: 40px; right: 6px; height: 1px; background: var(--separator);
  transform: scaleY(.6); transform-origin: top;
}
.cv-item.is-drag-source::before, .mx-item.is-drag-source::before { display: none; }
.cv-item > .cv-pill { height: 30px; margin: 3px 0; }
.cv-aday .cv-composer { padding: 4px 10px 6px; }

/* ---------- matrix ---------- */
.mx {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(260px, 1fr);
  gap: var(--vw-gap); height: 100%; min-height: 560px; padding: 4px 16px 16px; box-sizing: border-box;
}
.mx-q {
  --qc: var(--label-3);
  display: flex; flex-direction: column; min-height: 0; border-radius: var(--r-xl); background: var(--surface);
  box-shadow: var(--shadow-1); overflow: hidden; transition: box-shadow var(--dur-1), background var(--dur-1);
}
.mx-q1 { --qc: var(--p1); } .mx-q2 { --qc: var(--p2); } .mx-q3 { --qc: var(--p3); }
.mx-q.is-over { box-shadow: inset 0 0 0 2px var(--qc), var(--shadow-2); background: color-mix(in srgb, var(--qc) 7%, var(--surface)); }
.mx-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px 10px 14px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--qc) 10%, transparent), transparent);
}
.mx-badge { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--qc); color: #fff; }
.mx-titles { display: grid; flex: 1; min-width: 0; }
.mx-title { margin: 0; font: var(--t-headline); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-hint { font: var(--t-footnote); color: var(--label-2); }
.mx-toggle { display: none; }
.mx-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 6px 8px; overscroll-behavior-y: contain; }
.mx-list { display: flex; flex-direction: column; }
.mx-fallback { padding: 10px 8px; cursor: pointer; }
.mx-add {
  display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 4px; padding: 8px; border: 0;
  border-radius: var(--r-md); background: transparent; color: var(--label-2); font: var(--t-callout); cursor: pointer;
}
.mx-add:hover { background: var(--fill-4); color: var(--tint-text); }
.mx-composer { padding: 6px 4px 2px; }

/* ---------- phones ---------- */
@media (max-width: 680px) {
  .bv { gap: 10px; padding: 4px 16px 16px; scroll-snap-type: x mandatory; }
  .bv-col { flex-basis: 85vw; scroll-snap-align: start; }
  .bv-col-ghost { flex-basis: 60vw; }
  .bv-card { padding: 12px 14px 12px 16px; }
  .vw-check { width: 22px; height: 22px; }
  .bv-card-labels, .bv-card-meta { padding-left: 31px; }
  .cv { padding: 0 16px 16px; }
  .cv-title { width: 100%; font: var(--t-title3); }
  .cv-toolbar .vw-seg { margin-left: auto; }
  .cv-day { min-height: 64px; padding: 3px; }
  .cv-pill { height: 18px; padding: 0 4px; font-size: 10px; }
  .cv-pill-time, .cv-pill-dot { display: none; }
  .cv-weekdays > div { padding: 6px 4px; text-align: center; }
  .cv-day-head { justify-content: center; }
  .mx { display: flex; flex-direction: column; height: auto; min-height: 0; padding: 0 16px 16px; }
  .mx-q { flex: none; }
  .mx-toggle { display: inline-grid; transition: transform var(--dur-2) var(--ease-out); }
  .mx-q.is-collapsed .mx-toggle { transform: rotate(-90deg); }
  .mx-q.is-collapsed .mx-body { display: none; }
  .mx-body { max-height: none; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .vw *, .vw-ghost { animation: none !important; transition: none !important; }
  .vw-ghost { rotate: none; scale: none; }
}
