:root {
  --bg: #ffffff;
  --sidebar: #f9fafb;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --st-todo: #9ca3af;
  --st-doing: #4f46e5;
  --st-waiting: #d97706;
  --st-done: #059669;
  --st-todo-bg: #f3f4f6;
  --st-doing-bg: #eef2ff;
  --st-waiting-bg: #fffbeb;
  --st-done-bg: #ecfdf5;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .16), 0 4px 12px rgba(16, 24, 40, .06);
  --radius: 8px;
  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", "Yu Gothic UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--text-3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; padding: 16px 12px;
}
.content { min-width: 0; }
.main { max-width: 1120px; margin: 0 auto; padding: 28px 36px 80px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 14px; font-weight: 700; font-size: 15px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  display: inline-block; position: relative; flex: none; box-shadow: var(--shadow-sm);
}
.brand-mark::after {
  content: ""; position: absolute; left: 9px; top: 5px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2.4px 2.4px 0; transform: rotate(45deg);
}
.brand-name { letter-spacing: .02em; }
.brand-sub { font-weight: 500; color: var(--text-3); margin-left: 6px; }

.nav { display: grid; gap: 2px; margin: 12px 0 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: none; border-radius: 6px; padding: 7px 10px;
  color: var(--text-2); font-weight: 500; text-align: left;
}
.nav-item svg { color: var(--text-3); flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.nav-item[aria-current="page"] svg { color: var(--accent); }
.nav-count { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-count:empty { display: none; }

.side-section { margin-top: 14px; }
.side-title { font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: .06em; padding: 0 10px 6px; }
.sidebar .member-filter { display: grid; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: none; border-radius: 6px; padding: 6px 10px;
  color: var(--text-2); text-align: left; font-size: 13.5px;
}
.side-item:hover { background: var(--surface-2); color: var(--text); }
.side-item[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-item .count { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.side-item .hash { color: var(--text-3); width: 22px; text-align: center; flex: none; }
.side-item[aria-pressed="true"] .hash { color: var(--accent); }
.side-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.side-projects { flex: 1; }
.side-empty { font-size: 12.5px; color: var(--text-3); padding: 2px 10px; }

.me-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 8px 10px;
  text-align: left; box-shadow: var(--shadow-sm); margin-top: 12px;
}
.me-btn:hover { border-color: var(--border-strong); }
.me-btn .me-name { font-weight: 600; font-size: 13px; line-height: 1.3; }
.me-btn .me-email { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-btn > div { min-width: 0; }

.mobile-bar, .tabbar { display: none; }

.avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
}
.avatar.lg { width: 32px; height: 32px; font-size: 13px; }
.avatar.none { background: var(--surface-2); color: var(--text-3); border: 1px dashed var(--border-strong); }
.avatar.all { background: #6b7280; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---- buttons ---- */
.btn {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 6px;
  padding: 6px 12px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; box-shadow: var(--shadow-sm); color: var(--text);
}
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 8px 12px; }
.icon-btn { border: 0; background: none; color: var(--text-3); padding: 5px; border-radius: 6px; line-height: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---- page head ---- */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.view-head h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.view-head .sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.stats { display: grid; grid-auto-flow: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-sm); }
.stat { padding: 8px 16px; border-left: 1px solid var(--border); min-width: 92px; }
.stat:first-child { border-left: 0; }
.stat-label { font-size: 11.5px; color: var(--text-3); font-weight: 500; white-space: nowrap; }
.stat-value { font-size: 20px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat.over .stat-value { color: var(--danger); }
.stat.ok .stat-value { color: var(--ok); }

/* ---- quick add ---- */
.quickadd {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 6px 6px 6px 12px; box-shadow: var(--shadow-sm); margin-bottom: 28px;
  transition: border-color .15s, box-shadow .15s;
}
.quickadd:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.quickadd-icon { color: var(--text-3); }
.quickadd input { border: 0; background: none; padding: 6px 0; font-size: 14.5px; outline: none; min-width: 0; }
.quickadd input::placeholder { color: var(--text-3); }
.quick-preview { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 4px; }
.quick-preview:empty { display: none; }

.section { margin-bottom: 32px; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text); margin: 0 0 10px;
}
.section-title .count {
  font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2);
  border-radius: 999px; padding: 0 7px; line-height: 18px;
}
.empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-3);
  padding: 28px 18px; text-align: center; color: var(--text-3); font-size: 13px;
}

/* ---- tags & badges ---- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 0 8px; line-height: 20px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; font-weight: 500;
}
.tag.due-over { background: var(--danger-soft); color: var(--danger); }
.tag.due-today { background: var(--warn-soft); color: var(--warn); }
.tag.prio { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.tag.mail { background: var(--accent-soft); color: var(--accent); }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 0 8px; line-height: 20px; border-radius: 999px; white-space: nowrap;
  background: var(--bgc); color: var(--c);
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.st-todo { --c: #6b7280; --bgc: var(--st-todo-bg); }
.st-doing { --c: var(--st-doing); --bgc: var(--st-doing-bg); }
.st-waiting { --c: var(--warn); --bgc: var(--st-waiting-bg); }
.st-done { --c: var(--st-done); --bgc: var(--st-done-bg); }

.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; flex: 1; min-width: 40px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.progress.done > span { background: var(--st-done); }
.progress-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.progress-wrap .pct { width: 34px; text-align: right; }

/* ---- today cards ---- */
.today-list { display: grid; gap: 10px; }
.tcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: start;
  transition: border-color .15s;
}
.tcard:hover { border-color: var(--border-strong); }
.tcard.achieved { background: var(--surface-3); box-shadow: none; }
.tcard.achieved .tcard-title { color: var(--text-3); text-decoration: line-through; }
.check {
  appearance: none; width: 20px; height: 20px; margin: 1px 0 0; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none;
}
.check:hover { border-color: var(--st-done); }
.check:checked { background: var(--st-done); border-color: var(--st-done); }
.check:checked::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.check.sm { width: 18px; height: 18px; }
.check.sq { border-radius: 4px; }
.check.sm:checked::after { width: 4px; height: 8px; }
.tcard-body { min-width: 0; display: grid; gap: 8px; }
.tcard-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tcard-title { font-weight: 600; font-size: 15px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: var(--text); }
.tcard-title:hover { color: var(--accent); }
.tcard-actions { margin-left: auto; display: flex; gap: 2px; align-items: center; }
.meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.goal {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); background: var(--surface-3); border-radius: 6px; padding: 3px 6px 3px 10px;
}
.goal:focus-within { border-color: var(--accent); background: var(--surface); }
.goal label { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.goal input { flex: 1; min-width: 0; border: 0; background: none; padding: 4px 0; outline: none; }
.goal input::placeholder { color: var(--text-3); }
.tcard-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tcard-foot .progress-wrap { width: 240px; }
.note-line { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.note-line b { font-weight: 600; color: var(--text-3); margin-right: 6px; }

.suggest-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.srow {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface);
  border-top: 1px solid var(--border);
}
.srow:first-child { border-top: 0; }
.srow:hover { background: var(--surface-3); }
.srow-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.srow .title-btn { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.srow .title-btn:hover { color: var(--accent); }
.reason { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.reason.over { color: var(--danger); }

/* ---- list (table) ---- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.input, .filters input[type="search"], .filters select {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 6px; padding: 6px 10px; min-width: 0;
  box-shadow: var(--shadow-sm);
}
.input:focus, .filters input:focus, .filters select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 340px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-wrap input { width: 100%; padding-left: 32px !important; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }

.table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); background: var(--surface); }
.trow, .thead {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 96px 130px 130px 130px 36px; gap: 12px; align-items: center;
  padding: 0 16px;
}
.thead {
  background: var(--surface-3); border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--text-3); height: 36px;
}
.tgroup {
  display: flex; align-items: center; gap: 8px; padding: 0 16px; height: 34px;
  background: var(--surface-3); border-bottom: 1px solid var(--border); border-top: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.thead + .tgroup { border-top: 0; }
.tgroup .count { color: var(--text-3); font-weight: 500; }
.tgroup.over { color: var(--danger); }
.trow { min-height: 48px; border-top: 1px solid var(--border); cursor: pointer; padding-block: 8px; }
.tgroup + .trow { border-top: 0; }
.trow:hover { background: var(--surface-3); }
.trow-main { min-width: 0; display: grid; gap: 1px; }
.trow-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.trow-title span { overflow: hidden; text-overflow: ellipsis; }
.trow.is-done .trow-title { color: var(--text-3); text-decoration: line-through; }
.trow-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 10px; align-items: center; }
.trow-sub > span { overflow: hidden; text-overflow: ellipsis; }
.cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-2); }
.cell .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ---- board ---- */
.board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 16px; align-items: start; }
.col { background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 10px; min-height: 160px; }
.col.drop { border-color: var(--accent); background: var(--accent-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 12px; font-weight: 600; font-size: 13px; }
.col-head .count { font-size: 11.5px; color: var(--text-2); background: var(--surface-2); border-radius: 999px; padding: 0 7px; line-height: 18px; font-weight: 600; }
.col-head .muted { margin-left: auto; font-weight: 400; font-size: 11.5px; }
.col-cards { display: grid; gap: 8px; }
.bcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  display: grid; gap: 8px; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s;
}
.bcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.bcard.dragging { opacity: .4; }
.bcard-title { font-weight: 600; line-height: 1.45; }
.bcard-note { font-size: 12px; color: var(--text-2); border-left: 2px solid var(--border-strong); padding: 0 0 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: 8px; }

/* ---- drawer ---- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .3); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(600px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform .22s ease; overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top)) 28px calc(40px + env(safe-area-inset-bottom));
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.title-input {
  flex: 1; font-size: 20px; font-weight: 700; border: 1px solid transparent; border-radius: 6px; overflow: hidden;
  padding: 4px 8px; margin-left: -8px; background: none; resize: none; line-height: 1.4; min-width: 0;
}
.title-input:hover { border-color: var(--border); }
.title-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-sm); flex-wrap: wrap; }
.segmented button { border: 0; border-left: 1px solid var(--border-strong); background: var(--surface); padding: 5px 12px; font-size: 13px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.segmented button:first-child { border-left: 0; }
.segmented button::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.segmented button:hover { background: var(--surface-3); }
.segmented button[aria-pressed="true"] { background: var(--bgc); color: var(--c); font-weight: 600; }
.props { display: grid; grid-template-columns: 84px 1fr; gap: 10px 12px; align-items: center; margin: 18px 0 6px; }
.props > .label { font-size: 13px; color: var(--text-3); }
.props .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.props input[type="range"] { flex: 1; accent-color: var(--accent); }
.dsec { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 20px; }
.dsec h3 { font-size: 14px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.dsec h3 .hint { font-weight: 400; color: var(--text-3); font-size: 12px; }
.today-box { background: var(--accent-soft); border: 1px solid #e0e7ff; border-radius: 8px; padding: 12px; display: grid; gap: 10px; }
.today-box .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.today-box input[type="text"] { flex: 1; min-width: 0; }
.cl-item { display: flex; align-items: center; gap: 10px; padding: 5px 4px; border-radius: 6px; }
.cl-item:hover { background: var(--surface-3); }
.cl-item .cl-text { flex: 1; border: 0; background: none; padding: 2px 4px; border-radius: 4px; min-width: 0; }
.cl-item .cl-text:focus { background: var(--surface); outline: 1px solid var(--accent); }
.cl-item.done .cl-text { color: var(--text-3); text-decoration: line-through; }
.cl-item .icon-btn { opacity: 0; }
.cl-item:hover .icon-btn, .cl-item .icon-btn:focus { opacity: 1; }
.inline-add { display: flex; gap: 8px; margin-top: 8px; }
.inline-add input { flex: 1; }
.mail-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; box-shadow: var(--shadow-sm);
}
.mail-item .mi-icon { color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 6px; line-height: 0; }
.mail-item .mi-subject { font-weight: 600; word-break: break-word; }
.mail-item .mi-sub { font-size: 12px; color: var(--text-3); }
.mail-item .mi-note { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.mail-form { display: grid; gap: 8px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.mail-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mail-form .help { font-size: 12px; color: var(--text-3); margin: 0; }
textarea.input { width: 100%; resize: vertical; min-height: 72px; line-height: 1.6; }
.timeline { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; }
.timeline .tl-body { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.timeline .tl-sys .tl-body { color: var(--text-2); font-size: 13px; }
.timeline .tl-meta { font-size: 12px; color: var(--text-3); }
.timeline .tl-today .tl-body { color: var(--ok); font-weight: 600; }
.timeline .tl-note .tl-body { background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 2px; }
.drawer-foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: 12px; }

/* ---- modal ---- */
.modal {
  border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(17, 24, 39, .4); }
.modal form { padding: 24px; display: grid; gap: 14px; }
.modal h2 { font-size: 18px; margin: 0; }
.modal .lead { margin: -8px 0 4px; color: var(--text-3); font-size: 13px; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field input, .field select { border: 1px solid var(--border-strong); border-radius: 6px; padding: 7px 10px; background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 6px -24px -24px; padding: 14px 24px; background: var(--surface-3); border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #111827; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .trow, .thead { grid-template-columns: 28px minmax(0, 1fr) 96px 120px 110px 32px; }
  .col-project { display: none !important; }
  .main { padding-inline: 24px; }
}
@media (max-width: 900px) {
  .board { grid-template-columns: repeat(4, 280px); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .col { scroll-snap-align: start; }
}
@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { display: none; }
  .mobile-bar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px;
  }
  .mobile-bar .brand { padding: 0; font-size: 15px; }
  .mobile-bar .brand-mark { width: 22px; height: 22px; }
  .mobile-bar .brand-mark::after { left: 7px; top: 4px; width: 5px; height: 10px; }
  .mobile-bar .member-filter { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
  .mobile-bar .side-item { padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; white-space: nowrap; width: auto; gap: 6px; }
  .mobile-bar .side-item .count, .mobile-bar .side-item .avatar { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar-item { border: 0; background: none; padding: 12px 0; font-size: 13px; font-weight: 600; color: var(--text-3); }
  .tabbar-item[aria-current="page"] { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
  .main { padding: 18px 16px 96px; }
  .view-head h1 { font-size: 20px; }
  .stats { width: 100%; grid-auto-columns: 1fr; }
  .stat { padding: 6px 10px; min-width: 0; }
  .stat-value { font-size: 17px; }
  .quickadd { margin-bottom: 22px; }
  .srow-main { flex-direction: column; align-items: flex-start; gap: 0; }
  .srow .title-btn { width: 100%; }
  .hide-sm { display: none !important; }
  .thead { display: none; }
  .trow { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 14px; }
  .trow .cell { grid-column: 2; }
  .trow .cell-status, .trow .cell-progress, .trow .col-project { display: none; }
  .trow .cell-assignee { grid-column: 3; grid-row: 1; }
  .tcard-foot .progress-wrap { width: 100%; }
  .board { grid-template-columns: repeat(4, 82vw); margin: 0 -16px; padding-inline: 16px; }
  .drawer { padding-inline: 18px; }
  .props { grid-template-columns: 64px 1fr; }
  .mail-form .two, .field-row { grid-template-columns: 1fr; }
  .toast { bottom: calc(70px + env(safe-area-inset-bottom)); }
}
