/* =========================================================================
   Task Board — single stylesheet.
   Light palette on :root, dark overrides in the media query at the bottom.
   ========================================================================= */

:root {
  --bg: #f5f6f8;
  --bg-sunk: #eceef1;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #dfe3e8;
  --border-strong: #c7ced7;

  --text: #16191d;
  --text-2: #5a636e;
  --text-3: #8b939e;

  --accent: #3b5bdb;
  --accent-hover: #2f4bc0;
  --accent-soft: #e8ecfb;
  --accent-text: #ffffff;

  --danger: #c92a2a;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --ok: #1f7a4d;
  --ok-soft: #e6f5ed;

  --p-urgent: #d6336c;
  --p-high: #e8590c;
  --p-medium: #3b5bdb;
  --p-low: #7c8794;

  /* Bare channels, so the pulse halo can be built with rgba(). */
  --pulse-rgb: 224, 49, 49;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;

  --shadow-1: 0 1px 2px rgba(16, 20, 28, 0.06), 0 1px 3px rgba(16, 20, 28, 0.05);
  --shadow-2: 0 4px 12px rgba(16, 20, 28, 0.1), 0 1px 3px rgba(16, 20, 28, 0.06);
  --shadow-3: 0 18px 45px rgba(16, 20, 28, 0.22);

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

  --topbar-h: 116px;
}

* {
  box-sizing: border-box;
}

/* A class that sets `display` outranks the browser's own `[hidden]` rule, so
   without this a hidden .board or .nudge-banner stays on screen. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- buttons ------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-quiet:hover {
  background: var(--bg-sunk);
  border-color: transparent;
  color: var(--text);
}

.btn-danger-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}
.btn-danger-quiet:hover {
  background: var(--danger-soft);
  border-color: transparent;
}

.btn-icon {
  padding: 6px 10px;
  font-size: 16px;
  line-height: 1;
}

.btn-block {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

/* ---------- login -------------------------------------------------------- */

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(120% 90% at 50% -20%, var(--accent-soft), transparent 62%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 32px 30px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  text-align: center;
}

.login-mark {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-bottom: 18px;
}
.login-mark span {
  width: 22px;
  height: 8px;
  border-radius: 3px;
  background: var(--border-strong);
}
.login-mark span:nth-child(1) {
  background: var(--text-3);
}
.login-mark span:nth-child(2) {
  background: var(--accent);
}
.login-mark span:nth-child(3) {
  background: var(--ok);
}

.login-card h1 {
  font-size: 21px;
}
.login-sub {
  margin: 6px 0 22px;
  color: var(--text-2);
  font-size: 13px;
}
.login-card .field {
  text-align: left;
  margin-bottom: 16px;
}

/* ---------- fields ------------------------------------------------------- */

.field {
  display: block;
  margin-bottom: 14px;
}
.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* A button that sits in a field row, lined up with the inputs beside it. */
.field-action {
  grid-column: 1 / -1;
}
.field-action .btn {
  white-space: nowrap;
}
@media (min-width: 560px) {
  .field-row:has(.field-action) {
    grid-template-columns: 1fr 1fr auto;
  }
  .field-action {
    grid-column: auto;
  }
  .field-action .field-label {
    visibility: hidden;
  }
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}
textarea {
  resize: vertical;
  min-height: 62px;
}

/* The title is a textarea only so that it wraps; it should read as a single
   prominent field, not a box you drag. Height is set from its content in JS. */
.title-input {
  resize: none;
  overflow: hidden;
  min-height: 0;
  line-height: 1.4;
  font-size: 14.5px;
  font-weight: 550;
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--text-3);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-3);
  min-height: 1em;
}

.form-error {
  margin: 0 0 12px;
  padding: 8px 11px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

/* ---------- topbar ------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 680;
  letter-spacing: -0.015em;
  font-size: 15px;
}
.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), var(--p-urgent));
}

.views {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-sunk);
  border-radius: 9px;
}
.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 570;
  cursor: pointer;
}
.view-tab:hover {
  color: var(--text);
}
.view-tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.tab-badge {
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 20px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.menu {
  position: relative;
}
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 184px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  z-index: 40;
}
.menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}
.menu-item:hover {
  background: var(--bg-sunk);
}

/* ---------- toolbar ------------------------------------------------------ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 20px 11px;
}
.search-wrap {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 380px;
}
.select-wrap select {
  width: auto;
  min-width: 128px;
  padding: 7px 9px;
  font-size: 12.5px;
  background: var(--surface-2);
}

/* ---------- nudge banner ------------------------------------------------- */

.nudge-banner {
  position: sticky;
  top: var(--topbar-h);
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-bottom: 1px solid var(--border);
  background: var(--border);
}

.nudge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  background: var(--warn-soft);
  font-size: 13px;
}
.nudge.is-overdue {
  background: var(--danger-soft);
}
.nudge.is-cadence {
  background: var(--accent-soft);
}

.nudge-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
}
.nudge.is-overdue .nudge-dot {
  background: var(--danger);
}
.nudge.is-cadence .nudge-dot {
  background: var(--accent);
}

.nudge-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nudge-text strong {
  font-weight: 620;
}
.nudge-why {
  color: var(--text-2);
}

.nudge-actions {
  display: flex;
  gap: 4px;
  flex: none;
}
.nudge-actions .btn {
  padding: 4px 9px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.12);
}

.nudge-more {
  padding: 7px 20px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
}

/* ---------- board -------------------------------------------------------- */

main {
  padding: 18px 20px 40px;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

.column {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
}
.column-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.column[data-status="todo"] .column-swatch {
  background: var(--text-3);
}
.column[data-status="in_progress"] .column-swatch {
  background: var(--accent);
}
.column[data-status="complete"] .column-swatch {
  background: var(--ok);
}
.column-title {
  font-size: 13px;
  font-weight: 650;
}
.column-count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
}

.column-drop {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 10px 12px;
  min-height: 90px;
}
.column-drop.is-over {
  background: var(--accent-soft);
  border-radius: var(--radius);
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
}

.column-empty {
  padding: 20px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-3);
  font-size: 12.5px;
  text-align: center;
}

/* ---------- card --------------------------------------------------------- */

.card {
  position: relative;
  padding: 11px 12px 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  cursor: grab;
  transition: box-shadow 0.12s ease, transform 0.06s ease, border-color 0.12s ease;
}
.card:hover {
  box-shadow: var(--shadow-2);
  border-color: var(--border-strong);
}
.card:active {
  cursor: grabbing;
}
.card.is-dragging {
  opacity: 0.45;
}
.card.is-drop-target {
  border-top: 2px solid var(--accent);
}
.card.is-lifted {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--p-medium);
}
.card[data-priority="urgent"]::before {
  background: var(--p-urgent);
}
.card[data-priority="high"]::before {
  background: var(--p-high);
}
.card[data-priority="low"]::before {
  background: var(--p-low);
}

.card-title {
  font-size: 13.5px;
  font-weight: 570;
  line-height: 1.35;
  word-break: break-word;
  /* Leaves room for the hover actions so they never sit on top of the text. */
  padding-right: 72px;
  /* Titles can run to 500 characters; a card is a summary, so show the first
     few lines and leave the rest to the editor. The full text stays in the
     card's aria-label and title attribute. */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card[data-status="complete"] .card-title {
  color: var(--text-2);
  text-decoration: line-through;
  text-decoration-color: var(--text-3);
}

.card-notes {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--bg-sunk);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
}
.chip-date.is-overdue {
  background: var(--danger-soft);
  color: var(--danger);
}
/* Under an hour to go: red, and quietly pulsing to pull the eye across the
   board. One cycle every 1.6s — a slow breath, nowhere near the three-per-
   second threshold at which flashing becomes an accessibility hazard. */
.chip-date.is-imminent {
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 650;
  animation: chip-pulse 1.6s ease-in-out infinite;
}

@keyframes chip-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(var(--pulse-rgb), 0.5);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(var(--pulse-rgb), 0);
  }
}

.chip-date.is-soon {
  background: var(--warn-soft);
  color: var(--warn);
}
.chip-date.is-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.chip-tag {
  background: var(--accent-soft);
  color: var(--accent);
}
.chip-repeat,
.chip-nudge {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-3);
}

.card-actions {
  position: absolute;
  top: 7px;
  right: 7px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.card:hover .card-actions,
.card:focus-within .card-actions {
  opacity: 1;
}
.card-action {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.card-action:hover {
  background: var(--bg-sunk);
  color: var(--text);
}
.card-action.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.card-action .icon-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}
/* The front card is filled so it reads as sitting on top of the back one. */
.card-action .icon-front {
  fill: var(--surface);
}
.card-action:hover .icon-front {
  fill: var(--bg-sunk);
}

/* ---------- countdown ---------------------------------------------------- */

.countdown {
  max-width: 860px;
  margin: 0 auto;
}
.countdown-head {
  margin-bottom: 16px;
}
.countdown-head h2 {
  font-size: 17px;
}
.countdown-sub {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: 13px;
}

.countdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cd-item {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px 12px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.cd-band {
  align-self: stretch;
  background: var(--border-strong);
}
.cd-item.is-overdue .cd-band {
  background: var(--danger);
}
.cd-item.is-urgent .cd-band {
  background: var(--p-high);
}
.cd-item.is-soon .cd-band {
  background: var(--warn);
}
.cd-item.is-later .cd-band {
  background: var(--ok);
}

.cd-main {
  min-width: 0;
}
.cd-title {
  font-size: 14px;
  font-weight: 570;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  color: inherit;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.cd-title:hover {
  color: var(--accent);
}
.cd-sub {
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--text-2);
  font-size: 12px;
}

.cd-right {
  text-align: right;
}
.cd-clock {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.cd-item.is-overdue .cd-clock {
  color: var(--danger);
}
.cd-item.is-urgent .cd-clock {
  color: var(--p-high);
}
.cd-item.is-soon .cd-clock {
  color: var(--warn);
}
.cd-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.empty-state {
  padding: 34px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-3);
  text-align: center;
  font-size: 13px;
}

/* ---------- calendar ------------------------------------------------------
   Day and week: working days across, working hours down. Month: whole
   Monday-first weeks. Block positions are percentages of the visible range,
   computed in calendar-layout.js, so the grid can be any height. */

.calendar {
  max-width: 1280px;
  margin: 0 auto;
  --cal-gutter: 56px;
  --cal-cols: 5;
  --cal-hour: 64px; /* vertical pixels per hour */
  --cal-rail: 220px;
}

.cal-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}
.cal-nav {
  display: inline-flex;
  gap: 4px;
}
.cal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 640;
}
.cal-sub {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 13px;
}

.cal-modes {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-sunk);
  border-radius: var(--radius);
}
.cal-mode {
  padding: 5px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  cursor: pointer;
}
.cal-mode.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.cal-mode:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---- overdue, pinned ---- */
.cal-overdue {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius);
}
.cal-overdue-label {
  flex: none;
  padding-top: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--danger);
}
.cal-overdue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

/* ---- body: grid + rail ---- */
.cal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--cal-rail);
  gap: 14px;
  align-items: start;
}

.cal-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow-x: auto;
  overflow-y: hidden;
  user-select: none;
}
.calendar.is-dragging {
  cursor: grabbing;
}

.cal-rail {
  position: sticky;
  top: calc(var(--topbar-h) + 12px);
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  min-height: 120px;
}
.cal-rail.is-drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cal-rail-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.cal-rail-hint,
.cal-rail-empty {
  margin: 6px 0 10px;
  font-size: 12px;
  color: var(--text-3);
}
.cal-rail-empty {
  margin-bottom: 0;
}
.cal-rail-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ---- hour grid (day + week) ---- */
.cal-header,
.cal-hours-body {
  display: grid;
  grid-template-columns: var(--cal-gutter) repeat(var(--cal-cols), minmax(0, 1fr));
  min-width: calc(var(--cal-gutter) + var(--cal-cols) * var(--cal-col-min, 120px));
}
.cal-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cal-corner {
  border-right: 1px solid var(--border);
}
.cal-day {
  padding: 8px 8px 8px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.cal-day:last-child,
.cal-col:last-child {
  border-right: 0;
}
.cal-day.is-drop-target {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.cal-day-name {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  cursor: pointer;
}
.cal-day-name:hover {
  color: var(--accent);
}
.cal-day-num {
  display: inline-block;
  margin-top: 2px;
  min-width: 26px;
  line-height: 26px;
  text-align: center;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 640;
}
.cal-day.is-today .cal-day-num {
  background: var(--accent);
  color: var(--accent-text);
}
.cal-day.is-off .cal-day-name,
.cal-day.is-off .cal-day-num {
  color: var(--text-3);
  font-weight: 500;
}

.cal-outside {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
}

.cal-hours-body {
  position: relative;
  height: calc(var(--cal-hours, 10) * var(--cal-hour));
}
.cal-gutter {
  position: relative;
  border-right: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}
.cal-tick {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  background: var(--surface);
  padding: 0 2px;
}
.cal-tick:first-child {
  transform: translateY(0);
}

.cal-col {
  position: relative;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.cal-col.is-off,
.cal-cell.is-off {
  background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--bg-sunk) 6px 7px);
}
.cal-col.is-today {
  background: var(--accent-soft);
}
.cal-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
  pointer-events: none;
}
.cal-line:first-child {
  border-top: 0;
}

.cal-now {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px solid var(--danger);
  pointer-events: none;
  z-index: 3;
}
.cal-now::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

/* ---- blocks (hour grid) and chips (month, overdue, rail) ---- */
.cal-block,
.cal-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 6px;
  border: 0;
  border-left: 3px solid var(--p-medium);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  color: var(--text);
  font: inherit;
  text-align: left;
  overflow: hidden;
  touch-action: none;
  transition: box-shadow 0.12s ease;
}
.cal-block {
  position: absolute;
  z-index: 2;
}
.cal-chip {
  position: relative;
  width: 100%;
  max-width: 100%;
}
.cal-overdue-list .cal-chip {
  width: auto;
  max-width: 320px;
}
.is-draggable {
  cursor: grab;
}
.cal-block:hover,
.cal-chip:hover,
.cal-block:focus-visible,
.cal-chip:focus-visible {
  box-shadow: var(--shadow-2);
  z-index: 4;
}
.cal-block:focus-visible,
.cal-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.is-dragging.cal-block,
.is-dragging.cal-chip {
  box-shadow: var(--shadow-3);
  opacity: 0.9;
  z-index: 6;
  cursor: grabbing;
  pointer-events: none;
}
.cal-block.is-urgent,
.cal-chip.is-urgent {
  border-left-color: var(--p-urgent);
}
.cal-block.is-high,
.cal-chip.is-high {
  border-left-color: var(--p-high);
}
.cal-block.is-low,
.cal-chip.is-low {
  border-left-color: var(--p-low);
}
.cal-block.is-active,
.cal-chip.is-active {
  background: var(--accent-soft);
}
.cal-block.is-past,
.cal-chip.is-past {
  border-left-color: var(--danger);
}
/* Complete: muted, so what's done reads as done. */
.cal-block.is-done,
.cal-chip.is-done {
  opacity: 0.55;
}
.cal-block.is-done .cal-block-title,
.cal-chip.is-done .cal-chip-title {
  text-decoration: line-through;
  color: var(--text-2);
}
/* Projected recurrence: real estate, not a real action yet. */
.cal-block.is-projection,
.cal-chip.is-projection {
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-left: 3px dashed var(--p-medium);
  box-shadow: none;
  color: var(--text-2);
  cursor: pointer;
}
.cal-block.is-projection.is-urgent,
.cal-chip.is-projection.is-urgent {
  border-left-color: var(--p-urgent);
}
.cal-block.is-projection.is-high,
.cal-chip.is-projection.is-high {
  border-left-color: var(--p-high);
}
.cal-block.is-projection.is-low,
.cal-chip.is-projection.is-low {
  border-left-color: var(--p-low);
}
.cal-block.is-projection .cal-block-title::before,
.cal-chip.is-projection .cal-chip-title::before {
  content: "↻ ";
  color: var(--text-3);
}
.cal-block.is-snoozed .cal-block-time::after,
.cal-chip.is-snoozed .cal-chip-time::after {
  content: " · zz";
  color: var(--text-3);
}
.cal-block.is-outside {
  position: static;
  width: 100%;
}
.cal-block[data-lanes="3"] .cal-block-time,
.cal-block[data-lanes="4"] .cal-block-time,
.cal-block[data-lanes="5"] .cal-block-time {
  display: none;
}

.cal-block-time,
.cal-chip-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-2);
  white-space: nowrap;
  flex: none;
}
.cal-block-title,
.cal-chip-title {
  font-size: 12px;
  font-weight: 560;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-chip.is-overdue-chip .cal-chip-time {
  color: var(--danger);
  font-weight: 600;
}

.cal-ghost {
  position: absolute;
  left: 2px;
  right: 2px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  min-height: 24px;
  pointer-events: none;
  z-index: 5;
}

/* ---- month ---- */
.cal-month-header,
.cal-month-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: calc(7 * var(--cal-col-min, 120px));
}
.cal-month-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cal-month-dow {
  padding: 8px;
  border-right: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.cal-month-dow:last-child {
  border-right: 0;
}
.cal-month-dow.is-off {
  color: var(--text-3);
  font-weight: 500;
}
.cal-month-body {
  grid-auto-rows: minmax(112px, auto);
}
.cal-cell {
  position: relative;
  padding: 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.cal-cell:nth-child(7n) {
  border-right: 0;
}
.cal-cell:nth-last-child(-n + 7) {
  border-bottom: 0;
}
.cal-cell.is-outside-month {
  background: var(--surface-2);
}
.cal-cell.is-outside-month .cal-cell-num {
  color: var(--text-3);
}
.cal-cell.is-today {
  background: var(--accent-soft);
}
.cal-cell.is-drop-target {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.cal-cell-num {
  display: inline-block;
  min-width: 24px;
  margin-bottom: 4px;
  padding: 0;
  line-height: 24px;
  border: 0;
  border-radius: 999px;
  background: none;
  text-align: center;
  font: inherit;
  font-size: 13px;
  font-weight: 640;
  color: var(--text);
  cursor: pointer;
}
.cal-cell-num:hover {
  background: var(--bg-sunk);
}
.cal-cell.is-today .cal-cell-num {
  background: var(--accent);
  color: var(--accent-text);
}
.cal-cell-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-more {
  align-self: flex-start;
  padding: 1px 6px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.cal-hint {
  margin: 12px 0 0;
  color: var(--text-3);
  font-size: 12px;
}
.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 900px) {
  .calendar {
    --cal-gutter: 48px;
    --cal-hour: 52px;
    --cal-col-min: 128px;
    --cal-rail: auto;
  }
  .cal-head {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "titles titles"
      "nav modes";
    row-gap: 8px;
  }
  .cal-titles {
    grid-area: titles;
  }
  .cal-nav {
    grid-area: nav;
  }
  .cal-modes {
    grid-area: modes;
  }
  .cal-body {
    /* minmax(0, …) so the scrolling grid can't widen the page. */
    grid-template-columns: minmax(0, 1fr);
  }
  .cal-rail {
    position: static;
  }
  .cal-block-title,
  .cal-chip-title {
    font-size: 11px;
  }
  .cal-block:not(.is-outside) .cal-block-time {
    display: none;
  }
  .cal-month-body {
    grid-auto-rows: minmax(84px, auto);
  }
}

/* ---------- dialogs ------------------------------------------------------ */

.dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-3);
}
.dialog::backdrop {
  background: rgba(12, 16, 22, 0.45);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 820px);
}

.dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 {
  font-size: 15.5px;
  flex: 1;
}

.dialog-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.dialog-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.dialog-foot-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ---------- working hours ------------------------------------------------ */

.switch-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  margin-bottom: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.switch-row.is-compact {
  padding: 9px 11px;
  margin-bottom: 8px;
  background: transparent;
  border-color: transparent;
}
.switch-row.is-compact:hover {
  background: var(--surface-2);
}
.switch-row input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}
.switch-title {
  display: block;
  font-size: 13px;
  font-weight: 570;
}
.switch-hint {
  display: block;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.4;
}

.fieldset {
  margin: 0;
  padding: 14px 14px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.fieldset[disabled],
.fieldset.is-muted {
  opacity: 0.5;
}
.fieldset legend {
  padding: 0 5px;
}

.day-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}
.day-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  user-select: none;
}
.day-toggle:hover {
  border-color: var(--text-3);
}
/* The checkbox stays in the DOM for keyboard and screen-reader use, but the
   label itself is the visible control. */
.day-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.day-toggle:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.day-toggle:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dialog-foot-note {
  color: var(--text-3);
  font-size: 12px;
}

.nudge.is-quiet {
  background: var(--surface-2);
  color: var(--text-2);
}
.nudge.is-quiet .nudge-dot {
  background: var(--text-3);
}
.nudge.is-quiet strong {
  color: var(--text);
}

/* ---------- tag input ---------------------------------------------------- */

.tag-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  min-height: 36px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: text;
}
.tag-editor:hover {
  border-color: var(--text-3);
}
.tag-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tag-chips {
  display: contents;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 3px 2px 8px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}
.tag-chip-remove {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
}
.tag-chip-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.tag-entry {
  position: relative;
  flex: 1 1 110px;
  min-width: 110px;
}
.tag-entry input {
  width: 100%;
  padding: 3px 2px;
  border: 0;
  background: transparent;
  font-size: 13px;
}
.tag-entry input:hover,
.tag-entry input:focus {
  border: 0;
  box-shadow: none;
  outline: none;
}

.tag-options {
  position: absolute;
  z-index: 5;
  top: calc(100% + 5px);
  left: -6px;
  right: -6px;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 210px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
}
.tag-option {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.tag-option:hover,
.tag-option.is-active {
  background: var(--accent-soft);
}
.tag-option.is-new {
  color: var(--text-2);
}
.tag-option-meta {
  margin-left: auto;
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
}

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.tag-suggestions-label {
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tag-suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag-suggestion {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 9px;
  border: 1px dashed var(--border-strong);
  border-radius: 20px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}
.tag-suggestion:hover {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.tag-suggestion-why {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 450;
}
.tag-suggestion:hover .tag-suggestion-why {
  color: var(--accent);
}

/* ---------- manage tags -------------------------------------------------- */

.tags-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tags-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
}
.tags-name {
  font-size: 13px;
}
.tags-meta {
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .tags-row {
    grid-template-columns: 1fr auto;
  }
  .tags-meta {
    grid-column: 1 / -1;
    order: 3;
  }
}

/* ---------- attachments -------------------------------------------------- */

.attachments {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}
.attachments h3 {
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 9px;
}

.attachment-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.attachment-drop.is-over {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.attachment-hint {
  color: var(--text-3);
  font-size: 12px;
}

.attachment-link-form {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 7px;
  margin-top: 8px;
}

.attachment-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.attachment-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.attachment-item.is-queued,
.attachment-item.is-uploading {
  opacity: 0.8;
  border-style: dashed;
}

.attachment-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--bg-sunk);
}

.attachment-badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 5px;
  background: var(--bg-sunk);
  color: var(--text-2);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.attachment-badge.is-link {
  background: var(--accent-soft);
  color: var(--accent);
}

.attachment-main {
  min-width: 0;
}
.attachment-name {
  display: block;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.attachment-name:hover {
  color: var(--accent);
  text-decoration: underline;
}
.attachment-meta {
  display: block;
  margin-top: 1px;
  color: var(--text-3);
  font-size: 11.5px;
}

.attachment-progress {
  display: block;
  margin-top: 5px;
  height: 4px;
  border-radius: 3px;
  background: var(--bg-sunk);
  overflow: hidden;
}
.attachment-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.15s linear;
}

.attachment-remove {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.attachment-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip-attachment {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.chip-attachment .icon-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

@media (max-width: 560px) {
  .attachment-link-form {
    grid-template-columns: 1fr;
  }
}

/* ---------- activity ----------------------------------------------------- */

.activity {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}
.activity h3 {
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 9px;
}
.activity-add {
  display: flex;
  gap: 7px;
  margin-bottom: 11px;
}
.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 190px;
  overflow-y: auto;
}
.activity-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 7px 9px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.activity-item.is-meta {
  color: var(--text-2);
}
.activity-when {
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------- deleted list ------------------------------------------------- */

.deleted-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.deleted-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.deleted-main {
  flex: 1;
  min-width: 0;
}
.deleted-title {
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deleted-when {
  color: var(--text-3);
  font-size: 11.5px;
}

/* ---------- toasts ------------------------------------------------------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 15px;
  background: #1b2028;
  color: #f2f4f7;
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  font-size: 13px;
  pointer-events: auto;
  animation: toast-in 0.16s ease-out;
}
.toast.is-error {
  background: #7f1d1d;
}
.toast .btn {
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}
.toast .btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

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

@media (max-width: 900px) {
  .board {
    grid-template-columns: 1fr;
  }
  .topbar-row {
    flex-wrap: wrap;
  }
  .nudge-banner {
    top: 0;
    position: static;
  }
}

@media (max-width: 560px) {
  .field-row {
    grid-template-columns: 1fr;
  }
  .nudge {
    flex-wrap: wrap;
  }
  .nudge-text {
    white-space: normal;
  }
  /* Five buttons no longer fit on one phone-width line. */
  .nudge-actions {
    flex-wrap: wrap;
    max-width: 100%;
  }
  .cd-item {
    grid-template-columns: 4px 1fr;
  }
  .cd-right {
    grid-column: 2;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    /* Without this, a looping animation squeezed into 0.01ms flashes thousands
       of times a second — the opposite of what the setting asks for. */
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* The imminent chip is still red and bold; it just stops moving. */
  .chip-date.is-imminent {
    animation: none !important;
  }
}

/* ---------- dark --------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --bg-sunk: #1a1e25;
    --surface: #1e232b;
    --surface-2: #242a33;
    --border: #2e3540;
    --border-strong: #414a58;

    --text: #e8ecf1;
    --text-2: #a3adba;
    --text-3: #78828f;

    --accent: #7d97f4;
    --accent-hover: #93a9f7;
    --accent-soft: #232c47;
    --accent-text: #10131a;

    --danger: #f08a8a;
    --danger-soft: #3a2124;
    --warn: #e0aa62;
    --warn-soft: #362a1c;
    --ok: #6cc79a;
    --ok-soft: #1c2f26;

    --p-urgent: #ef7fa8;
    --p-high: #f0a06a;
    --p-medium: #7d97f4;
    --p-low: #78828f;

    /* Lighter red, so the halo reads against a dark card rather than muddying. */
    --pulse-rgb: 240, 138, 138;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.45);
    --shadow-3: 0 20px 50px rgba(0, 0, 0, 0.6);
  }

  .nudge-actions .btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
  }

  .toast {
    background: #2a313c;
  }
  .toast.is-error {
    background: #5a2226;
  }
}
