/* 小半工作室 · 工作台 — 中性灰阶设计系统 */

:root {
  --bg: #f7f7f6;
  --surface: #ffffff;
  --surface-2: #f2f2f0;
  --line: #ebeae7;
  --line-strong: #dedcd7;
  --ink: #101010;
  --ink-2: #5d5d58;
  --ink-3: #98988f;
  --ink-4: #c6c4bd;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 16, 16, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 16, 16, 0.1), 0 2px 8px rgba(16, 16, 16, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", system-ui, sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #101010;
  color: #fff;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- 外壳 ---------- */

.shell {
  display: grid;
  grid-template-columns: 234px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--ink);
  display: grid;
  place-items: center;
  flex: none;
}

.brand-mark::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--ink-4);
  text-transform: uppercase;
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13.5px;
  transition: background 0.14s ease, color 0.14s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex: none;
  opacity: 0.62;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-item.active {
  background: #111110;
  color: #fff;
  font-weight: 500;
}

.nav-item.active svg {
  opacity: 0.95;
}

.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.nav-item.active .nav-count {
  color: rgba(255, 255, 255, 0.55);
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  flex: none;
}

.user-name {
  font-size: 12.5px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  font-size: 12.5px;
}

.logout-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.logout-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- 主区 ---------- */

.main {
  min-width: 0;
  padding: 38px 44px 90px;
}

.main-inner {
  max-width: 1000px;
  margin: 0 auto;
}

.page {
  animation: fade 0.24s ease both;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-title {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.page-sub {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform 0.1s ease, background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.985);
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}

.btn-primary:hover {
  background: #2b2b28;
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.btn-ghost:hover {
  border-color: var(--ink-4);
  color: var(--ink);
  background: #fff;
}

.btn-quiet {
  color: var(--ink-3);
  height: 30px;
  padding: 0 8px;
}

.btn-quiet:hover {
  color: var(--ink);
  background: var(--surface-2);
  border-radius: 7px;
}

.btn-danger {
  color: #8a3b2e;
}

.btn-danger:hover {
  background: #fbf1ef;
  color: #7a2f22;
}

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.btn-block {
  width: 100%;
  height: 40px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--ink-4);
  transition: background 0.14s ease, color 0.14s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- 卡片 ---------- */

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

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px 0;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-transform: uppercase;
}

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

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 15px;
  box-shadow: var(--shadow);
}

.metric-label {
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.metric-value {
  margin-top: 9px;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
}

.metric-value .unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  margin-right: 3px;
  letter-spacing: 0;
}

.metric-value .cents {
  font-size: 15px;
  color: var(--ink-3);
  font-weight: 500;
}

.metric-note {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-4);
}

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

/* ---------- 待办列表 ---------- */

.todo-list {
  padding: 6px 8px 8px;
}

.todo-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 10px;
  border-radius: 10px;
  transition: background 0.13s ease;
  position: relative;
}

.todo-row:hover {
  background: #fafaf8;
}

.check {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  margin-top: 2px;
  flex: none;
  display: grid;
  place-items: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  position: relative;
}

.check::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
}

.check:hover {
  border-color: var(--ink-2);
}

.check svg {
  width: 10px;
  height: 10px;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s ease, transform 0.15s ease;
  color: #fff;
}

.todo-row.done .check {
  background: var(--ink);
  border-color: var(--ink);
}

.todo-row.done .check svg {
  opacity: 1;
  transform: none;
}

.todo-main {
  min-width: 0;
  flex: 1;
}

.todo-title {
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  transition: color 0.15s ease;
}

.todo-row.done .todo-title {
  color: var(--ink-4);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.todo-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-4);
}

.prio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.prio::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-3);
}

.prio-1::before {
  background: var(--ink);
}

.prio-2::before {
  background: var(--ink-3);
}

.prio-3::before {
  background: var(--ink-4);
}

.todo-row:hover .row-actions {
  opacity: 1;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.14s ease;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.date-chip.overdue {
  color: #8a3b2e;
}

.date-chip.today {
  color: var(--ink);
  font-weight: 500;
}

/* ---------- 表单 ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.input,
.select,
.textarea {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13.5px;
  width: 100%;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  appearance: none;
}

.textarea {
  height: auto;
  min-height: 68px;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.55;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-4);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(16, 16, 16, 0.06);
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398988f' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* 快速添加 */

.quick-add {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 7px 8px 7px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-add:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(16, 16, 16, 0.05);
}

.quick-add input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  height: 30px;
  font-size: 13.5px;
  background: none;
}

.quick-add input::placeholder {
  color: var(--ink-4);
}

.quick-extra {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-select {
  height: 28px;
  border: 1px solid transparent;
  background: none;
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink-3);
  padding: 0 6px;
  cursor: pointer;
  max-width: 96px;
}

.mini-select:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.mini-select:focus {
  outline: none;
  border-color: var(--line-strong);
}

input.mini-date {
  height: 28px;
  border: 1px solid transparent;
  background: none;
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink-3);
  padding: 0 6px;
  width: 118px;
  cursor: pointer;
}

input.mini-date:hover {
  background: var(--surface-2);
}

input.mini-date:focus {
  outline: none;
  border-color: var(--line-strong);
  color: var(--ink);
}

/* 日期选择触发器 */
.date-pick {
  position: relative;
  display: inline-flex;
}

.date-pick input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  border: 0;
  padding: 0;
}

.mini-select.on {
  color: var(--ink);
  background: var(--surface-2);
}

/* ---------- 分段控件 ---------- */

.segmented {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 9px;
  padding: 3px;
}

.segmented button {
  height: 26px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--ink-3);
  transition: background 0.14s ease, color 0.14s ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(16, 16, 16, 0.08);
}

/* ---------- 项目 ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 12px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px 15px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
  cursor: pointer;
  text-align: left;
}

.project-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 16, 16, 0.06);
}

.project-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.project-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.4;
  word-break: break-word;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid var(--line);
  color: var(--ink-3);
  background: #fbfbfa;
  flex: none;
  white-space: nowrap;
}

.status-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-chip.active {
  color: #2f2f2b;
  border-color: var(--line-strong);
  background: #fff;
}

.status-chip.active::before {
  background: var(--ink);
}

.status-chip.done {
  color: var(--ink-3);
}

.project-desc {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 0;
}

.progress {
  height: 4px;
  border-radius: 4px;
  background: #f0efec;
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-3);
  gap: 8px;
}

.progress-num {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  font-weight: 500;
}

/* ---------- 账目 ---------- */

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.summary-item {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary-item .k {
  font-size: 12px;
  color: var(--ink-3);
}

.summary-item .v {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.summary-item .v.neg {
  color: var(--ink);
}

.summary-item .v .dec {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0;
}

.month-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 2px;
}

.month-nav .label {
  font-size: 13px;
  font-weight: 500;
  padding: 0 10px;
  min-width: 96px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.month-nav button {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
}

.month-nav button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.month-nav svg {
  width: 14px;
  height: 14px;
}

.tx-list {
  padding: 4px 8px 8px;
}

.tx-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 10px;
}

.tx-row:hover {
  background: #fafaf8;
}

.tx-ico {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--ink-2);
  flex: none;
  font-weight: 500;
}

.tx-main {
  flex: 1;
  min-width: 0;
}

.tx-cat {
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-amt {
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.tx-amt.income {
  color: var(--ink);
}

.tx-amt.expense {
  color: var(--ink-2);
  font-weight: 500;
}

.tx-amt .sign {
  color: var(--ink-3);
  margin-right: 1px;
  font-weight: 400;
}

.tx-end {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 82px;
}

.tx-actions {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  padding-left: 8px;
  background: #fafaf8;
  transition: opacity 0.13s ease;
}

.tx-row:hover .tx-actions {
  opacity: 1;
}

.tx-row:has(.tx-actions):hover .tx-amt {
  opacity: 0;
}

.tx-amt {
  transition: opacity 0.13s ease;
}

/* 项目进度（工作台） */

.proj-list {
  padding: 10px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.proj-line {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.proj-line-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.proj-line-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-line-num {
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.proj-line-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.tx-day {
  padding: 14px 10px 4px;
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.cat-bars {
  padding: 10px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.cat-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cat-bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-2);
}

.cat-bar-top .amt {
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.cat-bar-track {
  height: 5px;
  border-radius: 4px;
  background: #f2f1ee;
  overflow: hidden;
}

.cat-bar-track > i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--ink);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cat-bar:nth-child(2) .cat-bar-track > i {
  background: #3a3a35;
}
.cat-bar:nth-child(3) .cat-bar-track > i {
  background: #66665f;
}
.cat-bar:nth-child(4) .cat-bar-track > i {
  background: #8e8e86;
}
.cat-bar:nth-child(5) .cat-bar-track > i {
  background: #b3b2a9;
}
.cat-bar:nth-child(6) .cat-bar-track > i {
  background: #d2d0c8;
}

/* 记账面板 */

.entry-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  animation: fade 0.2s ease both;
}

.entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.type-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 9px;
}

.type-toggle button {
  height: 27px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.type-toggle button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(16, 16, 16, 0.08);
}

.amount-input-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.amount-input-wrap .cny {
  font-size: 20px;
  color: var(--ink-3);
  font-weight: 500;
}

.amount-input {
  border: none;
  outline: none;
  background: none;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.04em;
  width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  padding: 0;
}

.amount-input::placeholder {
  color: var(--ink-4);
  font-weight: 500;
}

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

.chip {
  height: 28px;
  padding: 0 11px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  color: var(--ink-2);
  transition: all 0.14s ease;
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ---------- 弹窗 ---------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 18, 0.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  animation: fade 0.16s ease both;
}

.modal {
  width: min(480px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 22px;
  animation: pop 0.2s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.modal-foot .spacer {
  margin-right: auto;
}

/* ---------- 空状态 ---------- */

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--ink-4);
  font-size: 12.5px;
  line-height: 1.8;
}

.empty strong {
  display: block;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}

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

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--bg);
}

.auth-card {
  width: min(374px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 30px 26px;
  box-shadow: 0 10px 40px rgba(16, 16, 16, 0.06);
  animation: fade 0.3s ease both;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 26px;
}

.auth-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.auth-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--ink-3);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.auth-note {
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--ink-4);
  line-height: 1.65;
  text-align: center;
}

.form-error {
  font-size: 12px;
  color: #8a3b2e;
  background: #fbf1ef;
  border: 1px solid #f2ded9;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  animation: fade 0.15s ease both;
}

/* ---------- 提示条 ---------- */

.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #171715;
  color: #fff;
  font-size: 12.5px;
  padding: 9px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 16, 16, 0.18);
  animation: toastIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1) both;
  max-width: 82vw;
}

.toast.err {
  background: #6d2f24;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 移动端 ---------- */

.mobile-bar {
  display: none;
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    transform: translateX(-101%);
    transition: transform 0.24s cubic-bezier(0.3, 0.9, 0.3, 1);
    box-shadow: 0 0 40px rgba(16, 16, 16, 0.12);
  }

  .sidebar.open {
    transform: none;
  }

  .scrim {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 18, 0.22);
    z-index: 19;
    animation: fade 0.2s ease both;
  }

  .main {
    padding: 0 18px 80px;
  }

  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    margin: 0 -18px 18px;
    padding: 0 18px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 15;
  }

  .mobile-bar .m-name {
    font-size: 13px;
    font-weight: 600;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .cols {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
  }

  .head-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .page-title {
    font-size: 20px;
  }

  .metric-value {
    font-size: 21px;
  }

  .summary-item .v {
    font-size: 21px;
  }

  .quick-extra {
    display: none;
  }

  .row-actions {
    opacity: 1;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 26px 22px 22px;
  }
}

@media (max-width: 420px) {
  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .metric {
    padding: 13px 14px;
  }

  .metric-value {
    font-size: 18px;
    margin-top: 7px;
  }

  .metric-value .unit {
    font-size: 11px;
  }

  .metric-value .cents {
    font-size: 12px;
  }

  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .summary-item {
    padding: 12px 11px;
  }

  .summary-item .k {
    font-size: 11px;
  }

  .summary-item .v {
    font-size: 15px;
    margin-top: 5px;
  }

  .summary-item .v .dec {
    font-size: 11px;
  }
}

/* 隐藏滚动条但保留滚动能力（弹窗内） */
.modal::-webkit-scrollbar {
  width: 8px;
}
.modal::-webkit-scrollbar-thumb {
  background: #e2e1dc;
  border-radius: 8px;
  border: 2px solid #fff;
}

/* 触屏设备：消除 hover 粘滞 */
@media (hover: none) {
  .nav-item:hover {
    background: transparent;
    color: var(--ink-2);
  }

  .nav-item.active:hover {
    background: #111110;
    color: #fff;
  }

  .todo-row:hover,
  .tx-row:hover {
    background: transparent;
  }

  .project-card:hover {
    transform: none;
    box-shadow: var(--shadow);
    border-color: var(--line);
  }

  .btn-ghost:hover {
    background: var(--surface);
    color: var(--ink-2);
    border-color: var(--line-strong);
  }

  .btn-quiet:hover,
  .logout-btn:hover {
    background: transparent;
  }

  .icon-btn:hover {
    background: transparent;
    color: var(--ink-4);
  }

  .chip:hover {
    border-color: var(--line);
  }

  .tx-actions {
    display: none;
  }

  .tx-row:has(.tx-actions):hover .tx-amt {
    opacity: 1;
  }
}
