:root {
  --navy: #18222e;
  --navy-2: #223142;
  --ink: #1e2934;
  --muted: #66717d;
  --faint: #96a0a9;
  --line: #dce1e5;
  --line-soft: #edf0f2;
  --paper: #ffffff;
  --canvas: #f4f5f4;
  --orange: #e36b3d;
  --orange-soft: #fff0e9;
  --teal: #2d7e78;
  --teal-soft: #e4f0ee;
  --blue: #4c6f94;
  --blue-soft: #e9eff5;
  --red: #b94b4b;
  --red-soft: #f8eaea;
  --green: #4e7c61;
  --green-soft: #e7f0ea;
  --amber: #b47b25;
  --amber-soft: #f7eedc;
  --shadow: 0 18px 48px rgba(24, 34, 46, 0.08);
  --shadow-small: 0 8px 24px rgba(24, 34, 46, 0.08);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { border: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(227, 107, 61, 0.24);
  outline-offset: 2px;
}
a { color: inherit; text-decoration: none; }

.page-shell {
  width: min(1480px, calc(100% - 64px));
  margin-inline: auto;
}

.product-mark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--navy);
  flex: 0 0 auto;
}
.product-mark > span:last-child { display: grid; line-height: 1; gap: 4px; }
.product-mark b { font-family: var(--mono); font-size: 16px; letter-spacing: 0.16em; }
.product-mark small { font-family: var(--mono); font-size: 7px; letter-spacing: 0.17em; color: var(--faint); }
.product-mark-symbol { width: 30px; height: 30px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; transform: skew(-8deg); }
.product-mark-symbol i { background: currentColor; border-radius: 1px; }
.product-mark-symbol i:nth-child(1) { height: 56%; align-self: end; }
.product-mark-symbol i:nth-child(2) { height: 78%; align-self: end; }
.product-mark-symbol i:nth-child(3) { height: 100%; }
.product-mark-light { color: #fff; }
.product-mark-light small { color: rgba(255,255,255,.48); }

/* Authentication */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(420px, .82fr);
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.is-auth-loading .auth-screen,
.is-authenticated .auth-screen { display: none; }
.is-logged-out .auth-screen { opacity: 1; pointer-events: auto; }
.auth-visual {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    var(--navy);
  background-size: 54px 54px;
  color: #fff;
}
.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, transparent 55%, rgba(227,107,61,.1));
}
.auth-visual-inner {
  position: relative;
  z-index: 1;
  min-height: 100%;
  padding: 54px clamp(44px, 6vw, 96px) 46px;
  display: flex;
  flex-direction: column;
}
.auth-project-copy { margin: auto 0 52px; max-width: 720px; }
.auth-kicker { display: block; margin-bottom: 25px; font: 500 11px/1 var(--mono); letter-spacing: .18em; color: #93a3b2; }
.auth-project-copy h1 { margin: 0; font-size: clamp(48px, 6vw, 82px); line-height: 1.13; letter-spacing: -.045em; font-weight: 500; }
.auth-project-copy h1 em { color: #ef8a61; font-style: normal; }
.auth-project-copy p { max-width: 620px; margin: 30px 0 0; color: #b9c2ca; font-size: 15px; line-height: 1.9; }
.auth-mini-plan { width: min(720px, 100%); border-top: 1px solid rgba(255,255,255,.13); border-bottom: 1px solid rgba(255,255,255,.13); padding: 18px 0; }
.auth-mini-months { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0 0 12px 92px; color: #738494; font: 500 9px/1 var(--mono); letter-spacing: .12em; }
.auth-mini-row { display: grid; grid-template-columns: 92px repeat(100, 1fr); min-height: 26px; align-items: center; border-top: 1px solid rgba(255,255,255,.055); }
.auth-mini-row b { grid-column: 1; font-size: 10px; font-weight: 500; color: #9aa9b6; }
.auth-mini-row i { grid-column: calc(var(--start) + 1) / span var(--span); height: 5px; border-radius: 5px; background: #dce4e9; opacity: .88; }
.auth-mini-row:nth-child(3) i { background: #ef8a61; }
.auth-mini-row:nth-child(4) i { background: #6fa39e; }
.auth-mini-row:nth-child(5) i { background: #7792ae; }
.auth-period { display: flex; justify-content: space-between; gap: 24px; margin-top: 26px; color: #8293a2; font: 500 10px/1.4 var(--mono); letter-spacing: .12em; }
.auth-period strong { color: #c7d0d7; font-weight: 500; }

.auth-form-panel { display: grid; place-items: center; padding: 52px clamp(32px, 6vw, 90px); background: #fbfbfa; }
.auth-card { width: min(430px, 100%); }
.auth-card-step { color: var(--orange); font: 600 10px/1 var(--mono); letter-spacing: .17em; }
.auth-card h2 { margin: 18px 0 9px; color: var(--navy); font-size: 28px; line-height: 1.35; letter-spacing: -.02em; }
.auth-card-head p { margin: 0 0 38px; color: var(--muted); font-size: 13px; }
.field-label { display: block; margin: 0 0 8px; color: #4f5c68; font-size: 12px; font-weight: 600; }
.auth-card input, .auth-card select {
  width: 100%; height: 52px; border: 1px solid #d7dce0; border-radius: 5px; background: #fff; color: var(--navy); padding: 0 15px; transition: border-color 150ms, box-shadow 150ms;
}
.auth-card input:focus, .auth-card select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(24,34,46,.08); outline: 0; }
.auth-card input { margin-bottom: 22px; }
.select-wrap { position: relative; margin-bottom: 22px; }
.select-wrap::after { content: "⌄"; position: absolute; right: 15px; top: 13px; color: var(--muted); pointer-events: none; }
.auth-card select { appearance: none; }
.auth-submit { width: 100%; height: 54px; border-radius: 5px; background: var(--navy); color: #fff; font-weight: 600; transition: transform 150ms, background 150ms; }
.auth-submit:hover { background: var(--navy-2); transform: translateY(-1px); }
.auth-submit:disabled { opacity: .58; cursor: wait; transform: none; }
.form-error { min-height: 22px; margin: 10px 0 0; color: var(--red); font-size: 12px; }
.auth-trust { margin-top: 24px; padding-top: 19px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; }
.auth-trust span { color: var(--teal); font-size: 8px; margin-right: 8px; }

/* App shell */
.app { display: none; min-height: 100vh; }
.is-authenticated .app { display: block; }
.app-header {
  position: sticky; top: 0; z-index: 50; height: 72px; padding: 0 max(32px, calc((100vw - 1480px) / 2)); display: flex; align-items: center; gap: 26px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px);
}
.header-project { min-width: 0; display: flex; align-items: center; gap: 24px; }
.header-divider { width: 1px; height: 28px; background: var(--line); }
.header-project div { display: grid; min-width: 0; gap: 2px; }
.header-project small { font: 500 8px/1 var(--mono); letter-spacing: .14em; color: var(--faint); }
.header-project strong { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { position: relative; margin-left: auto; display: flex; align-items: center; gap: 18px; }
.sync-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.sync-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.sync-state.online i { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.sync-state.offline i { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.header-account { min-width: 184px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; }
.header-account:hover { background: var(--canvas); }
.account-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 4px; background: var(--navy); color: #fff; font: 600 11px/1 var(--mono); }
.header-account > span:nth-child(2) { display: grid; min-width: 0; gap: 1px; }
.header-account strong { overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.header-account small { color: var(--faint); font: 500 8px/1.4 var(--mono); letter-spacing: .08em; }
.chevron { color: var(--faint); }
.account-popover { position: absolute; right: 0; top: calc(100% + 12px); width: 230px; display: none; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-small); }
.account-popover.open { display: grid; gap: 5px; }
.account-popover span { color: var(--faint); font-size: 10px; }
.account-popover strong { font-size: 12px; }
.account-popover button { margin-top: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--red); font-size: 11px; text-align: left; }

main { overflow: hidden; }
.project-hero { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 80px; padding-top: 70px; padding-bottom: 52px; }
.hero-kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.hero-kicker span { padding: 5px 8px; border-radius: 3px; background: var(--orange); color: #fff; font: 600 9px/1 var(--mono); letter-spacing: .13em; }
.hero-kicker b { font-size: 11px; color: var(--muted); font-weight: 600; }
.hero-copy h1 { margin: 0; color: var(--navy); font-size: clamp(36px, 4.4vw, 62px); line-height: 1.18; letter-spacing: -.045em; font-weight: 600; }
.hero-copy h1 span { color: #526273; font-weight: 400; }
.hero-copy > p { max-width: 760px; margin: 25px 0 30px; color: var(--muted); font-size: 14px; line-height: 1.9; }
.hero-goals { display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero-goals span { padding: 11px 20px 11px 0; margin-right: 20px; color: #4d5a66; font-size: 11px; white-space: nowrap; }
.hero-goals b { margin-right: 8px; color: var(--orange); font: 600 9px/1 var(--mono); }
.hero-status { align-self: end; padding: 26px 0 7px 30px; border-left: 1px solid var(--line); }
.status-label { font: 600 9px/1 var(--mono); letter-spacing: .15em; color: var(--faint); }
.progress-figure { display: flex; align-items: baseline; margin: 11px 0; color: var(--navy); }
.progress-figure strong { font: 500 58px/.95 var(--mono); letter-spacing: -.08em; }
.progress-figure span { margin-left: 5px; font: 500 15px/1 var(--mono); color: var(--muted); }
.progress-track { height: 5px; margin-bottom: 24px; overflow: hidden; background: #dfe3e6; border-radius: 5px; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--orange); transition: width 450ms cubic-bezier(.2,.8,.2,1); }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 10px; }
.progress-meta span { color: var(--faint); }
.progress-meta strong { color: #52606c; font-family: var(--mono); font-weight: 500; }

.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.38); }
.summary-item { display: flex; gap: 17px; padding: 25px 28px; border-right: 1px solid var(--line); }
.summary-item:first-child { padding-left: 0; }
.summary-item:last-child { border-right: 0; }
.summary-index { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font: 600 10px/1 var(--mono); }
.summary-index.alert { background: var(--orange-soft); color: var(--orange); }
.summary-item div { display: grid; gap: 2px; }
.summary-item small { color: var(--faint); font-size: 10px; }
.summary-item strong { color: var(--navy); font: 600 20px/1.25 var(--mono); }
.summary-item p { margin: 0; color: var(--muted); font-size: 10px; }

.workspace { padding-top: 56px; }
.workspace-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 24px; }
.section-kicker { display: block; margin-bottom: 8px; color: var(--orange); font: 600 9px/1 var(--mono); letter-spacing: .17em; }
.workspace-heading h2, .next-actions h2 { margin: 0; color: var(--navy); font-size: 25px; line-height: 1.3; }
.workspace-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.workspace-link { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; color: var(--blue); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.workspace-link:hover { color: var(--navy); }
.workspace-actions { display: flex; gap: 8px; }
.outline-button, .solid-button, .create-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.outline-button { border: 1px solid var(--line); background: #fff; color: #4f5d68; }
.solid-button { background: var(--navy); color: #fff; }
.create-button { background: var(--orange); color: #fff; box-shadow: 0 7px 18px rgba(227,107,61,.2); }
.outline-button:hover { border-color: #bac2c8; }
.solid-button:hover { background: var(--navy-2); }
.create-button:hover { background: #cf5e34; transform: translateY(-1px); }

.schedule-toolbar { min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-bottom: 0; border-radius: 7px 7px 0 0; background: #fff; }
.search-box { width: 210px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-right: 1px solid var(--line); }
.search-box span { color: var(--faint); font-size: 17px; }
.search-box input { width: 100%; border: 0; background: transparent; color: var(--ink); font-size: 11px; outline: 0; }
.search-box input::placeholder { color: #a4acb3; }
.filter-group { display: inline-flex; align-items: center; gap: 3px; }
.filter-group button, .zoom-switch button { min-height: 31px; padding: 0 11px; border-radius: 3px; background: transparent; color: var(--muted); font-size: 10px; }
.filter-group button:hover, .zoom-switch button:hover { background: var(--canvas); }
.filter-group button.active { background: var(--navy); color: #fff; }
.time-filter { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 4px; background: #f7f8f8; transition: border-color 150ms, background 150ms; }
.time-filter.active { border-color: #b7c9c7; background: var(--teal-soft); }
.time-filter label { display: flex; align-items: center; gap: 5px; height: 29px; padding: 0 7px; border-radius: 3px; background: #fff; color: var(--faint); }
.time-filter label span { font-size: 8px; white-space: nowrap; }
.time-filter select, .time-filter input { height: 27px; border: 0; background: transparent; color: var(--ink); font-size: 9px; outline: 0; }
.time-filter select { width: 86px; }
.time-filter input { width: 108px; }
.time-filter > button { width: 27px; height: 27px; border-radius: 3px; background: transparent; color: var(--muted); font-size: 14px; }
.time-filter > button:disabled { opacity: .3; cursor: default; }
.time-filter > button:not(:disabled):hover { background: #fff; color: var(--red); }
.mine-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; cursor: pointer; }
.mine-toggle input { position: absolute; opacity: 0; }
.mine-toggle span { position: relative; width: 27px; height: 16px; border-radius: 10px; background: #cfd5d9; transition: background 150ms; }
.mine-toggle span::after { content: ""; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: transform 150ms; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.mine-toggle input:checked + span { background: var(--teal); }
.mine-toggle input:checked + span::after { transform: translateX(11px); }
.zoom-switch { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 4px; background: var(--canvas); }
.zoom-switch button { min-height: 27px; padding-inline: 10px; }
.zoom-switch button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(24,34,46,.09); }

.timeline-card { border: 1px solid var(--line); border-radius: 0 0 7px 7px; background: #fff; box-shadow: var(--shadow-small); overflow: hidden; }
.timeline-scroll { overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: #aeb7be #eef0f2; }
.timeline { --label-width: 320px; --chart-width: 1120px; min-width: calc(var(--label-width) + var(--chart-width)); }
.timeline.zoom-week { --chart-width: 1580px; }
.timeline-head, .lane-row, .task-row { display: grid; grid-template-columns: var(--label-width) var(--chart-width); }
.timeline-head { position: sticky; top: 0; z-index: 6; min-height: 48px; border-bottom: 1px solid var(--line); background: #f9faf9; }
.timeline-head-label { position: sticky; left: 0; z-index: 8; display: flex; align-items: end; padding: 0 16px 10px; border-right: 1px solid var(--line); background: #f9faf9; color: #7f8a94; font: 600 9px/1 var(--mono); letter-spacing: .1em; }
.month-axis, .week-axis { position: relative; }
.month-cell { position: absolute; inset-block: 0; display: flex; align-items: end; padding: 0 0 10px 10px; border-left: 1px solid var(--line); color: #46535f; font: 600 10px/1 var(--mono); letter-spacing: .08em; }
.month-cell small { margin-left: 5px; color: var(--faint); font-size: 8px; }
.week-tick { position: absolute; inset-block: 0; border-left: 1px solid var(--line-soft); }
.week-tick span { position: absolute; bottom: 10px; left: 5px; color: var(--faint); font: 500 8px/1 var(--mono); }
.lane-row { min-height: 32px; border-bottom: 1px solid #d9e0e4; background: #f1f4f4; }
.lane-label { position: sticky; left: 0; z-index: 5; display: flex; align-items: center; gap: 9px; padding: 0 16px; border-right: 1px solid var(--line); background: #f1f4f4; }
.lane-label i { width: 3px; height: 15px; border-radius: 3px; background: var(--lane-color); }
.lane-label strong { color: #3d4b57; font-size: 11px; }
.lane-label span { margin-left: auto; color: var(--faint); font: 500 8px/1 var(--mono); }
.lane-axis { position: relative; background-image: linear-gradient(to right, var(--line-soft) 1px, transparent 1px); background-size: calc(100% / 5) 100%; }
.task-row { min-height: 50px; border-bottom: 1px solid #e8ecef; background: #fff; transition: opacity 150ms, background 150ms; }
.task-row:hover { background: #fbfcfc; }
.task-row.is-hidden { display: none; }
.task-label { position: sticky; left: 0; z-index: 4; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 13px; border-right: 1px solid var(--line); background: inherit; }
.task-number { color: var(--faint); font: 500 8px/1 var(--mono); }
.task-label-text { min-width: 0; display: grid; gap: 2px; }
.task-label strong { overflow: hidden; color: #2f3e4a; font-size: 10.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.task-label small { overflow: hidden; color: #8a959e; font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.task-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #7d8993; }
.task-status-dot.doing { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.task-status-dot.blocked { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.task-status-dot.done { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.task-axis { position: relative; background-image: linear-gradient(to right, var(--line-soft) 1px, transparent 1px); background-size: calc(100% / 5) 100%; }
.today-line, .closure-line { position: absolute; z-index: 2; top: 0; bottom: 0; width: 1px; background: var(--orange); pointer-events: none; }
.today-line::before { content: none; }
.today-line.show-label::before { content: "TODAY"; position: absolute; top: 6px; left: 4px; color: var(--orange); font: 600 7px/1 var(--mono); letter-spacing: .08em; }
.closure-line { width: 10px; transform: translateX(-5px); background: repeating-linear-gradient(90deg, rgba(185,75,75,.04), rgba(185,75,75,.04) 3px, rgba(185,75,75,.14) 3px, rgba(185,75,75,.14) 4px); }
.task-bar { position: absolute; z-index: 3; top: 11px; height: 28px; min-width: 12px; display: flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid rgba(255,255,255,.24); border-radius: 4px; background: #74828e; color: #fff; box-shadow: 0 2px 7px rgba(24,34,46,.18), inset 0 1px rgba(255,255,255,.1); overflow: hidden; text-align: left; white-space: nowrap; transition: filter 150ms, transform 150ms, box-shadow 150ms; }
.task-bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--progress); background: rgba(255,255,255,.24); border-right: 1px solid rgba(255,255,255,.22); pointer-events: none; }
.task-bar span { position: relative; overflow: hidden; font-size: 9.5px; font-weight: 700; letter-spacing: .01em; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.14); }
.task-bar small { position: relative; margin-left: auto; font: 600 8px/1 var(--mono); opacity: .92; }
.task-bar:hover { filter: brightness(.96) saturate(1.08); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(24,34,46,.22); }
.task-bar.doing { background: #237a74; }
.task-bar.blocked { background: #d46339; }
.task-bar.done { background: #47795b; }
.task-bar.milestone { width: 17px !important; min-width: 17px; height: 17px; top: 17px; padding: 0; overflow: visible; border: 0; border-radius: 2px; background: var(--navy); transform: translateX(-8px) rotate(45deg); }
.task-bar.milestone:hover { transform: translateX(-8px) rotate(45deg) scale(1.08); }
.task-bar.milestone span { position: absolute; width: max-content; max-width: 170px; left: 20px; top: -2px; transform: rotate(-45deg); color: #35424d; font-weight: 600; }
.empty-timeline { padding: 60px 24px; color: var(--muted); text-align: center; }
.timeline-footer { min-height: 49px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--line); background: #fafbfa; }
.legend { display: flex; flex-wrap: wrap; gap: 15px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.legend span::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: #9ba6af; }
.legend .doing::before { background: var(--teal); }
.legend .blocked::before { background: var(--orange); }
.legend .done::before { background: var(--green); }
.legend .milestone::before { background: var(--navy); transform: rotate(45deg); border-radius: 1px; }
.timeline-note { color: var(--faint); font-size: 9px; }

.next-actions { padding-top: 72px; padding-bottom: 76px; }
.next-actions-head { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 22px; }
.next-actions-head p { max-width: 430px; margin: 0; color: var(--muted); font-size: 11px; }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; box-shadow: var(--shadow-small); }
.action-card { min-height: 188px; padding: 24px; border-right: 1px solid var(--line); }
.action-card:last-child { border-right: 0; }
.action-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 23px; }
.action-card-head span:first-child { color: var(--orange); font: 600 11px/1 var(--mono); }
.action-state { padding: 4px 7px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-size: 8px; }
.action-card h3 { min-height: 45px; margin: 0 0 12px; color: #374550; font-size: 12px; line-height: 1.7; }
.action-card p { margin: 0; color: var(--muted); font-size: 10px; }

footer { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); color: var(--faint); font-size: 9px; }
footer div { display: flex; align-items: center; gap: 16px; }
footer strong { color: var(--navy); font: 600 12px/1 var(--mono); letter-spacing: .12em; }
footer b { color: var(--muted); font-family: var(--mono); font-weight: 500; }

/* Drawer */
.drawer-backdrop { position: fixed; z-index: 80; inset: 0; display: none; background: rgba(17,27,37,.28); backdrop-filter: blur(2px); }
.drawer-backdrop.open { display: block; }
.task-drawer { position: fixed; z-index: 90; top: 0; right: 0; width: min(520px, 100vw); height: 100vh; display: flex; flex-direction: column; background: #fff; box-shadow: -22px 0 60px rgba(24,34,46,.19); transform: translateX(104%); transition: transform 260ms cubic-bezier(.2,.8,.2,1); }
.task-drawer.open { transform: translateX(0); }
.drawer-head { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 25px; border-bottom: 1px solid var(--line); }
.drawer-kicker { color: var(--orange); font: 600 8px/1 var(--mono); letter-spacing: .16em; }
.drawer-head h2 { margin: 5px 0 0; color: var(--navy); font-size: 19px; }
.drawer-close { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--canvas); color: var(--muted); font-size: 23px; line-height: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 26px; }
.drawer-phase { display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 3px; background: var(--blue-soft); color: var(--blue); font: 600 8px/1 var(--mono); letter-spacing: .1em; }
.drawer-task-title { margin: 15px 0 20px; color: var(--navy); font-size: 23px; line-height: 1.45; }
.drawer-task-heading { display: grid; gap: 11px; margin: 15px 0 20px; }
.drawer-task-heading .drawer-task-title { margin: 0; }
.task-manage-actions { display: flex; gap: 6px; }
.task-manage-actions button { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--muted); font-size: 9px; }
.task-manage-actions button:hover { border-color: #aeb8c0; color: var(--ink); }
.task-manage-actions button.danger { margin-left: auto; border-color: #ecd4d4; color: var(--red); }
.drawer-meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.drawer-meta { padding: 14px 0; }
.drawer-meta:nth-child(odd) { border-right: 1px solid var(--line); }
.drawer-meta:nth-child(even) { padding-left: 16px; }
.drawer-meta:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
.drawer-meta small { display: block; color: var(--faint); font-size: 9px; }
.drawer-meta strong { display: block; margin-top: 3px; color: #465460; font-size: 11px; }
.drawer-description { margin: 22px 0 0; padding: 17px 18px; border-left: 3px solid var(--orange); background: #faf8f5; color: #56636e; font-size: 11px; line-height: 1.85; }
.update-form { margin-top: 28px; }
.update-form-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.update-form-title h3 { margin: 0; color: var(--navy); font-size: 14px; }
.scope-badge { padding: 4px 7px; border-radius: 9px; background: var(--teal-soft); color: var(--teal); font-size: 8px; }
.status-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.status-option { min-height: 42px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--muted); font-size: 9px; }
.status-option.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.progress-control { margin-top: 19px; }
.form-row-label { display: flex; justify-content: space-between; margin-bottom: 8px; color: #52606b; font-size: 10px; font-weight: 600; }
.form-row-label output { color: var(--orange); font-family: var(--mono); }
.progress-control input { width: 100%; accent-color: var(--orange); }
.update-form label[for="update-note"] { display: block; margin: 18px 0 7px; color: #52606b; font-size: 10px; font-weight: 600; }
.update-form textarea { width: 100%; min-height: 96px; resize: vertical; padding: 12px 13px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); font-size: 11px; line-height: 1.7; }
.update-form textarea:focus { border-color: var(--navy); outline: 0; box-shadow: 0 0 0 3px rgba(24,34,46,.07); }
.save-update { width: 100%; min-height: 48px; margin-top: 13px; border-radius: 4px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 600; }
.save-update:hover { background: #cf5e34; }
.save-update:disabled { opacity: .5; cursor: not-allowed; }
.read-only-note { margin-top: 24px; padding: 14px; border-radius: 4px; background: var(--amber-soft); color: #76551f; font-size: 10px; }
.comment-section { margin-top: 28px; padding-top: 23px; border-top: 1px solid var(--line); }
.comment-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.comment-section-head h3 { margin: 0; color: var(--navy); font-size: 13px; }
.comment-section-head span { color: var(--faint); font: 500 9px/1 var(--mono); }
.comment-form { display: grid; gap: 8px; padding-bottom: 19px; }
.comment-form textarea { width: 100%; min-height: 78px; resize: vertical; padding: 11px 12px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); font-size: 11px; line-height: 1.7; }
.comment-form textarea:focus { border-color: var(--navy); outline: 0; box-shadow: 0 0 0 3px rgba(24,34,46,.07); }
.comment-form button { justify-self: end; min-height: 36px; padding: 0 14px; border-radius: 4px; background: var(--navy); color: #fff; font-size: 9px; font-weight: 600; }
.comment-form button:disabled { opacity: .5; }
.comment-list { display: grid; gap: 1px; }
.comment-entry { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 11px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.comment-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 4px; color: #fff; font-size: 9px; font-weight: 600; }
.comment-content { min-width: 0; }
.comment-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; }
.comment-meta strong { color: var(--ink); font-size: 10px; }
.comment-meta span { color: var(--faint); font-size: 8px; }
.comment-content p { margin: 5px 0 0; color: #52606b; font-size: 10.5px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 10px; margin-top: 7px; }
.comment-actions button { padding: 0; background: transparent; color: var(--faint); font-size: 8px; text-decoration: underline; text-underline-offset: 2px; }
.comment-actions button:last-child { color: #aa6565; }
.task-update-log { margin-top: 27px; padding-top: 22px; border-top: 1px solid var(--line); }
.task-update-log h3, .history-view h3 { margin: 0 0 15px; color: var(--navy); font-size: 13px; }
.update-entry { position: relative; display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; padding: 0 0 20px; }
.update-entry:not(:last-child)::before { content: ""; position: absolute; left: 4px; top: 12px; bottom: 1px; width: 1px; background: var(--line); }
.update-entry-dot { position: relative; z-index: 1; width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px #fff; }
.update-entry-main { min-width: 0; }
.update-entry-main strong { font-size: 10px; }
.update-entry-main span { display: inline-flex; margin-left: 7px; color: var(--faint); font-size: 8px; }
.update-entry-main p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.update-entry time { color: var(--faint); font: 500 8px/1.4 var(--mono); white-space: nowrap; }
.history-filter { display: flex; gap: 5px; margin-bottom: 20px; }
.history-filter button { padding: 6px 9px; border-radius: 3px; background: var(--canvas); color: var(--muted); font-size: 9px; }
.history-filter button.active { background: var(--navy); color: #fff; }
.empty-log { padding: 26px 0; color: var(--faint); font-size: 10px; text-align: center; }

/* Task create / edit */
.task-editor-intro { margin: 0 0 23px; padding: 13px 15px; border-left: 3px solid var(--teal); background: var(--teal-soft); color: #47645f; font-size: 10px; }
.task-editor > label, .task-editor-grid label { display: block; margin: 0 0 7px; color: #52606b; font-size: 10px; font-weight: 600; }
.task-editor > input, .task-editor > textarea, .task-editor-grid input, .task-editor-grid select { width: 100%; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); font-size: 11px; }
.task-editor > input, .task-editor-grid input, .task-editor-grid select { height: 43px; padding: 0 11px; }
.task-editor > textarea { min-height: 120px; resize: vertical; padding: 11px 12px; line-height: 1.7; }
.task-editor > input, .task-editor > textarea { margin-bottom: 18px; }
.task-editor input:focus, .task-editor select:focus, .task-editor textarea:focus { border-color: var(--navy); outline: 0; box-shadow: 0 0 0 3px rgba(24,34,46,.07); }
.task-editor-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 12px; margin-bottom: 18px; }
.milestone-check { display: inline-flex !important; align-items: center; gap: 9px; margin: 1px 0 0 !important; color: var(--muted) !important; cursor: pointer; }
.milestone-check input { position: absolute; opacity: 0; }
.milestone-check span { width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.milestone-check input:checked + span { border-color: var(--teal); background: var(--teal); box-shadow: inset 0 0 0 4px #fff; }
.task-editor-error { min-height: 20px; margin: 11px 0 0; color: var(--red); font-size: 10px; }
.task-editor-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 6px; }
.task-editor-actions .save-update { margin: 0; }

.toast-region { position: fixed; z-index: 120; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast { min-width: 280px; max-width: 380px; padding: 13px 15px; border-radius: 5px; background: var(--navy); color: #fff; box-shadow: var(--shadow); font-size: 10px; animation: toast-in 180ms ease both; }
.toast.error { background: #8b3939; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1040px) {
  .schedule-toolbar { flex-wrap: wrap; }
  .page-shell { width: min(100% - 40px, 1480px); }
  .auth-screen { grid-template-columns: 1fr 440px; }
  .auth-visual-inner { padding-inline: 45px; }
  .auth-project-copy h1 { font-size: 50px; }
  .project-hero { grid-template-columns: minmax(0, 1fr) 230px; gap: 40px; }
  .summary-item { padding-inline: 18px; }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
  .action-card:nth-child(2) { border-right: 0; }
  .action-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .page-shell { width: calc(100% - 28px); }
  .auth-screen { display: block; background: #fff; }
  .auth-visual { min-height: 410px; }
  .auth-visual-inner { padding: 30px 25px; }
  .auth-project-copy { margin: auto 0 18px; }
  .auth-project-copy h1 { font-size: 38px; }
  .auth-project-copy p { margin-top: 17px; font-size: 12px; }
  .auth-mini-plan { display: none; }
  .auth-period { margin-top: 23px; }
  .auth-form-panel { padding: 38px 24px 52px; }
  .auth-card-head p { margin-bottom: 28px; }
  .app-header { height: 62px; padding: 0 14px; gap: 11px; }
  .product-mark b { font-size: 13px; }
  .product-mark small, .header-project, .sync-state, .header-account > span:nth-child(2), .chevron { display: none; }
  .product-mark-symbol { width: 25px; height: 25px; }
  .header-account { min-width: 42px; width: 42px; padding: 4px; grid-template-columns: 34px; }
  .project-hero { display: block; padding-top: 43px; padding-bottom: 32px; }
  .hero-copy h1 { font-size: 35px; }
  .hero-copy > p { margin-top: 18px; font-size: 12px; }
  .hero-copy, .hero-copy > p { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .hero-goals { display: grid; }
  .hero-goals span { padding: 8px 0; margin: 0; border-bottom: 1px solid var(--line-soft); }
  .hero-goals span:last-child { border-bottom: 0; }
  .hero-status { margin-top: 31px; padding: 21px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .progress-figure strong { font-size: 48px; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-item { min-width: 0; padding: 17px 10px; border-bottom: 1px solid var(--line); }
  .summary-item:nth-child(2) { border-right: 0; }
  .summary-item:nth-child(n+3) { border-bottom: 0; }
  .summary-item:first-child { padding-left: 10px; }
  .summary-item strong { font-size: 17px; }
  .workspace { padding-top: 40px; }
  .workspace-heading { align-items: start; flex-direction: column; gap: 18px; }
  .workspace-link { display: flex; width: max-content; margin: 7px 0 0; }
  .workspace-actions { width: 100%; }
  .workspace-actions .outline-button { display: none; }
  .workspace-actions .solid-button, .workspace-actions .create-button { flex: 1; min-width: 0; }
  .solid-button, .create-button { padding-inline: 11px; }
  .schedule-toolbar { flex-wrap: wrap; gap: 8px; padding: 10px; }
  .search-box { width: 100%; height: 34px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .filter-group { max-width: 100%; overflow-x: auto; }
  .time-filter { width: 100%; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) 30px; }
  .time-filter label { min-width: 0; }
  .time-filter select, .time-filter input { width: 100%; min-width: 0; }
  .mine-toggle { margin-left: 0; }
  .zoom-switch { margin-left: auto; }
  .timeline { --label-width: 220px; --chart-width: 980px; }
  .timeline.zoom-week { --chart-width: 1480px; }
  .task-label { grid-template-columns: 18px minmax(0, 1fr) auto; padding-inline: 9px; }
  .timeline-footer { align-items: start; flex-direction: column; }
  .next-actions { padding-top: 54px; padding-bottom: 52px; }
  .next-actions-head { align-items: start; flex-direction: column; gap: 11px; }
  .action-grid { grid-template-columns: 1fr; }
  .action-card { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .action-card:last-child { border-bottom: 0; }
  footer { align-items: start; flex-direction: column; justify-content: center; }
  .drawer-body { padding: 22px 18px; }
  .status-options { grid-template-columns: repeat(2, 1fr); }
  .task-editor-grid { grid-template-columns: 1fr; gap: 12px; }
}

@media print {
  body { background: #fff; }
  .app-header, .workspace-actions, .schedule-toolbar, .next-actions, footer, .drawer-backdrop, .task-drawer, .toast-region { display: none !important; }
  .page-shell { width: 100%; }
  .project-hero { padding: 22px 0; }
  .timeline-card { box-shadow: none; }
  .timeline-scroll { overflow: visible; }
  .timeline { --label-width: 220px; --chart-width: 880px; transform-origin: top left; }
}

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