/* ==========================================================================
   同频 · 设计系统
   视觉语言对齐 DeepSeek Harness 客户端：近白底色、发丝级描边、克制的蓝色点缀、
   扁平无重投影、紧凑排版。明暗双主题，全响应式，零外部资源依赖。
   ========================================================================== */

/* --------------------------------- 字体 --------------------------------- */

/* MiSans 的 @font-face 由服务端通过 /fonts/misans.css 下发（见 src/static.js）：
   装了字体文件就用文件，没装就只认系统已安装的 MiSans，任何情况都不会 404。
   仓库已内置 MiSans（npm run font 生成的，随打包一起走）；重装/更新：npm run font。
   MiSans 是「中文 + 拉丁」两套字配对，中文分片不含 A-Z/a-z，所以后面要接 MiSansLatin。 */

:root {
  --font-sans: 'MiSans', 'MiSansLatin', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
  --font-mono: 'MiSans', 'MiSansLatin', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

/* ------------------------------- 主题变量 ------------------------------- */

:root {
  --brand: #2563eb;
  --brand-2: #60a5fa;
  --brand-grad: linear-gradient(135deg, #2563eb, #60a5fa);

  --ok: #12a150;
  --warn: #d97706;
  --danger: #e5484d;
  --info: #0891b2;

  /* 主内容区是纯白，侧栏是极浅灰 —— 这是 Harness 客户端的底色关系 */
  --bg: #ffffff;
  --bg-soft: #f8f8fa;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f3f3f5;
  --surface-4: #ececef;
  --border: #ececef;
  --border-strong: #dcdce1;
  --text: #1a1a1c;
  --text-2: #56565e;
  --muted: #8b8b94;
  --faint: #a9a9b1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --on-primary: #ffffff;

  --shadow-sm: 0 1px 2px rgb(16 16 24 / 4%);
  --shadow-md: 0 2px 10px rgb(16 16 24 / 7%);
  --shadow-lg: 0 14px 40px rgb(16 16 24 / 13%), 0 2px 8px rgb(16 16 24 / 5%);
  --ring: 0 0 0 3px rgb(37 99 235 / 15%);

  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --sidebar-w: 252px;
  --header-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

[data-theme='dark'] {
  --bg: #191919;
  --bg-soft: #141414;
  --surface: #212121;
  --surface-2: #262626;
  --surface-3: #2b2b2d;
  --surface-4: #333335;
  --border: #2e2e30;
  --border-strong: #3d3d40;
  --text: #ececec;
  --text-2: #b6b6bc;
  --muted: #8a8a92;
  --faint: #6a6a72;
  --primary: #5b8cff;
  --primary-hover: #7ba3ff;
  --primary-soft: #16233f;
  --on-primary: #0f1116;
  --ok: #3ecf7c;
  --warn: #f0b429;
  --danger: #ff6b6b;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow-md: 0 2px 10px rgb(0 0 0 / 38%);
  --shadow-lg: 0 16px 44px rgb(0 0 0 / 55%);
  --ring: 0 0 0 3px rgb(91 140 255 / 22%);
}

@media (prefers-color-scheme: dark) {
  [data-theme='auto'] {
    --bg: #191919;
    --bg-soft: #141414;
    --surface: #212121;
    --surface-2: #262626;
    --surface-3: #2b2b2d;
    --surface-4: #333335;
    --border: #2e2e30;
    --border-strong: #3d3d40;
    --text: #ececec;
    --text-2: #b6b6bc;
    --muted: #8a8a92;
    --faint: #6a6a72;
    --primary: #5b8cff;
    --primary-hover: #7ba3ff;
    --primary-soft: #16233f;
    --on-primary: #0f1116;
    --ok: #3ecf7c;
    --warn: #f0b429;
    --danger: #ff6b6b;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow-md: 0 2px 10px rgb(0 0 0 / 38%);
    --shadow-lg: 0 16px 44px rgb(0 0 0 / 55%);
    --ring: 0 0 0 3px rgb(91 140 255 / 22%);
  }
}

/* --------------------------------- 基础 --------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.62;
  font-feature-settings: 'tnum' 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

code,
kbd,
pre,
.mono {
  font-family: var(--font-mono);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  background-clip: padding-box;
  border: 3px solid transparent;
}
::-webkit-scrollbar-track {
  background: transparent;
}

.hidden {
  display: none !important;
}

.only-sm {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------- 启动骨架 ------------------------------- */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: var(--bg);
}
.boot__logo {
  animation: bootPulse 1.6s ease-in-out infinite;
}
.boot__text {
  color: var(--muted);
  font-size: 12.5px;
}
@keyframes bootPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.noscript {
  padding: 48px 24px;
  max-width: 520px;
  margin: 0 auto;
}

/* ------------------------------- 通用组件 ------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.13s, border-color 0.13s, color 0.13s, transform 0.06s;
}
.btn:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.btn:active {
  transform: scale(0.98);
}
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn--ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}
.btn--danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 26%, var(--border));
}
.btn--danger:hover {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border-color: var(--danger);
}
.btn--danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn--danger-solid:hover {
  filter: brightness(1.05);
  background: var(--danger);
}
.btn--sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}
.btn--lg {
  height: 42px;
  padding: 0 20px;
  font-size: 14.5px;
  border-radius: var(--radius);
}
.btn--block {
  width: 100%;
}
.btn--icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  color: var(--text-2);
}
.btn--icon.btn--sm {
  width: 26px;
  height: 26px;
}
.btn--icon:hover {
  color: var(--text);
}

.icon {
  /* 16px 起步：副屏/远距离下 15px 的细笔画偏糊，和别站的 18px 也差得远。
     齿轮这类多曲线图标尤其明显（见 ui.js 里 settings 的注释）。 */
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--lg {
  width: 19px;
  height: 19px;
}
.icon--xs {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}
.icon--xl {
  width: 24px;
  height: 24px;
}

/* 登录/引导页右上角的主题按钮（浮在角上，不参与居中布局） */
.auth__theme {
  position: fixed;
  top: calc(14px + var(--safe-t));
  right: 14px;
  z-index: 5;
}

/* ---------------------------------------------------------------- 头像
   三种形态共用 .avatar 这个圆形底座：上传的图片用 <img> 铺满，表情/首字母直接排字。 */
.avatar--img {
  overflow: hidden;
  padding: 0;
}
.avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.avatar--emoji {
  font-size: 1.05em;
  line-height: 1;
}
.avatar--sm.avatar--emoji {
  font-size: 0.95em;
}
/* 资料面板里的头像编辑区 */
.avatar-edit {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar-edit__preview .avatar {
  width: 56px;
  height: 56px;
  font-size: 20px;
}
.avatar-edit__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.avatar-edit__hint {
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 6px;
}

/* ---------------------------------------------------------------- 主题切换按钮   与其它 inorize 站点（file.inorize.com 等）同款：38×38 圆角方按钮，太阳/月亮两枚
   18px 图标按 data-theme 互换，没有"自动"这个中间态 —— 点一下就是明确的浅色/深色。 */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.theme-toggle:hover {
  color: var(--primary);
  border-color: rgb(37 99 235 / 35%);
  background: rgb(37 99 235 / 8%);
}
.theme-toggle svg {
  display: block;
}
.theme-toggle .tt-moon {
  display: none;
}
[data-theme='dark'] .theme-toggle .tt-sun {
  display: none;
}
[data-theme='dark'] .theme-toggle .tt-moon {
  display: block;
}
[data-theme='dark'] .theme-toggle:hover {
  background: rgb(96 165 250 / 14%);
}
/* 顶栏里更紧凑一点 */
.theme-toggle--sm {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}
.theme-toggle--sm svg {
  width: 16px;
  height: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}
.field__hint {
  font-size: 11.5px;
  color: var(--muted);
}
.field__error {
  font-size: 12px;
  color: var(--danger);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.13s, box-shadow 0.13s, background 0.13s;
}
.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--border-strong);
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--faint);
}
.textarea {
  resize: vertical;
  min-height: 62px;
  line-height: 1.65;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.input--sm {
  padding: 5px 9px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.checkbox input {
  appearance: none;
  width: 16px;
  height: 16px;
  flex: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 4.5px;
  background: var(--surface);
  position: relative;
  transition: background 0.13s, border-color 0.13s;
  cursor: pointer;
}
.checkbox input:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.checkbox input:checked::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(45deg);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 19px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.badge--primary {
  background: var(--primary-soft);
  color: var(--primary);
}
.badge--ok {
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  color: var(--ok);
}
.badge--warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
}
.badge--danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--muted);
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: #fff;
  flex: none;
  user-select: none;
}
.avatar--sm {
  width: 19px;
  height: 19px;
  font-size: 9px;
}
.avatar--lg {
  width: 34px;
  height: 34px;
  font-size: 13px;
}
.avatar-stack {
  display: flex;
  align-items: center;
}
.avatar-stack .avatar {
  margin-left: -6px;
  box-shadow: 0 0 0 2px var(--bg);
}
.avatar-stack .avatar:first-child {
  margin-left: 0;
}
.avatar-stack__more {
  margin-left: -6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  box-shadow: 0 0 0 2px var(--bg);
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
}

.online-dot {
  position: relative;
}
.online-dot::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--bg);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 0;
}

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty__icon {
  margin-bottom: 10px;
  color: var(--faint);
}
.empty__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 3px;
}
.empty__text {
  font-size: 12.5px;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.75;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 22%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

/* --------------------------------- 登录 --------------------------------- */

.auth {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background: var(--bg-soft);
}
.auth__box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 28px 26px;
  margin: auto;
}
.auth__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.auth__mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-grad);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}
.auth__name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.25;
}
.auth__slogan {
  font-size: 11.5px;
  color: var(--muted);
}
.auth__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 3px;
}
.auth__sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 18px;
  line-height: 1.75;
}
.auth__form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.auth__features {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.auth__feature {
  display: flex;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.7;
}
.auth__feature strong {
  color: var(--text);
  font-weight: 600;
}
.auth__feature .icon {
  color: var(--primary);
  margin-top: 3px;
}
.auth__foot {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* -------------------------------- 应用外壳 -------------------------------- */

.app-root {
  height: 100dvh;
  display: grid;
  grid-template-columns: 1fr; /* 侧边栏已取消：整页宽度都给内容（副屏挂机时把空间还回来） */
  overflow: hidden;
}

.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: var(--safe-t);
}
.sidebar__head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 14px 12px;
}
.sidebar__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand-grad);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}
.sidebar__brand {
  flex: 1;
  min-width: 0;
}
.sidebar__name {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.sidebar__slogan {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__cta {
  padding: 0 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar__section {
  padding: 8px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
  min-height: 0;
}
.sidebar__actions {
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 头像上方的实时时钟：数字用等宽，秒跳动时宽度不抖 */
.sideclock {
  padding: 10px 12px 9px;
  margin-bottom: 4px;
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.sideclock__time {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  line-height: 1.15;
}
.sideclock__date {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

/* 侧栏里的主行动按钮：白底 + 发丝描边（Harness 客户端「新会话」同款） */
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  width: 100%;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  transition: background 0.13s, border-color 0.13s;
}
.cta:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.cta--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
  justify-content: flex-start;
  padding: 0 12px;
  height: 32px;
  font-weight: 500;
}
.cta--ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* 侧边栏里的主行动按钮：实心主题色 */
.cta--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.cta--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.proj {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--text-2);
  transition: background 0.12s, color 0.12s;
}
.proj:hover {
  background: var(--surface-3);
  color: var(--text);
}
.proj.is-active {
  background: var(--surface-4);
  color: var(--text);
  font-weight: 550;
}
.proj__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.proj__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.proj__count {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}

.me {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.me:hover {
  background: var(--surface-3);
}
.me__info {
  flex: 1;
  min-width: 0;
}
.me__name {
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}
.me__role {
  font-size: 11px;
  color: var(--muted);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding-top: var(--safe-t);
  background: var(--bg);
}

.topbar {
  height: var(--header-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* ---------------------------------------------------------------- 项目下拉 */
.projpick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  max-width: 240px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.13s, background 0.13s;
}
.projpick:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.projpick__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar__home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--primary);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.13s, color 0.13s;
}
.topbar__home:hover {
  background: var(--primary-soft);
}
.topbar__home .icon {
  width: 18px;
  height: 18px;
}
/* 兼容旧类名（避免别处/旧缓存用到就掉样式） */
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--primary);
  font-size: 13.5px;
}
.topbar__brand .icon {
  width: 18px;
  height: 18px;
}

/* ------------------------------------------------------- 顶栏视图页签（横排） */
.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar {
  display: none;
}
.topnav .nav__item {
  width: auto;
  flex: 0 0 auto;
  padding: 6px 11px;
  gap: 6px;
  font-size: 13px;
  border-radius: 999px;
}
.topnav .nav__item.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
[data-theme='dark'] .topnav .nav__item.is-active {
  background: rgb(96 165 250 / 14%);
}
.topnav .nav__n {
  font-size: 11px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.topnav .nav__item.is-active .nav__n {
  background: rgb(37 99 235 / 14%);
  color: var(--primary);
}

/* ------------------------------------------------------- 常驻快速添加输入框 */
.quickadd {
  position: relative;
  flex: 1 1 300px;
  min-width: 150px;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.quickadd__more {
  flex: 0 0 auto;
}
.quickadd__input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.13s, background 0.13s, box-shadow 0.13s;
}
.quickadd__input::placeholder {
  color: var(--faint);
}
.quickadd__input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--ring);
}
.quickadd__input:disabled {
  opacity: 0.6;
}
/* 识别提示：浮在输入框下面，不进文档流（不挤压清单） */
.quickadd__hint {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 12px;
}
.quickadd__label {
  color: var(--muted);
}
.quickadd__chip {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.quickadd__note {
  margin-left: auto;
  color: var(--faint);
  font-size: 11.5px;
}

/* --------------------------------------------------------- 顶栏里的紧凑时钟 */
.sideclock--sm {
  padding: 3px 9px;
  margin-bottom: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  background: transparent;
}
.sideclock--sm .sideclock__time {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.sideclock--sm .sideclock__date {
  font-size: 11px;
  color: var(--muted);
}
/* 我的头像按钮：GitHub 那种做法 —— **头像本身就是按钮**，
   一个 34px 的圆形图片，外面不再套圆角方按钮（不套 padding、边框、底色）。 */
.me-btn {
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 0;
  transition: box-shadow 0.13s, transform 0.13s;
}
.me-btn .avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}
.me-btn:hover {
  box-shadow: 0 0 0 2px var(--border-strong);
}
.me-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
@media (max-width: 1560px) {
  /* 屏不够宽时页签只留图标（hover 有 title），把宽度让给"加一条任务" —— 那才是天天要用的 */
  .topnav .nav__label {
    display: none;
  }
  .topnav .nav__item {
    padding: 6px 9px;
  }
}
@media (max-width: 1280px) {
  .sideclock--sm {
    display: none;
  }
}
@media (max-width: 1180px) {
  .hide-lg {
    display: none !important;
  }
}
@media (max-width: 1020px) {
  .hide-md {
    display: none !important;
  }
  .sideclock--sm {
    display: none;
  }
}
@media (max-width: 860px) {
  .quickadd {
    flex: 1 1 auto;
  }
  .topnav .nav__label {
    display: none;
  }
  .topnav .nav__item {
    padding: 6px 9px;
  }
  .projpick {
    max-width: 150px;
  }
}
.topbar__titles {
  min-width: 0;
  flex: 1;
}
.topbar__title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 7px;
}
.topbar__sub {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.hamburger {
  display: none;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  white-space: nowrap;
}
.conn__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

/* 连接状态平时不显示（见 app.js 的注释）：正常时整块收起，
   只在"连接中/已断开/未连接"时露出一个小圆点当信号。 */
.conn--dot {
  padding: 0;
  background: none;
  gap: 0;
}
.conn--dot.is-quiet {
  display: none;
}
.conn--dot .conn__dot {
  width: 7px;
  height: 7px;
}
.conn--dot.is-offline .conn__dot,
.conn--dot.is-idle .conn__dot {
  background: var(--danger);
}
.conn--dot.is-connecting .conn__dot {
  background: var(--warn);
  animation: connPulse 1.1s ease-in-out infinite;
}
@keyframes connPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
.conn.is-live .conn__dot {
  background: var(--ok);
}
.conn.is-connecting .conn__dot {
  background: var(--warn);
  animation: blink 1.1s ease-in-out infinite;
}
.conn.is-offline .conn__dot {
  background: var(--danger);
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px;
  padding-bottom: calc(26px + var(--safe-b));
}
.view__inner {
  max-width: 900px;
  margin: 0 auto;
}
.view__inner--wide {
  max-width: 1140px;
  margin: 0 auto;
}

/* ------------------------------- 倒计时条 ------------------------------- */

.strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar {
  display: none;
}
.mini {
  flex: none;
  min-width: 172px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.13s, background 0.13s;
}
.mini:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.mini__label {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 148px;
}
.mini__num {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.mini__unit {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}
.mini__clock {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  margin-top: 1px;
}
.mini__bar {
  margin-top: 6px;
  height: 3px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.mini__bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--mini-color, var(--brand));
}

/* 侧栏导航：清单 / 倒计时 / 专注 / 统计 / 设置（顶部标签栏已取消） */
.nav {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 8px 8px;
}
.nav:empty {
  display: none;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.nav__item:hover {
  background: var(--surface-3);
  color: var(--text);
}
.nav__item.is-active {
  background: var(--surface-4);
  color: var(--text);
  font-weight: 550;
}
.nav__item .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.nav__item.is-active .icon {
  color: var(--text-2);
}
.nav__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav__n {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* -------------------------------- 任务区 -------------------------------- */

.quick {
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  transition: border-color 0.13s, box-shadow 0.13s;
}
.quick:focus-within {
  border-color: var(--primary);
  box-shadow: var(--ring);
}
.quick__row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.quick__input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  padding: 6px 2px;
  outline: none;
}
.quick__input:focus,
.quick__input:focus-visible {
  box-shadow: none;
}
.quick__input::placeholder {
  color: var(--faint);
}
/* 一排看得见的选项：点哪个改哪个，不需要记语法 */
.quick__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 9px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.13s, color 0.13s, background 0.13s;
}
.opt:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.opt.is-set {
  border-color: color-mix(in srgb, var(--primary) 34%, var(--border));
  background: var(--primary-soft);
  color: var(--primary);
}
.opt > .icon {
  width: 14px;
  height: 14px;
}
.opt__x {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: -4px;
  border-radius: 4px;
  color: inherit;
  opacity: 0.6;
}
.opt__x:hover {
  opacity: 1;
  background: color-mix(in srgb, currentColor 16%, transparent);
}
.opt__x .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2.4;
}
select.opt--select {
  appearance: none;
  padding-right: 24px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  max-width: 190px;
  text-overflow: ellipsis;
}

/* 优先级：四个并排按钮，选中的那个才亮 */
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.seg__btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  border-left: 1px solid var(--border);
  transition: background 0.13s, color 0.13s;
}
.seg__btn:first-child {
  border-left: none;
}
.seg__btn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.seg__btn.is-active {
  background: var(--surface-4);
  color: var(--text);
  font-weight: 600;
}
.seg__btn.is-active[data-p='1'] {
  color: var(--info);
}
.seg__btn.is-active[data-p='2'] {
  color: var(--warn);
}
.seg__btn.is-active[data-p='3'] {
  color: var(--danger);
}

.qtag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  padding: 0 4px 0 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
}
.qtag__x {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  color: var(--muted);
}
.qtag__x:hover {
  background: color-mix(in srgb, currentColor 14%, transparent);
  color: var(--text);
}
.qtag__x .icon {
  width: 10px;
  height: 10px;
  stroke-width: 2.4;
}

/* 展开的二级面板（截止时间 / 标签 / 备注） */
.quick__panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  animation: slideDown 0.16s ease;
}
.quick__panel-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.quick__panel .textarea {
  flex: 1;
  min-width: 200px;
}

/* 标题里识别到时间时的提示条：只提示，不自动改 */
.quick__detect {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 9px;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  border: 1px dashed color-mix(in srgb, var(--primary) 34%, transparent);
  font-size: 12.5px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.chip:hover {
  background: var(--surface-3);
}
.chip.is-active {
  background: var(--surface-4);
  color: var(--text);
  font-weight: 600;
}
.chip__n {
  font-size: 10.5px;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}
.filters__spacer {
  flex: 1;
}

.tasks {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
/* 单行任务条：副屏挂机时一屏能看几十条，比"每条三行"实用得多。
   标题占满剩余宽度，截止/优先级/标签/负责人挤在右侧同一行；
   备注默认收起，点一下这条才展开（配合 .is-open）。 */
.task {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.13s, background 0.13s, opacity 0.2s;
  position: relative;
  min-height: 34px;
}
.task:hover {
  border-color: var(--border-strong);
}
.task.is-open {
  align-items: flex-start;
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.task.is-dragging {
  box-shadow: var(--shadow-lg);
  z-index: 5;
  opacity: 0.96;
}
.task.is-done {
  opacity: 0.55;
}
/* 刚添加的那条闪一下：不用弹提示也知道"加成功了、加的是这条" */
.task.is-new {
  animation: taskNew 1.3s ease;
}
@keyframes taskNew {
  0% {
    background: var(--primary-soft);
    border-color: var(--primary);
    transform: translateY(-2px);
  }
  60% {
    background: var(--primary-soft);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    transform: none;
  }
  100% {
    background: var(--surface);
    border-color: var(--border);
  }
}
.task.is-done .task__title {
  text-decoration: line-through;
  text-decoration-color: var(--faint);
}
/* 左侧色条只表示优先级（低=蓝 中=橙 高=红），紧急度交给时间徽章和底色 */
.task.is-overdue {
  background: color-mix(in srgb, var(--danger) 4%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
}
.task.is-soon {
  background: color-mix(in srgb, var(--warn) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--warn) 24%, var(--border));
}
.task__grip {
  width: 16px;
  align-self: stretch;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--faint);
  cursor: grab;
  touch-action: none;
  border-radius: 5px;
  opacity: 0;
  transition: opacity 0.13s, color 0.13s;
}
.task:hover .task__grip {
  opacity: 1;
}
.task__grip:active {
  cursor: grabbing;
  color: var(--text-2);
}
.task__check {
  flex: none;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  padding: 0; /* button 自带 padding，不清掉会把图标挤偏 */
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  line-height: 0;
  color: transparent;
  transition: all 0.15s;
  background: var(--surface);
}
.task__check svg {
  display: block; /* inline 的基线间隙也会造成偏移 */
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}
.task__check:hover {
  border-color: var(--primary);
  color: color-mix(in srgb, var(--primary) 55%, transparent);
}
.task__check.is-checked {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
  animation: pop 0.22s ease;
}
@keyframes pop {
  0% {
    transform: scale(0.82);
  }
  55% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}
.task__body {
  flex: 1 1 auto;
  min-width: 0;
}
.task__title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  /* 单行：超出省略，鼠标悬停看 title 全文；点开展开备注 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 备注默认收起 —— 一屏几十条时它最占地方；点一下任务才展开 */
.task__note {
  display: none;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  white-space: pre-wrap;
  word-break: break-word;
}
.task.is-open .task__note {
  display: block;
}
.task.is-open .task__title {
  white-space: normal;
  word-break: break-word;
}
.task__meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  margin-top: 0;
  flex-wrap: nowrap;
}
/* 单行模式下标签多了会挤，超过两个就只留前两个 */
.task__meta .tag:nth-child(n + 4) {
  display: none;
}
.task__due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.task__due--soon {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
}
.task__due--overdue {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.task__assignee {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-2);
}
.task__actions {
  display: flex;
  gap: 1px;
  flex: none;
  opacity: 0;
  transition: opacity 0.13s;
}
.task:hover .task__actions,
.task.is-editing .task__actions {
  opacity: 1;
}
@media (hover: none) {
  .task__actions {
    opacity: 1;
  }
  .task__grip {
    opacity: 0.5;
  }
}
.prio {
  width: 3px;
  align-self: stretch;
  border-radius: 999px;
  flex: none;
  background: transparent;
}
.prio--0 {
  background: transparent;
}
.prio--1 {
  background: var(--info);
}
.prio--2 {
  background: var(--warn);
}
.prio--3 {
  background: var(--danger);
}

/* 编辑态：让编辑器独占整行（.task 是 flex 行，不换行的话表单会被挤成一条窄柱子） */
.task.is-editing {
  flex-wrap: wrap;
}
.task.is-editing .task-edit {
  flex: 1 0 100%;
}

.task-edit {
  display: grid;
  gap: 9px;
  margin-top: 9px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  animation: slideDown 0.16s ease;
}
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
}
.task-edit__top {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.task-edit__top .field {
  flex: 1;
  min-width: 0;
}
.task-edit .textarea {
  min-height: 52px; /* 编辑时不用留那么高，整块更紧凑 */
}
.task-edit__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.task-edit__foot {
  display: flex;
  gap: 8px;
  flex: none;
  padding-bottom: 1px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--faint);
  margin: 18px 0 8px;
  cursor: pointer;
  user-select: none;
}
.section-title:hover {
  color: var(--muted);
}
.section-title__line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ------------------------------- 倒计时页 ------------------------------- */

.ms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
  gap: 12px;
}
.ms {
  position: relative;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.ms:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.ms::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--ms-color, var(--brand));
}
.ms.is-past {
  opacity: 0.66;
}
.ms__head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.ms__title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  word-break: break-word;
  line-height: 1.45;
}
.ms__tools {
  display: flex;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.13s;
  flex: none;
}
.ms:hover .ms__tools {
  opacity: 1;
}
@media (hover: none) {
  .ms__tools {
    opacity: 1;
  }
}
.ms__num {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-top: 2px;
}
.ms__digits {
  font-size: 46px;
  font-weight: 700;
}
/* 不足一天时，时钟本身升为大号显示 */
.ms__digits--clock {
  font-size: 34px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.ms__unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}
/* 秒级跳动的那一行 */
.ms__clock {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  margin-top: 2px;
}
.ms__clock b {
  color: var(--text);
  font-weight: 600;
}
.ms__when {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.ms__bar {
  margin-top: 12px;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.ms__bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ms-color, var(--brand));
  transition: width 0.4s ease;
}
.ms__progress {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.ms__badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 9px;
  align-items: center;
}

/* -------------------------------- 专注页 -------------------------------- */

.focus-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
  align-items: start;
}
.timer {
  padding: 26px 20px 22px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  position: relative;
  transition: border-color 0.3s;
}
.timer.is-running {
  border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
}
.timer__ring {
  position: relative;
  width: 216px;
  height: 216px;
  margin: 0 auto 16px;
}
.timer__ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}
.timer__track {
  stroke: var(--surface-3);
}
.timer__prog {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s linear, stroke 0.3s;
}
.timer.is-break .timer__prog {
  stroke: var(--ok);
}
.timer__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 3px;
}
.timer__digits {
  font-size: 42px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
  font-family: var(--font-mono);
}
.timer__label {
  font-size: 12px;
  color: var(--muted);
}
.timer__task {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 5px;
  max-width: 180px;
  margin-inline: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timer__controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.timer__durations {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.timer__today {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 30px;
}
.stat-mini {
  text-align: center;
}
.stat-mini__v {
  font-size: 18px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.stat-mini__l {
  font-size: 11.5px;
  color: var(--muted);
}

.live-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.live {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.live__body {
  flex: 1;
  min-width: 0;
}
.live__name {
  font-size: 12.5px;
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 6px;
}
.live__task {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live__time {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  flex: none;
  font-family: var(--font-mono);
}

/* -------------------------------- 统计页 -------------------------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.kpi {
  padding: 13px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}
.kpi__label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}
.kpi__value {
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  margin-top: 2px;
}
.kpi__unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}
.kpi__sub {
  font-size: 11.5px;
  color: var(--muted);
}

.panel {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel__title {
  font-size: 13.5px;
  font-weight: 600;
}
.panel__sub {
  font-size: 11.5px;
  color: var(--muted);
}

.chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.chart__axis {
  stroke: var(--border);
  stroke-width: 1;
}
.chart__grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.8;
}
.chart__label {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart__bar {
  transition: opacity 0.15s;
}
.chart__bar:hover {
  opacity: 0.82;
}
.chart__value {
  fill: var(--text-2);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
}
.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend__swatch {
  width: 9px;
  height: 9px;
  border-radius: 2.5px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  padding: 0 10px 8px;
  white-space: nowrap;
}
.table td {
  padding: 9px 10px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.table td.num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table tr:hover td {
  background: var(--surface-2);
}
.table__who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.table__bar {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  min-width: 56px;
}
.table__bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.ring-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.ring {
  width: 126px;
  height: 126px;
  flex: none;
  position: relative;
}
.ring svg {
  transform: rotate(-90deg);
}
.ring__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.ring__pct {
  font-size: 24px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ring__cap {
  font-size: 11px;
  color: var(--muted);
}

.urgent {
  display: flex;
  flex-direction: column;
}
.urgent__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}
.urgent__row:first-child {
  border-top: none;
}
.urgent__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -------------------------------- 侧抽屉 -------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgb(20 20 24 / 34%);
  display: grid;
  z-index: 60;
  animation: fade 0.15s ease;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.overlay--center {
  place-items: center;
  padding: 20px;
  overflow-y: auto;
}
.overlay--right {
  justify-items: end;
}

.drawer {
  width: min(420px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  animation: slideLeft 0.19s cubic-bezier(0.22, 1, 0.36, 1);
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}
@keyframes slideLeft {
  from {
    transform: translateX(20px);
    opacity: 0.5;
  }
}
.drawer--left {
  border-left: none;
  border-right: 1px solid var(--border);
  animation: slideRight 0.19s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes slideRight {
  from {
    transform: translateX(-20px);
    opacity: 0.5;
  }
}
.drawer__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.drawer__title {
  flex: 1;
  font-size: 14.5px;
  font-weight: 600;
}
.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  min-height: 0;
}
.drawer__foot {
  flex: none;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.17s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
}
@keyframes modalIn {
  from {
    transform: translateY(8px) scale(0.99);
    opacity: 0;
  }
}
.modal__head {
  padding: 18px 20px 0;
}
.modal__title {
  font-size: 15.5px;
  font-weight: 600;
}
.modal__sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.7;
}
.modal__body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.modal__foot {
  padding: 0 20px 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.menu {
  position: fixed;
  z-index: 80;
  min-width: 184px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  animation: modalIn 0.12s ease;
  max-width: 280px;
}
.menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
  text-align: left;
  white-space: nowrap;
}
.menu__item:hover {
  background: var(--surface-3);
  color: var(--text);
}
.menu__item--danger {
  color: var(--danger);
}
.menu__item--danger:hover {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
.menu__sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.menu__head {
  padding: 7px 9px 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
}

.invite {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
}
.invite__code {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--primary);
  font-family: var(--font-mono);
  flex: 1;
}
.invite__help {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 6px;
  word-break: break-all;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row--between {
  justify-content: space-between;
}
.row--wrap {
  flex-wrap: wrap;
}
.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.list-row:first-child {
  border-top: none;
}
.list-row__body {
  flex: 1;
  min-width: 0;
}
.list-row__title {
  font-size: 13px;
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 6px;
}
.list-row__sub {
  font-size: 11.5px;
  color: var(--muted);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stack--sm {
  gap: 8px;
}

.act {
  display: flex;
  gap: 9px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.act:first-child {
  border-top: none;
}
.act__body {
  flex: 1;
  min-width: 0;
}
.act__text {
  font-size: 12.5px;
  color: var(--text-2);
  word-break: break-word;
}
.act__text strong {
  color: var(--text);
  font-weight: 600;
}
.act__time {
  font-size: 11px;
  color: var(--faint);
  margin-top: 1px;
}

/* -------------------------------- 轻提示 -------------------------------- */

.toasts {
  position: fixed;
  z-index: 100;
  bottom: calc(20px + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 7px;
  align-items: center;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 100%;
  text-align: left;
}
.toast__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toast--ok {
  background: var(--ok);
  color: #fff;
}
.toast--err {
  background: var(--danger);
  color: #fff;
}
.toast--live {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.toast.is-out {
  animation: toastOut 0.18s ease forwards;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(5px) scale(0.99);
  }
}

/* ------------------------------- 响应式 ------------------------------- */

.mobile-nav {
  display: none;
}

@media (max-width: 900px) {
  .focus-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-root {
    grid-template-columns: 1fr;
  }
  /* 侧边栏已经取消，抽屉也就不需要了；汉堡按钮一并藏掉，
     空间留给项目下拉 + 快速添加（手机上这两个才是真正要用的）。 */
  .hamburger {
    display: none !important;
  }
  .nav.active,
  .sidebar {
    display: none !important;
  }
  .view {
    padding: 12px 12px calc(74px + var(--safe-b));
  }
  .topbar {
    padding: 0 10px;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .topbar__title {
    font-size: 14px;
  }
  .topbar .quickadd {
    max-width: none;
  }
  .hide-sm {
    display: none !important;
  }
  .only-sm {
    display: block !important;
  }
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-b);
  }
  .mobile-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 4px 8px;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--muted);
    position: relative;
  }
  .mobile-nav__item.is-active {
    color: var(--text);
    font-weight: 600;
  }
  .mobile-nav__item .icon {
    width: 18px;
    height: 18px;
  }
  .ms__digits {
    font-size: 40px;
  }
  .ms__clock {
    font-size: 14px;
  }
  .timer__ring {
    width: 188px;
    height: 188px;
  }
  .timer__digits {
    font-size: 36px;
  }
  .task__grip {
    display: none;
  }
  .quick {
    padding: 10px;
  }
  /* 手机上按钮别太挤：选项整行铺开，各自可点区域更大 */
  .quick__opts {
    gap: 8px;
  }
  .opt,
  .seg__btn {
    height: 32px;
  }
  .seg__btn {
    padding: 0 13px;
  }
  select.opt--select {
    max-width: 100%;
    flex: 1;
    min-width: 140px;
  }
  .toasts {
    bottom: calc(70px + var(--safe-b));
  }
}

@media (max-width: 420px) {
  .ms-grid {
    grid-template-columns: 1fr;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi__value {
    font-size: 21px;
  }
}

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

/* ================================ 完成彩带 ================================ */

/* 临时覆盖层：不拦截点击、不参与布局，动画结束由 JS 整个移除 */
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
}

/* 勾选框被点中时轻轻一弹，配合彩带形成"做完了"的强反馈 */
.task__check.is-pop,
.sblock__check.is-pop {
  animation: checkPop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes checkPop {
  0% {
    transform: scale(1);
  }
  38% {
    transform: scale(1.34);
  }
  100% {
    transform: scale(1);
  }
}

/* ---------------------------- 任务树（大任务 / 子任务） ---------------------------- */

/* 展开箭头：贴在最左边，不占任务内容的位置 */
.task__fold {
  flex: none;
  width: 18px;
  height: 19px;
  margin-top: 1px;
  margin-left: -6px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--faint);
  transition: color 0.13s, background 0.13s;
}
.task__fold svg {
  display: block;
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}
.task__fold:hover {
  color: var(--text);
  background: var(--surface-3);
}

/* 子任务：缩进 + 一条竖线，层级一眼看得出来 */
.task--child {
  margin-left: 26px;
  position: relative;
  background: var(--surface-2);
}
.task--child::before {
  content: '';
  position: absolute;
  left: -14px;
  top: -6px;
  bottom: 50%;
  width: 12px;
  border-left: 1.5px solid var(--border-strong);
  border-bottom: 1.5px solid var(--border-strong);
  border-bottom-left-radius: 7px;
}
.task--child .task__title {
  font-size: 13px;
  font-weight: 450;
}

/* 大任务进度条：完成一条子任务就往前走一点 */
.task__progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  max-width: 260px;
}
.task__progress-bar {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-4);
  overflow: hidden;
}
.task__progress-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.task__progress-text {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* 刚勾完的任务：先变灰、再收起，动画放完才被移出未完成列表（不是"啪"一下消失） */
.task.is-completing {
  pointer-events: none;
  overflow: hidden;
  animation: taskComplete 1.05s cubic-bezier(0.4, 0, 0.2, 1) forwards,
    taskCollapse 0.42s cubic-bezier(0.4, 0, 0.2, 1) 1.05s forwards;
}
.task.is-completing .task__check {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
@keyframes taskComplete {
  0% {
    opacity: 1;
    filter: none;
    transform: scale(1);
  }
  45% {
    opacity: 0.6;
    filter: grayscale(0.85);
    transform: scale(0.995);
  }
  100% {
    opacity: 0.4;
    filter: grayscale(1);
    transform: scale(0.985);
  }
}
@keyframes taskCollapse {
  from {
    max-height: 220px;
    opacity: 0.4;
  }
  to {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
  }
}

/* ================================ 时间表 ================================ */

.sched {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 12px 16px;
  max-width: 1180px;
}

.sched__head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.sched__nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sched__date {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 650;
  min-width: 130px;
}
.sched__hint {
  font-size: 12px;
  color: var(--muted);
}

.sched__overdue {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  background: color-mix(in srgb, var(--danger) 7%, transparent);
  border-radius: var(--radius);
}
.sched__overdue-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
}
.sched__overdue-item {
  font-size: 12px;
  color: var(--text-2);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sched__overdue-item:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.sched__timeline {
  grid-column: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  min-height: 300px;
  max-height: calc(100vh - 250px);
}
.sched__side {
  grid-column: 2;
  overflow: auto;
  max-height: calc(100vh - 250px);
  padding-right: 2px;
}

.srow {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  min-height: 54px;
  border-bottom: 1px solid var(--border);
}
.srow:last-child {
  border-bottom: 0;
}
.srow__label {
  padding: 7px 8px 0 0;
  text-align: right;
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--border);
}
.srow__slots {
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: text;
  min-height: 44px;
}
.srow.is-now .srow__label {
  color: var(--primary);
  font-weight: 650;
}
.srow.is-now .srow__slots {
  background: color-mix(in srgb, var(--primary) 4%, transparent);
}
.srow.is-over .srow__slots {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  outline: 1px dashed var(--primary);
  outline-offset: -3px;
  border-radius: 8px;
}

.sblock {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  background: var(--surface);
  transition: border-color 0.13s, background 0.13s;
}
.sblock:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}
.sblock--mid {
  border-left-color: var(--warn);
}
.sblock--high {
  border-left-color: var(--danger);
}
.sblock.is-done {
  opacity: 0.55;
}
.sblock.is-done .sblock__title {
  text-decoration: line-through;
}
.sblock.is-dragging {
  opacity: 0.4;
}
.sblock__check {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  color: transparent;
  display: grid;
  place-items: center;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
}
.sblock__check svg {
  width: 11px;
  height: 11px;
  stroke-width: 3.4;
}
.sblock__check:hover {
  border-color: var(--primary);
}
.sblock__check.is-checked {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.sblock__body {
  flex: 1;
  min-width: 0;
}
.sblock__title {
  font-size: 13.5px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sblock__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}
.sblock__who {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sblock__who .avatar {
  width: 15px;
  height: 15px;
  font-size: 9px;
}
.sblock__tag {
  color: var(--primary);
}
.sblock__more {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--faint);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.13s, background 0.13s;
}
.sblock:hover .sblock__more,
.sblock__more:focus-visible {
  opacity: 1;
}
.sblock__more:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sblock__more svg {
  width: 13px;
  height: 13px;
}

.srow__add {
  padding: 1px 0;
}
.srow__input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}

.sched__side-head {
  margin-bottom: 10px;
}
.sched__empty {
  font-size: 12.5px;
  color: var(--muted);
  padding: 14px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.sunitem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  /* 显式命名区域：不依赖 grid 自动放置的顺序（否则按钮可能跑到标题左边） */
  grid-template-areas:
    'title action'
    'meta  action';
  align-items: center;
  gap: 6px 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: grab;
}
.sunitem:hover {
  border-color: var(--border-strong);
}
.sunitem.is-locked {
  cursor: default;
  opacity: 0.75;
}
.sunitem__title {
  grid-area: title;
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sunitem__meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}
.sunitem__lock {
  grid-area: action;
  font-size: 11px;
  color: var(--faint);
}
.sunitem .btn {
  grid-area: action;
}
.pri {
  padding: 0 5px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
}
.pri--mid {
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
}
.pri--high {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

@media (max-width: 900px) {
  .sched {
    grid-template-columns: minmax(0, 1fr);
  }
  .sched__timeline {
    grid-column: 1;
    max-height: 62vh;
  }
  .sched__side {
    grid-column: 1;
    max-height: none;
    overflow: visible;
  }
  .srow {
    grid-template-columns: 52px minmax(0, 1fr);
  }
}

@media print {
  .sidebar,
  .topbar,
  .mobile-nav,
  .quick,
  .task__actions {
    display: none !important;
  }
  .view {
    overflow: visible;
    padding: 0;
  }
  body {
    overflow: visible;
  }
}
