@import url('data:text/css,');
:root {
  --paper: #faf9f6;
  --paper-2: #f3f1eb;
  --ink: #181817;
  --muted: #72706a;
  --line: #d9d6ce;
  --line-dark: #9b988f;
  --accent: #b43b31;
  --accent-soft: #f5e5e1;
  --success: #356b4c;
  --warning: #9b6425;
  --blue: #38647b;
  --shadow: 0 12px 36px rgba(35, 31, 25, .08);
  --sidebar: 270px;
  --radius: 4px;
  color-scheme: light;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); }
body { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.splash { min-height: 100dvh; display: grid; place-content: center; text-align: center; color: var(--muted); letter-spacing: .08em; }
.brand-mark { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-content: center; border: 1px solid var(--ink); font-size: 30px; color: var(--ink); }
.app-shell { min-height: 100dvh; }
.layout { height: 100dvh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); background: #f7f5ef; }
.masthead { padding: 28px 24px 19px; border-bottom: 3px double var(--ink); }
.eyebrow { margin: 0 0 4px; color: var(--accent); font: 700 10px/1.2 system-ui, sans-serif; letter-spacing: .18em; text-transform: uppercase; }
.masthead h1 { margin: 0; font-size: 25px; letter-spacing: .08em; font-weight: 800; }
.masthead time { display: block; margin-top: 7px; color: var(--muted); font: 11px/1.3 system-ui, sans-serif; }
.sidebar-scroll { overflow-y: auto; padding: 16px 13px 100px; }
.nav-home, .project-link, .new-project { width: 100%; border: 0; background: transparent; text-align: left; border-radius: var(--radius); }
.nav-home { display: flex; align-items: center; gap: 10px; padding: 10px 11px; font-weight: 700; }
.nav-home.active, .project-link.active { background: var(--ink); color: white; }
.profile-group { margin-top: 22px; }
.profile-title { display: flex; align-items: center; justify-content: space-between; margin: 0 8px 8px; color: var(--muted); font: 700 10px/1 system-ui, sans-serif; letter-spacing: .13em; text-transform: uppercase; }
.profile-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--success); }
.project-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 9px 10px; margin-bottom: 2px; font-size: 14px; }
.project-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { min-width: 22px; padding: 2px 6px; border: 1px solid currentColor; border-radius: 99px; text-align: center; font: 10px/1.2 system-ui, sans-serif; opacity: .65; }
.new-project { margin-top: 14px; padding: 10px; border: 1px dashed var(--line-dark); color: var(--muted); text-align: center; font-size: 13px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; color: var(--muted); font: 11px/1 system-ui, sans-serif; }
.online::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--success); }
.main { min-width: 0; height: 100dvh; display: flex; flex-direction: column; }
.topbar { flex: 0 0 auto; min-height: 78px; padding: 19px 26px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; background: rgba(250,249,246,.95); }
.topbar h2 { margin: 1px 0 4px; font-size: clamp(22px, 2.3vw, 34px); line-height: 1; letter-spacing: .04em; }
.subtitle { color: var(--muted); font: 12px/1.4 system-ui, sans-serif; }
.top-actions { display: flex; gap: 8px; }
.icon-btn, .secondary-btn, .primary-btn, .danger-btn { min-height: 40px; border-radius: var(--radius); padding: 0 14px; border: 1px solid var(--line-dark); background: white; }
.primary-btn { border-color: var(--ink); background: var(--ink); color: white; }
.danger-btn { color: var(--accent); border-color: var(--accent); }
.icon-btn { width: 40px; padding: 0; }
.workspace { flex: 1 1 auto; min-height: 0; overflow: auto; }
.home { padding: 28px clamp(18px, 3.3vw, 52px) 70px; max-width: 1440px; margin: 0 auto; }
.lead { border-top: 4px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 20px 0 22px; display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; }
.lead h3 { margin: 0; font-size: clamp(30px, 4.2vw, 58px); line-height: 1.05; font-weight: 800; }
.lead p { margin: 4px 0 0; font-size: 15px; line-height: 1.7; color: var(--muted); }
.summary-grid { margin-top: 24px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.summary-card { padding: 18px 16px; border-right: 1px solid var(--line); min-height: 122px; }
.summary-card:last-child { border-right: 0; }
.summary-card .number { display: block; font: 700 38px/1 system-ui, sans-serif; }
.summary-card h4 { margin: 12px 0 0; font-size: 13px; }
.summary-card p { margin: 4px 0 0; color: var(--muted); font: 11px/1.4 system-ui, sans-serif; }
.space-grid { margin-top: 32px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.space-card { min-height: 190px; padding: 20px; border: 1px solid var(--line-dark); background: white; box-shadow: 5px 5px 0 var(--paper-2); }
.space-card header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.space-card h3 { margin: 0; font-size: 19px; }
.space-card ul { margin: 15px 0 0; padding: 0; list-style: none; }
.space-card li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dotted var(--line); font-size: 13px; }
.project-view { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.composer { flex: 0 0 auto; margin: 16px 20px 8px; padding: 13px; border: 1px solid var(--line-dark); background: white; box-shadow: 3px 3px 0 var(--paper-2); }
.composer textarea { width: 100%; min-height: 58px; max-height: 160px; resize: vertical; border: 0; outline: 0; background: transparent; font-size: 15px; line-height: 1.55; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.mode-switch { display: flex; gap: 4px; }
.mode-btn { min-height: 36px; border: 0; background: transparent; padding: 0 11px; border-radius: 3px; color: var(--muted); font-size: 13px; }
.mode-btn.active { color: var(--ink); background: var(--paper-2); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.composer-actions { display: flex; align-items: center; gap: 7px; }
.attach-btn { border: 0; background: transparent; min-width: 36px; min-height: 36px; }
.file-note { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 11px/1 system-ui, sans-serif; }
.board-nav { flex: 0 0 auto; display: none; gap: 6px; padding: 6px 16px 8px; overflow-x: auto; scrollbar-width: none; }
.board-nav button { white-space: nowrap; border: 1px solid var(--line); background: white; padding: 7px 10px; border-radius: 99px; font-size: 11px; }
.board { flex: 1 1 auto; min-height: 0; display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 8px 20px 22px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.column { flex: 0 0 292px; min-width: 292px; height: 100%; min-height: 280px; display: flex; flex-direction: column; scroll-snap-align: start; border-top: 3px solid var(--ink); background: var(--paper-2); }
.column[data-status="running"] { border-top-color: var(--blue); }
.column[data-status="review"] { border-top-color: var(--accent); }
.column[data-status="blocked"] { border-top-color: var(--warning); }
.column[data-status="done"] { border-top-color: var(--success); }
.column-head { padding: 12px 12px 10px; display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); }
.column-head h3 { margin: 0; font-size: 15px; letter-spacing: .04em; }
.column-head span { color: var(--muted); font: 11px/1 system-ui, sans-serif; }
.cards { flex: 1; min-height: 0; overflow-y: auto; padding: 9px; }
.task-card { position: relative; padding: 13px 13px 12px; margin-bottom: 9px; background: white; border: 1px solid var(--line); box-shadow: 2px 2px 0 #e1ded6; cursor: pointer; }
.task-card:hover { border-color: var(--line-dark); transform: translateY(-1px); }
.task-card.urgent::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.card-kicker { display: flex; justify-content: space-between; color: var(--muted); font: 10px/1.2 system-ui, sans-serif; letter-spacing: .04em; }
.task-card h4 { margin: 8px 0 9px; font-size: 15px; line-height: 1.35; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pill { padding: 3px 6px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font: 10px/1 system-ui, sans-serif; }
.pill.profile { color: var(--ink); }
.empty-column { padding: 24px 10px; color: var(--muted); font-size: 12px; text-align: center; }
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(20,19,17,.28); backdrop-filter: blur(2px); }
.drawer { position: fixed; z-index: 21; top: 0; right: 0; width: min(590px, 92vw); height: 100dvh; overflow-y: auto; background: var(--paper); border-left: 1px solid var(--ink); box-shadow: var(--shadow); padding: 24px 28px calc(38px + env(safe-area-inset-bottom)); }
.drawer-close { position: sticky; top: 0; float: right; z-index: 2; }
.detail-kicker { margin-top: 38px; color: var(--accent); font: 700 11px/1 system-ui, sans-serif; letter-spacing: .13em; }
.drawer h2 { margin: 9px 0 18px; font-size: 30px; line-height: 1.14; }
.detail-body { white-space: pre-wrap; line-height: 1.7; font-size: 14px; padding: 18px 0; border-top: 3px double var(--ink); border-bottom: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font: 10px/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.field select, .field input { width: 100%; min-height: 40px; border: 1px solid var(--line-dark); background: white; padding: 8px; }
.timeline { margin-top: 25px; }
.timeline h3 { border-bottom: 1px solid var(--ink); padding-bottom: 8px; font-size: 14px; }
.timeline-item { padding: 10px 0 10px 15px; border-left: 1px solid var(--line); font-size: 12px; line-height: 1.5; }
.timeline-item time { display: block; color: var(--muted); font: 10px/1 system-ui, sans-serif; margin-bottom: 4px; }
.comment-box { display: flex; gap: 7px; margin-top: 18px; }
.comment-box input { flex: 1; min-width: 0; border: 1px solid var(--line-dark); background: white; padding: 10px; }
.modal { position: fixed; z-index: 21; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(680px, calc(100vw - 30px)); max-height: 88dvh; overflow-y: auto; background: var(--paper); border: 1px solid var(--ink); box-shadow: var(--shadow); padding: 25px; }
.modal h2 { margin: 0 0 18px; font-size: 26px; }
.modal label { display: block; margin: 12px 0 5px; color: var(--muted); font-size: 11px; }
.modal input, .modal textarea, .modal select { width: 100%; border: 1px solid var(--line-dark); background: white; min-height: 42px; padding: 9px; }
.modal textarea { min-height: 90px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.plan-goal { font-size: 16px; line-height: 1.55; border-top: 3px double var(--ink); border-bottom: 1px solid var(--ink); padding: 14px 0; }
.plan-task { margin: 12px 0; padding: 13px; border: 1px solid var(--line); background: white; }
.plan-task header { display: flex; justify-content: space-between; gap: 12px; }
.plan-task h4 { margin: 0; }
.risk { color: var(--accent); font: 700 10px/1 system-ui, sans-serif; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); max-width: calc(100vw - 30px); padding: 11px 15px; background: var(--ink); color: white; opacity: 0; pointer-events: none; transition: .2s ease; font: 12px/1.4 system-ui, sans-serif; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.offline-banner { padding: 9px 18px; background: #fff1d9; border-bottom: 1px solid #d5a44b; color: #754d16; font: 12px/1.35 system-ui, sans-serif; }
.mobile-bar { display: none; }
.loading { padding: 50px; color: var(--muted); text-align: center; }

@media (max-width: 780px) {
  body { overflow: hidden; }
  .layout { display: block; }
  .sidebar { position: fixed; z-index: 30; inset: 0 18% 0 0; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .layout.menu-open .sidebar { transform: none; }
  .main { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 65px; padding: calc(12px + env(safe-area-inset-top)) 15px 11px; align-items: center; }
  .topbar h2 { font-size: 22px; }
  .topbar .subtitle { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions .secondary-btn { display: none; }
  .workspace { overflow: hidden; }
  .home { height: 100%; overflow-y: auto; padding: 18px 15px 90px; }
  .lead { display: block; padding: 14px 0 18px; }
  .lead h3 { font-size: 35px; }
  .lead p { margin-top: 13px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; scroll-snap-type: none; }
  .summary-card { min-height: 104px; padding: 14px 12px; border-bottom: 1px solid var(--line); }
  .summary-card:nth-child(2n) { border-right: 0; }
  .summary-card:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .space-grid { grid-template-columns: 1fr; }
  .project-view { height: 100%; }
  .composer { margin: 8px 10px 4px; padding: 10px; }
  .composer textarea { min-height: 48px; }
  .composer-bottom { display: block; }
  .mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 8px; }
  .mode-btn { padding: 0 5px; font-size: 12px; }
  .composer-actions { justify-content: flex-end; }
  .board-nav { display: flex; -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent 100%); mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent 100%); }
  .board { padding: 5px 14px 15px; gap: 10px; scroll-snap-type: x mandatory; }
  .column { flex-basis: calc(100vw - 50px); min-width: calc(100vw - 50px); }
  .drawer { inset: 0; width: 100%; padding: calc(16px + env(safe-area-inset-top)) 17px calc(80px + env(safe-area-inset-bottom)); border-left: 0; }
  .drawer h2 { font-size: 26px; }
  .detail-grid { grid-template-columns: 1fr; }
  .mobile-bar { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line-dark); background: rgba(250,249,246,.97); }
  .mobile-bar button { border: 0; background: transparent; font-size: 11px; }
  .mobile-bar button strong { display: block; margin-bottom: 3px; font-size: 18px; }
  .modal { top: auto; bottom: 0; left: 0; transform: none; width: 100%; max-height: 90dvh; border-width: 1px 0 0; padding: 20px 17px calc(24px + env(safe-area-inset-bottom)); }
}

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