:root {
  --bg: #fff8df;
  --surface: #ffffff;
  --surface-soft: #fff8df;
  --line: #f6efd7;
  --line-strong: #ece5cf;
  --text: #1f2933;
  --muted: #667085;
  --accent: #92bd63;
  --accent-strong: #6f904b;
  --accent-soft: #e9f2dc;
  --danger: #bd3b3b;
  --danger-soft: #f8dddd;
  --shadow: 0 14px 40px rgba(45, 67, 34, 0.1);
  --radius: 8px;
  --sidebar: 272px;
  --sidebar-collapsed: 132px;
  --sidebar-expanded: 272px;
  --panel: 390px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr) 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  transition: grid-template-columns 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.app-shell.has-task {
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--panel);
}

.app-shell.sidebar-compact {
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr) 0;
}

.app-shell.sidebar-compact.has-task {
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr) var(--panel);
}

.app-shell.sidebar-compact:has(.sidebar:hover) {
  grid-template-columns: var(--sidebar-expanded) minmax(0, 1fr) var(--panel);
  transition-delay: 280ms;
}

.app-shell.sidebar-compact:not(.has-task):has(.sidebar:hover) {
  grid-template-columns: var(--sidebar-expanded) minmax(0, 1fr) 0;
  transition-delay: 280ms;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, white);
  overflow: hidden;
  transition: padding 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 44px;
  width: 100%;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: #050505;
  color: white;
  font-weight: 650;
  will-change: transform;
  overflow: hidden;
  flex: none;
}

.brand-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  font-weight: 650;
  line-height: 1.1;
  white-space: nowrap;
}

.brand > div:last-child {
  min-width: 0;
  max-width: 170px;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.app-shell.sidebar-compact .sidebar:not(:hover) {
  padding-inline: 12px;
}

.app-shell.sidebar-compact .sidebar:not(:hover) .brand > div:last-child {
  max-width: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
}

.sidebar .brand > div:last-child,
.sidebar .sidebar-actions,
.sidebar .project-name {
  transition: opacity 260ms ease, transform 520ms cubic-bezier(0.22, 1, 0.36, 1), max-width 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.app-shell.sidebar-compact:has(.sidebar:hover) .sidebar .brand > div:last-child,
.app-shell.sidebar-compact:has(.sidebar:hover) .sidebar .sidebar-actions,
.app-shell.sidebar-compact:has(.sidebar:hover) .sidebar .project-name,
.app-shell.sidebar-compact:has(.sidebar:hover) .sidebar .add-project-label,
.app-shell.sidebar-compact:has(.sidebar:hover) .sidebar .add-project-symbol,
.app-shell.sidebar-compact:has(.sidebar:hover) .sidebar .project-item,
.app-shell.sidebar-compact:has(.sidebar:hover) .sidebar #add-project,
.app-shell.sidebar-compact:has(.sidebar:hover) .sidebar {
  transition-delay: 280ms;
}

.sidebar-actions {
  display: flex;
  flex-shrink: 0;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-weight: 560;
  overflow: hidden;
  white-space: nowrap;
  transition: background 160ms ease, transform 160ms ease, padding 520ms cubic-bezier(0.22, 1, 0.36, 1), gap 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.primary-action:hover {
  background: var(--accent-strong);
}

.app-shell.sidebar-compact .sidebar:not(:hover) .sidebar-actions {
  justify-content: center;
}

.app-shell.sidebar-compact .sidebar:not(:hover) #add-project {
  gap: 0;
}

.add-project-symbol,
.add-project-label {
  display: inline-block;
  overflow: hidden;
  transition: opacity 260ms ease, max-width 520ms cubic-bezier(0.22, 1, 0.36, 1), transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.add-project-symbol {
  width: 18px;
  max-width: 18px;
  opacity: 1;
  transform: scale(1);
  text-align: center;
  font-size: 24px;
  font-weight: 460;
  line-height: 1;
}

.add-project-label {
  max-width: 130px;
  opacity: 1;
  transform: translateX(0);
}

.app-shell.sidebar-compact .sidebar:not(:hover) .add-project-symbol {
  max-width: 18px;
  opacity: 1;
  transform: scale(1);
}

.app-shell.sidebar-compact .sidebar:not(:hover) .add-project-label {
  max-width: 0;
  opacity: 0;
  transform: translateX(-4px);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.project-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 6px 5px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--project-bg-inactive, color-mix(in srgb, var(--accent-soft) 18%, var(--surface)));
  color: var(--text);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, min-height 160ms ease, padding 160ms ease;
}

.app-shell.sidebar-compact .sidebar:not(:hover) .project-item {
  min-height: 34px;
  padding-inline: 8px;
}

.project-item:active {
  cursor: grabbing;
}

.project-item.is-dragging {
  cursor: grabbing;
}

.project-item.is-active {
  border-color: transparent;
  background: var(--project-bg-active, color-mix(in srgb, var(--accent-soft) 32%, var(--surface)));
}

.project-item.is-drop {
  outline: 2px solid var(--accent);
  background: var(--project-bg-drop, color-mix(in srgb, var(--accent-soft) 28%, var(--surface)));
}

.project-list.is-drop {
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.project-bucket-menu {
  position: fixed;
  z-index: 60;
  display: grid;
  gap: 4px;
  width: min(240px, calc(100vw - 20px));
  max-height: min(360px, calc(100vh - 20px));
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: auto;
  animation: popover-in 140ms ease;
}

.project-bucket-menu-title {
  padding: 5px 7px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  text-transform: uppercase;
}

.project-bucket-drop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.project-bucket-drop span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-bucket-drop span:last-child {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 560;
}

.project-bucket-drop:hover,
.project-bucket-drop.is-drop {
  background: var(--accent-soft);
  color: var(--accent-strong);
  transform: translateX(2px);
}

.project-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 520;
}

.app-shell.sidebar-compact .sidebar:not(:hover) .project-name {
  max-width: 98px;
}

.icon-button,
.tool-button,
.mini-button {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 540;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-button:hover,
.tool-button:hover,
.mini-button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
}

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

.topbar-actions a {
  text-decoration: none;
}

.view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.view-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 13px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 540;
  transition: background 160ms ease, color 160ms ease;
}

.view-tab.is-active {
  background: var(--accent-strong);
  color: white;
}

.save-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg);
  padding: 18px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.project-page-head {
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--project-bg-header, color-mix(in srgb, var(--accent-soft) 32%, var(--surface)));
}

.page-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.weeks-title-row {
  width: auto;
  flex: 1 1 auto;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary-action,
.danger-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 540;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-only {
  width: 38px;
  padding-inline: 0;
}

.button-text {
  line-height: 1;
}

.add-bucket-button {
  flex: none;
}

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

.danger-icon {
  color: var(--danger);
}

.muted-icon {
  color: var(--muted);
}

.secondary-action:hover {
  border-color: var(--line-strong);
}

.secondary-action.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.danger-action {
  color: var(--danger);
}

.danger-action:hover {
  background: var(--danger-soft);
}

.bucket-board {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: start;
}

.bucket {
  flex: 0 1 360px;
  max-width: 380px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(31, 41, 51, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  overflow: hidden;
}

.bucket.is-dragging,
.project-item.is-dragging {
  opacity: 0.5;
}

.bucket-board.is-drop {
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.bucket-header {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) repeat(5, auto);
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  cursor: grab;
}

.bucket-header:active {
  cursor: grabbing;
}

.bucket-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 560;
}

.bucket-toggle {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transition: background 140ms ease, transform 180ms ease, color 140ms ease;
}

.bucket-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.bucket-body {
  max-height: 1600px;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 300ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms ease, transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bucket.is-collapsed .bucket-header {
  border-bottom-color: transparent;
}

.bucket.is-collapsed .bucket-toggle {
  transform: rotate(-90deg);
}

.bucket.is-collapsed .bucket-body {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
}

@media (min-width: 1181px) {
  .app-shell.has-task .bucket-board {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 360px);
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .app-shell.has-task .bucket {
    min-width: 0;
    max-width: none;
  }
}

.bucket-count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 560;
}

.bucket-tasks,
.week-tasks,
.overdue-tasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 70px;
  padding: 10px;
}

.drop-line {
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: drop-line-in 120ms ease;
}

.bucket-tasks.is-drop,
.week-tasks.is-drop {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

.bucket.is-drop {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.bucket-drop-ghost,
.project-drop-ghost {
  border-color: var(--accent);
  background: var(--accent-soft);
  opacity: 0.48;
  pointer-events: none;
  transform: none;
}

.bucket-drop-ghost {
  flex: 0 1 360px;
  max-width: 380px;
  min-height: 160px;
}

.bucket-ghost-body {
  min-height: 92px;
  margin: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
}

.project-drop-ghost {
  outline: 1px solid var(--accent);
}

.quick-task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 6px;
  margin-top: 11px;
  padding: 6px 10px 10px;
}

.quick-task-input,
.import-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.quick-task-input {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 13px;
}

.quick-task-input:focus,
.import-textarea:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

.mini-submit {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  align-self: center;
  justify-self: center;
  border-radius: var(--radius);
  background: var(--text);
  color: white;
  font-size: 13px;
  font-weight: 560;
  line-height: 1;
  transition: background 160ms ease, transform 160ms ease;
}

.mini-submit:hover {
  background: var(--accent-strong);
}

.bucket-import {
  border-top: 1px solid var(--line);
}

.bucket-import summary {
  min-height: 34px;
  padding: 8px 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 520;
}

.import-form {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.import-textarea {
  min-height: 92px;
  padding: 9px;
  resize: vertical;
}

.task-card {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(31, 41, 51, 0.05);
  cursor: grab;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.task-card:active {
  cursor: grabbing;
}

.task-card.is-archived {
  opacity: 0.72;
}

.task-card.is-archived .task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.task-card.is-archived .task-quick-actions {
  display: none;
}

.complete-button {
  display: grid;
  place-items: center;
  align-self: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.complete-button .fa-solid {
  display: block;
  font-size: 11px;
  line-height: 1;
  transform: translateY(0);
}

.complete-button:not(.is-complete)::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 140ms ease, transform 140ms ease;
}

.complete-button:not(.is-complete):hover::after {
  opacity: 1;
  transform: scale(1);
}

.complete-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.complete-button.is-complete {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.task-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px) scale(1.015);
  z-index: 6;
  box-shadow: 0 2px 7px rgba(31, 41, 51, 0.06);
}

.task-card.is-low-priority {
  color: #4f5b68;
}

.task-card.is-low-priority .task-title {
  color: #4a5562;
  font-weight: 330;
}

.task-card.is-readonly .complete-button {
  visibility: hidden;
  pointer-events: none;
}

.complete-spacer {
  width: 22px;
  height: 22px;
}

.task-card.is-active {
  border-color: var(--accent);
  z-index: 10;
  box-shadow: none;
}

.task-card:focus-within {
  z-index: 20;
}

.task-card:has(.quick-week-picker.is-open) {
  z-index: 70;
}

.bucket:has(.quick-week-picker.is-open),
.week-column:has(.quick-week-picker.is-open) {
  position: relative;
  z-index: 60;
  overflow: visible;
}

.task-card.is-dragging {
  opacity: 0.45;
}

.task-card.drop-ghost {
  border-color: var(--accent);
  background: var(--accent-soft);
  opacity: 0.42;
  pointer-events: none;
  transform: none;
}

.task-quick-actions {
  position: absolute;
  right: 8px;
  top: 50%;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(31, 41, 51, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.task-card:hover .task-quick-actions,
.task-card:focus-within .task-quick-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.task-card:has(.checklist-toggle) .task-quick-actions {
  right: 38px;
}

.task-card:has(.checklist-toggle):hover .checklist-toggle,
.task-card:has(.checklist-toggle):focus-within .checklist-toggle {
  transform: translateX(14px);
}

.task-card:has(.checklist-toggle):hover .checklist-toggle.is-open,
.task-card:has(.checklist-toggle):focus-within .checklist-toggle.is-open {
  transform: translateX(14px) rotate(180deg);
}

.task-card.is-week-card:has(.checklist-toggle):hover .checklist-toggle,
.task-card.is-week-card:has(.checklist-toggle):focus-within .checklist-toggle {
  transform: none;
}

.task-card.is-week-card:has(.checklist-toggle):hover .checklist-toggle.is-open,
.task-card.is-week-card:has(.checklist-toggle):focus-within .checklist-toggle.is-open {
  transform: rotate(180deg);
}

.task-card.is-week-card .task-quick-actions {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 30;
  pointer-events: none;
  transform: translateY(-2px) translateX(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.task-card.is-week-card .task-quick-actions::before {
  content: "";
  position: absolute;
  inset: -8px -10px -8px -28px;
  z-index: -1;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--surface) 28px, var(--surface) 100%);
}

.task-card.is-week-card:hover .task-quick-actions,
.task-card.is-week-card:focus-within .task-quick-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) translateX(0);
}

.task-card.is-week-card:has(.checklist-toggle) .task-quick-actions {
  right: 42px;
}

.quick-action {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.quick-action::after {
  content: attr(data-hint);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  max-width: 190px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--text);
  color: white;
  box-shadow: 0 8px 20px rgba(31, 41, 51, 0.18);
  font-size: 11px;
  font-weight: 520;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

.quick-action:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.quick-action:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.quick-action.priority-normal {
  color: #b34242;
}

.quick-action.priority-low {
  color: #3970ad;
}

.quick-action.week-on {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.quick-action.week-off {
  color: #8a939e;
}

.quick-week-picker {
  grid-template-columns: auto auto;
  width: auto;
  min-width: 34px;
  padding-inline: 7px;
  gap: 4px;
}

.quick-week-picker span {
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
}

.quick-week-picker.has-week {
  color: var(--accent-strong);
}

.quick-week-picker.no-week {
  color: #7b8490;
}

.quick-week-picker.is-open {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.quick-week-picker.is-open::after {
  display: none;
}

.quick-week-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  width: min(230px, calc(100vw - 28px));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(24, 38, 58, 0.16);
  color: var(--text);
}

.quick-week-head {
  display: grid;
  grid-template-columns: 26px 1fr 26px;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.quick-week-head .icon-button {
  width: 26px;
  height: 26px;
}

.quick-week-title {
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  color: var(--muted);
}

.quick-week-list {
  display: grid;
  gap: 2px;
  max-height: min(250px, calc(100vh - 170px));
  overflow: auto;
}

.quick-week-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
  align-items: center;
  width: 100%;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.quick-week-item span:first-child {
  font-size: 12px;
  font-weight: 650;
}

.quick-week-item span:last-child {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-week-item:hover {
  background: var(--accent-soft);
}

.quick-week-item.is-current {
  border-color: rgba(79, 158, 114, 0.35);
}

.quick-week-item.is-selected {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.task-card.is-week-card .task-meta {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-2px);
  transition: opacity 140ms ease, transform 140ms ease, max-height 160ms ease;
}

.task-card.is-week-card:hover {
  transform: scale(1.025);
  z-index: 12;
}

.task-card.is-week-card.is-active .task-meta {
  max-height: 30px;
  opacity: 1;
  transform: translateY(0);
}

.task-card.is-week-card .project-pill {
  box-shadow: none;
}

.task-card.is-week-card {
  padding-block: 7px;
  padding-right: 10px;
}

.task-card.is-week-card:has(.checklist-toggle) {
  padding-right: 10px;
}

.task-title {
  grid-column: 2;
  min-width: 0;
  font-size: 14px;
  font-weight: 430;
  line-height: 1.25;
}

.app-shell.has-task .task-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-week-number {
  grid-column: 4;
  grid-row: 1;
  align-self: start;
  justify-self: end;
  min-width: 24px;
  height: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 560;
  line-height: 18px;
  text-align: center;
}

.task-meta {
  position: relative;
  z-index: 1;
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.checklist-toggle {
  grid-column: 3;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  transition: background 140ms ease, transform 140ms ease;
}

.checklist-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.checklist-toggle.is-open {
  transform: rotate(180deg);
}

.task-checklist-inline {
  grid-column: 2 / -1;
  display: grid;
  gap: 5px;
  padding-top: 3px;
}

.checklist-inline-item {
  display: grid;
  grid-template-columns: 18px 22px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12.5px;
}

.checklist-inline-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.checklist-inline-item.is-done {
  color: var(--muted);
  text-decoration: line-through;
}

.mini-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

.mini-check.is-complete {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.checklist-promote {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: var(--muted);
  opacity: 0.58;
  transition: background 140ms ease, color 140ms ease, opacity 140ms ease;
}

.checklist-promote:hover {
  background: var(--accent-soft);
  color: var(--accent);
  opacity: 1;
}

.checklist-inline-item .checklist-promote {
  width: 22px;
  height: 22px;
  opacity: 0;
}

.checklist-inline-item:hover .checklist-promote,
.checklist-inline-item:focus-within .checklist-promote {
  opacity: 0.72;
}

.bucket-archive {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.bucket-archive summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 520;
}

.archive-tasks {
  display: grid;
  gap: 6px;
  padding: 0 10px 10px;
}

.archive-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.archive-row:last-child {
  border-bottom: 0;
}

.archive-restore {
  width: 22px;
  height: 22px;
}

.archive-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
  text-decoration: line-through;
}

.archive-delete {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 999px;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.archive-delete span {
  display: none;
}

.archive-delete:hover {
  color: var(--danger);
}

.archive-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 520;
}

.pill.project-pill {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.weeks-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.week-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.week-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.week-title {
  font-weight: 580;
}

.week-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.week-completed-toggle,
.week-detective-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

.week-completed-toggle:hover,
.week-completed-toggle.is-active,
.week-detective-toggle:hover,
.week-detective-toggle.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.week-completed-toggle:disabled,
.week-detective-toggle:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.task-card.is-view-only {
  cursor: default;
}

.task-card.is-view-only .complete-button {
  visibility: visible;
  pointer-events: none;
}

.task-card.is-view-only:hover {
  transform: none;
}

.complete-button.is-static {
  cursor: default;
}

.detective-hide-button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: var(--muted);
  opacity: 0.6;
  transition: background 140ms ease, color 140ms ease, opacity 140ms ease;
}

.detective-hide-button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
  opacity: 1;
}

.task-card.is-detective-card .task-meta {
  max-height: 40px;
  opacity: 1;
  transform: translateY(0);
}

.task-card.is-detective-card.is-archived .task-title {
  color: var(--text);
  text-decoration: none;
}

.completed-pill {
  color: var(--muted);
}

.week-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.week-column.is-current {
  border-color: var(--accent);
}

.week-add-task {
  display: grid;
  place-items: center;
  width: calc(100% - 20px);
  min-height: 32px;
  margin: 2px 10px 10px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
  font-size: 12px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.week-add-task:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.overdue-column {
  border-color: var(--accent);
}

.week-jump {
  position: relative;
}

.week-jump-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: popover-in 140ms ease;
}

.week-jump-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.week-jump-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
}

.week-jump-list {
  display: grid;
  max-height: 390px;
  overflow: auto;
  padding: 6px;
}

.week-jump-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  transition: background 160ms ease, color 160ms ease;
}

.week-jump-item span:first-child {
  font-weight: 560;
}

.week-jump-item span:last-child {
  color: var(--muted);
}

.week-jump-item:hover,
.week-jump-item.is-current,
.week-jump-item.is-selected {
  background: var(--accent-soft);
}

.week-jump-item.is-current,
.week-jump-item.is-selected {
  color: var(--accent-strong);
}

.week-jump-item.is-selected {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.task-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(24px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.app-shell.has-task .task-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.task-panel.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 20;
  width: auto;
  border: 0;
  background: var(--surface);
}

.empty-panel {
  margin: auto;
  max-width: 260px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-panel h2 {
  margin: 0 0 8px;
  color: var(--text);
}

.task-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 560;
  color: var(--muted);
  text-transform: uppercase;
}

.panel-tools {
  display: flex;
  gap: 4px;
}

.form-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  text-transform: uppercase;
}

.text-input,
.week-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.title-edit-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.panel-complete-button {
  width: 22px;
  height: 22px;
}

.task-control-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
  text-transform: none;
}

.switch-row input {
  width: 34px;
  height: 18px;
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
}

.switch-row input::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 1px;
  top: 1px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 1px 3px rgba(31, 41, 51, 0.18);
  transition: transform 160ms ease;
}

.switch-row input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.switch-row input:checked::after {
  transform: translateX(16px);
}

.week-picker {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: center;
}

.priority-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, 34px);
  gap: 4px;
  width: max-content;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.checklist-editor {
  display: grid;
  gap: 6px;
}

.checklist-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 7px;
}

.checklist-row.is-done .checklist-input {
  color: var(--muted);
  text-decoration: line-through;
}

.checklist-row.is-new .danger-icon,
.checklist-row.is-new .checklist-promote {
  visibility: hidden;
}

.checklist-input {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.checklist-input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

.move-task-controls {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.task-move-anchor {
  position: relative;
  display: inline-flex;
}

.task-move-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 8;
  display: grid;
  gap: 7px;
  width: min(360px, calc(100vw - 28px));
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: popover-in 140ms ease;
}

.task-move-popover label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  text-transform: uppercase;
}

.move-target-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
}

.move-target-row .secondary-action {
  min-height: 40px;
  padding-inline: 10px;
}

.priority-option {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.priority-option.is-active {
  background: var(--accent-strong);
  color: white;
}

.week-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.week-select-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-week-popover {
  right: 0;
  left: auto;
  top: calc(100% + 8px);
  grid-column: 1 / -1;
  width: min(320px, calc(100vw - 36px));
  max-width: 100%;
  z-index: 30;
}

.task-week-popover .week-jump-head {
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 4px;
}

.week-picker .icon-button {
  width: 32px;
  min-width: 32px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.week-range {
  min-height: 28px;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 520;
}

.text-input:focus,
.week-input:focus,
.week-select-button:focus,
.editor:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

.editor-wrap {
  display: flex;
  flex-direction: column;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 7px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.tool-button {
  min-width: 32px;
  border: 1px solid transparent;
  font-size: 14px;
}

.tool-button:hover {
  border-color: var(--line);
  background: white;
}

.editor {
  flex: 1;
  min-height: 290px;
  padding: 14px;
  overflow: auto;
  line-height: 1.55;
}

.editor h1,
.editor h2,
.editor h3 {
  line-height: 1.2;
}

.editor a {
  color: var(--accent-strong);
}

.panel-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.panel-footer .icon-only {
  width: 36px;
  min-width: 36px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  padding: 11px 13px;
  border-radius: var(--radius);
  background: var(--text);
  color: white;
  box-shadow: var(--shadow);
  font-weight: 540;
  animation: toast-in 160ms ease;
}

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 41, 51, 0.34);
  backdrop-filter: blur(3px);
}

.dialog-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: popover-in 140ms ease;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 560;
}

.dialog-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.dialog-field {
  display: grid;
  gap: 7px;
}

.dialog-field > span,
.dialog-field > label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  text-transform: uppercase;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-actions .primary-action {
  width: auto;
}

.week-task-dialog {
  width: min(520px, 100%);
}

.dialog-choice-label {
  margin-bottom: -6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  text-transform: uppercase;
}

.dialog-choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dialog-choice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 520;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.dialog-choice-button:hover,
.dialog-choice-button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.dialog-card:has(.project-dialog) {
  width: min(640px, 100%);
}

.project-dialog {
  display: grid;
  gap: 14px;
}

.project-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-mode-switch .dialog-choice-button {
  gap: 8px;
}

.project-share-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 72%, white);
}

.project-share-panel[hidden] {
  display: none;
}

.share-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  align-items: center;
  gap: 10px;
}

.share-panel-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  text-transform: uppercase;
}

.share-search {
  min-height: 32px;
}

.share-button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.share-user-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 520;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.share-user-button:hover,
.share-user-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.share-user-button.is-selected::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.selected-share-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}

.share-chip {
  display: inline-grid;
  grid-template-columns: minmax(0, auto) auto;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.share-chip-name {
  min-height: 27px;
  padding: 4px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 560;
}

.share-mode-select {
  min-height: 27px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}

.share-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pinaplan-color-picker {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.color-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  text-transform: uppercase;
}

.color-hex-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-transform: none;
}

.color-picker-body {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 190px);
  gap: 12px;
  align-items: stretch;
}

.color-spectrum {
  position: relative;
  min-height: 178px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, hsl(var(--picker-hue) 100% 50%));
  cursor: crosshair;
  overflow: hidden;
  touch-action: none;
}

.color-spectrum-cursor {
  position: absolute;
  left: var(--picker-x);
  top: var(--picker-y);
  width: 18px;
  height: 18px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(31, 41, 51, 0.76), 0 2px 8px rgba(31, 41, 51, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.color-side {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 9px;
  min-width: 0;
}

.color-preview-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--picker-color);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
  cursor: default;
}

.color-hue-field,
.color-hex-field,
.color-rgb-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.color-hue-field span,
.color-hex-field span,
.color-rgb-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
  text-transform: uppercase;
}

.color-hue-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.color-hex-input {
  min-height: 32px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  text-transform: uppercase;
}

.color-rgb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.color-rgb-grid input {
  min-height: 32px;
  padding-inline: 6px;
  text-align: center;
}

.color-value-input {
  display: none;
}

@keyframes popover-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes drop-line-in {
  from {
    opacity: 0;
    transform: scaleX(0.65);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

.auth-page,
.admin-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card,
.admin-shell {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-card {
  width: min(460px, 100%);
}

.auth-card h1,
.admin-shell h1,
.admin-section h2 {
  margin: 0 0 12px;
  font-weight: 560;
}

.auth-card p {
  color: var(--muted);
  line-height: 1.45;
}

.auth-form,
.admin-grid {
  display: grid;
  gap: 12px;
}

.auth-form label,
.admin-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
}

.auth-form input,
.admin-grid input,
.permission-grid select {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.password-policy {
  display: grid;
  gap: 6px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.password-policy strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 560;
}

.password-policy ul {
  margin: 0;
  padding-left: 18px;
}

.password-policy li + li {
  margin-top: 3px;
}

.compact-policy {
  margin-bottom: 12px;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.readonly-checklist {
  display: grid;
  gap: 6px;
}

.secret-box,
.auth-error,
.auth-success {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  overflow-wrap: anywhere;
}

.secret-box code {
  font-size: 16px;
}

.secret-box small {
  color: var(--muted);
}

.qr-box {
  display: grid;
  place-items: center;
  width: 236px;
  min-height: 236px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.qr-box img,
.qr-box canvas,
.qr-box svg {
  display: block;
  width: 220px;
  height: 220px;
}

.auth-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.auth-success {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.admin-page {
  display: block;
  place-items: initial;
  padding: 18px;
}

.admin-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(31, 41, 51, 0.04);
}

.admin-layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.admin-section-theme,
.admin-section-icon,
.admin-section-profile {
  grid-column: span 6;
}

.admin-section-backups {
  grid-column: span 12;
}

.admin-section-create {
  grid-column: span 4;
}

.admin-section-users {
  grid-column: span 8;
}

.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-grid .primary-action {
  grid-column: 1 / -1;
}

.theme-color-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.theme-suggestion {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.theme-suggestion:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.theme-swatch {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  flex: none;
}

.theme-swatch-accent {
  background: #92bd63;
}

.theme-swatch-background {
  background: #fff8df;
}

.app-icon-preview {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 16px;
  background: var(--text);
  color: white;
  font-weight: 650;
  overflow: hidden;
}

.app-icon-upload-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 74px minmax(180px, 1fr);
  align-items: center;
  gap: 14px;
}

.app-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.admin-file-row {
  min-width: 0;
}

.admin-help-text {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.admin-empty-state {
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.backup-load-link {
  width: fit-content;
}

.backup-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.backup-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.4fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.backup-card-main {
  display: grid;
  gap: 3px;
}

.backup-card-main strong {
  font-weight: 560;
}

.backup-card-main span,
.backup-confirm {
  color: var(--muted);
  font-size: 13px;
}

.backup-confirm {
  margin: 0;
}

.checkbox-row {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  min-height: auto;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.admin-permission-form:has(.admin-toggle input:checked) .permission-grid,
.user-permission-card:has(.admin-toggle input:checked) .permission-grid {
  display: none;
}

.permission-grid label,
.user-permission-card {
  display: grid;
  gap: 7px;
}

.user-list-admin {
  display: grid;
  gap: 12px;
}

.user-permission-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.user-permission-card:has(.admin-toggle input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.super-user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--text);
  color: white;
  font-size: 11px;
  font-weight: 560;
}

.totp-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 560;
}

.totp-status-badge.is-open {
  background: var(--danger-soft);
  color: var(--danger);
}

.user-permission-head,
.user-permission-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-permission-actions {
  justify-content: flex-start;
}

.inline-reset-password {
  display: grid;
  gap: 4px;
  min-width: min(220px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
}

.inline-reset-password input {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

@media (max-width: 1180px) {
  .admin-layout {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .admin-section-theme,
  .admin-section-icon,
  .admin-section-profile,
  .admin-section-backups,
  .admin-section-create,
  .admin-section-users {
    grid-column: 1 / -1;
  }

  .backup-card {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .app-shell.has-task {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .task-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 15;
    width: min(420px, 100vw);
    box-shadow: var(--shadow);
    transform: translateX(100%);
    opacity: 1;
    transition: transform 220ms ease;
  }

  .app-shell.has-task .task-panel {
    transform: translateX(0);
  }
}

@media (max-width: 760px) {
  .admin-page {
    padding: 12px;
  }

  .app-shell,
  .app-shell.has-task,
  .app-shell.sidebar-compact,
  .app-shell.sidebar-compact.has-task,
  .app-shell.sidebar-compact:has(.sidebar:hover),
  .app-shell.sidebar-compact:not(.has-task):has(.sidebar:hover) {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .workspace {
    overflow: auto;
  }

  .sidebar {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand action"
      "projects projects";
    gap: 8px;
    max-height: 138px;
    padding: 8px 12px 7px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    transition: max-height 220ms ease, padding 220ms ease;
  }

  .brand {
    grid-area: brand;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
    min-height: 36px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .brand-title {
    font-size: 14px;
  }

  .brand-subtitle {
    display: none;
  }

  .sidebar-actions {
    grid-area: action;
    align-self: start;
    justify-self: end;
  }

  #add-project {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    gap: 0;
  }

  #add-project .add-project-symbol {
    width: auto;
    max-width: none;
    font-size: 24px;
    line-height: 1;
  }

  #add-project .add-project-label {
    max-width: 0;
    opacity: 0;
    transform: translateX(-4px);
  }

  .project-list {
    grid-area: projects;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: flex-start;
    gap: 5px;
    max-height: none;
    overflow: hidden;
    transition: opacity 180ms ease, max-height 260ms ease;
  }

  .project-item {
    flex: 0 1 auto;
    max-width: min(168px, calc(50% - 3px));
    min-height: 26px;
    padding: 3px 9px;
  }

  .mobile-projects-toggle {
    display: none;
    flex: 0 0 34px;
    min-height: 24px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  .app-shell.has-many-projects .mobile-projects-toggle {
    display: grid;
    place-items: center;
  }

  .app-shell.has-many-projects:not(.mobile-projects-expanded) .project-list {
    max-height: 86px;
  }

  .app-shell.mobile-projects-expanded .project-list {
    max-height: 260px;
    overflow-y: auto;
  }

  .sidebar::before,
  .sidebar::after {
    display: none;
  }

  .sidebar::before {
    content: "\2039";
    left: 3px;
  }

  .sidebar::after {
    content: "\203A";
    right: 3px;
  }

  .project-name {
    font-size: 12.5px;
    line-height: 1.1;
  }

  .topbar {
    order: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: auto;
    padding: 12px 12px 104px;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .view-tabs {
    position: fixed;
    left: 50%;
    bottom: 12px;
    z-index: 24;
    padding: 3px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: 0 10px 26px rgba(31, 41, 51, 0.16);
    transform: translateX(-50%);
  }

  .view-tab {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 999px;
    font-size: 15px;
  }

  .view-tab span {
    display: none;
  }

  .topbar-actions {
    justify-content: center;
    gap: 4px;
    margin-bottom: 44px;
    padding: 0;
    border-top: 0;
    background: transparent;
    box-shadow: none;
    flex-shrink: 0;
  }

  .topbar-actions .icon-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
  }

  .save-state {
    display: none;
  }

  .content {
    order: 2;
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
    padding: 12px 12px 72px;
  }

  .app-shell.is-weeks-view .sidebar {
    max-height: 54px;
    grid-template-areas: "brand action";
  }

  .app-shell.is-weeks-view .project-list,
  .app-shell.is-weeks-view .sidebar-actions {
    display: none;
  }

  .app-shell.mobile-projects-expanded .sidebar {
    max-height: 320px;
  }

  .app-shell.mobile-scrolled .sidebar {
    max-height: 42px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .app-shell.mobile-scrolled .brand,
  .app-shell.mobile-scrolled .sidebar-actions,
  .app-shell.mobile-scrolled .project-list {
    opacity: 0;
    pointer-events: none;
  }

  .app-shell.mobile-scrolled .project-list {
    max-height: 0;
  }

  .page-head {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    margin-bottom: 10px;
  }

  .page-title-row {
    gap: 4px;
  }

  .page-title {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 20px;
  }

  .page-title-row .icon-button {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
  }

  .app-shell.is-weeks-view .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell.is-weeks-view .weeks-title-row {
    width: 100%;
    justify-content: space-between;
  }

  .app-shell.is-weeks-view .page-actions {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    width: 100%;
    gap: 6px;
  }

  .app-shell.is-weeks-view .page-actions .secondary-action {
    min-height: 32px;
  }

  .app-shell.is-weeks-view .page-actions .icon-only {
    width: 34px;
  }

  .app-shell.is-weeks-view .page-actions .secondary-action:not(.icon-only) {
    min-width: 0;
    padding-inline: 8px;
  }

  .app-shell.is-weeks-view .week-completed-toggle,
  .app-shell.is-weeks-view .week-detective-toggle {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
  }

  .add-bucket-button {
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    gap: 0;
  }

  .add-bucket-button .button-text {
    display: none;
  }

  .bucket-board,
  .weeks-grid {
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    grid-auto-columns: auto;
  }

  .bucket-board {
    display: grid;
    gap: 10px;
  }

  .bucket {
    flex-basis: auto;
    width: 100%;
    max-width: none;
  }

  .bucket-header {
    grid-template-columns: 24px minmax(0, 1fr) repeat(5, auto);
    padding: 8px;
  }

  .bucket-title {
    font-size: 14px;
  }

  .bucket-tasks,
  .week-tasks,
  .overdue-tasks {
    min-height: 48px;
    padding: 8px;
  }

  .quick-task-form {
    margin-top: 7px;
    padding: 4px 8px 8px;
  }

  .move-target-row {
    grid-template-columns: 1fr;
  }

  .move-target-row .secondary-action {
    width: 100%;
  }

  .task-quick-actions {
    display: none;
  }

  .task-card.is-week-card,
  .task-card.is-week-card:has(.checklist-toggle) {
    padding-right: 10px;
  }

  .complete-button:not(.is-complete):hover::after {
    opacity: 0;
    transform: scale(0.8);
  }

  .dialog-card:has(.project-dialog) {
    width: min(420px, 100%);
  }

  .project-dialog {
    gap: 11px;
  }

  .project-share-panel {
    padding: 9px;
  }

  .share-panel-head {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .share-user-button {
    min-height: 29px;
    padding: 4px 8px;
  }

  .share-chip {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    border-radius: var(--radius);
  }

  .share-chip-name {
    justify-content: flex-start;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pinaplan-color-picker {
    gap: 7px;
  }

  .color-picker-head {
    font-size: 11px;
  }

  .color-picker-body {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .color-spectrum {
    min-height: 132px;
  }

  .color-side {
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 7px;
    align-items: end;
  }

  .color-preview-button {
    grid-row: span 2;
    min-height: 70px;
  }

  .color-hue-field,
  .color-hex-field {
    min-width: 0;
  }

  .color-rgb-grid {
    grid-column: 1 / -1;
    gap: 5px;
  }

  .color-rgb-grid input,
  .color-hex-input {
    min-height: 30px;
  }

  .panel-tools [data-action="toggle-fullscreen"] {
    display: none;
  }

  .task-panel {
    width: 100vw;
    max-width: 100vw;
    bottom: 66px;
  }
}
