:root {
  --paper: #f3f7f4;
  --paper-2: #e4efe7;
  --card: #ffffff;
  --ink: #141914;
  --muted: #5d6b61;
  --line: #d7e4db;
  --green: #21a038;
  --green-2: #14802c;
  --green-soft: #e3f6e8;
  --blue: #2bb0ed;
  --blue-soft: #ddf4fc;
  --gold: #e2b13c;
  --warn: #e25c2a;
  --shadow: 0 12px 40px rgba(20, 70, 32, 0.08);
  --radius: 28px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  background:
    radial-gradient(900px 500px at -10% -20%, #c8f0d0 0%, transparent 55%),
    radial-gradient(700px 420px at 110% 0%, #b7ecff 0%, transparent 50%),
    radial-gradient(600px 380px at 50% 110%, #e8f8c9 0%, transparent 45%),
    var(--paper);
  color: var(--ink);
  font-family: Onest, sans-serif;
}

body {
  padding-top: calc(var(--clock-h, 64px) + env(safe-area-inset-top, 0px));
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  animation: blob 12s var(--ease) infinite alternate;
}

body::before {
  background: #7be08a;
  top: 12%;
  left: -60px;
}

body::after {
  background: #7ad4f5;
  right: -50px;
  bottom: 10%;
  animation-delay: -4s;
}

.clock {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(20, 70, 32, 0.06);
}

.clock[hidden] {
  display: none;
}

.clock-inner {
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  flex-wrap: wrap;
  padding: 6px 28px;
}

.clock-top,
.clock-main,
.clock-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clock-tools {
  flex-wrap: wrap;
}

.clock-time {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.04em;
  min-width: 4.6ch;
}

.clock-ring {
  width: 34px;
  height: 34px;
  flex: none;
}

.clock-presets {
  display: flex;
  gap: 6px;
}

.clock-presets button,
.clock-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

.clock-presets button.on {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-2);
}

.clock-btn.primary {
  background: linear-gradient(180deg, #2cc44a, var(--green));
  color: #fff;
  border: 0;
  box-shadow: 0 6px 14px rgba(33, 160, 56, 0.22);
}

.clock-btn.ghost {
  background: transparent;
}

.clock-btn.ghost.on {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-2);
}

.clock-btn.ghost.dim {
  opacity: 0.45;
}

.clock.running .clock-time {
  color: var(--green-2);
}

.clock.alarm {
  background: #fff4e8;
  animation: alarmpulse 0.8s ease-in-out infinite alternate;
}

@keyframes alarmpulse {
  from {
    box-shadow: 0 0 0 0 rgba(226, 92, 42, 0.12);
  }
  to {
    box-shadow: 0 0 0 8px rgba(226, 92, 42, 0.04);
  }
}

.clock-track {
  height: 3px;
  background: var(--paper-2);
}

.clock-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 0.2s linear;
}

.clock input {
  width: 64px;
  padding: 6px 8px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .clock-inner {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 4px;
    min-height: 0;
    padding: 4px 8px 5px;
  }

  .clock-top {
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
  }

  .clock-main {
    gap: 6px;
    flex: none;
  }

  .clock-ring {
    width: 22px;
    height: 22px;
  }

  .clock-time {
    font-size: 16px;
    min-width: 4.2ch;
  }

  .clock-presets {
    gap: 4px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
  }

  .clock-presets button,
  .clock-btn {
    padding: 4px 8px;
    font-size: 12px;
  }

  .clock-min-word {
    display: none;
  }

  .clock-tools {
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  .clock-tools .clock-btn.primary {
    flex: 1;
  }

  .clock input {
    width: 48px;
    padding: 4px 6px;
    font-size: 16px;
    border-radius: 10px;
  }

  .clock-track {
    height: 2px;
  }
}

.urgent {
  position: fixed;
  top: auto;
  bottom: 24px;
  right: 0;
  z-index: 45;
  display: flex;
  align-items: flex-end;
  gap: 0;
}

.urgent[hidden] {
  display: none;
}

.urgent-tab {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  border: 1px solid var(--line);
  border-right: 0;
  background: #fff4e5;
  color: #b45312;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 14px 8px;
  border-radius: 12px 0 0 12px;
  box-shadow: -6px 8px 20px rgba(180, 83, 18, 0.12);
}

.urgent-tab .n {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-top: 8px;
  background: #e25c2e;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  transform: rotate(180deg);
}

.urgent-tab.hot {
  animation: hot 1.6s ease-in-out infinite;
}

@keyframes hot {
  50% {
    background: #ffe0c2;
  }
}

.urgent-panel {
  width: min(320px, calc(100vw - 48px));
  max-height: min(560px, calc(100vh - 120px));
  overflow: auto;
  background: #fffaf3;
  border: 1px solid #f0d2b0;
  border-right: 0;
  border-radius: 18px 0 0 18px;
  padding: 16px;
  box-shadow: -12px 10px 32px rgba(120, 60, 10, 0.12);
  display: none;
}

.urgent.open .urgent-panel {
  display: block;
}

.urgent-panel h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.urgent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.urgent-head h3 {
  margin: 0;
}

.urgent-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.urgent-stick {
  background: #fff7cc;
  border: 1px solid #ead97a;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 6px 0 #e6d36a;
  transform: rotate(-0.4deg);
  text-align: left;
}

.urgent-stick:nth-child(even) {
  transform: rotate(0.6deg);
  background: #ffe9c8;
  border-color: #f0c48a;
  box-shadow: 0 6px 0 #e8b56a;
}

.urgent-stick p {
  margin: 0;
  font-weight: 650;
  font-size: 14px;
  white-space: pre-wrap;
}

.urgent-stick .meta {
  margin-top: 8px;
}

.remind-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.remind-row label {
  margin: 0;
  flex: 1;
  min-width: 180px;
}

.remind-row input {
  margin-top: 6px;
}

.tg-box {
  text-align: left;
  margin: 16px 0 0;
  padding: 14px;
  background: var(--blue-soft);
  border-radius: 16px;
}
.tg-box .meta {
  margin: 0 0 10px;
}

.urgent-panel .hint {
  margin: 0 0 12px;
}

.urgent-panel textarea {
  min-height: 72px;
  margin-bottom: 8px;
  background: #fff;
}

.urgent-item {
  background: #fff7cc;
  border: 1px solid #ead97a;
  border-radius: 14px;
  padding: 10px 12px;
  margin-top: 8px;
  box-shadow: 0 4px 0 #e6d36a;
}

.urgent-item.done {
  opacity: 0.55;
  text-decoration: line-through;
}

.urgent-item p {
  margin: 0 0 8px;
  white-space: pre-wrap;
  font-weight: 600;
  font-size: 14px;
}

.urgent-item .row {
  margin: 0;
}

@media (max-width: 720px) {
  .urgent {
    bottom: 12px;
    right: 12px;
    left: auto;
    justify-content: flex-end;
  }

  .urgent-tab {
    writing-mode: horizontal-tb;
    transform: none;
    border-radius: 999px;
    border: 1px solid #f0d2b0;
    padding: 10px 14px;
  }

  .urgent-tab .n {
    display: inline-flex;
    margin: 0 0 0 6px;
    transform: none;
  }

  .urgent-panel {
    position: absolute;
    bottom: 52px;
    right: 0;
    border-radius: 18px;
    border-right: 1px solid #f0d2b0;
    max-height: 60vh;
  }
}

.guide {
  position: fixed;
  left: 0;
  bottom: 24px;
  z-index: 46;
  display: flex;
  align-items: flex-end;
}

.guide[hidden] {
  display: none;
}

.guide-tab {
  writing-mode: vertical-rl;
  border: 1px solid var(--line);
  border-left: 0;
  background: var(--green-soft);
  color: var(--green-2);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 14px 8px;
  border-radius: 0 12px 12px 0;
  box-shadow: 6px 8px 20px rgba(20, 70, 32, 0.12);
}

.guide-panel {
  display: none;
  width: min(300px, calc(100vw - 48px));
  max-height: min(70vh, calc(100vh - 120px));
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 18px 18px 0;
  padding: 16px;
  box-shadow: 12px 10px 32px rgba(20, 70, 32, 0.12);
}

.guide.open .guide-panel {
  display: block;
}

.guide-panel h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.guide-list {
  margin: 0 0 14px;
  padding: 0 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.guide-list li {
  margin: 0 0 8px;
}

.guide-list strong {
  color: var(--ink);
}

.guide-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 720px) {
  .guide {
    left: 12px;
    bottom: 12px;
  }

  .guide-tab {
    writing-mode: horizontal-tb;
    border-radius: 999px;
    border: 1px solid var(--line);
    padding: 10px 14px;
  }

  .guide-panel {
    position: absolute;
    bottom: 52px;
    left: 0;
    border-radius: 18px;
    border-left: 1px solid var(--line);
    max-height: 60vh;
  }
}

@keyframes blob {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(24px, 18px) scale(1.12);
  }
}

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

button {
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

button:active {
  transform: scale(0.97);
}

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

#app {
  max-width: 100%;
  overflow-x: hidden;
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px 56px 80px 56px;
}

.enter {
  animation: rise 0.45s var(--ease);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  background: #e8f8ee;
  flex: none;
  box-shadow: 0 8px 18px rgba(33, 160, 56, 0.28);
  animation: sticker-bob 2.8s ease-in-out infinite;
}

.logo img {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: cover;
}

.logo .logo-wink {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: sticker-wink 4.2s ease-in-out infinite;
}

@keyframes sticker-bob {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-3px) rotate(4deg);
  }
}

@keyframes sticker-wink {
  0%,
  70%,
  86%,
  100% {
    opacity: 0;
  }
  74%,
  82% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo,
  .logo .logo-wink {
    animation: none;
  }
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
  font-weight: 500;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
}

.ghost,
.primary,
.plus,
.danger {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 700;
}

.ghost {
  background: transparent;
  color: var(--muted);
}

.primary {
  background: linear-gradient(180deg, #2cc44a, var(--green));
  color: #fff;
  box-shadow: 0 10px 20px rgba(33, 160, 56, 0.25);
}

.primary:hover {
  background: linear-gradient(180deg, #26b542, var(--green-2));
}

.plus {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  background: linear-gradient(180deg, #2cc44a, var(--green));
  color: #fff;
  font-size: 32px;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 24px rgba(33, 160, 56, 0.28);
}

.plus:hover {
  transform: rotate(90deg) scale(1.04);
}

.danger {
  background: transparent;
  color: var(--warn);
}

.card {
  background: var(--card);
  border: 1px solid rgba(215, 228, 219, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth {
  position: relative;
  z-index: 1;
  min-height: calc(100dvh - var(--clock-h, 64px) - env(safe-area-inset-top, 0px));
  display: grid;
  place-items: center;
  padding: 28px 24px 40px;
}

.auth-card {
  width: min(420px, 100%);
  padding: 28px 28px 32px;
  text-align: center;
}

.auth.enter .auth-card {
  animation: pop 0.55s var(--ease);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-card h1 {
  font-size: 36px;
  margin: 4px 0 8px;
}

.auth-card p {
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.5;
}

.auth-card label,
.auth-card input,
.auth-card .tabs,
.auth-card .stack,
.auth-card .err {
  text-align: left;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 14px 0 6px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.stack {
  display: grid;
  gap: 12px;
}

.empty {
  text-align: center;
  padding: 48px 24px 40px;
}

.empty h2 {
  font-size: 30px;
  margin-bottom: 8px;
}

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

.sticker {
  width: 148px;
  height: 148px;
  object-fit: cover;
  border-radius: 36px;
  margin: 0 auto 12px;
  display: block;
  animation: float 3.4s ease-in-out infinite;
  filter: drop-shadow(0 14px 20px rgba(33, 160, 56, 0.18));
}

.sticker.sm {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  margin-bottom: 8px;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-10px) rotate(2deg);
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.project-card,
.task-card {
  padding: 20px;
  text-align: left;
  width: 100%;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.task-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 148px;
}

.task-card h3 {
  overflow-wrap: anywhere;
}

.task-card .mini-bar {
  margin-top: auto;
}

.enter .project-card,
.enter .task-card {
  animation: rise 0.5s var(--ease) both;
}

.enter .project-card:nth-child(2),
.enter .task-card:nth-child(2) {
  animation-delay: 0.06s;
}

.enter .project-card:nth-child(3),
.enter .task-card:nth-child(3) {
  animation-delay: 0.12s;
}

.project-card:hover,
.task-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(20, 70, 32, 0.12);
}

.project-card h3,
.task-card h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.back {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 0 0 18px;
}

.back:hover {
  color: var(--green-2);
}

.task-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  margin-top: 0;
  align-items: stretch;
}

.prio-board {
  display: grid;
  gap: 20px;
  margin-top: 18px;
}

.prio-lane {
  padding: 14px 14px 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px dashed transparent;
}

.prio-lane.over {
  border-color: var(--green);
  background: var(--green-soft);
}

.prio-lane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.prio-drop {
  grid-column: 1 / -1;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
  font-weight: 600;
}

.prio {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.pip {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #cfd6d1;
  background: #e6ebe7;
  box-shadow: none;
  flex: none;
}

.pip:hover {
  border-color: #e25c2a;
}

.pip.on {
  background: #e25c2a;
  border-color: #c94a1f;
  box-shadow: 0 0 0 3px rgba(226, 92, 42, 0.16);
}

.pip:active {
  transform: scale(0.92);
}

.task-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: -0.12em;
  user-select: none;
  padding: 0 4px;
}

.task-card.dragging {
  opacity: 0.4;
}

.task-open {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.task-open:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
  border-radius: 12px;
}

.task-list .empty {
  grid-column: 1 / -1;
}

.mini-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper-2);
  margin-top: 14px;
  gap: 3px;
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(12, 28, 18, 0.38);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 20;
  animation: fade 0.25s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  width: min(720px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  padding: 24px;
  animation: sheet 0.4s var(--ease);
}

@keyframes sheet {
  from {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.stage-editor {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.stage-block {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--paper);
  border-radius: 16px;
}

.stage-block textarea,
.stage-edit textarea,
#task-desc,
#task-notes {
  min-height: 88px;
}

.attach-box {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: var(--paper);
  border-radius: 16px;
}

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

.card-desc {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stage-head,
.stage-row {
  display: grid;
  grid-template-columns: 1fr minmax(150px, 180px) 72px 72px auto;
  gap: 8px;
  align-items: end;
}

.stage-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 2px;
}

.total {
  background: var(--green-soft);
  color: var(--green-2);
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 700;
}

.task-view {
  padding: 24px;
}

.deadline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  margin: 10px 0 22px;
}

.deadline.soon {
  color: var(--warn);
  font-weight: 700;
}

.timeline {
  display: flex;
  height: 32px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper-2);
  gap: 4px;
  padding: 5px;
}

.seg {
  position: relative;
  min-width: 28px;
  border-radius: 999px;
  overflow: hidden;
  background: #d9e8de;
}

.seg-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, #3ec6f0, #2bb0ed);
  transition: width 0.35s linear;
}

.seg.done .seg-fill {
  width: 100% !important;
  background: linear-gradient(90deg, #3dd45a, var(--green));
  transition: none;
}

.seg.over .seg-fill {
  background: linear-gradient(90deg, #1a9ad6, #1478b0);
}

.seg.run .seg-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: shine 1.6s linear infinite;
}

@keyframes shine {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

.stages {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}

.stage {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.stage-edit {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.stage-edit input[data-stage-edit="title"] {
  font-weight: 800;
  font-size: 16px;
}

.stage-times {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 88px 88px;
  gap: 8px;
}

.stage-times label {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.stage-times input {
  margin-top: 4px;
  padding: 10px 12px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper-2);
}

.stage.done .dot {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.stage.run .dot {
  background: var(--blue);
  animation: pulse 1.4s ease-in-out infinite;
}

.stage.pause .dot {
  background: var(--gold);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(43, 176, 237, 0.45);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(43, 176, 237, 0);
  }
}

.seg.pause .seg-fill {
  background: var(--blue);
  opacity: 0.85;
}

.ghost.big {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

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

.big {
  padding: 16px 22px;
  font-size: 16px;
  border-radius: 18px;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  margin-top: 12px;
}

.err {
  color: var(--warn);
  font-size: 14px;
  min-height: 20px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--paper-2);
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 8px;
}

.tab {
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 10px;
  font-weight: 700;
  color: var(--muted);
}

.tab.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 14px rgba(20, 70, 32, 0.08);
}

.people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  font-size: 13px;
  font-weight: 600;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.chip.you .avatar {
  background: var(--blue);
}

.invite {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--green);
  border-radius: 18px;
  padding: 10px 14px;
  margin: 12px 0 18px;
  font-size: 14px;
}

.invite strong {
  letter-spacing: 0.14em;
  color: var(--green-2);
}

.badge {
  display: inline-block;
  background: var(--blue-soft);
  color: #0f6f96;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.badge.green {
  background: var(--green-soft);
  color: var(--green-2);
}

.icon-btn {
  border: 0;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--green);
}

.chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 2px 0 4px;
  font-size: 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
  align-items: center;
}

.filter-split {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
}

.filters input {
  width: min(360px, 100%);
  flex: 1 1 240px;
  padding: 10px 12px;
}

.note-box {
  background: var(--paper);
  border-radius: 16px;
  padding: 12px 14px;
  margin: 0 0 16px;
  color: var(--muted);
  white-space: pre-wrap;
}

.link-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-width: 0;
}

.link-chip .task-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-row,
.file-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.contact-row {
  grid-template-columns: 1fr 1fr auto;
}

.attach-box .contact-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
}

.task-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.call-btn,
.task-link,
.task-file {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.call-btn {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-2);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

@media (max-width: 640px) {
  .wrap {
    padding: 16px 14px 96px;
    overflow-x: hidden;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .task-list {
    grid-template-columns: 1fr;
  }

  .stage-head {
    display: none;
  }

  .stage-row {
    grid-template-columns: 1fr 1fr auto;
  }

  .stage-row .wide,
  .stage-row input[type="datetime-local"] {
    grid-column: 1 / -1;
  }

  .stage-times {
    grid-template-columns: 1fr 1fr;
  }

  .stage-times label:first-child {
    grid-column: 1 / -1;
  }

  .contact-row,
  .link-row {
    grid-template-columns: 1fr;
  }

  .link-row .ghost {
    justify-self: start;
  }

  .invite {
    flex-wrap: wrap;
  }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.22s;
  animation-timing-function: ease;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
