:root {
  --violet: #7c5cff;
  --violet-deep: #5b3fe0;
  --violet-soft: #ede7ff;
  --ink: #2e2250;
  --ink-soft: rgba(46, 34, 80, .64);
  --ink-faint: rgba(46, 34, 80, .4);
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .8);
  --stroke: rgba(255, 255, 255, .8);
  --line: rgba(90, 64, 160, .1);
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: linear-gradient(135deg, #f7f3ff 0%, #ece6fd 42%, #faf5ff 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.ambient { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); }
.blob-a { width: 540px; height: 540px; background: #b9a0ff; opacity: .48; top: -190px; left: -140px; }
.blob-b { width: 480px; height: 480px; background: #e6bcff; opacity: .44; bottom: -200px; right: -120px; }
.blob-c { width: 400px; height: 400px; background: #a8c6ff; opacity: .26; top: 38%; left: 44%; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--stroke);
  box-shadow: 0 14px 44px rgba(80, 50, 160, .08);
  border-radius: var(--radius);
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 20px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
}

.sidebar {
  padding: 26px 16px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  min-height: 520px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-mark {
  width: 42px; height: 42px; flex: none; border-radius: 13px;
  background: linear-gradient(140deg, #8f74ff, #6a48ee);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; letter-spacing: -.5px;
  box-shadow: 0 8px 20px rgba(124, 92, 255, .3);
}
.brand-mark span { opacity: .7; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 13px; font-weight: 600; white-space: nowrap; }
.brand-text span { font-size: 11px; color: var(--ink-faint); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border-radius: 12px;
  font-size: 13px; color: var(--ink-soft); cursor: pointer;
  border: 1px solid transparent; background: transparent;
  width: 100%; text-align: left; font-family: inherit;
  transition: background .18s, color .18s, border-color .18s;
}
.nav-item:hover { background: rgba(255, 255, 255, .55); color: var(--ink); }
.nav-item.active {
  background: rgba(124, 92, 255, .14);
  border-color: rgba(124, 92, 255, .18);
  color: var(--violet-deep); font-weight: 600;
}
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(124, 92, 255, .25); flex: none; }
.nav-item.active .nav-dot { background: var(--violet); }

.sidebar-foot { margin-top: auto; padding: 0 10px; }
.sync-line { font-size: 11px; color: var(--ink-faint); display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #b7abd6; }
.sync-dot.on { background: #4fbf8b; }
.brand-mini { font-size: 11px; color: rgba(46, 34, 80, .28); }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 22px; margin-bottom: 18px;
}
.page-title h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.page-title p { margin: 2px 0 0; font-size: 12px; color: var(--ink-faint); }
.top-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.btn {
  font-family: inherit; font-size: 13px; padding: 9px 16px; border-radius: 11px;
  border: 1px solid rgba(124, 92, 255, .22); background: rgba(255, 255, 255, .55);
  color: var(--violet-deep); cursor: pointer; transition: .18s;
}
.btn:hover { background: #fff; transform: translateY(-1px); }
.btn-primary {
  background: var(--violet); border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px rgba(124, 92, 255, .26);
}
.btn-primary:hover { background: var(--violet-deep); }
.btn-ghost { border-color: var(--line); color: var(--ink-soft); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { color: #c2546f; border-color: rgba(194, 84, 111, .25); }

.card { padding: 20px 22px; margin-bottom: 18px; }
.card-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.card-sub { font-size: 12px; color: var(--ink-faint); margin: 0 0 18px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.segment {
  display: inline-flex; gap: 4px; padding: 4px;
  background: rgba(255, 255, 255, .5); border: 1px solid var(--stroke); border-radius: 14px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.segment button {
  font-family: inherit; font-size: 13px; padding: 8px 17px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; transition: .18s;
}
.segment button.active { background: var(--violet); color: #fff; box-shadow: 0 6px 14px rgba(124, 92, 255, .24); }
.hint { font-size: 12px; color: var(--ink-faint); }

.list-head, .row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1.7fr) minmax(0, 1fr) 104px 106px 46px;
  gap: 12px; align-items: center;
}
.list-head {
  padding: 0 12px 10px; font-size: 11px; color: var(--ink-faint);
  letter-spacing: .3px; border-bottom: 1px solid var(--line);
}
.list { margin-top: 4px; }
.row {
  padding: 11px 12px; border-radius: 12px; cursor: pointer;
  border-bottom: 1px solid rgba(90, 64, 160, .07); transition: background .16s;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: rgba(255, 255, 255, .62); }
.row-num { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.row-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title.done { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: rgba(124, 92, 255, .4); }
.row-client, .row-date { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-amount { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 500; }
.month-divider {
  font-size: 11px; color: var(--violet-deep); background: rgba(124, 92, 255, .09);
  display: inline-block; padding: 4px 12px; border-radius: 999px; margin: 16px 0 6px 12px;
}
.check {
  width: 20px; height: 20px; border-radius: 6px; position: relative; cursor: pointer;
  border: 1.5px solid rgba(124, 92, 255, .45); background: rgba(255, 255, 255, .6);
  transition: .18s; margin-left: auto;
}
.check:hover { border-color: var(--violet); transform: scale(1.08); }
.check.done { background: var(--violet); border-color: var(--violet); }
.check.done::after {
  content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(42deg);
}

.empty { text-align: center; padding: 48px 20px; color: var(--ink-faint); font-size: 13px; }
.empty strong { display: block; color: var(--ink); font-size: 15px; font-weight: 500; margin-bottom: 6px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { padding: 18px 20px; }
.metric-label { font-size: 12px; color: var(--ink-faint); }
.metric-value { font-size: 25px; font-weight: 600; margin-top: 6px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.metric-value small { font-size: 13px; font-weight: 400; color: var(--ink-soft); margin-left: 3px; }
.metric-foot { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }
.trend-up { color: #d2544f; }
.trend-down { color: #3f9c72; }

.chart-wrap { width: 100%; overflow-x: auto; }
.chart { display: block; width: 100%; height: auto; }
.chart-note { font-size: 11px; color: var(--ink-faint); margin-top: 10px; }

.calendar-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 8px; }
.calendar-head div { text-align: center; font-size: 11px; color: var(--ink-faint); }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day {
  min-height: 88px; padding: 8px; border-radius: 12px;
  background: rgba(255, 255, 255, .36); border: 1px solid rgba(255, 255, 255, .55);
}
.day.blank { background: transparent; border-color: transparent; }
.day.today { border-color: rgba(124, 92, 255, .5); background: rgba(124, 92, 255, .1); }
.day-num { font-size: 11px; color: var(--ink-faint); margin-bottom: 4px; }
.day-item {
  font-size: 11px; line-height: 1.35; padding: 3px 5px; margin-bottom: 3px;
  border-radius: 6px; background: rgba(255, 255, 255, .7); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.day-item.done { background: rgba(124, 92, 255, .2); color: var(--violet-deep); }
.day-item .dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: rgba(124, 92, 255, .4); margin-right: 4px; vertical-align: middle; }
.day-item.done .dot { background: var(--violet); }

.legend { display: flex; gap: 16px; font-size: 11px; color: var(--ink-faint); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; color: var(--ink-faint); font-weight: 400; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid rgba(90, 64, 160, .07); font-variant-numeric: tabular-nums; }
.table td:last-child, .table th:last-child { text-align: right; }
.table tr:last-child td { border-bottom: 0; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--ink);
  padding: 10px 12px; border-radius: 11px; border: 1px solid rgba(124, 92, 255, .18);
  background: rgba(255, 255, 255, .7); outline: none; transition: .18s;
}
.form-row input:focus, .form-row textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124, 92, 255, .12); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.modal-actions .right { display: flex; gap: 8px; }

.overlay {
  position: fixed; inset: 0; z-index: 50; padding: 20px;
  background: rgba(46, 34, 80, .24); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: min(470px, 100%); max-height: 90vh; overflow-y: auto; padding: 24px;
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(28px) saturate(160%); -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid #fff; border-radius: 22px; box-shadow: 0 26px 70px rgba(60, 35, 130, .22);
}
.modal h2 { margin: 0 0 3px; font-size: 17px; font-weight: 600; }
.modal .sub { margin: 0 0 20px; font-size: 12px; color: var(--ink-faint); }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 12px);
  z-index: 80; padding: 10px 18px; border-radius: 12px; font-size: 13px;
  background: rgba(46, 34, 80, .88); color: #fff; opacity: 0; pointer-events: none;
  transition: .22s; backdrop-filter: blur(10px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .label { font-size: 13px; }
.setting-row .desc { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
  .sidebar { position: static; height: auto; min-height: 0; padding: 14px; }
  .brand { padding-bottom: 12px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .nav-item { white-space: nowrap; width: auto; padding: 8px 12px; }
  .nav-dot, .sidebar-foot { display: none; }
  .topbar { padding: 14px 16px; }
  .list-head { display: none; }
  .row { grid-template-columns: 26px minmax(0, 1fr) 90px 30px; gap: 8px; }
  .row-client, .row-date { display: none; }
  .card { padding: 16px; }
  .day { min-height: 62px; padding: 5px; }
  .day-item { font-size: 10px; }
}
