/* Minimalist neutral white sheet, soft flat gray cards, and clean pastel pills (no purple). */
:root {
  color-scheme: light;
  --canvas: #f2f2f2;
  --surface: #ffffff;
  --card-bg: #f8f8f9;
  --card-hover: #f2f3f5;
  --ink: #1c1e21;
  --ink-secondary: #525866;
  --muted: #8c919b;
  --line: #eceef1;
  --line-strong: #dcdfe5;

  /* Neutral primary interactive color */
  --accent: #18181b;
  --accent-hover: #2c2c31;
  --accent-soft: #f3f4f6;
  --accent-border: #c6cbd4;

  /* Exact pastel badge palette from reference */
  --green: #16a34a;
  --green-soft: #dcfce7;
  --green-text: #15803d;

  --blue: #0ea5e9;
  --blue-soft: #e0f2fe;
  --blue-text: #0284c7;

  --yellow-soft: #fef3c7;
  --yellow-text: #9a6700;

  --amber-soft: #ffedd5;
  --amber-text: #c2410c;

  --rose: #ef4444;
  --rose-soft: #fee2e2;
  --rose-text: #c53030;

  --neutral-soft: #ebedf0;
  --neutral-text: #5f6672;

  --radius-sheet: 22px;
  --radius-card: 16px;
  --radius-md: 11px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow-sheet: 0 2px 18px rgba(0, 0, 0, 0.045);
  --shadow-dialog: 0 24px 64px -16px rgba(0, 0, 0, 0.22);

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --display: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font: 400 14.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

input,
textarea,
select {
  min-width: 0;
  max-width: 100%;
}

input:not([type='checkbox']),
textarea,
select {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--ink);
}

input:not([type='checkbox']):focus,
textarea:focus,
select:focus {
  border-color: #6b7280;
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
  outline: none;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

/* Clean rounded checkboxes (neutral unchecked, emerald green checked) */
input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 19px;
  height: 19px;
  border: 1.6px solid #c5cad3;
  border-radius: 6px;
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  margin: 0;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

input[type='checkbox']:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

input[type='checkbox']:checked {
  background: var(--green);
  border-color: var(--green);
}

input[type='checkbox']:checked::after {
  content: '';
  width: 9.5px;
  height: 5.5px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
}

a {
  color: var(--ink);
  text-underline-offset: 0.2em;
}

button,
a,
input,
textarea,
select {
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid #3f3f46;
  outline-offset: 2px;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
}

a,
button,
label,
input,
select,
textarea {
  scroll-margin-block: 16px;
}

.icon {
  display: inline-block;
  flex: none;
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: middle;
}

.symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only,
.skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip:focus {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
}

/* Container & Masthead */
.shell {
  width: min(940px, calc(100% - 36px));
  margin-inline: auto;
}

.masthead {
  padding: 18px 0 10px;
}

.mast-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  row-gap: 12px;
  column-gap: 14px;
  min-height: 44px;
}

.brand-group {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 650 17px/1 var(--display);
  letter-spacing: -0.025em;
  color: var(--ink);
  flex: none;
  border: 0;
  background: transparent;
  padding: 4px 6px 4px 2px;
  margin: -4px 0 -4px -2px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.brand:hover {
  background: rgba(0, 0, 0, 0.045);
}

@keyframes glamp-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn.is-spinning .icon {
  animation: glamp-spin 0.65s linear infinite;
}

.project-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.project-sep {
  color: #c5c9d2;
  font-size: 16px;
  font-weight: 400;
  user-select: none;
}

.project-select-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 8px 0 10px;
  min-height: 34px;
  max-width: 190px;
}

.project-select-wrap:hover {
  border-color: #c5c9d2;
}

.project-select-wrap select {
  border: 0;
  background: transparent;
  padding: 5px 2px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink);
  cursor: pointer;
  max-width: 100%;
}

.project-select-wrap select:focus {
  box-shadow: none;
  outline: none;
}

.project-add-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-secondary);
  padding: 0;
  flex: none;
}

.project-add-btn:hover {
  background: var(--card-bg);
  color: var(--ink);
  border-color: #c5c9d2;
}

.project-add-btn .icon {
  width: 15px;
  height: 15px;
}

.brand-logo {
  display: block;
  width: 28px;
  height: 28px;
  flex: none;
}

.brand-logo.large {
  width: 54px;
  height: 54px;
}

.brand-logo.small {
  width: 16px;
  height: 16px;
}

/* Neutral segmented navigation */
.views {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 11px;
  background: #e6e7ea;
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: start;
}

.views button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 8.5px;
  background: transparent;
  color: var(--ink-secondary);
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
}

.views button .icon {
  width: 15px;
  height: 15px;
}

.views button:hover {
  color: var(--ink);
}

.views button[aria-current='page'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.header-right {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}

.quiet,
.intro,
.help,
.secondary-line {
  color: var(--muted);
}

.quiet,
.help {
  font-size: 13px;
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 550;
  background: var(--surface);
  color: var(--ink-secondary);
  border: 1px solid var(--line-strong);
}

.pill-tag .icon {
  width: 14px;
  height: 14px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 550;
  font-size: 13.5px;
  line-height: 1.25;
  padding: 8px 15px;
  text-decoration: none;
  white-space: nowrap;
}

.btn .icon {
  width: 15px;
  height: 15px;
}

.btn:hover {
  background: var(--card-bg);
  border-color: #c8ccd4;
}

.btn.outline {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn.outline:hover {
  background: var(--card-bg);
  border-color: #c5c9d2;
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.full {
  width: 100%;
  min-height: 43px;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-secondary);
  min-height: 35px;
  padding: 6px 10px;
}

.btn.ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.icon-only {
  min-width: 35px;
  min-height: 35px;
  padding: 6px;
}

.boot {
  margin: 84px 0;
  text-align: center;
  font-size: 14.5px;
}

/* Sign-in Gate */
.gate {
  margin: clamp(32px, 9vh, 84px) auto 0;
  max-width: 410px;
}

.gate-card {
  background: var(--surface);
  border-radius: var(--radius-sheet);
  padding: 34px 30px 30px;
  box-shadow: var(--shadow-sheet);
  text-align: center;
}

.gate-badge {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.gate-card h1 {
  font-size: 23px;
  font-weight: 700;
  margin: 14px 0 8px;
}

.gate-card .intro {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.gate-card form {
  margin-top: 22px;
  text-align: left;
}

.gate-card label,
.field-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

.gate-card input {
  width: 100%;
  min-height: 43px;
}

.gate-card .primary {
  margin-top: 15px;
}

.error-text {
  color: var(--rose-text);
  font-size: 13.5px;
  font-weight: 500;
}

.error-text:not(:empty) {
  margin-top: 8px;
}

/* Main White Sheet (matching reference image) */
.workspace-sheet {
  background: var(--surface);
  border-radius: var(--radius-sheet);
  box-shadow: var(--shadow-sheet);
  margin-top: 8px;
  overflow: hidden;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.sheet-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.title-icon {
  width: 21px;
  height: 21px;
  color: var(--ink-secondary);
}

.sheet-title-group h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.count {
  font: 550 12px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--neutral-soft);
  border-radius: var(--radius-pill);
  padding: 4px 8.5px;
}

.count:empty {
  display: none;
}

.sheet-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-body {
  padding: 20px 26px 26px;
}

/* Filter Pill Bar (Task: All · Time: All · Status: All) */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 7px 0 10px;
  min-height: 35px;
  font-size: 13px;
  color: var(--ink);
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.filter-chip:hover {
  border-color: #c5c9d2;
  background: var(--card-bg);
}

.filter-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.chip-prefix {
  color: var(--ink-secondary);
  font-weight: 500;
  pointer-events: none;
}

.filter-chip select {
  border: 0;
  background: transparent;
  padding: 5px 1px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
  cursor: pointer;
}

.filter-chip select:focus {
  box-shadow: none;
  outline: none;
}

.chip-reset {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 550;
  padding: 6px 9px;
  border-radius: 8px;
}

.chip-reset:hover {
  background: var(--card-bg);
  color: var(--ink);
}

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 160px;
  max-width: 210px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  padding-left: 10px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.search .icon {
  width: 15px;
  height: 15px;
}

.search input[type='search'] {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 7px 10px 7px 0;
  min-height: 34px;
  font-size: 13.5px;
  box-shadow: none;
}

.search:focus-within {
  border-color: #6b7280;
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}

.search input:focus {
  outline: none;
  box-shadow: none;
}

/* Pastel Status & Time Pills — exact reference palette */
.pill,
.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  white-space: nowrap;
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
}

.status.open {
  background: var(--blue-soft);
  color: var(--blue-text);
}

.status.review {
  background: var(--amber-soft);
  color: var(--amber-text);
}

.status.done {
  background: var(--green-soft);
  color: var(--green-text);
}

.pill.time-today {
  background: var(--rose-soft);
  color: var(--rose-text);
}

.pill.time-tomorrow,
.pill.time-upcoming {
  background: var(--yellow-soft);
  color: var(--yellow-text);
}

.pill.time-past {
  background: var(--neutral-soft);
  color: var(--neutral-text);
}

.pill.kind-note {
  background: var(--neutral-soft);
  color: var(--neutral-text);
}

.pill.kind-task {
  background: var(--yellow-soft);
  color: var(--yellow-text);
}

.pill.project-tag {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-secondary);
}

.pill.assignee-tag {
  background: #e6f4f1;
  color: #0f766e;
  font-weight: 550;
}

.pill.archived-tag {
  background: var(--neutral-soft);
  color: var(--neutral-text);
  border: 1px solid var(--line-strong);
}

/* Agents Manager Dialog */
.agent-create-form {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 15px 16px;
  margin-top: 14px;
}

.agent-create-form .fields {
  margin: 0 0 12px;
  gap: 11px;
}

.token-banner {
  margin-top: 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  padding: 14px 16px;
}

.token-banner-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--green-text);
  margin-bottom: 6px;
}

.token-code {
  display: block;
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid #bbf7d0;
  color: var(--ink);
  margin: 8px 0 10px;
}

.agents-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.agent-row {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 13px 15px;
}

.agent-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.agent-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.agent-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.agent-name {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
}

.agent-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.agent-tokens {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  flex-wrap: wrap;
}

.token-prefix {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 12px;
  color: var(--ink);
}

.btn.sm {
  min-height: 29px;
  padding: 4px 10px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn.danger {
  color: var(--rose-text);
  border-color: #fecaca;
}

.btn.danger:hover {
  background: var(--rose-soft);
  border-color: #fca5a5;
}

/* Flat Light-Gray Cards directly on White Sheet (exact reference!) */
.card-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-item {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  transition: background-color 0.14s ease;
}

.card-item:hover {
  background: var(--card-hover);
}

.card-item.done-task .card-title {
  color: var(--muted);
  text-decoration: line-through;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-top-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex-wrap: wrap;
}

.card-title {
  font-family: var(--display);
  font-weight: 550;
  font-size: 16px;
  line-height: 1.35;
  text-decoration: none;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.card-item a.card-title::after,
.lane-card a.card-title::after,
.todo-row a.card-title::after {
  content: '';
  position: absolute;
  inset: 0;
}

.card-pills {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.chev {
  width: 17px;
  height: 17px;
  color: var(--ink-secondary);
  flex: none;
  transition: transform 0.14s ease;
}

.card-item:hover .chev {
  transform: translateX(2px);
}

.card-snippet {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-snippet strong,
.lane-card .snippet strong,
.todo-sub strong,
.card-check-row strong {
  font-weight: 600;
  color: var(--ink-secondary);
}

.card-snippet em,
.lane-card .snippet em,
.todo-sub em,
.card-check-row em {
  font-style: italic;
}

.card-snippet del,
.lane-card .snippet del,
.todo-sub del,
.card-check-row del {
  text-decoration: line-through;
  opacity: 0.75;
}

.card-snippet code,
.lane-card .snippet code,
.todo-sub code,
.card-check-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.5px 4px;
  color: var(--ink-secondary);
}

.lane-card .snippet code,
.todo-sub code {
  background: var(--card-bg);
}

.preview-sep {
  opacity: 0.5;
}

.preview-link {
  text-decoration: underline;
  text-decoration-color: rgba(107, 114, 128, 0.45);
  text-underline-offset: 2px;
}

.card-check-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.card-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-secondary);
  min-width: 0;
}

.card-check-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-check-row.checked {
  color: var(--muted);
  text-decoration: line-through;
}

.mini-box {
  width: 15px;
  height: 15px;
  border-radius: 4.5px;
  border: 1.5px solid #bfc5ce;
  display: inline-grid;
  place-items: center;
  flex: none;
  background: var(--surface);
}

.mini-box.checked {
  background: var(--green);
  border-color: var(--green);
}

.mini-box.checked::after {
  content: '';
  width: 6.5px;
  height: 3.5px;
  border-left: 1.7px solid #ffffff;
  border-bottom: 1.7px solid #ffffff;
  transform: rotate(-45deg) translate(0.5px, -0.5px);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

.card-footer input[type='checkbox'] {
  position: relative;
  z-index: 2;
}

.card-footer-strong {
  color: var(--ink);
  font-weight: 500;
}

.card-footer-dot {
  opacity: 0.45;
}

/* Contributor avatar circles (matching reference footer) & comments */
.avatar-stack {
  display: inline-flex;
  align-items: center;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  border: 2px solid var(--card-bg);
  flex: none;
  user-select: none;
}

.avatar + .avatar {
  margin-left: -7px;
}

.avatar.lg {
  width: 28px;
  height: 28px;
  font-size: 12px;
  border-color: var(--surface);
}

.avatar.color-slate { background: #e5e7eb; color: #374151; }
.avatar.color-sky { background: #dff2fe; color: #0369a1; }
.avatar.color-green { background: #dcfce7; color: #15803d; }
.avatar.color-amber { background: #fef3c7; color: #9a6700; }
.avatar.color-rose { background: #fee2e2; color: #b91c1c; }
.avatar.color-teal { background: #ccfbf1; color: #0f766e; }

.comments-section {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.comments-head h3 {
  font-size: 16px;
  font-weight: 650;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.comment-item {
  background: var(--card-bg);
  border-radius: 13px;
  padding: 12px 14px;
}

.comment-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.comment-author {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.comment-role {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
}

.comment-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.md-body.comment-body {
  padding: 0;
  font-size: 13.8px;
  line-height: 1.55;
  color: var(--ink-secondary);
  overflow-wrap: anywhere;
}

.md-body.comment-body p,
.md-body.comment-body ul,
.md-body.comment-body ol,
.md-body.comment-body blockquote,
.md-body.comment-body pre {
  margin: 0.45em 0;
}

.md-body.comment-body code {
  background: var(--surface);
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-form textarea {
  min-height: 68px;
  font-size: 13.8px;
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
}

/* To-Do View + Week Strip (neutral + green/red like reference 3) */
.todo-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.week-strip-wrap {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 14px 14px 16px;
}

.week-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.week-month {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 1.5px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface);
  padding: 0;
  overflow: hidden;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.week-day:hover {
  border-color: #aeb4bf;
}

.week-day-dow {
  font-size: 11px;
  font-weight: 550;
  color: var(--muted);
  text-align: center;
  padding-top: 6px;
}

.week-day-cap {
  margin: 4px 5px 0;
  padding: 4.5px 0;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: var(--neutral-soft);
  color: var(--ink-secondary);
}

.week-day.all-done {
  border-color: #86efac;
}

.week-day.all-done .week-day-cap {
  background: var(--green);
  color: #ffffff;
}

.week-day.has-open {
  border-color: #fca5a5;
}

.week-day.has-open .week-day-cap {
  background: var(--rose);
  color: #ffffff;
}

.week-day.is-today {
  border-color: var(--ink);
}

.week-day.is-selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2.5px rgba(24, 24, 27, 0.12);
}

.week-day.is-selected .week-day-cap {
  background: var(--accent);
  color: #ffffff;
}

.week-day-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.stat-open {
  color: var(--rose-text);
}

.stat-done {
  color: var(--green-text);
}

.todo-card-sheet {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface);
}

.todo-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.todo-sheet-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.todo-sheet-title h3 {
  font-size: 18px;
  font-weight: 700;
}

.todo-progress {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-text);
  background: var(--green-soft);
  padding: 3.5px 9px;
  border-radius: var(--radius-pill);
}

.todo-list {
  display: flex;
  flex-direction: column;
}

.todo-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 15px 20px;
  border-top: 1px solid var(--line);
  transition: background-color 0.12s ease;
}

.todo-row:first-child {
  border-top: 0;
}

.todo-row:hover {
  background: var(--card-bg);
}

.todo-row input[type='checkbox'] {
  position: relative;
  z-index: 2;
}

.todo-row.done-task .card-title {
  text-decoration: line-through;
  color: var(--muted);
}

.todo-row-body {
  min-width: 0;
}

.todo-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-sub.is-done {
  color: var(--green-text);
}

.todo-sub.is-review {
  color: var(--amber-text);
}

.todo-row-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Kanban Board (clean neutral columns + crisp white cards) */
.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.lane {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 13px;
  min-width: 0;
  min-height: 200px;
}

.lane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.lane-head .count {
  margin-left: auto;
  background: var(--surface);
  color: var(--ink-secondary);
}

.lane-card {
  position: relative;
  padding: 14px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.lane-card:hover {
  border-color: #cdd2db;
}

.lane-card + .lane-card {
  margin-top: 10px;
}

.lane-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.lane-card .card-date {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lane-card .card-title {
  display: block;
  font-size: 14.5px;
  margin-bottom: 4px;
}

.lane-card .snippet {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lane-empty {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 24px 8px;
}

/* Calendar View */
.calendar {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  overflow: hidden;
}

.calendar-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.calendar-tools h3 {
  font-size: 17px;
  font-weight: 650;
}

.calendar-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.calendar-buttons .btn {
  min-height: 33px;
  min-width: 33px;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 13px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday {
  background: var(--card-bg);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.day {
  min-height: 88px;
  min-width: 0;
  padding: 6px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.day:nth-child(7n + 1) {
  border-left: 0;
}

.day.off {
  background: #fafafa;
}

.day-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  border-radius: 9px;
  background: transparent;
  min-width: 28px;
  height: 28px;
  font-size: 13px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
}

.day-head:hover {
  background: var(--card-bg);
  color: var(--ink);
}

.day-head.today {
  background: var(--accent);
  color: #ffffff;
}

.day-head[aria-pressed='true']:not(.today) {
  background: var(--neutral-soft);
  color: var(--ink);
  border-color: var(--line-strong);
}

.day-event {
  display: block;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue-text);
  padding: 2.5px 6px;
  margin-top: 4px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
  font-weight: 550;
}

.day-event.scheduled {
  background: var(--yellow-soft);
  color: var(--yellow-text);
}

.day-event.done {
  background: var(--green-soft);
  color: var(--green-text);
}

.day-event:hover {
  filter: brightness(0.96);
}

.day-dot {
  display: none;
}

.agenda {
  border-top: 1px solid var(--line);
  background: var(--card-bg);
  padding: 15px 18px 18px;
}

.agenda h4 {
  font-size: 14.5px;
  font-weight: 650;
  margin-bottom: 10px;
}

.agenda ul {
  margin: 0;
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agenda li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.agenda li a {
  overflow-wrap: anywhere;
  font-weight: 550;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 11px;
  padding-left: 4px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend span::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--yellow-soft);
  border: 1px solid #fde68a;
}

.legend span + span::before {
  background: var(--green-soft);
  border-color: #bbf7d0;
}

/* Empty States */
.empty {
  text-align: center;
  padding: 44px 24px 46px;
  border-radius: var(--radius-card);
  background: var(--card-bg);
}

.empty-mark {
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-secondary);
}

.empty-mark .icon {
  width: 22px;
  height: 22px;
}

.empty h3 {
  font-size: 18px;
  font-weight: 650;
}

.empty p {
  margin: 6px auto 16px;
  color: var(--muted);
  max-width: 34em;
  font-size: 14px;
}

/* Colophon */
.colophon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 12px 6px 32px;
  color: var(--muted);
  font-size: 12.5px;
}

.colophon span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 550;
}

.colophon .colophon-note {
  font-weight: 400;
}

.colophon-right {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 550;
  padding: 4px 8px;
  border-radius: 7px;
}

.footer-link:hover,
.footer-link[aria-current='page'] {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.footer-link .icon {
  width: 14px;
  height: 14px;
}

.colophon .icon {
  width: 15px;
  height: 15px;
}

/* Dialog */
body:has(dialog[open]) {
  overflow: hidden;
}

dialog {
  width: min(600px, calc(100% - 28px));
  max-height: calc(100dvh - 36px);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-dialog);
  padding: 0;
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(4px);
}

.dialog-bar {
  padding: 14px 16px 14px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}

.dialog-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.dialog-eyebrow .icon {
  width: 16px;
  height: 16px;
}

#detail {
  padding: 22px clamp(20px, 4vw, 26px) 26px;
}

#dialog-title {
  font-size: 23px;
  font-weight: 700;
  overflow-wrap: anywhere;
  letter-spacing: -0.025em;
}

#dialog-title:focus,
#workspace-title:focus,
#main:focus {
  outline: 0;
}

.detail-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.detail-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.detail-meta .icon {
  width: 15px;
  height: 15px;
}

.body-text {
  padding: 14px 0 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  color: var(--ink-secondary);
}

.body-text .help {
  font-style: italic;
}

.body-text a {
  font-weight: 600;
  text-decoration: underline;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.button-row .btn {
  min-height: 35px;
  padding: 6px 12px;
  font-size: 13px;
}

.button-row .icon {
  width: 15px;
  height: 15px;
}

.images {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.image-head {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 4px;
}

.image-head h3 {
  font-size: 16px;
  font-weight: 650;
}

.image-head .btn {
  min-height: 33px;
  padding: 5px 11px;
  font-size: 13px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(148px, 100%), 1fr));
  gap: 10px;
  margin-top: 12px;
}

.gallery img {
  width: 100%;
  height: 135px;
  object-fit: contain;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: block;
}

.gallery figcaption {
  overflow-wrap: anywhere;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.image-zoom {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: zoom-in;
}

.large-image {
  grid-column: 1 / -1;
}

.large-image .image-zoom {
  cursor: zoom-out;
}

.gallery .large-image img {
  height: auto;
  max-height: 72vh;
}

/* Wide Document View (replaces cramped modal for cards) */
.doc-sheet {
  padding: 0;
  overflow: visible;
}

.doc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  flex-wrap: wrap;
}

.doc-message {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.doc-message:empty {
  display: none;
}

.doc-detail {
  padding: 28px clamp(22px, 5vw, 48px) 40px;
  max-width: 820px;
  margin-inline: auto;
}

#doc-title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
  margin: 0;
}

#doc-title:focus {
  outline: 0;
}

.doc-actions {
  margin-top: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

/* Top Image Hero / Gallery with Captions */
.doc-images {
  margin: 22px 0 8px;
}

.doc-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 16px;
}

.doc-gallery.single {
  grid-template-columns: 1fr;
}

.doc-figure {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid var(--line);
}

.doc-figure img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: var(--surface);
  border-radius: 10px;
  display: block;
}

.doc-gallery.single .doc-figure img {
  max-height: 460px;
}

.doc-figure.large-image {
  grid-column: 1 / -1;
}

.doc-figure.large-image img {
  max-height: 76vh;
}

.doc-caption-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 0 2px;
}

.doc-caption-text {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-secondary);
  overflow-wrap: anywhere;
}

.doc-caption-text.fallback {
  color: var(--muted);
}

.doc-caption-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.doc-caption-form input {
  flex: 1 1 200px;
  padding: 6px 10px;
  font-size: 13px;
}

.upload-panel {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-row input[type='text'] {
  flex: 1 1 220px;
  padding: 8px 11px;
  font-size: 13.5px;
}

/* Rendered Markdown Typography */
.md-body {
  padding: 20px 0 24px;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.md-body > :first-child {
  margin-top: 0;
}

.md-body > :last-child {
  margin-bottom: 0;
}

.md-body h2,
.md-body h3,
.md-body h4,
.md-body h5 {
  font-family: var(--display);
  font-weight: 650;
  color: var(--ink);
  margin: 1.4em 0 0.55em;
  line-height: 1.3;
}

.md-body h2 {
  font-size: 22px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.md-body h3 {
  font-size: 18.5px;
}

.md-body h4 {
  font-size: 16px;
}

.md-body h5 {
  font-size: 14.5px;
  color: var(--ink-secondary);
}

.md-body p {
  margin: 0.75em 0;
}

.md-body ul,
.md-body ol {
  margin: 0.75em 0;
  padding-left: 1.55em;
}

.md-body li {
  margin: 0.35em 0;
}

.md-body ul.md-checklist {
  list-style: none;
  padding-left: 0;
}

.md-body ul.md-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.md-body ul.md-checklist .mini-box {
  margin-top: 5px;
}

.md-body ul.md-checklist li.checked {
  color: var(--muted);
  text-decoration: line-through;
}

.md-body blockquote {
  margin: 1em 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink-secondary);
}

.md-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1.5px 5px;
}

.md-body pre {
  margin: 1em 0;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  line-height: 1.55;
}

.md-body pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 13.5px;
}

.md-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.5em 0;
}

.md-body a {
  color: var(--blue-text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(2, 132, 199, 0.35);
}

.md-body a:hover {
  text-decoration-color: var(--blue-text);
}

.md-table-wrap {
  margin: 1em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.md-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.md-body th,
.md-body td {
  padding: 9px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.md-body th {
  background: var(--card-bg);
  font-weight: 600;
  color: var(--ink);
}

.md-body tr:last-child td {
  border-bottom: 0;
}

.editor-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.editor-image-item {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-image-item img {
  width: 100%;
  height: 116px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
}

.editor-image-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.editor-image-meta {
  font-size: 12.5px;
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.fields {
  display: grid;
  gap: 15px;
  margin: 18px 0 22px;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fields .help {
  margin-top: 5px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.check-label {
  display: flex;
  gap: 9px;
  align-items: center;
  align-self: end;
  min-height: 41px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  background: var(--card-bg);
  border: 1px solid var(--line);
  font-weight: 550;
  font-size: 13.5px;
  cursor: pointer;
}

.form-bottom {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.dialog-message:not(:empty) {
  padding: 11px 22px;
  border-top: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 500;
}

.notice {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #ffffff;
  max-width: min(92vw, 520px);
  padding: 10px 16px;
  border-radius: 11px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  z-index: 10;
  font-size: 13.5px;
  font-weight: 500;
}

.notice:empty {
  display: none;
}

.copy-input {
  display: block;
  width: 100%;
  margin-top: 10px;
}

/* Read / Unread Indicators & Toggle Chip */
.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0d9488;
  flex: none;
}

.filter-chip.chip-toggle {
  gap: 6px;
  padding: 0 11px;
  font-weight: 550;
  cursor: pointer;
}

.chip-count {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
  background: var(--neutral-soft);
  border-radius: var(--radius-pill);
  padding: 1.5px 6px;
}

.chip-count:empty {
  display: none;
}

.lane-card-title-row,
.todo-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.lane-card-title-row .card-title {
  margin-bottom: 0;
}

.lane-card-title-row {
  margin-bottom: 4px;
}

.card-item.is-unread .card-title,
.lane-card.is-unread .card-title,
.todo-row.is-unread .card-title {
  font-weight: 650;
}

/* Activity is a text log: timestamps and actors, without avatar tiles. */
.activity-feed { display:grid; gap:22px; max-width:860px; }
.activity-day-head { font:600 13px/1.4 var(--sans); color:var(--ink-secondary); margin:0; border-bottom:1px solid var(--line); padding-bottom:6px; }
.activity-list { display:grid; }
.activity-row { display:grid; grid-template-columns: minmax(45px,auto) minmax(0,1fr); align-items:baseline; gap:14px; padding:12px 0; }
.activity-main {min-width:0;}
.activity-line {font-size:14px;line-height:1.5;color:var(--ink-secondary);overflow-wrap:anywhere;}
.activity-actor {color:var(--ink);font-weight:600;}
.activity-card-link {color:var(--ink);text-decoration:underline;text-decoration-color:#b4bac0;text-underline-offset:3px;}
.activity-card-link:hover {text-decoration-color:currentColor;}
.activity-detail {margin-top:3px;color:var(--ink-secondary);font-size:13px;overflow-wrap:anywhere;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;}
.activity-time {display:inline-flex;align-items:center;gap:5px;font-size:12px;color:var(--ink-secondary);font-variant-numeric:tabular-nums;white-space:nowrap;}

/* In-Situ Document View & Tiptap Simple Markdown Editor */
.doc-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.doc-save-state {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  white-space: nowrap;
}

.doc-save-state:empty {
  display: none;
}

.doc-save-state.is-dirty {
  color: var(--amber-text);
}

.doc-save-state.is-saving {
  color: var(--ink-secondary);
}

.doc-save-state.is-saved {
  color: var(--green-text);
}

.doc-save-state.is-error {
  color: var(--rose-text);
}

.doc-title-input {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  padding: 4px 6px;
  margin: 0 -6px;
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.025em;
  color: var(--ink);
  resize: none;
  field-sizing: content;
  overflow: hidden;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.doc-title-input:hover:not([readonly]) {
  background: var(--card-bg);
}

.doc-title-input:focus:not([readonly]) {
  outline: none;
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}

.doc-title-input[readonly] {
  cursor: default;
  outline: none;
}

.doc-props-panel {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.doc-props-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.new-doc-props {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card-bg);
  padding: 10px 14px;
}

.new-doc-props-toggle {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-secondary);
  user-select: none;
}

.new-doc-props[open] .new-doc-props-toggle {
  margin-bottom: 12px;
}

.new-doc-props .fields {
  margin: 0;
}

.doc-caption-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.btn.ghost.danger-text {
  color: var(--rose-text);
}

.btn.ghost.danger-text:hover {
  background: var(--rose-soft);
  color: var(--rose-text);
}

.rich-editor-wrap {
  margin-top: 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.rich-editor-wrap.is-editing.is-focused {
  border-color: var(--line);
}

.rich-editor-wrap:not(.is-editing) .glamp-editor {
  min-height: 0;
  padding: 6px 0 20px;
}

.editor-toolbar-dock {
  position: sticky;
  top: 12px;
  z-index: 15;
  margin-bottom: 12px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05);
}

.tool-btn.tool-done {
  margin-left: auto;
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  padding: 6px 11px;
}

.tool-btn.tool-done:hover {
  background: var(--accent-hover);
  color: #ffffff;
  border-color: var(--accent-hover);
}

.tool-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1;
  padding: 6px 8.5px;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.tool-btn:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.tool-btn.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.tool-btn.tool-bold {
  font-weight: 750;
}

.tool-btn.tool-italic {
  font-style: italic;
  font-family: Georgia, serif;
}

.tool-btn.tool-strike {
  text-decoration: line-through;
}

.tool-btn.tool-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
}

.tool-sep {
  width: 1px;
  height: 18px;
  background: var(--line-strong);
  margin: 0 4px;
}

.editor-link-bar {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.editor-link-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-link-form input {
  flex: 1 1 220px;
  padding: 6px 10px;
  font-size: 13px;
  min-height: 32px;
}

.editor-link-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-link-dest {
  font-size: 13px;
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 360px;
  margin-right: auto;
}

.card-link-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-link-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.card-link-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}

.card-link-choice:hover {
  background: var(--card-hover);
  border-color: var(--line-strong);
}

.card-link-choice-title {
  font-weight: 550;
  margin-right: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ProseMirror structural CSS (required when Tiptap injectCSS: false for strict CSP) */
.ProseMirror {
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  white-space: break-spaces;
  font-variant-ligatures: none;
  font-feature-settings: 'liga' 0;
  outline: none;
}

.ProseMirror-hideselection *::selection {
  background: transparent;
}

.ProseMirror-selectednode {
  outline: 2px solid var(--line-strong);
}

.glamp-editor {
  min-height: 200px;
  padding: 12px 10px 24px;
  border-radius: 10px;
}

.glamp-editor h1 {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 650;
  margin: 1.2em 0 0.5em;
  line-height: 1.25;
}

.glamp-editor p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--muted);
  opacity: 0.7;
  pointer-events: none;
  height: 0;
}

.glamp-editor a.editor-card-link {
  background: var(--neutral-soft);
  color: var(--ink);
  border-radius: 5px;
  padding: 1px 6px;
  text-decoration: none;
  font-weight: 550;
}

.glamp-editor a.editor-card-link:hover {
  background: var(--card-hover);
}

/* Backlinks ("Linked from") */
.backlinks-section {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.backlinks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.backlinks-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
}

.backlinks-title .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.backlinks-title h3 {
  font-size: 16px;
  font-weight: 650;
}

.backlinks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.backlink-item {
  position: relative;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 11px 14px;
  transition: background-color 0.14s ease;
}

.backlink-item:hover {
  background: var(--card-hover);
}

.backlink-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.backlink-link {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
}

.backlink-link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.backlink-snippet {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Responsive layouts */
@media (max-width: 780px) {
  .mast-inner {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .views {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .views button {
    flex: 1;
    padding: 7px 6px;
  }

  .board {
    grid-template-columns: 1fr;
  }

  .lane {
    min-height: 0;
  }
}

@media (max-width: 600px) {
  .shell {
    width: calc(100% - 20px);
  }

  .masthead {
    padding: 14px 0 8px;
  }

  .workspace-sheet {
    border-radius: 18px;
  }

  .sheet-header {
    padding: 16px 16px;
  }

  .sheet-body {
    padding: 16px 16px 20px;
  }

  .header-right .btn span {
    display: none;
  }

  .header-right .btn {
    padding: 7px;
  }

  .search {
    width: 100%;
  }

  .card-item {
    padding: 15px 16px;
    border-radius: 14px;
  }

  .week-strip-wrap {
    padding: 10px;
  }

  .week-strip {
    gap: 5px;
  }

  .week-day {
    border-radius: 10px;
  }

  .week-day-cap {
    margin: 3px 3px 0;
    font-size: 12px;
    border-radius: 6px;
  }

  .week-day-stats {
    font-size: 10.5px;
    padding: 5px 2px 6px;
  }

  .todo-sheet-head {
    padding: 14px 16px 12px;
  }

  .todo-row {
    padding: 13px 15px;
    gap: 11px;
  }

  .day {
    min-height: 46px;
    padding: 3px;
    position: relative;
  }

  .day-head {
    width: 100%;
    height: 40px;
    padding-bottom: 8px;
  }

  .day-event {
    display: none;
  }

  .day-dot {
    display: block;
    position: absolute;
    left: 50%;
    bottom: 7px;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 99px;
    background: var(--blue);
    pointer-events: none;
  }

  .day-dot.scheduled {
    background: #d97706;
  }

  .day-head.today + .day-dot {
    background: #ffffff;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .gate-card {
    padding: 26px 20px 22px;
  }

  dialog {
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
