:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --ink: #182433;
  --muted: #687587;
  --brand: #b5252d;
  --brand-2: #b5252d;
  --red: #b5252d;
  --green: #17795b;
  --amber: #a46712;
  --line: #dfe5ec;
  --shadow: 0 12px 34px rgba(31, 48, 70, .08);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

::selection { color: #fff; background: #2f71da; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  display: none;
}

button, input, select, textarea { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }

button {
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  color: #33445a;
  font-weight: 700;
  cursor: pointer;
  background: #f5f7fa;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .12s ease;
}

button:hover { background: #edf1f6; }
button:focus-visible { outline: 3px solid rgba(181, 37, 45, .22); outline-offset: 2px; }
button:active { transform: scale(.98); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(181, 37, 45, .58);
  box-shadow: 0 0 0 3px rgba(181, 37, 45, .10);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  width: min(430px, 100%);
  gap: 15px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.logo, .brand {
  color: var(--red);
  font-size: 18px;
  font-style: italic;
  font-weight: 900;
  line-height: 1.05;
}

.logo span { font-style: normal; font-size: 24px; }

.login-card h1, .topbar h1 { margin: 0; letter-spacing: 0; }
.login-card h1 { font-size: 34px; }
.login-card p, .topbar p { margin: 0; color: var(--muted); }
.login-card small { min-height: 18px; color: var(--red); }

.primary, .login-card button {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(181, 37, 45, .17);
}

.primary:hover, .login-card button:hover {
  background: #982027;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.topbar h1 {
  margin-top: 7px;
  font-size: 30px;
}

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

.personal-strip {
  display: grid;
  grid-template-columns: 250px minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(31, 48, 70, .05);
}

.identity-control {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.identity-control select { min-height: 38px; padding: 7px 9px; }
.personal-strip > p { margin: 0; color: var(--muted); font-size: 13px; }
.personal-stats { display: flex; align-items: stretch; gap: 4px; }
.personal-stats span,
.personal-stats button {
  display: grid;
  min-width: 76px;
  min-height: 42px;
  place-items: center;
  align-content: center;
  gap: 1px;
  padding: 4px 10px;
  border-radius: 7px;
  color: #667486;
  font-size: 10px;
  line-height: 1.2;
  background: #f5f7fa;
  box-shadow: inset 0 0 0 1px #e4e9ef;
}

.personal-stats b { color: #1f3850; font-size: 16px; font-variant-numeric: tabular-nums; }
.personal-stats button.active { color: #9b2229; background: #fff0f2; box-shadow: inset 0 0 0 1px rgba(181, 37, 45, .28); }
.personal-stats button.active b { color: var(--brand); }

.reminder-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  padding: 11px 14px;
  border: 1px solid rgba(181, 37, 45, .24);
  border-radius: 9px;
  color: #6f2026;
  background: linear-gradient(100deg, #fff0f2 0%, #fff8f8 70%, #fff 100%);
  box-shadow: 0 5px 15px rgba(181, 37, 45, .06);
}

.reminder-banner strong { display: block; font-size: 14px; }
.reminder-banner p { margin: 2px 0 0; color: #8d565b; font-size: 12px; }
.reminder-banner button { flex: 0 0 auto; color: #fff; background: var(--brand); box-shadow: none; }

.weekly-panel {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(31, 48, 70, .05);
}
.weekly-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  text-align: left;
  background: transparent;
  box-shadow: none;
}
.weekly-toggle:hover { background: #f8faff; }
.weekly-toggle:focus-visible { outline: 2px solid #3979df; outline-offset: -3px; }
.weekly-panel h2 { margin: 0; color: #223b54; font-size: 15px; }
.weekly-panel .weekly-toggle p { margin: 1px 0 0; color: #7a8797; font-size: 10px; }
.weekly-toggle-meta { display: flex; flex: 0 0 auto; align-items: center; gap: 9px; color: #3979df; }
.weekly-toggle-meta strong { font-size: 11px; font-weight: 800; }
.weekly-toggle-meta i {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .18s ease-out;
}
.weekly-toggle[aria-expanded="true"] .weekly-toggle-meta i { transform: rotate(225deg) translate(-1px, -1px); }
.weekly-activity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 14px 12px; }
.weekly-activity[hidden] { display: none; }
.weekly-activity button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 8px 9px;
  text-align: left;
  background: #f7f9fc;
  box-shadow: inset 0 0 0 1px #e5eaf0;
}
.activity-person { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; color: #1757b8; font-size: 10px; background: #e7f0ff; }
.activity-copy { min-width: 0; }
.activity-copy b, .activity-copy em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy b { color: #31435a; font-size: 11px; }
.activity-copy em { margin-top: 1px; color: #7b8797; font-size: 9px; font-style: normal; font-weight: 500; }
.activity-status, .activity-help { padding: 2px 5px; border-radius: 4px; font-size: 8px; white-space: nowrap; }
.activity-status { color: #496078; background: #eaf0f6; }
.activity-help { color: #a21f2a; background: #ffe8eb; }
.weekly-activity time { color: #8793a2; font-size: 8px; white-space: nowrap; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin: 14px 0;
}

.shell.member-view .metric[data-filter="待结算的项目"] { display: none; }
.shell.member-view #newBtn,
.shell.member-view .fab-new,
.shell.member-view .editor:not(.employee-progress-mode) { display: none; }
.shell.member-view .editor.employee-progress-mode .admin-only-field,
.shell.member-view .editor.employee-progress-mode #resetBtn { display: none; }
.shell.member-view .editor.employee-progress-mode .form-actions { grid-template-columns: 1fr; }

.metric {
  position: relative;
  overflow: hidden;
  min-height: 108px;
  padding: 17px 18px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 7px 22px rgba(31, 48, 70, .06);
}

.metric::before {
  display: none;
}

.metric:nth-child(1) strong { color: var(--brand); }
.metric:nth-child(2) strong { color: #17795b; }
.metric:nth-child(3) strong { color: #a46712; }
.metric:nth-child(4) strong { color: #5f6f83; }

.metric.active {
  border-color: rgba(35, 104, 242, .50);
  box-shadow: 0 16px 36px rgba(35, 104, 242, .14);
}

.metric span { display: block; color: var(--muted); font-weight: 900; }
.metric strong { display: block; margin-top: 10px; font-size: 40px; line-height: .9; }
.metric em {
  display: block;
  margin-top: 12px;
  color: #32658f;
  font-size: 13px;
  font-style: normal;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 332px;
  gap: 14px;
  align-items: start;
}

.list-panel, .editor {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 210px 150px;
  gap: 12px;
  align-items: end;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 12px 12px 0 0;
}

.focus-pill {
  display: grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid rgba(211, 25, 32, .20);
  border-radius: 10px;
  color: #a31824;
  font-weight: 900;
  background: #fff5f6;
}

.focus-pill.active {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.project-list {
  display: grid;
  gap: 15px;
  padding: 15px;
}

.group {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #e3ebf6;
  border-radius: 8px;
  background: #fbfdff;
}

.group.feedback {
  margin-top: -4px;
  border-style: dashed;
  background: #f8fbff;
}

.group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 2px 11px;
  border-bottom: 1px solid #e7eef8;
}

.group-title h2 {
  margin: 0;
  color: #21415f;
  font-size: 17px;
}

.group-title span {
  padding: 4px 9px;
  border-radius: 999px;
  color: #35637f;
  font-size: 12px;
  font-weight: 900;
  background: #eef6ff;
}

.project-row {
  --stage-color: #3979df;
  --stage-soft: #edf4ff;
  --stage-border: rgba(57, 121, 223, .24);
  --nature-color: #17768b;
  --nature-soft: #e9f7fa;
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 1.9fr) 82px 112px 150px 228px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dfe8f3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(31, 48, 70, .04);
  cursor: pointer;
}

.project-row.stage-feedback { --stage-color: #cf8314; --stage-soft: #fff6e6; --stage-border: rgba(207, 131, 20, .25); }
.project-row.stage-landing { --stage-color: #118b68; --stage-soft: #e9f8f2; --stage-border: rgba(17, 139, 104, .24); }
.project-row.stage-settlement { --stage-color: #765fd0; --stage-soft: #f1effc; --stage-border: rgba(118, 95, 208, .24); }
.project-row.stage-done { --stage-color: #718096; --stage-soft: #f0f3f7; --stage-border: rgba(113, 128, 150, .24); }

.project-row.nature-ad { --nature-color: #087b91; --nature-soft: #e8f7fa; }
.project-row.nature-engineering { --nature-color: #6b52c7; --nature-soft: #f0edfc; }
.project-row.nature-video { --nature-color: #bd466f; --nature-soft: #fceef3; }
.project-row.nature-misc { --nature-color: #5f6e82; --nature-soft: #eef2f6; }

.project-row::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 12px;
  width: 42px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--stage-color);
}

.project-row.priority {
  border-color: rgba(181, 37, 45, .46);
  background: linear-gradient(100deg, #ffedef 0%, #fff5f6 42%, #fff 82%);
  box-shadow: 0 5px 16px rgba(181, 37, 45, .12), inset 0 0 0 1px rgba(181, 37, 45, .04);
}

.project-row.priority::before {
  display: none;
}

.title-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.title-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.project-signals { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }

.attention-badge {
  padding: 2px 6px;
  border-radius: 5px;
  color: #8a590e;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.4;
  white-space: nowrap;
  background: #fff1d8;
}

.help-badge {
  padding: 2px 6px;
  border-radius: 5px;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.4;
  white-space: nowrap;
  background: #c92833;
}

.priority-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid #b5252d;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  background: #b5252d;
  box-shadow: 0 2px 6px rgba(181, 37, 45, .18);
}

.project-title-button {
  display: block;
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding-right: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 3px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
  box-shadow: none;
}

.project-title-button:hover { color: var(--stage-color); background: transparent; }

.project-main p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.project-main .next-action {
  color: #42546a;
}

.next-action b {
  margin-right: 6px;
  color: var(--stage-color);
  font-size: 10px;
}

.tag {
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--nature-color);
  font-size: 12px;
  font-weight: 900;
  background: var(--nature-soft);
}

.meta {
  color: #31435a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.project-meta { display: contents; }

.running {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--stage-color);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--stage-soft);
}

.row-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  cursor: default;
}

.row-actions.single-action { grid-template-columns: 1fr; }

.secondary-actions { display: contents; }
.more-toggle { display: none; }
.row-actions [data-action="edit"] { order: 1; }
.row-actions [data-action="priority"] { order: 2; }
.row-actions .primary-action { order: 3; }
.row-actions [data-action="feedback"] { order: 4; }
.row-actions [data-action="delete"] { order: 5; }

.row-actions button {
  min-height: 30px;
  padding: 6px 5px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.row-actions button:focus-visible,
.metric:focus-visible,
.focus-pill:focus-visible,
.fab-new:focus-visible {
  outline: 3px solid rgba(181, 37, 45, .22);
  outline-offset: 2px;
}

.row-actions .danger {
  color: #fff;
  background: #d31920;
  box-shadow: none;
}

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

.close-editor, .fab-new, .editor-overlay { display: none; }

.editor {
  position: sticky;
  top: 14px;
  padding: 17px;
}

.editor h2 { margin: 0 0 14px; font-size: 20px; }
.editor form { display: grid; gap: 11px; }
.editor form label small { color: #8994a2; font-size: 11px; font-weight: 500; }
.member-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.member-picker legend,
.member-progress-head strong {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.member-picker small,
.member-progress-head small {
  color: #8994a2;
  font-size: 11px;
}

.member-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.member-option { display: block; color: #435267; font-size: 12px; cursor: pointer; }
.member-option input { position: absolute; opacity: 0; pointer-events: none; }
.member-option span {
  display: block;
  padding: 6px 10px;
  border: 1px solid #dce4ed;
  border-radius: 999px;
  background: #f7f9fc;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .12s ease;
}
.member-option input:checked + span {
  border-color: #3979df;
  color: #1757b8;
  background: #eaf2ff;
  box-shadow: inset 0 0 0 1px rgba(57, 121, 223, .08);
}
.member-option input:focus-visible + span { outline: 3px solid rgba(57, 121, 223, .18); outline-offset: 2px; }
.member-option:active span { transform: scale(.97); }

.member-progress-editor {
  padding-top: 11px;
  border-top: 1px solid #e5eaf0;
}
.member-progress-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.member-progress-head strong { margin: 0; }
#memberProgressEditor { display: grid; gap: 7px; margin-top: 8px; }
.member-progress-field {
  gap: 5px;
  padding: 9px;
  border: 1px solid #e1e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.member-progress-person { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.member-progress-field b { color: #27384d; font-size: 12px; }
.member-progress-field time { color: #8994a2; font-size: 10px; font-weight: 600; }
.member-progress-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.member-progress-controls select { min-height: 34px; padding: 6px 8px; font-size: 11px; }
.help-toggle { display: flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid #e4cbd0; border-radius: 7px; color: #9a3038; font-size: 10px; background: #fff5f6; cursor: pointer; }
.help-toggle input { width: 14px; height: 14px; margin: 0; accent-color: #b5252d; }
.member-progress-field textarea { min-height: 58px; padding: 8px 9px; font-size: 13px; background: #fff; }
.member-progress-empty { margin: 0; padding: 12px; color: #7a8797; font-size: 12px; text-align: center; background: #f7f9fc; border-radius: 8px; }

.project-detail {
  width: min(650px, calc(100% - 28px));
  max-height: min(760px, calc(100dvh - 40px));
  padding: 0;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 12px;
  color: var(--ink);
  background: #f5f7fa;
  box-shadow: 0 28px 70px rgba(20, 34, 52, .25);
}
.project-detail::backdrop { background: rgba(17, 29, 46, .46); backdrop-filter: blur(3px); }
.detail-surface { max-height: inherit; overflow-y: auto; }
.detail-head {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 15px;
  border-bottom: 1px solid #e1e7ee;
  background: rgba(255, 255, 255, .96);
}
.detail-head span { color: #3979df; font-size: 11px; font-weight: 800; }
.detail-head h2 { margin: 3px 0 0; font-size: 21px; line-height: 1.3; }
.detail-head button { width: 36px; height: 36px; padding: 0; font-size: 22px; }
#detailContent { display: grid; gap: 12px; padding: 16px 20px 22px; }
.detail-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: #58677a; font-size: 12px; }
.detail-summary > span:not(.tag) { padding-right: 8px; border-right: 1px solid #d8e0e8; }
.detail-summary > span:last-child { border-right: 0; }
.detail-block { padding: 12px 14px; border: 1px solid #e0e7ef; border-radius: 8px; background: #fff; }
.detail-block h3, .detail-section-title h3 { margin: 0; color: #31435a; font-size: 12px; }
.detail-block p { margin: 5px 0 0; color: #5d6b7d; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.detail-team { margin-top: 2px; }
.detail-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.detail-section-title span { color: #718094; font-size: 11px; }
.member-progress-list { display: grid; gap: 7px; }
.member-progress-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(31, 48, 70, .04);
}
.member-avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: #1757b8; font-size: 13px; font-weight: 900; background: #e8f1ff; }
.member-progress-card header { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 5px; }
.member-progress-card strong { color: #26384e; font-size: 13px; }
.member-progress-card time { margin-left: auto; color: #8793a2; font-size: 10px; white-space: nowrap; }
.owner-badge { padding: 2px 5px; border-radius: 4px; color: #97600d; font-size: 9px; font-weight: 800; background: #fff1d5; }
.member-status { padding: 2px 5px; border-radius: 4px; color: #315d87; font-size: 9px; font-weight: 800; background: #e8f2fb; }
.member-status.status-等待他人 { color: #95600f; background: #fff1d5; }
.member-status.status-我的部分已完成 { color: #157052; background: #e6f6ef; }
.member-progress-card p { margin: 4px 0 0; color: #526175; font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.member-progress-card .empty-progress { color: #98a2ae; }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.empty { padding: 42px 14px; color: var(--muted); text-align: center; }

@media (max-width: 1180px) {
  .workbench { grid-template-columns: 1fr; }
  .editor { position: static; }
  .project-row { grid-template-columns: minmax(220px, 1fr) 92px 120px; }
  .row-actions { grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(88px, 1fr)); }
}

@media (max-width: 760px) {
  body {
    background-color: #f2f5f8;
  }

  body::before { display: none; }
  body.editor-open { overflow: hidden; }

  .shell {
    width: 100%;
    padding: 8px 12px calc(28px + env(safe-area-inset-bottom));
  }

  .topbar {
    display: flex;
    padding: 12px 13px;
    border-color: #e0e5eb;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(31, 48, 70, .06);
    background: #fff;
    border-top: 2px solid var(--brand);
  }

  .brand { font-size: 11px; }
  .topbar h1 { margin-top: 2px; font-size: 19px; line-height: 1.25; }
  .topbar p { margin-top: 2px; max-width: none; font-size: 10px; line-height: 1.35; }
  .topbar .actions { flex-wrap: nowrap; gap: 6px; margin-left: auto; }
  .topbar #backupBtn, .topbar #importBtn { display: none; }
  .topbar #refreshBtn {
    min-height: 40px;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 11px;
    background: #f5f7fa;
  }
  .topbar #newBtn {
    display: grid;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    place-items: center;
    font-size: 0;
    box-shadow: none;
  }
  .topbar #newBtn::before {
    content: "+";
    font-size: 23px;
    font-weight: 500;
    line-height: 1;
  }

  .personal-strip {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 8px;
    margin-top: 8px;
    padding: 8px 9px;
    border-radius: 9px;
    box-shadow: 0 3px 12px rgba(31, 48, 70, .05);
  }

  .identity-control {
    grid-template-columns: 1fr;
    gap: 2px;
    min-width: 0;
    font-size: 9px;
  }

  .identity-control select { min-height: 34px; padding: 5px 8px; font-size: 11px; }
  .personal-strip > p {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow: hidden;
    font-size: 9px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .personal-stats { gap: 3px; align-self: end; }
  .personal-stats span,
  .personal-stats button {
    min-width: 48px;
    min-height: 34px;
    padding: 3px 5px;
    font-size: 7px;
  }
  .personal-stats b { font-size: 13px; }

  .reminder-banner {
    gap: 8px;
    margin-top: 7px;
    padding: 8px 9px;
    border-radius: 8px;
  }
  .reminder-banner strong { font-size: 11px; }
  .reminder-banner p { font-size: 8.5px; line-height: 1.3; }
  .reminder-banner button { min-height: 34px; padding: 5px 8px; font-size: 9px; }

  .weekly-panel { margin-top: 7px; border-radius: 9px; }
  .weekly-toggle { padding: 9px; }
  .weekly-panel h2 { font-size: 12px; }
  .weekly-panel .weekly-toggle p { font-size: 8px; }
  .weekly-toggle-meta strong { font-size: 9px; }
  .weekly-activity {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 9px 9px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .weekly-activity[hidden] { display: none; }
  .weekly-activity::-webkit-scrollbar { display: none; }
  .weekly-activity button { flex: 0 0 265px; grid-template-columns: auto minmax(0, 1fr) auto; scroll-snap-align: start; }
  .weekly-activity time { display: none; }

  .metrics {
    grid-template-columns: 1.28fr repeat(3, 1fr);
    gap: 0;
    margin: 8px 0 10px;
    overflow: hidden;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(31, 43, 58, .06);
  }

  .shell.member-view .metrics { grid-template-columns: 1.28fr repeat(2, 1fr); }

  .metric {
    --metric-color: #b5252d;
    --metric-border: #cbdcf8;
    --metric-bg: #f3f8ff;
    --metric-shadow: rgba(77, 132, 230, .12);
    display: grid;
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: start;
    min-height: 62px;
    padding: 7px 8px;
    border: 0;
    border-right: 1px solid #e7eaee;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }

  .metric:last-child { border-right: 0; }

  .metric:nth-child(2) { --metric-color: #26a879; --metric-border: #c8eadc; --metric-bg: #f2fbf7; --metric-shadow: rgba(38, 168, 121, .11); }
  .metric:nth-child(3) { --metric-color: #d59a2b; --metric-border: #f0dfbd; --metric-bg: #fffaf0; --metric-shadow: rgba(213, 154, 43, .11); }
  .metric:nth-child(4) { --metric-color: #7d899a; --metric-border: #d9dfe7; --metric-bg: #f7f9fb; --metric-shadow: rgba(125, 137, 154, .11); }
  .metric::before {
    display: none;
  }
  .metric.active {
    background: var(--metric-bg);
    box-shadow: inset 0 -2px 0 var(--metric-color);
  }
  .metric span { font-size: 9px; line-height: 1.2; white-space: nowrap; }
  .metric strong { margin: 3px 0 0; font-size: 22px; line-height: 1; }
  .metric em {
    margin-top: 3px;
    font-size: 7px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .workbench { display: block; }
  .list-panel {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 116px 72px;
    gap: 6px;
    padding: 7px 0 9px;
    border: 0;
    border-bottom: 1px solid #dfe5ec;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .toolbar label { gap: 0; min-width: 0; font-size: 0; }
  .toolbar label:first-child { grid-column: auto; }
  .toolbar input, .toolbar select { min-height: 40px; padding: 7px 9px; font-size: 11px; background: #fff; }
  .focus-pill {
    min-width: 0;
    min-height: 40px;
    align-self: end;
    padding: 5px 7px;
    border-radius: 8px;
    font-size: 11px;
    background: #fff5f6;
  }
  .focus-pill.active {
    color: #a31824;
    border-color: rgba(211, 25, 32, .32);
    background: #ffecef;
  }

  .project-list { gap: 14px; padding: 8px 0 0; }
  .group {
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .group.feedback {
    margin-top: 2px;
    border: 0;
    background: transparent;
  }

  .group-title {
    min-height: 36px;
    padding: 6px 2px;
    border-bottom: 1px solid #d9e3ed;
  }

  .group.feedback .group-title {
    padding-left: 2px;
  }

  .group.feedback .group-title h2::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: #c78622;
    vertical-align: 2px;
  }

  .group-title h2 { color: #182b3c; font-size: 14px; }
  .group-title span {
    padding: 4px 9px;
    color: #276998;
    background: #e7f4ff;
    box-shadow: inset 0 0 0 1px rgba(58, 133, 196, .08);
  }

  .group.feedback .group-title span { color: #9a630e; background: #fff2d9; }

  .project-row {
    grid-template-columns: minmax(0, 1fr) 58px;
    grid-template-areas:
      "main actions"
      "meta actions";
    gap: 2px 7px;
    min-height: 84px;
    padding: 7px 8px 7px 10px;
    border-color: color-mix(in srgb, var(--stage-color) 20%, #dce4eb);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 13px rgba(28, 49, 71, .065), inset 0 1px 0 rgba(255, 255, 255, .8);
  }

  .project-row::after { left: 10px; width: 36px; }

  .project-row.priority {
    border-color: rgba(181, 37, 45, .48);
    background: linear-gradient(100deg, #ffeaed 0%, #fff4f5 45%, #fff 86%);
    box-shadow: 0 5px 16px rgba(181, 37, 45, .14), inset 0 0 0 1px rgba(181, 37, 45, .05);
  }

  .project-main { grid-area: main; min-width: 0; }
  .title-line { gap: 5px; }
  .title-copy { gap: 5px; }
  .project-title-button {
    width: 100%;
    padding-right: 0;
    overflow: hidden;
    font-size: 13.5px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .priority-badge { padding: 2px 5px; font-size: 8px; }
  .project-signals { gap: 3px; }
  .attention-badge { padding: 2px 4px; font-size: 7px; }
  .project-main p {
    overflow: hidden;
    margin-top: 1px;
    font-size: 9.5px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .project-main .next-action { margin-top: 1px; }
  .next-action b { margin-right: 4px; font-size: 8px; }

  .project-meta {
    display: grid;
    grid-area: meta;
    grid-template-columns: auto auto minmax(0, 1fr);
    min-width: 0;
    align-items: center;
    gap: 4px;
    overflow: hidden;
  }

  .tag {
    padding: 2px 5px;
    color: var(--nature-color);
    font-size: 8.5px;
    background: var(--nature-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nature-color) 10%, transparent);
  }
  .meta { overflow: hidden; color: #526071; font-size: 8.5px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
  .meta::before { content: "·"; margin-right: 4px; color: #a4adb8; }
  .running {
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 8px;
    line-height: 1.35;
  }

  .row-actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: 1fr;
    align-self: stretch;
    align-items: center;
    align-content: center;
    gap: 4px;
    margin: 0;
    padding-left: 6px;
    border-left: 1px solid color-mix(in srgb, var(--stage-color) 14%, #edf0f3);
    position: relative;
  }

  .row-actions button {
    width: 100%;
    min-height: 36px;
    padding: 4px 2px;
    border-radius: 6px;
    font-size: 9px;
  }
  .row-actions .primary-action {
    order: 1;
    min-width: 0;
    padding: 4px 2px;
    color: #fff;
    background: var(--stage-color);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--stage-color) 22%, transparent), inset 0 0 0 1px rgba(255, 255, 255, .18);
  }

  .more-toggle {
    display: block;
    order: 2;
    width: 100%;
    padding: 0;
    color: #40536b;
    font-size: 13px;
    letter-spacing: 0;
    background: #edf2f7;
    box-shadow: inset 0 0 0 1px #dce4ec;
  }
  .secondary-actions { display: none; }
  .project-row:has(.row-actions.actions-open) { z-index: 20; }
  .row-actions.actions-open .secondary-actions {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    right: 0;
    display: grid;
    width: 164px;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 6px;
    border: 1px solid #dfe5ec;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(22, 33, 47, .16);
  }

  .row-actions .secondary-actions button {
    display: block;
    min-height: 44px;
    border-radius: 8px;
  }

  .editor {
    position: fixed;
    z-index: 30;
    inset: auto 0 0;
    max-height: 88dvh;
    overflow-y: auto;
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -14px 40px rgba(23, 32, 51, .20);
    transform: translateY(105%);
    transition: transform .22s ease;
  }

  .editor.open { transform: translateY(0); }
  .editor h2 { margin: 0; font-size: 19px; }
  .editor-head { margin-bottom: 14px; }
  .close-editor {
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    font-size: 24px;
    line-height: 1;
  }

  .editor-overlay {
    position: fixed;
    z-index: 20;
    inset: 0;
    background: rgba(20, 31, 48, .35);
  }
  .editor-overlay.open { display: block; }

  .member-options { gap: 5px; }
  .member-option span { padding: 6px 9px; font-size: 11px; }
  .member-progress-head { align-items: flex-start; }
  .member-progress-head small { max-width: 125px; text-align: right; }
  .member-progress-controls { grid-template-columns: minmax(0, 1fr) auto; }
  .help-toggle { padding-inline: 7px; }

  .project-detail {
    width: 100%;
    max-width: none;
    max-height: 88dvh;
    margin: auto 0 0;
    border: 0;
    border-radius: 16px 16px 0 0;
  }
  .detail-head { padding: 15px 16px 13px; }
  .detail-head h2 { max-width: 280px; font-size: 18px; }
  #detailContent { gap: 10px; padding: 13px 14px calc(20px + env(safe-area-inset-bottom)); }
  .detail-block { padding: 10px 11px; }
  .member-progress-card { padding: 10px; }
  .member-progress-card time { flex: 1 0 100%; margin-left: 0; }

  .fab-new {
    display: none;
  }
}

@media (max-width: 390px) {
  .shell { padding-inline: 10px; }
  .topbar { padding-inline: 11px; }
  .topbar h1 { font-size: 18px; }
  .metric { padding-inline: 9px; }
  .metric span { font-size: 10px; }
  .metric strong { font-size: 23px; }
  .metric em { font-size: 8px; }
  .project-main p { -webkit-line-clamp: 1; }
  .meta { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (min-width: 360px) and (max-width: 760px) {
  .topbar p { white-space: nowrap; }
}

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