:root {
  color-scheme: light;
  --canvas: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --ink: #17171a;
  --muted: #6e6e73;
  --faint: #96969b;
  --line: rgba(17, 17, 19, 0.09);
  --accent: #17171a;
  --green: #2f8f5b;
  --green-soft: #eaf6ef;
  --yellow: #b27b00;
  --yellow-soft: #fff5d6;
  --red: #c63b37;
  --red-soft: #fdeceb;
  --gray-status: #85858b;
  --gray-soft: #f0f0f2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 35px rgba(0, 0, 0, 0.045);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 14% -20%, rgba(255, 255, 255, 0.95), transparent 38rem),
    var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  position: fixed;
  z-index: 19;
  right: 0;
  left: 0;
  height: 118px;
  opacity: 0;
  pointer-events: none;
  content: "";
  transition: opacity 180ms ease;
}

body::before {
  top: 68px;
  background: linear-gradient(180deg, rgba(0, 107, 61, 0.13), transparent);
}

body::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(0, 107, 61, 0.13), transparent);
}

body.is-auto-scroll-up::before,
body.is-auto-scroll-down::after {
  opacity: 1;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.site-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 8px max(24px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid rgba(17, 17, 19, 0.07);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(150%) blur(24px);
  -webkit-backdrop-filter: saturate(150%) blur(24px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 214px;
  height: 39px;
  object-fit: contain;
  object-position: left center;
}

.brand-divider {
  width: 1px;
  height: 29px;
  background: rgba(17, 17, 19, 0.12);
}

.brand-title {
  color: #3d3d42;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(17, 17, 19, 0.06);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.025);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9a9aa0;
  box-shadow: 0 0 0 4px rgba(154, 154, 160, 0.12);
}

.sync-pill.is-ready .sync-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 143, 91, 0.12);
}

.sync-pill.is-saving .sync-dot {
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(178, 123, 0, 0.12);
  animation: pulse 1.1s ease-in-out infinite;
}

.sync-pill.is-error .sync-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(198, 59, 55, 0.12);
}

.page-wrap {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 76px;
}

.dialog-eyebrow {
  margin: 0 0 13px;
  color: #79797f;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.15em;
}

.overview {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  min-height: 28px;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
}

.overview-count strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.overview-separator {
  width: 1px;
  height: 13px;
  background: var(--line);
}

.board-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
  padding: 0 3px;
}

.board-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.board-heading h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 680;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.refresh-button,
.icon-button,
.text-button,
.secondary-button,
.primary-button,
.date-button,
.details-toggle,
.drag-handle,
.edge-button {
  border: 0;
  cursor: pointer;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 37px;
  padding: 8px 12px;
  border: 1px solid rgba(17, 17, 19, 0.08);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.76);
  color: #505055;
  font-size: 13px;
  font-weight: 600;
  transition: background 160ms ease, transform 160ms ease;
}

.refresh-button:hover {
  background: white;
}

.refresh-button:active {
  transform: scale(0.97);
}

.refresh-symbol {
  display: inline-block;
  font-size: 18px;
  line-height: 1;
}

.refresh-button.is-loading .refresh-symbol {
  animation: spin 750ms linear infinite;
}

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

.task-card {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  min-height: 102px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.task-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--status-color, var(--gray-status));
  content: "";
}

.task-card::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.7);
  pointer-events: none;
  content: "";
}

.task-card.status-green {
  --status-color: var(--green);
  border-color: rgba(47, 143, 91, 0.24);
}

.task-card.status-yellow {
  --status-color: var(--yellow);
  border-color: rgba(178, 123, 0, 0.3);
}

.task-card.status-red {
  --status-color: var(--red);
  border-color: rgba(198, 59, 55, 0.28);
}

.task-card.status-none {
  --status-color: #a4a4a9;
}

.task-card:hover {
  border-color: color-mix(in srgb, var(--status-color) 42%, transparent);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.035), 0 15px 42px rgba(0, 0, 0, 0.065);
  transform: translateY(-1px);
  will-change: transform;
}

.task-card.is-dragging {
  z-index: 8;
  opacity: 0.82;
  border-color: color-mix(in srgb, var(--status-color) 52%, transparent);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);
  transform: scale(1.012) rotate(0.12deg);
  will-change: transform;
}

body.is-reordering {
  cursor: grabbing;
  user-select: none;
}

body.is-reordering .task-card:not(.is-dragging) {
  transform: none;
}

.priority-rail {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 9px 5px 8px 9px;
  border-right: 1px solid rgba(17, 17, 19, 0.055);
  background: rgba(249, 249, 250, 0.66);
}

.drag-handle {
  display: grid;
  grid-template-columns: repeat(2, 3px);
  gap: 3px;
  width: 30px;
  height: 30px;
  place-content: center;
  border-radius: 10px;
  background: transparent;
  touch-action: none;
  cursor: grab;
}

.drag-handle:hover,
.drag-handle:focus-visible {
  background: rgba(17, 17, 19, 0.055);
  outline: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.grip-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #8d8d93;
}

.priority-number {
  color: #8c8c92;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.edge-controls {
  display: grid;
  grid-template-columns: repeat(2, 23px);
  gap: 2px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.task-card:hover .edge-controls,
.task-card:focus-within .edge-controls {
  opacity: 1;
  transform: translateY(0);
}

.edge-button {
  position: relative;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid rgba(17, 17, 19, 0.075);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.78);
  color: #626268;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.035);
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.edge-button:hover:not(:disabled) {
  border-color: rgba(0, 107, 61, 0.2);
  background: rgba(0, 107, 61, 0.075);
  color: #006b3d;
  transform: translateY(-1px);
}

.edge-button:active:not(:disabled) {
  transform: scale(0.92);
}

.edge-button:disabled {
  opacity: 0.22;
  cursor: default;
}

.task-main {
  min-width: 0;
  padding: 17px 18px 15px;
}

.task-main h3 {
  overflow: hidden;
  margin: 0;
  color: #202024;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.024em;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-subtitle {
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 8px;
  border: 1px solid rgba(17, 17, 19, 0.055);
  border-radius: 999px;
  background: #f7f7f8;
  color: #626267;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.meta-chip.is-logo-sample {
  border-color: rgba(0, 107, 61, 0.12);
  background: rgba(0, 107, 61, 0.07);
  color: #006b3d;
}

.task-actions {
  display: flex;
  min-width: 234px;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 12px 16px 12px 8px;
}

.date-button {
  display: grid;
  min-width: 166px;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--status-color) 24%, transparent);
  border-radius: 15px;
  background: color-mix(in srgb, var(--status-color) 8%, white);
  text-align: left;
  transition: transform 160ms ease, background 160ms ease;
}

.date-button:hover {
  background: color-mix(in srgb, var(--status-color) 12%, white);
}

.date-button:active {
  transform: scale(0.985);
}

.details-toggle {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(17, 17, 19, 0.09);
  border-radius: 13px;
  background: #f5f5f7;
  color: #74747a;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.details-toggle:hover {
  background: #ececef;
  color: var(--ink);
}

.details-chevron {
  display: block;
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
  transform: translateX(1px);
  transition: transform 180ms ease;
}

.details-toggle[aria-expanded="true"] .details-chevron {
  transform: rotate(90deg);
}

.date-button:focus-visible,
.refresh-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible,
.details-toggle:focus-visible,
.edge-button:focus-visible,
.date-mode button:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.26);
  outline-offset: 2px;
}

.date-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--status-color);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.date-value {
  color: #2c2c30;
  font-size: 16px;
  font-weight: 670;
  letter-spacing: -0.02em;
}

.date-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 520;
}

.task-details {
  grid-column: 1 / -1;
  padding: 0 18px 16px 80px;
  border-top: 1px solid rgba(17, 17, 19, 0.065);
  background: rgba(248, 248, 249, 0.7);
  transform-origin: top center;
}

.task-details[hidden] {
  display: none;
}

.products-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 2px 9px;
}

.products-heading strong {
  color: #39393e;
  font-size: 12px;
  font-weight: 670;
}

.products-heading span {
  color: #8a8a90;
  font-size: 10px;
  font-weight: 650;
}

.product-list {
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(17, 17, 19, 0.065);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  list-style: none;
}

.product-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 9px 13px;
}

.product-row + .product-row {
  border-top: 1px solid rgba(17, 17, 19, 0.055);
}

.product-number {
  color: #a0a0a5;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.product-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.product-copy strong {
  overflow-wrap: anywhere;
  color: #303035;
  font-size: 13px;
  font-weight: 620;
  line-height: 1.32;
}

.product-meta,
.product-description {
  overflow-wrap: anywhere;
  color: #7b7b81;
  font-size: 10px;
  font-weight: 540;
  line-height: 1.35;
}

.product-description {
  color: #929298;
}

.product-balance {
  display: grid;
  min-width: 104px;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.product-balance strong {
  color: #303035;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.product-balance span {
  color: #89898f;
  font-size: 9px;
  font-weight: 590;
}

.products-empty {
  margin: 0;
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
}

.loading-card {
  min-height: 102px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(100deg, rgba(255,255,255,.72) 28%, rgba(255,255,255,.98) 42%, rgba(255,255,255,.72) 58%);
  background-size: 240% 100%;
  box-shadow: var(--shadow);
  animation: shimmer 1.5s ease infinite;
}

.empty-state {
  padding: 72px 24px;
  border: 1px dashed rgba(17, 17, 19, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.empty-check {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 21px;
  font-weight: 700;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.date-dialog {
  width: min(500px, calc(100% - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(17, 17, 19, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.22);
}

.date-dialog::backdrop {
  background: rgba(22, 22, 25, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.date-dialog form {
  padding: 28px;
}

.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 680;
  letter-spacing: -0.04em;
}

.dialog-header p:not(.dialog-eyebrow) {
  overflow: hidden;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #f1f1f3;
  color: #626267;
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
}

.date-mode {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 4px;
  margin: 26px 0 22px;
  padding: 4px;
  border-radius: 13px;
  background: #efeff1;
}

.date-mode button {
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 640;
}

.date-mode button[aria-selected="true"] {
  background: white;
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
}

.date-panel label {
  display: block;
  margin: 0 0 8px;
  color: #505055;
  font-size: 12px;
  font-weight: 640;
}

.date-panel input,
.date-panel select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(17, 17, 19, 0.12);
  border-radius: 13px;
  background: white;
  color: var(--ink);
  outline: none;
}

.date-panel input {
  padding: 10px 13px;
}

.date-panel select {
  padding: 10px 38px 10px 13px;
}

.date-panel input:focus,
.date-panel select:focus {
  border-color: rgba(0, 122, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.estimate-row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
}

.calculated-date {
  margin: 11px 1px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 540;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.dialog-actions > div {
  display: flex;
  gap: 8px;
}

.text-button,
.secondary-button,
.primary-button {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 650;
}

.text-button {
  padding-inline: 2px;
  background: transparent;
}

.danger-text {
  color: var(--red);
}

.secondary-button {
  border: 1px solid rgba(17, 17, 19, 0.09);
  background: #f3f3f5;
  color: #55555a;
}

.primary-button {
  min-width: 86px;
  background: var(--accent);
  color: white;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100% - 48px));
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: rgba(28, 28, 31, 0.94);
  color: white;
  font-size: 13px;
  font-weight: 560;
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.2);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

@keyframes shimmer {
  to { background-position: -140% 0; }
}

@media (max-width: 800px) {
  .page-wrap {
    width: min(100% - 28px, 680px);
    padding-top: 22px;
  }

  .topbar {
    padding-inline: 18px;
  }

  .brand-logo {
    width: 180px;
    height: 34px;
  }

  .board-title-group {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .task-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .priority-rail {
    grid-row: 1;
    padding-inline: 4px 3px;
  }

  .edge-controls {
    grid-template-columns: repeat(2, 21px);
    opacity: 0.72;
    transform: none;
  }

  .edge-button {
    width: 21px;
    height: 23px;
  }

  .task-main {
    padding: 15px 13px 10px;
  }

  .task-actions {
    grid-column: 2;
    min-width: 0;
    padding: 0 13px 13px;
  }

  .date-button {
    width: 100%;
    min-width: 0;
  }

  .task-details {
    padding: 0 13px 13px;
  }
}

@media (max-width: 520px) {
  .topbar {
    min-height: 66px;
  }

  .brand {
    gap: 9px;
  }

  .brand-logo {
    width: 133px;
    height: 27px;
  }

  .brand-divider {
    height: 23px;
  }

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

  .sync-pill {
    width: 34px;
    min-width: 34px;
    padding: 0;
    justify-content: center;
  }

  .sync-pill #syncLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .board-heading {
    align-items: center;
  }

  .refresh-button span:not(.refresh-symbol) {
    display: none;
  }

  .refresh-button {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .task-main h3 {
    font-size: 16px;
  }

  .task-actions {
    gap: 7px;
  }

  .details-toggle {
    width: 40px;
    height: 40px;
  }

  .product-row {
    grid-template-columns: 23px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .product-balance {
    grid-column: 2;
    min-width: 0;
    justify-content: start;
    justify-items: start;
    grid-auto-flow: column;
    gap: 5px;
    text-align: left;
  }

  .date-dialog form {
    padding: 22px 18px 18px;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .text-button {
    align-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
