@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;800&family=Noto+Sans+KR:wght@400;500;600;700&family=Outfit:wght@500;650;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,400..600,0..1,0&display=swap");
@import url("./tokens.css");

.mi {
  font-family: "Material Symbols Outlined", sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 1.15em;
  line-height: 1;
  letter-spacing: normal;
  display: inline-block;
  vertical-align: -0.18em;
  user-select: none;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

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

html {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: calc(100% / 12) 4.5rem;
  background-attachment: fixed;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  animation: page-in 0.22s ease-out;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ink);
}

html {
  scroll-padding-top: calc(var(--nav-h) + var(--space-3));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: transparent;
  border-bottom: 1px solid var(--bp-cyan);
  /* Sticky chrome must not steal clicks from content scrolled underneath */
  pointer-events: none;
}

.site-header a,
.site-header button,
.site-header input,
.site-header select {
  pointer-events: auto;
}

.site-header__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--nav-h);
  font-family: var(--font-nav);
}

.brand {
  font-family: var(--font-nav);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bp-navy);
  text-decoration: none;
}

.brand span {
  color: var(--bp-cyan);
}

.nav {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.nav a {
  color: var(--bp-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  padding: var(--space-1) 0;
}

.nav a:hover {
  color: var(--bp-navy);
}

.nav a[aria-current="page"] {
  color: var(--bp-navy);
  font-weight: 650;
  box-shadow: inset 0 -2px 0 var(--bp-cyan);
}

.main {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-5) var(--space-7);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-head h1 {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.045em;
  line-height: 0.95;
  text-transform: lowercase;
  max-width: 14ch;
}

.page-head h1::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 3px;
  background: var(--signal);
  margin-top: 0.45rem;
}

.page-head p {
  margin: var(--space-3) 0 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  max-width: 36rem;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper-solid);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.btn:hover {
  background: var(--paper-solid);
  border-color: var(--signal);
}

.btn--primary {
  background: var(--signal);
  border-color: var(--signal);
  color: #fff;
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--signal) 88%, #000);
  border-color: color-mix(in srgb, var(--signal) 88%, #000);
  color: #fff;
}

.btn--ghost {
  background: transparent;
}

.weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
}

.weekdays {
  margin-bottom: 0;
}

.weekdays div {
  background: transparent;
  padding: 0.4rem 0;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid rgba(20, 24, 40, 0.28);
}

.weekdays .sun {
  color: var(--signal);
}

.cal-grid {
  border: 1px solid var(--line);
}

.day {
  background: var(--paper-2);
  min-height: 7.5rem;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.day:nth-child(7n) {
  border-right: none;
}

.day:hover {
  background: var(--paper-solid);
}

.day--muted {
  opacity: 0.4;
}

.day--today {
  background: var(--paper-solid);
  box-shadow: inset 0 0 0 2px var(--signal);
}

.day__num {
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-1);
}

.day--today .day__num {
  color: var(--signal);
}

.task {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.35rem;
  row-gap: 0.15rem;
  align-items: center;
  font-size: 0.72rem;
  line-height: 1.25;
}

.task__icon {
  grid-row: 1 / span 2;
  font-size: 0.85rem;
  line-height: 1;
}

.task__pri {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--ink-muted);
}

.task__pri[data-level="3"] {
  background: var(--sun);
}

.task__pri[data-level="2"] {
  background: var(--accent);
}

.task__pri[data-level="1"] {
  background: var(--sage);
}

.task__title {
  grid-column: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task--done .task__title {
  text-decoration: line-through;
  color: var(--done);
}

.task__bar {
  grid-column: 2 / span 2;
  height: 2px;
  background: color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 1px;
  overflow: hidden;
}

.task__bar > i {
  display: block;
  height: 100%;
  background: var(--signal);
}

.overflow {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--signal);
  margin-top: auto;
  padding-top: var(--space-1);
}

.panel {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--line);
}

.panel summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-muted);
  list-style: none;
}

.panel summary::-webkit-details-marker {
  display: none;
}

.panel summary::before {
  content: "+ ";
  color: var(--accent);
}

.panel[open] summary::before {
  content: "− ";
}

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.chip {
  border: 1px dashed var(--line);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius);
  background: transparent;
}

.stats-placeholder {
  margin-top: var(--space-3);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.layout-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 0.9fr);
  gap: var(--space-5);
  align-items: start;
}

@media (max-width: 900px) {
  .layout-split {
    grid-template-columns: 1fr;
  }

  .day {
    min-height: 5.5rem;
  }
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data th,
table.data td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

table.data th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.85);
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tr.is-selected {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 3px 0 0 var(--signal);
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.badge--derived {
  border-style: dashed;
  color: var(--ink-muted);
}

.form-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: var(--space-4);
}

.form-card h2 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: var(--space-3);
}

.field label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.field input,
.field select,
.field textarea {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

.field textarea {
  min-height: 4rem;
  resize: vertical;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.note {
  margin-top: var(--space-4);
  padding: var(--space-3);
  border-left: 3px solid var(--signal);
  background: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.hero-links {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.hero-links a {
  display: block;
  padding: var(--space-4);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hero-links a:hover {
  background: var(--paper-solid);
  border-color: var(--signal);
}

.hero-links strong {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  display: block;
  margin-bottom: var(--space-1);
}

.checklist {
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.checklist li::before {
  content: "□ ";
  color: var(--accent);
}

.settings-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: var(--space-3);
  align-items: end;
  padding: var(--space-3);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

@media (max-width: 600px) {
  .settings-row {
    grid-template-columns: 1fr;
  }

  .site-header__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* —— Calendar with control rail —— */
.cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: var(--space-5);
  align-items: start;
}

@media (max-width: 960px) {
  .cal-layout {
    grid-template-columns: 1fr;
  }
}

.planner-title {
  margin-bottom: var(--space-4);
}

.planner-title h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.95;
  text-transform: lowercase;
  max-width: 14ch;
}

.planner-title h1::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 3px;
  background: var(--signal);
  margin-top: 0.45rem;
}

.planner-title p {
  margin: var(--space-3) 0 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.ym-label {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}

.cal-rail {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.cal-rail h2 {
  margin: 0 0 0.45rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.year-spin {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.year-spin output {
  flex: 1;
  text-align: center;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  border: 1px solid var(--line);
  padding: 0.35rem;
  background: var(--paper-solid);
}

.year-spin .spin-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.year-spin .spin-btns button {
  padding: 0.15rem 0.45rem;
  line-height: 1;
  font-size: 0.7rem;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.month-grid button {
  appearance: none;
  border: 1px solid var(--line-soft);
  background: var(--paper-solid);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0;
  line-height: 1.2;
  cursor: pointer;
  border-radius: var(--radius);
}

.month-grid button[aria-pressed="true"] {
  background: var(--signal);
  border-color: var(--signal);
  color: #fff;
  font-weight: 700;
}

.month-grid button:hover {
  border-color: var(--line);
}

.start-day select,
.start-day #week-start {
  width: 100%;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
  line-height: 1.2;
  height: auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

#cal-filter-reset {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  line-height: inherit;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink);
  height: auto;
  box-sizing: border-box;
}

#cal-filter-reset:hover {
  background: var(--paper-solid);
  border-color: var(--signal);
}

/* —— Todos: metrics left + filter right —— */
.dash-lean {
  margin-bottom: var(--space-5);
}

.dash-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
  align-items: stretch;
}

@media (max-width: 960px) {
  .dash-panel {
    grid-template-columns: 1fr;
  }
}

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.72);
  border-left: 1px solid var(--line);
  min-width: 0;
}

@media (max-width: 960px) {
  .filter-bar {
    border-left: none;
    border-top: 1px solid var(--line);
  }
}

.filter-bar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.filter-bar__row--primary {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}

.filter-bar__groups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-width: 0;
}

.filter-bar__row--category {
  padding-left: 0;
  padding-top: var(--space-1);
  border-top: 1px dashed var(--line);
}

.filter-bar__row--category .slicer-group {
  width: 100%;
}

.filter-bar__label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-muted);
  flex: 0 0 auto;
}

.filter-bar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
}

.filter-bar__reset {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 0.55rem;
  line-height: 1;
  height: 1.85rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}

.filter-bar .slicer-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.filter-bar .slicer-group > span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  min-width: 2.75rem;
}

.filter-bar .slicer-group button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink);
}

.filter-bar .slicer-group button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.filter-bar .slicer-group button[aria-pressed="false"] {
  color: var(--ink-muted);
  opacity: 0.7;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(9rem, 0.5fr);
  gap: 0;
  align-items: stretch;
  min-width: 0;
}

@media (max-width: 720px) {
  .summary-row {
    grid-template-columns: 1fr;
  }
}

.summary-row .metric-card {
  min-height: 0;
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: var(--space-3);
}

.summary-row .metric-card--status {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}

@media (max-width: 720px) {
  .summary-row .metric-card--status {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .filter-bar__row--category {
    padding-left: 0;
  }
}

.status-board {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.stat--total {
  flex: 0 0 auto;
  padding-right: var(--space-3);
  border-right: 1px solid var(--line);
}

.stat--total .stat__num {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.05rem;
}

.status-breakdown {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.status-stats--compact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.15rem 0.35rem;
  justify-items: center;
}

.status-stats--compact .stat {
  gap: 0.25rem;
}

.status-stats--compact .stat__num {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1rem;
}

.status-stats--compact .stat__label {
  font-size: 0.68rem;
}

.summary-row .metric-card--status .status-strip {
  height: 0.55rem;
  width: 100%;
}

.status-rate {
  flex: 0 0 auto;
  padding-left: var(--space-3);
  border-left: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-rate .donut {
  width: 4.75rem;
  height: 4.75rem;
}

.status-rate .donut__hole {
  width: 3.35rem;
  height: 3.35rem;
}

.summary-row .metric-card--priority {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-row .metric-card--priority .pri-chart {
  width: 100%;
  max-width: 18rem;
  margin: 0 auto;
  justify-content: space-evenly;
  gap: 0.75rem;
  border-bottom: none;
}

.summary-row .metric-card--priority .pri-stack {
  width: 1.85rem;
  height: 4.25rem;
}

.week-scope {
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  margin: 0.35rem 0 0;
}

.dash-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: stretch;
  min-width: 0;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(26, 31, 28, 0.06);
  padding: var(--space-3) var(--space-4);
}

.metric-card--status {
  flex: 1 1 17rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.metric-card--priority {
  flex: 0 0 11.5rem;
  display: flex;
  align-items: stretch;
}

.status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.status-stats {
  display: flex;
  gap: 0.65rem;
  flex: 1;
  justify-content: space-between;
  min-width: 0;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.stat__label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
}

.stat__label--muted {
  color: var(--ink-muted);
  font-weight: 600;
}

.stat__label--run {
  color: #3d9b6a;
}

.stat__label--done {
  color: #4a7eb5;
}

.stat__num {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  background: #4a4f4c;
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
}

.donut {
  --p: 30;
  width: 4.6rem;
  height: 4.6rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(#8eb6d8 calc(var(--p) * 1%), #e4e4e4 0);
  display: grid;
  place-items: center;
}

.donut__hole {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.donut__hole strong {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.donut__hole span {
  font-size: 0.58rem;
  color: var(--ink-muted);
  margin-top: 0.1rem;
}

.status-strip {
  display: grid;
  height: 0.45rem;
  border-radius: 999px;
  overflow: hidden;
  background: #ececec;
}

.status-strip i {
  display: block;
  height: 100%;
}

.seg-wait {
  background: #d8d8d8;
}
.seg-run {
  background: #9fd4b5;
}
.seg-done {
  background: #9ec0df;
}

.pri-chart {
  display: flex;
  width: 100%;
  align-items: flex-end;
  justify-content: space-around;
  gap: 0.35rem;
  padding-top: 0.15rem;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0;
}

.pri-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.pri-frac {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink);
}

.pri-stack {
  --fill: 33%;
  width: 1.55rem;
  height: 4.2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 2px 2px 0 0;
  overflow: hidden;
}

.pri-stack__done {
  height: var(--fill);
  min-height: 2px;
}

.pri-stack__rest {
  flex: 1;
  opacity: 0.55;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.55) 2px,
    rgba(255, 255, 255, 0.55) 4px
  );
  background-blend-mode: soft-light;
}

.pri-high {
  background-color: #e8a090;
}
.pri-stack__done.pri-high {
  background-color: #d97868;
  background-image: none;
  opacity: 1;
}

.pri-mid {
  background-color: #e8d090;
}
.pri-stack__done.pri-mid {
  background-color: #d4b84a;
  background-image: none;
  opacity: 1;
}

.pri-low {
  background-color: #a8d4b0;
}
.pri-stack__done.pri-low {
  background-color: #6db87a;
  background-image: none;
  opacity: 1;
}

.pri-name {
  font-size: 0.72rem;
  color: var(--ink-muted);
  padding: 0.35rem 0 0.1rem;
}

.slicer-bank {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: var(--space-3);
}

.slicer-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.slicer-group > span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  min-width: 3.5rem;
}

.slicer-group button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.slicer-group button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.date-slicer {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  max-height: 9.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  scrollbar-width: thin;
  align-self: stretch;
}

.date-slicer button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 0.22rem 0.4rem;
  font: inherit;
  cursor: pointer;
  color: var(--ink-muted);
  line-height: 1.2;
}

.date-slicer button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.95);
  color: var(--signal);
  font-weight: 700;
  box-shadow: inset 2px 0 0 var(--signal);
}

.todos-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(20rem, 0.7fr);
  gap: var(--space-4);
  align-items: start;
}

@media (max-width: 960px) {
  .todos-workspace {
    grid-template-columns: 1fr;
  }

  .editor-pane {
    position: static;
  }
}

.todos-list-pane {
  min-width: 0;
}

.list-pane__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

#btn-new-side {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  line-height: 1.2;
  height: auto;
  min-height: 0;
  box-sizing: border-box;
}

.list-pane__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.list-pane__hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.table-wrap--workspace {
  max-height: min(28rem, 55vh);
  overflow: auto;
}

table.data tbody tr {
  cursor: pointer;
}

table.data tbody tr:hover {
  background: rgba(255, 255, 255, 0.95);
}

.editor-pane {
  position: sticky;
  top: calc(var(--nav-h) + var(--space-3));
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.editor-form {
  padding: var(--space-4);
}

.editor-pane__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
}

.editor-pane__eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.editor-pane__head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: keep-all;
}

.editor-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.editor-form .field {
  min-width: 0;
}

.editor-form .field input,
.editor-form .field select,
.editor-form .field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.editor-form .field input[type="date"] {
  min-width: 0;
}

.progress-edit {
  display: grid;
  grid-template-columns: 1fr 3.5rem;
  gap: var(--space-2);
  align-items: center;
}

.progress-edit input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.progress-edit input[type="number"] {
  font-family: var(--font-mono);
  text-align: center;
}

.field-live {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
}

.derived-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.editor-actions {
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.editor-form.is-empty #btn-delete,
.editor-form.is-empty #link-cal {
  display: none;
}

.todos-body {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(14rem, 0.7fr);
  gap: var(--space-4);
  align-items: start;
}

@media (max-width: 1000px) {
  .todos-body {
    grid-template-columns: 1fr;
  }
}

.prog {
  position: relative;
  height: 1.15rem;
  background: rgba(20, 24, 40, 0.06);
  border: 1px solid var(--line-soft);
  border-radius: 0;
  overflow: hidden;
  min-width: 4.5rem;
}

.prog > i {
  display: block;
  height: 100%;
  background: var(--signal);
}

.prog > b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink);
}

.dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  display: inline-block;
}

.dot[data-level="3"] {
  background: var(--pri-high);
}
.dot[data-level="2"] {
  background: var(--pri-mid);
}
.dot[data-level="1"] {
  background: var(--pri-low);
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.widget {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: var(--space-3);
}

.widget h3 {
  margin: 0 0 var(--space-2);
  font-size: 0.8rem;
  font-weight: 700;
}

.widget textarea {
  width: 100%;
  min-height: 4.5rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem;
  resize: vertical;
}

.habit {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.habit th,
.habit td {
  border: 1px solid var(--line);
  padding: 0.3rem;
  text-align: center;
}

.habit th {
  background: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.habit td:first-child,
.habit th:first-child {
  text-align: left;
  font-weight: 500;
}

.help-mini {
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* —— Mandalart —— */
.mandala-layout {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

@media (max-width: 800px) {
  .mandala-layout {
    grid-template-columns: 1fr;
  }
}

.mandala-aside h1 {
  margin: 0 0 var(--space-3);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-transform: lowercase;
  max-width: 12ch;
}

.mandala-aside h1::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 3px;
  background: var(--signal);
  margin-top: 0.45rem;
}

.mandala-quote {
  border: 1px solid var(--line);
  background: #fff;
  padding: var(--space-4);
  font-size: 0.9rem;
  color: var(--ink-muted);
  text-align: center;
}

.mandala-deco {
  margin-top: var(--space-5);
  height: 2px;
  background: var(--line);
  position: relative;
}

.mandala-deco::after {
  content: "";
  position: absolute;
  left: 1rem;
  top: 1.2rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  opacity: 0.6;
}

.m9 {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(2.6rem, 1fr));
  gap: 1px;
  background: var(--ink);
  border: 1px solid var(--ink);
  aspect-ratio: 1;
  max-width: 42rem;
  margin-left: auto;
}

.m9 input {
  width: 100%;
  height: 100%;
  border: none;
  margin: 0;
  padding: 0.2rem;
  font: inherit;
  font-size: clamp(0.55rem, 1.1vw, 0.72rem);
  text-align: center;
  background: #fff;
  color: var(--ink);
}

.m9 input::placeholder {
  color: color-mix(in srgb, var(--ink-muted) 70%, transparent);
}

.m9 .core {
  background: var(--signal);
  color: #fff;
  font-weight: 700;
}

.m9 .core::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

.m9 .sub-c {
  background: #d6e6f5;
  font-weight: 600;
}
.m9 .b0 {
  background: #eef6d8;
}
.m9 .b1 {
  background: #d8f0ec;
}
.m9 .b2 {
  background: #f5e0ea;
}
.m9 .b3 {
  background: #f5e6d0;
}
.m9 .b4 {
  background: #f5efd0;
}
.m9 .b5 {
  background: #e4e0f5;
}
.m9 .b6 {
  background: #dceaf5;
}
.m9 .b7 {
  background: #e8e0f0;
}
.m9 .mirror {
  font-weight: 600;
}

.m9 .active-piece {
  color: #b54a3c !important;
  font-weight: 700;
}

.m9 .mirror-linked {
  outline: 2px solid var(--signal);
  outline-offset: -2px;
}

/* —— Gap fills: calendar toolbar / lamps / week strip —— */
.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.density-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.density-toggle .seg {
  display: inline-flex;
  border: 1px solid rgba(20, 24, 40, 0.25);
  overflow: hidden;
  background: transparent;
}

.density-toggle .seg button {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  color: var(--ink-muted);
}

.density-toggle .seg button[aria-pressed="true"] {
  background: var(--signal);
  color: #fff;
}

.cal-rail__filters {
  border-top: 1px solid var(--line);
  padding-top: var(--space-3);
}

.cal-filters {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  align-items: stretch;
}

.cal-filters .slicer-group {
  margin: 0;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.cal-filters .slicer-group > span {
  min-width: 0;
  flex: 0 0 100%;
}

.cal-filters .slicer-group button {
  width: auto;
  flex: 0 0 auto;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  line-height: 1.2;
}

#cal-filter-reset,
.filter-bar__reset {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

#cal-filter-reset {
  margin-left: 0;
  width: 100%;
  justify-content: center;
  font-size: 0.75rem;
  padding: 0.35rem 0.4rem;
}

#cal-filter-reset .mi,
.filter-bar__reset .mi {
  font-size: 1.05em;
}

.lamp {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.lamp--yellow {
  background: #e6c84a;
  box-shadow: 0 0 0 2px rgba(230, 200, 74, 0.35);
}

.lamp--orange {
  background: #e07a3a;
  box-shadow: 0 0 0 2px rgba(224, 122, 58, 0.35);
}

.day--warn {
  box-shadow: inset 0 0 0 2px #e6c84a;
}

.day--alert {
  box-shadow: inset 0 0 0 2px #e07a3a;
}

.cal-grid[data-density="8"] .task-extra {
  display: none;
}

.week-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}

.week-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.week-panel__head h2 {
  margin: 0;
  font-size: 1rem;
}

.week-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  font-size: 0.8rem;
}

.week-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  margin: 0;
  line-height: 1;
}

.week-controls select {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
  line-height: 1.2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  width: auto;
  max-width: 100%;
  height: 1.85rem;
  box-sizing: border-box;
}

.week-controls #week-all {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 0.55rem;
  line-height: 1;
  height: 1.85rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
}

.week-grid .wd {
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(20, 24, 40, 0.28);
}

.week-grid .wd.sun {
  color: var(--signal);
}

.week-grid .wc {
  background: var(--paper-2);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  min-height: 4.5rem;
  padding: 0.35rem;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.week-grid .wc:hover {
  background: var(--paper-solid);
}

.week-grid .wc--on {
  /* box-shadow: inset 0 0 0 2px var(--accent); */
}

.week-grid .wc--off {
  opacity: 0.4;
}

.week-grid .wc--solo {
  box-shadow: inset 0 0 0 2px var(--signal);
  background: var(--paper-solid);
}

.week-grid .wc:nth-child(7n) {
  border-right: none;
}

.week-grid .wc strong {
  display: block;
  font-family: var(--font-mono);
  margin-bottom: 0.2rem;
}

.slicer-bank__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.slicer-bank__head span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.hint-inline {
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin: 0 0 var(--space-2);
}

.mandala-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.badge-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
}


