:root {
  --bg: #333336;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.15);
  --placeholder: rgba(15, 23, 42, 0.36);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --accent: #2563eb;
  --danger: #dc2626;
  --axis-strong-line: #000;
  --radius: 16px;
  --radius-sm: 12px;
  --page-gutter: 16px;

  --label-width: 320px;
  --axis-height: 68px;
  --summary-height: 54px;
  --row-height: 48px;
  --row-gap: 0px;
  --rows-height: 0px;
  --day-width: 2px;
  --timeline-width: 2200px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}


html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-weight: 400;
  color: var(--text);
  background: #f5f5f7;
}

h1,
h2,
h3,
h4,
h5,
h6,
b,
strong {
  font-weight: 400;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px var(--page-gutter);
  margin: 0;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.7);
}

.app-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header__links {
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(15%);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: #fff;
  color: #000;
  border-radius: 8px;
  text-decoration: none;
  transition: transform 0.06s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.nav-link:hover {
  border-color: rgba(15, 23, 42, 0.15);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.nav-link:active {
  transform: translateY(0);
}

.nav-link svg {
  width: 22px;
  height: 22px;
  display: block;
  transform-origin: center;
}

.nav-link--x svg {
  transform: scale(1.2);
}

.nav-link--github svg {
  transform: scale(1);
}

.app-header__title h1 {
  margin: 0;
  font-size: 43px;
  font-family: inherit;
  letter-spacing: 1.76px;
  transform: translateX(5%);
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 26px;
}

.app-logo {
  display: inline-flex;
  width: 48px;
  height: 48px;
}

.app-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 999px;
}

.app-header__subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.app-header__stats {
  display: grid;
  grid-auto-flow: column;
  gap: 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stat {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  min-width: 120px;
  box-shadow: none;
}

.stat--toggle {
  cursor: pointer;
}

.stat--today.is-active {
  background: rgba(109, 199, 110, 0.16);
  border-color: rgba(109, 199, 110, 0.38);
}

.stat--month.is-active {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.38);
}

.stat--year.is-active {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.32);
}

.stat--selected.is-active {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.32);
}

.stat-toggle {
  --toggle-color: rgba(109, 199, 110, 0.9);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: #fff;
  padding: 0;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.stat-toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--toggle-color);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.stat-toggle:hover {
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.12);
}

.stat-toggle:active {
  transform: scale(0.96);
}

.stat-toggle.is-on {
  border-color: var(--toggle-color);
}

.stat-toggle--month {
  --toggle-color: rgba(245, 158, 11, 0.9);
}

.stat-toggle--year {
  --toggle-color: rgba(139, 92, 246, 0.9);
}

.stat-toggle--selected {
  --toggle-color: rgba(59, 130, 246, 0.9);
  cursor: default;
}

.stat-toggle.is-on::after {
  opacity: 1;
  transform: scale(1);
}

.stat__label {
  font-size: 12px;
  color: var(--muted);
}

.stat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.stat__header-spacer {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.stat__value {
  margin-top: 6px;
  font-weight: 400;
  font-size: 16px;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.stat__value--mono {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.stat-value__unit {
  font-size: 11px;
  color: var(--muted);
}

.stat__meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.app-main {
  padding: 10px var(--page-gutter) 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--page-gutter);
  align-items: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.is-modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: var(--page-gutter);
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}

.modal__panel {
  position: relative;
  width: min(946px, calc(100vw - var(--page-gutter) * 2));
  max-height: calc(100vh - var(--page-gutter) * 2);
  overflow: auto;
}

.panel__header--modal {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 16px 16px 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: none;
  /* 修复：顶部两个圆角被 header 背景“顶出直角”的问题 */
  border-top-left-radius: calc(var(--radius) - 1px);
  border-top-right-radius: calc(var(--radius) - 1px);
  background-clip: padding-box;
}

.panel__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal__close {
  flex: 0 0 auto;
}

.panel__header {
  padding: 16px 16px 0;
}

.panel__header h2 {
  margin: 0;
  font-size: 16px;
}

.panel__hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.form {
  padding: 14px 16px 16px;
  display: grid;
  gap: 12px;
}

.form-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 17px;
  align-items: start;
}

.form-split__col {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 8px;
  align-items: center;
}

.form-row--cols {
  grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.form-row--price {
  grid-template-columns: 96px minmax(0, 1fr) minmax(0, 160px);
}

.form-row--price .currency-picker {
  width: 100%;
}

.link-input-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
}

.form-col {
  display: grid;
  gap: 6px;
}

label {
  font-size: 12px;
  color: var(--muted);
}

.form-row > label {
  grid-column: 1;
  align-self: start;
  margin-top: 2px;
}

.form-row > :not(label) {
  grid-column: 2;
}

.form-row--cols > :not(label) {
  grid-column: auto;
}

.req {
  color: var(--danger);
  font-weight: 400;
}

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

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: #fff;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* 表单面板允许下拉菜单溢出显示 */
.panel--form {
  overflow: visible;
}

/* 自定义货币下拉（替代原生 select） */
.currency-picker,
.cycle-picker {
  position: relative;
}

.currency-picker__button,
.cycle-picker__button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: #fff;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.currency-picker__button:focus,
.currency-picker__button:focus-visible,
.cycle-picker__button:focus,
.cycle-picker__button:focus-visible {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.currency-picker__value,
.cycle-picker__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.currency-picker__chevron,
.cycle-picker__chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 18px;
}

.currency-picker__menu,
.cycle-picker__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 80;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 22px;
  gap: 6px;
  height: min(60vh, 360px);
}

.currency-picker__menu[hidden],
.cycle-picker__menu[hidden] {
  display: none;
}

.currency-picker__list,
.cycle-picker__list {
  position: relative;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(15, 23, 42, 0.01);
}

.cycle-picker__menu {
  /* 订阅周期下拉：无需字母索引，菜单更紧凑 */
  grid-template-columns: 1fr;
  height: auto;
  /* 适配“排序方式”较多选项：避免最后一项被裁切（240px 在默认 16px 字号下不够） */
  max-height: min(60vh, 280px);
}

.cycle-picker__list {
  height: auto;
}

.currency-group {
  position: relative;
}

.currency-group__header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.4px;
  color: rgba(15, 23, 42, 0.55);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(15, 23, 42, 0.15);
  backdrop-filter: blur(6px);
}

.currency-item,
.cycle-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: rgba(15, 23, 42, 0.9);
}

.cycle-item--divider {
  height: 1px;
  width: 100%;
  padding: 0;
  background: rgba(15, 23, 42, 0.15);
  border-radius: var(--radius);
  pointer-events: none;
}

.currency-item:hover,
.cycle-item:hover {
  background: rgba(37, 99, 235, 0.06);
}

.currency-item.is-selected,
.cycle-item.is-selected {
  background: rgba(37, 99, 235, 0.12);
}

.currency-item__code {
  font-weight: 400;
  letter-spacing: 0.2px;
}

.currency-item__name {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.58);
  white-space: nowrap;
}

.currency-picker__index {
  user-select: none;
  touch-action: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  padding: 6px 0;
  height: 100%;
}

.alpha-letter {
  width: 22px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: rgba(15, 23, 42, 0.55);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  flex: 1 1 0;
  display: grid;
  place-items: center;
}

.alpha-letter.is-active {
  color: var(--accent);
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-logo {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.color-logo--swatches {
  grid-template-columns: minmax(0, 1fr);
}

.link-logo__preview {
  margin-top: 0;
}

.color-logo__preview {
  width: 35px;
  height: 35px;
  border: 1px solid var(--border);
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.color-logo__preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.color-logo__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  align-items: center;
}

.color-custom {
  display: grid;
  gap: 6px;
}

.color-custom__title {
  font-size: 12px;
  color: var(--muted);
}

.color-custom__palette {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.color-custom__palette input[type="color"] {
  height: 40px;
  padding: 4px;
}

.color-swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  transition: transform 0.06s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.color-swatch:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 23, 42, 0.15);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.color-swatch.is-selected {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.color-swatch:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}

.date-inputs {
  display: grid;
  grid-template-columns: 1.2fr auto 0.9fr auto 0.9fr;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.date-inputs input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: #fff;
  text-align: center;
}

.date-inputs__sep {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.date-wheel {
  display: grid;
  gap: 6px;
}

.date-wheel__wheels {
  display: none;
  --wheel-height: 140px;
  --wheel-item-height: 36px;

  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 0.9fr;
  gap: 8px;
}

.wheel {
  height: var(--wheel-height);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  padding-block: calc((var(--wheel-height) - var(--wheel-item-height)) / 2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-y;
  cursor: grab;
}

.wheel.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.wheel.is-dragging .wheel-item {
  cursor: grabbing;
}

.wheel::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.wheel-item {
  width: 100%;
  height: var(--wheel-item-height);
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  user-select: none;
  font-weight: 400;
  color: rgba(15, 23, 42, 0.55);
}

.wheel-item:hover {
  color: rgba(15, 23, 42, 0.72);
}

.wheel-item.is-selected {
  color: rgba(15, 23, 42, 0.92);
}

.wheel-item:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.wheel-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wheel-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(255, 255, 255, 0.1) 30%,
    rgba(255, 255, 255, 0.1) 70%,
    rgba(255, 255, 255, 0.92) 100%
  );
}

.date-wheel__value {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: rgba(15, 23, 42, 0.02);
}

.date-wheel__value::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.end-date-toggle {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.end-date-toggle.is-active {
  grid-template-columns: 1fr;
  gap: 0;
}

.end-date-toggle.is-active .end-date-toggle__slot--left {
  display: none;
}

.end-date-toggle__slot {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.end-date-toggle__slot--right {
  justify-content: flex-end;
}

.end-date-controls {
  order: 0;
}

#btnCancelEndDate {
  order: 1;
}

.end-date-toggle__status {
  color: #000;
  font-size: 16px;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.end-date-toggle__btn {
  flex: 0 0 auto;
  padding: 7px 10px;
  font-size: 12px;
  min-width: 110px;
  text-align: center;
}

.end-date-controls {
  margin: 0;
  width: 100%;
}

.end-date-controls .date-wheel {
  width: 100%;
}

.end-date-toggle__slot--right {
  min-height: 40px;
}

.end-date-toggle__status {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 2px;
}

.modal__panel .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  padding: 12px 0 12px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-top: none;
}

.btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  padding: 9px 12px;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  font-weight: 400;
  text-decoration: none;
  color: var(--text);
}

.btn:hover {
  border-color: rgba(15, 23, 42, 0.15);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  border-color: rgba(37, 99, 235, 0.65);
  color: #fff;
}

.btn--danger {
  background: #fff;
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--danger);
}

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.06);
  color: #991b1b;
  font-size: 13px;
}

.panel--timeline {
  display: grid;
  grid-template-rows: auto 1fr;
  position: relative;
  /* 预留一条“线条头部标签”的空间，避免遮挡工具栏 */
  --line-label-space: 0px;
  --line-label-height: 24px;
  --line-label-stem: 8px;
  height: 100%;
  min-height: 0;
}

.timeline-toolbar {
  padding: 12px 12px 0;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.timeline-toolbar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

.toolbar-actions .btn {
  font-size: 12px;
}

.btn--with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn--with-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  flex: 0 0 auto;
}

.btn--bmc {
  padding: 6px 10px;
  font-size: 12px;
}

.timeline-toolbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.zoom-presets {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-preset-btn {
  padding: 7px 10px;
  font-size: 12px;
}

.sort-picker {
  width: 208px;
  flex: 0 0 auto;
}

.sort-picker .cycle-picker__button {
  border-radius: var(--radius);
  padding: 8px 12px;
  background: #fff;
  font-size: 12px;
}

#btnToday {
  font-size: 12px;
}

.sort-picker .cycle-picker__menu {
  left: 0;
  right: auto;
  width: 100%;
  max-height: min(70vh, 420px);
}

.sort-picker .cycle-picker__menu,
.sort-picker .cycle-item {
  font-size: 12px;
}

.zoom-controls {
  display: none;
}

.toolbar-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.toolbar-switch__label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* iOS 风格开关（类似“设置”里的左右拖动按钮） */
.ios-switch {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(15, 23, 42, 0.14);
  padding: 0;
  cursor: pointer;
  touch-action: none;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.ios-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  transition: transform 0.16s ease;
}

.ios-switch.is-on {
  background: rgba(52, 199, 89, 0.95);
  border-color: rgba(52, 199, 89, 0.95);
}

.ios-switch.is-on .ios-switch__thumb {
  transform: translateX(18px);
}

.ios-switch__thumb {
  transform: translateX(0px);
}

/* 首屏根据 localStorage 预读 today-highlight（见 index.html 头部脚本），避免开关/高亮闪烁 */
:root[data-today-highlight="1"] #toggleTodayHighlight {
  border-color: rgba(109, 199, 110, 0.9);
}

:root[data-today-highlight="0"] #toggleTodayHighlight {
  border-color: rgba(15, 23, 42, 0.18);
}

:root[data-today-highlight="1"] #toggleTodayHighlight::after {
  opacity: 1;
  transform: scale(1);
}

:root[data-today-highlight="0"] .today-band {
  display: none;
}

.ios-switch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.zoom-range {
  width: 160px;
}

.zoom-label {
  font-size: 12px;
  color: var(--muted);
  min-width: 64px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.timeline-scroller {
  margin: 8px 12px 12px;
  height: calc(100% - 20px);
  border: 1px solid var(--axis-strong-line);
  border-radius: var(--radius);
  background: linear-gradient(#ffffff, #ffffff);
  overflow: auto;
  min-height: 0;
  cursor: grab;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.timeline-scroller::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.timeline-line-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

.timeline-line-label {
  position: absolute;
  height: var(--line-label-height);
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(255, 255, 255, 0.96);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.timeline-line-label::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(var(--line-label-stem) * -1);
  width: 2px;
  height: var(--line-label-stem);
  transform: translateX(-50%);
  background: currentColor;
  opacity: 0.55;
}

.timeline-line-label--today {
  border-color: rgba(249, 115, 22, 0.4);
  background: rgba(249, 115, 22, 0.14);
  color: rgba(124, 45, 18, 0.95);
}

.timeline-line-label--selected {
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.14);
  color: rgba(30, 64, 175, 0.95);
}

.timeline-scroller.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.timeline-scroller.is-dragging * {
  cursor: grabbing;
}

.timeline-grid {
  --label-width: 320px;
  --axis-height: 68px;
  /* 顶部冻结行分成：年 / 月 / 日 三层（用于“合并单元格”视觉） */
  --axis-year-band: 24px;
  --axis-month-band: 24px;
  --axis-day-band: calc(var(--axis-height) - var(--axis-year-band) - var(--axis-month-band));
  --summary-height: 54px;
  --row-height: 48px;
  --row-gap: 0px;
  /* 左侧冻结列：四列（favicon / 名称 / 价格 / 周期） */
  --y-col-icon: var(--row-height);
  --y-col-price: 72px;
  --y-col-cycle: 72px;
  /* 年/月/日刻度线统一使用同一条网格线颜色（避免“粗细/深浅”层级差异） */
  --grid-line-color: rgba(15, 23, 42, 0.1);
  --day-width: 2px;
  --timeline-width: 2200px;
  --canvas-day-grid: repeating-linear-gradient(
    to right,
    var(--grid-line-color) 0,
    var(--grid-line-color) 1px,
    transparent 1px,
    transparent var(--day-width)
  );
  --canvas-row-grid: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--row-height) - 1px),
    var(--grid-line-color) calc(var(--row-height) - 1px),
    var(--grid-line-color) var(--row-height),
    transparent var(--row-height),
    transparent calc(var(--row-height) + var(--row-gap))
  );

  width: calc(var(--label-width) + var(--timeline-width));
  display: grid;
  grid-template-columns: var(--label-width) var(--timeline-width);
  grid-template-rows: var(--axis-height) auto var(--summary-height);
  min-height: 100%;
}

.corner,
.x-axis,
.y-axis,
.summary-corner,
.summary-axis {
  background: #fff;
}

.x-axis,
.summary-axis,
.summary-corner {
  font-weight: 400;
}

.x-axis .tick__label,
.summary-axis .tick__label,
.summary-axis .summary-cell,
.summary-axis .summary-marker {
  font-weight: 400;
}

.corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  padding: 0;
  font-weight: 400;
  letter-spacing: 0.2px;
  border-right: 1px solid var(--axis-strong-line);
  border-bottom: 1px solid var(--axis-strong-line);
}

.corner-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-auto-rows: 1fr;
  align-content: stretch;
  grid-template-columns:
    var(--y-col-icon)
    minmax(0, 1fr)
    minmax(0, var(--y-col-price))
    minmax(0, var(--y-col-cycle));
}

.corner-grid__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 400;
  color: #000;
  border-left: 1px solid #000;
  min-width: 0;
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
}

.corner-grid__cell--icon {
  border-left: none;
}

.corner-grid__cell--price {
  justify-content: center;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
}

.corner-grid__price-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.1;
}

.corner-grid__sort-icon {
  width: 12px;
  height: 12px;
  opacity: 0.7;
}

.corner-grid__cell--price:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.4);
  outline-offset: -2px;
}

.corner-grid__cell--cycle,
.corner-grid__cell--actions {
  justify-content: center;
}

.x-axis {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--grid-line-color);
  overflow: hidden;
}

.summary-axis {
  position: sticky;
  bottom: 0;
  z-index: 25;
  border-top: 1px solid #000;
  overflow: hidden;
}

.y-axis {
  position: sticky;
  left: 0;
  z-index: 20;
  border-right: 1px solid var(--axis-strong-line);
  box-shadow:
    6px 0 12px rgba(15, 23, 42, 0.12),
    0 -6px 12px rgba(15, 23, 42, 0.12),
    0 6px 12px rgba(15, 23, 42, 0.12);
  padding: var(--row-gap) 0;
  display: flex;
  flex-direction: column;
  gap: var(--row-gap);
  /* 左侧冻结列：背景与坐标轴一致（空白区域也显示行网格） */
  background-image: var(--canvas-row-grid);
  background-position: 0 var(--row-gap);
  background-size: 100% var(--rows-height);
  background-repeat: no-repeat;
}

.timeline-grid.is-empty .y-axis {
  background-image: none;
}

.timeline-grid.is-empty .canvas-grid-layer {
  display: none;
}

.timeline-grid.is-empty .y-axis,
.timeline-grid.is-empty .canvas {
  min-height: calc(36px + 16px);
}

.summary-corner {
  position: sticky;
  left: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 12px;
  font-weight: 400;
  letter-spacing: 0.2px;
  color: rgba(15, 23, 42, 0.7);
  border-right: 1px solid var(--axis-strong-line);
  border-top: 1px solid var(--axis-strong-line);
}

.summary-corner__title {
  min-width: 0;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #000;
}

.summary-corner__add {
  flex: 0 0 auto;
  padding: 7px 10px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.02);
}

.canvas {
  position: relative;
  z-index: 0;
  padding: var(--row-gap) 0;
  display: flex;
  flex-direction: column;
  gap: var(--row-gap);
}

.x-axis {
  position: sticky;
  top: 0;
  z-index: 8;
  border-bottom-color: #000;
}

/* 底部冻结行：三小行（年/月/日）合计 */
.summary-overlay-layer,
.summary-layer {
  position: absolute;
  inset: 0;
}

.summary-layer {
  display: flex;
  flex-direction: column;
  background-image: repeating-linear-gradient(
    to right,
    rgba(15, 23, 42, 0.15) 0,
    rgba(15, 23, 42, 0.15) 1px,
    transparent 1px,
    transparent var(--day-width)
  );
}

.summary-row {
  position: relative;
  flex: 1 1 0;
  overflow: hidden;
}

.summary-row:not(:first-child) {
  border-top: 1px solid rgba(15, 23, 42, 0.15);
}

.summary-cell {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 400;
  color: rgba(15, 23, 42, 0.75);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: auto;
}

.summary-row--year .summary-cell {
  font-size: 12px;
  font-weight: 400;
  color: rgba(15, 23, 42, 0.86);
}

.summary-row--day .summary-cell {
  padding: 0;
  justify-content: center;
  font-size: 10px;
  font-weight: 400;
}

.summary-marker {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background: rgba(37, 99, 235, 0.16);
  border-left: 1px solid rgba(37, 99, 235, 0.45);
  pointer-events: auto;
}

.summary-marker.is-multi {
  background: rgba(15, 23, 42, 0.08);
  border-left-color: rgba(15, 23, 42, 0.15);
}

/* “日刻度”网格：主画布使用背景网格；顶部冻结行只在“日行”显示，模拟 Excel 合并效果 */
.canvas-grid-layer {
  background-image: var(--canvas-day-grid), var(--canvas-row-grid);
  background-position: 0 0, 0 var(--row-gap);
  background-size: auto, 100% var(--rows-height);
  background-repeat: repeat, no-repeat;
}

/* 动态合成：缩小到一定程度时隐藏“日刻度”（每日网格） */
.timeline-grid.is-day-grid-hidden {
  --canvas-day-grid: none;
}

.timeline-grid.is-day-grid-hidden .summary-layer {
  background-image: none;
}

.axis-layer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--axis-day-band);
  background-image: repeating-linear-gradient(
    to right,
    var(--grid-line-color) 0,
    var(--grid-line-color) 1px,
    transparent 1px,
    transparent var(--day-width)
  );
  pointer-events: none;
}

/* 顶部冻结行：年/月/日 的水平分割线 */
.axis-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(
      to bottom,
      transparent calc(var(--axis-year-band) - 1px),
      rgba(15, 23, 42, 0.15) calc(var(--axis-year-band) - 1px),
      rgba(15, 23, 42, 0.15) var(--axis-year-band),
      transparent var(--axis-year-band)
    ),
    linear-gradient(
      to bottom,
      transparent calc(var(--axis-year-band) + var(--axis-month-band) - 1px),
      rgba(15, 23, 42, 0.15) calc(var(--axis-year-band) + var(--axis-month-band) - 1px),
      rgba(15, 23, 42, 0.15) calc(var(--axis-year-band) + var(--axis-month-band)),
      transparent calc(var(--axis-year-band) + var(--axis-month-band))
    );
}

/* 动态合成：年份独占时不画内部水平线 */
.timeline-grid.is-axis-year-only .axis-layer::after {
  background-image: none;
}

/* 动态合成：年/月 平分时只保留“年/月”分割线 */
.timeline-grid.is-axis-year-month .axis-layer::after {
  background-image: linear-gradient(
    to bottom,
    transparent calc(var(--axis-year-band) - 1px),
    rgba(15, 23, 42, 0.15) calc(var(--axis-year-band) - 1px),
    rgba(15, 23, 42, 0.15) var(--axis-year-band),
    transparent var(--axis-year-band)
  );
}

.timeline-grid.is-day-grid-hidden .axis-layer::before {
  background-image: none;
}

/* 动态合成：进一步缩小后隐藏“月刻度”网格线 */
.timeline-grid.is-month-grid-hidden .axis-layer .tick--month .tick__line,
.timeline-grid.is-month-grid-hidden .canvas-grid-layer .tick--month .tick__line {
  display: none;
}

.axis-layer,
.canvas-grid-layer,
.canvas-selection-layer,
.canvas-today-layer {
  position: absolute;
  inset: 0;
}

.axis-layer {
  pointer-events: auto;
}

.canvas-grid-layer,
.canvas-selection-layer,
.canvas-today-layer {
  pointer-events: none;
}

.canvas-grid-layer {
  z-index: 5;
}

.canvas-selection-layer {
  z-index: 30;
}

.canvas-today-layer {
  z-index: 25;
}

.tick {
  position: absolute;
  top: 0;
  bottom: 0;
}

.axis-layer .tick {
  cursor: pointer;
}

.axis-layer .tick--day {
  top: calc(var(--axis-year-band) + var(--axis-month-band));
  bottom: 0;
  pointer-events: none;
}

.axis-layer .tick--day .tick__label {
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  font-size: 11px;
  color: rgba(15, 23, 42, 0.6);
}

.axis-layer .tick--month .tick__line {
  /* “年行”不显示月边界线，模拟“合并后看不到列线” */
  top: var(--axis-year-band);
}

.axis-layer .tick:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.tick__line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--grid-line-color);
}

/* 日网格可见时，隐藏年线条，避免与日线叠加变粗 */
.timeline-grid:not(.is-day-grid-hidden) .tick--year .tick__line {
  display: none;
}

/* 选取范围已用“整列高亮”呈现，这里不额外改变刻度线颜色，避免出现“边框残留”观感 */
.tick.is-picked .tick__line {
  background: var(--grid-line-color);
}

.canvas-grid-layer .tick__line {
  background: var(--grid-line-color);
}

.tick__label {
  position: absolute;
  top: 32px;
  left: 6px;
  box-sizing: border-box;
  line-height: 1.1;
  font-size: 10px;
  color: rgba(15, 23, 42, 0.72);
  white-space: nowrap;
  pointer-events: none;
}

.tick--month .tick__label {
  top: var(--axis-year-band);
  height: var(--axis-month-band);
  display: flex;
  align-items: center;
  overflow: hidden;
  font-size: 12px;
}

.tick.is-picked .tick__label {
  color: rgba(15, 23, 42, 0.92);
  background: none;
  border: 0;
  padding: 0;
}

.tick--year .tick__label {
  top: 0;
  height: var(--axis-year-band);
  display: flex;
  align-items: center;
  overflow: hidden;
  font-size: 14px;
  font-weight: 400;
  color: rgba(15, 23, 42, 0.86);
}

.timeline-grid.is-axis-year-only .tick--year .tick__label {
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
}

/* 底部冻结行（花费合计）：内部顺序改为 日 > 月 > 年（日最上，年最下） */
.axis-layer--summary::before {
  top: 0;
  bottom: auto;
}

.axis-layer--summary::after {
  background-image:
    linear-gradient(
      to bottom,
      transparent calc(var(--axis-day-band) - 1px),
      var(--grid-line-color) calc(var(--axis-day-band) - 1px),
      var(--grid-line-color) var(--axis-day-band),
      transparent var(--axis-day-band)
    ),
    linear-gradient(
      to bottom,
      transparent calc(var(--axis-day-band) + var(--axis-month-band) - 1px),
      var(--grid-line-color) calc(var(--axis-day-band) + var(--axis-month-band) - 1px),
      var(--grid-line-color) calc(var(--axis-day-band) + var(--axis-month-band)),
      transparent calc(var(--axis-day-band) + var(--axis-month-band))
    );
}

.timeline-grid.is-axis-year-month .axis-layer--summary::after {
  background-image: linear-gradient(
    to bottom,
    transparent calc(var(--axis-day-band) + var(--axis-month-band) - 1px),
    var(--grid-line-color) calc(var(--axis-day-band) + var(--axis-month-band) - 1px),
    var(--grid-line-color) calc(var(--axis-day-band) + var(--axis-month-band)),
    transparent calc(var(--axis-day-band) + var(--axis-month-band))
  );
}

.timeline-grid.is-axis-year-only .axis-layer--summary::after {
  background-image: none;
}

.axis-layer--summary .tick--day {
  top: 0;
  bottom: auto;
  height: var(--axis-day-band);
}

.axis-layer--summary .tick--month .tick__label {
  top: var(--axis-day-band);
  height: var(--axis-month-band);
  font-size: 12px;
  color: rgba(15, 23, 42, 0.86);
}

.axis-layer--summary .tick--year .tick__label {
  top: calc(var(--axis-day-band) + var(--axis-month-band));
  height: var(--axis-year-band);
}

.axis-layer--summary .tick--day .tick__label {
  font-size: 10px;
  color: rgba(15, 23, 42, 0.86);
}

/* “年行”不显示月边界线：月线条只出现在 日+月 两行里 */
.axis-layer--summary .tick--month .tick__line {
  top: 0;
  bottom: var(--axis-year-band);
}

.selected-band {
  --band-fill: rgba(59, 130, 246, 0.18);
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--band-fill);
  pointer-events: none;
}

.selected-band-group {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.month-band {
  --band-fill: rgba(245, 158, 11, 0.18);
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--band-fill);
  pointer-events: none;
}

.year-band {
  --band-fill: rgba(139, 92, 246, 0.18);
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--band-fill);
  pointer-events: none;
}

.today-band {
  --band-fill: rgba(109, 199, 110, 0.18);
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--band-fill);
  pointer-events: none;
}

/* 选取/今天高亮：不画边框（避免边缘残留“加深”的边框效果） */
.selected-band::before,
.selected-band::after,
.month-band::before,
.month-band::after,
.year-band::before,
.year-band::after,
.today-band::before,
.today-band::after {
  content: none;
}

.selected-badge {
  position: absolute;
  top: 46px;
  transform: translateX(6px);
  padding: 2px 8px;
  border-radius: var(--radius);
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(37, 99, 235, 0.35);
  color: rgba(30, 64, 175, 0.95);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  pointer-events: none;
}

.today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.18);
  pointer-events: none;
}

.today-badge {
  position: absolute;
  top: 10px;
  transform: translateX(6px);
  padding: 2px 8px;
  border-radius: var(--radius);
  background: rgba(249, 115, 22, 0.14);
  border: 1px solid rgba(249, 115, 22, 0.35);
  color: rgba(124, 45, 18, 0.92);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  pointer-events: none;
}

.y-row {
  height: var(--row-height);
  display: grid;
  grid-template-columns:
    var(--y-col-icon)
    minmax(0, 1fr)
    minmax(0, var(--y-col-price))
    minmax(0, var(--y-col-cycle));
  align-items: stretch;
  padding: 0;
  border-radius: 0;
  /* 使用单边线条，避免上下相邻行“叠成双线” */
  box-shadow: inset 0 -1px 0 #000;
}

.y-row--add {
  position: sticky;
  bottom: 0;
  z-index: 22;
  width: calc(100% - 24px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 12px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.y-row--add:hover {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.15);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.y-row--add:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

.y-row--add:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.55);
}

.timeline-grid.is-empty .y-row--add {
  position: static;
  margin: 12px 12px 18px;
  width: calc(100% - 24px);
}

.y-row--add .y-cell--icon {
  color: rgba(15, 23, 42, 0.6);
  font-size: 16px;
}

.y-row--add .y-cell {
  padding: 0;
  height: auto;
  border-left: 0;
}

.y-row--add .y-cell--price,
.y-row--add .y-cell--cycle {
  display: none;
}

.y-row.is-selected {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.55), inset 0 -1px 0 #000;
}

.y-cell {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 10px;
  min-width: 0;
}

.y-cell:not(:first-child) {
  border-left: 1px solid #000;
}

.y-row--add .y-cell:not(:first-child) {
  border-left: 0;
}

.y-cell--name {
  gap: 10px;
}

.y-cell--icon {
  justify-content: center;
  padding: 0;
}

.y-row__favicon-link {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
}

.y-row__favicon {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.y-cell--price {
  justify-content: flex-end;
  font-size: 0.5em;
  font-variant-numeric: tabular-nums;
  color: #000;
}

.y-cell--cycle {
  justify-content: center;
  font-size: 12px;
  color: #000;
}

.y-cell--actions {
  justify-content: center;
}

.row-action {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  color: rgba(15, 23, 42, 0.85);
  transition: transform 0.06s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.row-action--icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 0;
}

.row-action--icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.y-row__name-link {
  color: inherit;
  text-decoration: none;
}

.y-row__name-link:hover {
  text-decoration: underline;
}

.row-action:hover {
  border-color: rgba(15, 23, 42, 0.15);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.row-action:active {
  transform: translateY(1px);
}

.row-action:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.row-action[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.row-action--danger {
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--danger);
  background: rgba(220, 38, 38, 0.04);
}

.row-action--link {
  border-color: rgba(37, 99, 235, 0.35);
  color: rgba(30, 64, 175, 0.92);
  background: rgba(37, 99, 235, 0.06);
}

.row-action--danger:hover {
  border-color: rgba(220, 38, 38, 0.45);
  background: rgba(220, 38, 38, 0.08);
}

.row-action--link:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.1);
}

.y-row__name {
  font-weight: 400;
  font-size: 13px;
  color: #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.y-row__meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-row {
  position: relative;
  height: var(--row-height);
}

.subscription-bar {
  position: absolute;
  z-index: 10;
  /* 让下一行色块“向上覆盖 1px”，把相邻两行的边线压成一条线（避免视觉 2px） */
  top: -1px;
  height: calc(var(--row-height) + 1px);
  box-sizing: border-box;
  border-radius: 0;
  box-shadow: none;
  color: rgba(15, 23, 42, 0.92);
  cursor: pointer;
  border: 1px solid #000;
  /* 右侧边线用 ::after 画到 100%（元素外侧），避免比刻度线偏左 1px */
  border-right: 0;
}

/* 第一行顶边上移 1px */
.canvas .service-row:first-child .subscription-bar {
  top: -1px;
  height: calc(var(--row-height) + 1px);
}

/* 右侧边线靠近 100% 并微调 0.5px：让边线视觉中心落在刻度线上 */
.subscription-bar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  left: 100%;
  transform: translateX(-0.5px);
  background: #000;
  pointer-events: none;
}

.subscription-bar:hover {
  filter: brightness(1.02);
  transition: filter 0.12s ease;
}

.subscription-bar.is-selected {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.55);
}

.subscription-bar.is-future {
  opacity: 1;
}

.subscription-bar.is-continuous::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 100%;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.34));
  pointer-events: none;
}

.bar-content {
  position: absolute;
  inset: 0;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bar-price-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.bar-price-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-title {
  font-weight: 400;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-subtitle {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.75);
  white-space: nowrap;
}

.bar-badge {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 400;
  padding: 2px 8px;
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(255, 255, 255, 0.2);
}

.cycle-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #000;
}

.empty-state {
  padding: 18px 14px;
  color: var(--muted);
  font-size: 13px;
}

.app-footer {
  padding: 0 var(--page-gutter) 18px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .app-header__right {
    flex-direction: column;
    align-items: stretch;
  }

  .app-header__stats {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
  }

  .app-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .form-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .timeline-toolbar {
    flex-wrap: wrap;
  }

  .zoom-range {
    width: 120px;
  }

  .tick--month .tick__label {
    display: none;
  }

  .y-row__meta {
    display: none;
  }
}
