/*
 * Subdots 的样式。设计语言来自 v1.0 的效果图(app-ideas 仓库 070 的设计画布):
 * 精美但克制——顶部一层非常淡的强调色渐变、白色圆角 20 的卡片配一根发丝阴影、
 * 无边框的浅色填充控件、强调色渐变的胶囊主按钮、系统字体。
 *
 * Token 只有一套,分三段:浅色(默认)、跟随系统的深色、显式选择的深色。后两段内容
 * 相同 —— 一段给"跟随系统",一段给"手动选了深色"。用到的每一个变量都要在这里定义,
 * scripts/check.ts 会查。
 */

:root {
  --bg: #F2F3F7;
  --surface: #FFFFFF;
  --surface-2: #F6F7F9;
  --fill: rgba(17, 24, 39, 0.05);
  --fill-strong: rgba(17, 24, 39, 0.08);
  --line: rgba(17, 24, 39, 0.07);
  /* 账号页「平台 → 账号 → 订阅」左边那条竖线:比发丝线重一点,深色下也看得出层级 */
  --rail: rgba(17, 24, 39, 0.12);
  --text: #111318;
  --text-2: #5C6270;
  --text-3: #8A909C;
  --accent: #1F66E0;
  --accent-text: #1F5AC8;
  --accent-soft: rgba(31, 102, 224, 0.10);
  --accent-soft-strong: rgba(31, 102, 224, 0.16);
  --accent-grad: linear-gradient(90deg, #1F66E0, #3172E2);
  --accent-shadow: 0 6px 16px rgba(31, 102, 224, 0.26);
  --on-accent: #FFFFFF;
  --focus: rgba(31, 102, 224, 0.6);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05);
  --shadow-pop: 0 12px 40px rgba(16, 24, 40, 0.16);
  --wash: linear-gradient(180deg, rgba(31, 102, 224, 0.12) 0, rgba(31, 102, 224, 0.04) 180px, rgba(31, 102, 224, 0) 380px);
  --warn-bg: rgba(234, 138, 24, 0.14);
  --warn-text: #9A4D00;
  --danger-bg: rgba(220, 53, 38, 0.10);
  --danger-text: #B42318;
  --trial-bg: rgba(105, 84, 220, 0.12);
  --trial-text: #5440C2;
  --info-bg: #E8F1FC;
  --info-text: #1F5AB4;
  --ok-bg: #E6F2EC;
  --ok-text: #17664A;
  --neutral-bg: #ECEDF0;
  --neutral-text: #3B4250;
  --mono-1-bg: #E6F2EC; --mono-1-text: #17664A;
  --mono-2-bg: #F7ECE5; --mono-2-text: #9A4A22;
  --mono-3-bg: #FDF1E2; --mono-3-text: #9A5300;
  --mono-4-bg: #E8F1FC; --mono-4-text: #1F5AB4;
  --mono-5-bg: #EEEBFB; --mono-5-text: #5440C2;
  --mono-6-bg: #ECEDF0; --mono-6-text: #3B4250;
  --backdrop: rgba(15, 18, 26, 0.32);
  --radius-card: 20px;
  --radius-inner: 16px;
  --radius-control: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono-font: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060C19;
    --surface: #0D1628;
    --surface-2: #121D33;
    --fill: rgba(255, 255, 255, 0.06);
    --fill-strong: rgba(255, 255, 255, 0.10);
    --line: rgba(255, 255, 255, 0.07);
    --rail: rgba(255, 255, 255, 0.16);
    --text: #EEF2FA;
    --text-2: #A3ADC2;
    --text-3: #6B7690;
    --accent-text: #8DB8FF;
    --accent-soft: rgba(141, 184, 255, 0.15);
    --accent-soft-strong: rgba(141, 184, 255, 0.24);
    --accent-shadow: 0 6px 16px rgba(31, 102, 224, 0.35);
    --focus: rgba(141, 184, 255, 0.7);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 28px rgba(0, 0, 0, 0.26);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
    --wash: linear-gradient(180deg, rgba(31, 102, 224, 0.20) 0, rgba(31, 102, 224, 0.06) 180px, rgba(31, 102, 224, 0) 380px);
    --warn-bg: rgba(255, 159, 64, 0.16);
    --warn-text: #FFBD7A;
    --danger-bg: rgba(255, 99, 82, 0.16);
    --danger-text: #FF948A;
    --trial-bg: rgba(150, 130, 255, 0.18);
    --trial-text: #BCB0FF;
    --info-bg: rgba(141, 184, 255, 0.15);
    --info-text: #8DB8FF;
    --ok-bg: rgba(127, 217, 168, 0.15);
    --ok-text: #7FD9A8;
    --neutral-bg: rgba(214, 217, 224, 0.15);
    --neutral-text: #D6D9E0;
    --mono-1-bg: rgba(127, 217, 168, 0.15); --mono-1-text: #7FD9A8;
    --mono-2-bg: rgba(242, 169, 133, 0.15); --mono-2-text: #F2A985;
    --mono-3-bg: rgba(255, 194, 122, 0.15); --mono-3-text: #FFC27A;
    --mono-4-bg: rgba(141, 184, 255, 0.15); --mono-4-text: #8DB8FF;
    --mono-5-bg: rgba(150, 130, 255, 0.18); --mono-5-text: #BCB0FF;
    --mono-6-bg: rgba(214, 217, 224, 0.15); --mono-6-text: #D6D9E0;
    --backdrop: rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #060C19;
  --surface: #0D1628;
  --surface-2: #121D33;
  --fill: rgba(255, 255, 255, 0.06);
  --fill-strong: rgba(255, 255, 255, 0.10);
  --line: rgba(255, 255, 255, 0.07);
  --rail: rgba(255, 255, 255, 0.16);
  --text: #EEF2FA;
  --text-2: #A3ADC2;
  --text-3: #6B7690;
  --accent-text: #8DB8FF;
  --accent-soft: rgba(141, 184, 255, 0.15);
  --accent-soft-strong: rgba(141, 184, 255, 0.24);
  --accent-shadow: 0 6px 16px rgba(31, 102, 224, 0.35);
  --focus: rgba(141, 184, 255, 0.7);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 28px rgba(0, 0, 0, 0.26);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
  --wash: linear-gradient(180deg, rgba(31, 102, 224, 0.20) 0, rgba(31, 102, 224, 0.06) 180px, rgba(31, 102, 224, 0) 380px);
  --warn-bg: rgba(255, 159, 64, 0.16);
  --warn-text: #FFBD7A;
  --danger-bg: rgba(255, 99, 82, 0.16);
  --danger-text: #FF948A;
  --trial-bg: rgba(150, 130, 255, 0.18);
  --trial-text: #BCB0FF;
  --info-bg: rgba(141, 184, 255, 0.15);
  --info-text: #8DB8FF;
  --ok-bg: rgba(127, 217, 168, 0.15);
  --ok-text: #7FD9A8;
  --neutral-bg: rgba(214, 217, 224, 0.15);
  --neutral-text: #D6D9E0;
  --mono-1-bg: rgba(127, 217, 168, 0.15); --mono-1-text: #7FD9A8;
  --mono-2-bg: rgba(242, 169, 133, 0.15); --mono-2-text: #F2A985;
  --mono-3-bg: rgba(255, 194, 122, 0.15); --mono-3-text: #FFC27A;
  --mono-4-bg: rgba(141, 184, 255, 0.15); --mono-4-text: #8DB8FF;
  --mono-5-bg: rgba(150, 130, 255, 0.18); --mono-5-text: #BCB0FF;
  --mono-6-bg: rgba(214, 217, 224, 0.15); --mono-6-text: #D6D9E0;
  --backdrop: rgba(0, 0, 0, 0.55);
}

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

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

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* 日文不在长音「ー」和小假名前断行;韩文按空格(词)断行,不把一个词拆到两行 */
:root:lang(ja) { line-break: strict; }
:root:lang(ko) { word-break: keep-all; }

.wash {
  position: fixed;
  inset: 0 0 auto 0;
  height: 380px;
  background: var(--wash);
  pointer-events: none;
  z-index: 0;
}

#root { position: relative; z-index: 1; }

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

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

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

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

/* hidden 要真的藏住:.field 这类自带 display 的元素会盖掉浏览器默认的 [hidden] 样式 */
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 50;
  padding: 10px 16px; border-radius: 999px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
.skip-link:focus { top: 16px; }

.boot { padding: 120px 24px; text-align: center; color: var(--text-2); }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

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

.app {
  display: flex;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
}

.side {
  position: sticky; top: 0;
  width: 248px; height: 100vh; flex-shrink: 0;
  padding: 28px 16px 24px;
  display: flex; flex-direction: column; gap: 28px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent-grad); box-shadow: var(--accent-shadow);
  display: inline-flex; align-items: center; justify-content: center;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px; border-radius: var(--radius-control);
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--fill); text-decoration: none; color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); font-weight: 600; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--text-3); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
/* 登录身份,也是设置的入口:和导航项一样悬停变底色,在设置页时高亮 */
.identity { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: var(--radius-control); color: var(--text); }
.identity:hover { background: var(--fill); text-decoration: none; }
.identity[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow-card); }
.identity-text { min-width: 0; }
/* 登录邮箱不截断:侧栏 248px,短邮箱也会被省略号吃掉几个字。放不下就在「@」后面折行(shell.js 放了 <wbr>) */
.identity-email { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.identity-how { font-size: 12px; color: var(--text-2); }
/* 看得见的「设置」:身份块是设置的唯一入口,只靠悬停提示找不到 */
.identity-go { margin-left: auto; flex-shrink: 0; font-size: 12px; color: var(--text-3); }

.main { flex: 1; min-width: 0; padding: 32px 32px 64px; }
/* 跳转链接和换页时程序把焦点放到 main 上,给读屏用;它不需要一圈描边。 */
.main:focus { outline: none; }
/* 就地操作之后焦点回到那张卡片的标题(main.js),也是给读屏和下一次 Tab 定位用的 */
section[tabindex="-1"]:focus, h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; }
.page-head p { margin-top: 4px; color: var(--text-2); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); margin-bottom: 12px; }

/* ---------------------------------------------------------------- 卡片与网格 */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.card-head p { color: var(--text-2); font-size: 13px; margin-top: 2px; }
/* 卡头左边是标题(账号详情是一个可能很长的邮箱):让它能缩,长邮箱在卡里折行,不把卡撑宽 */
.card-head > div:first-child { min-width: 0; }
.card-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 13px; }
/* 卡底右边的「去处理」:窄屏上不被挤成「去处 / 理」 */
.card-foot > a { flex-shrink: 0; white-space: nowrap; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.stat-label { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat-value { margin-top: 10px; font-size: 30px; font-weight: 650; letter-spacing: -0.02em; }
.stat-value .approx { color: var(--text-3); font-weight: 500; margin-right: 2px; }
.stat-note { margin-top: 6px; color: var(--text-2); font-size: 13px; }

/* ---------------------------------------------------------------- 行 */

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line); min-width: 0;
}
.row:first-child { border-top: 0; padding-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* 行标题里的名字(没有备注名时就是邮箱)能缩、能在任意处折行,不越出卡片;状态标签不折 */
.row-title > a, .row-title > span:not(.chip) { min-width: 0; overflow-wrap: anywhere; }
.row-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.row-side { text-align: right; flex-shrink: 0; }
/* 好几种币种的合计(「USD 87.49 + EUR 4.59 + JPY 3,000」)可以折行,最多占半行:左边的名字不被挤成一字一行 */
.row-side-wrap { flex-shrink: 1; min-width: 0; max-width: 50%; }
.row-amount { font-weight: 600; }
.row-equiv { color: var(--text-3); font-size: 12px; }
a.row, a.row-link { color: inherit; }
/* 圆角的整行链接:分隔线画成一根直线(::before)。border-top 会被圆角压弯,两头往下翘;订阅行同样(见 .sub-row) */
.row.row-link { position: relative; }
.row.row-link:not(:first-child) { border-top-color: transparent; }
.row.row-link:not(:first-child)::before, .sub-row + .sub-row::before { content: ""; position: absolute; top: -1px; left: 0; right: 0; border-top: 1px solid var(--line); pointer-events: none; }
a.row:hover, a.row-link:hover { text-decoration: none; background: var(--fill); }
.row-link { border-radius: var(--radius-control); margin: 0 -10px; padding-left: 10px; padding-right: 10px; }
/* 只有标题区是链接、右边还有按钮的行(总览的需要注意、即将到来):不铺底色,悬停给标题加下划线 */
a.row-main { color: inherit; }
a.row-main:hover { text-decoration: none; }
button.row-main { border: 0; padding: 0; background: none; text-align: left; cursor: pointer; }
a.row-main:hover .row-title > span:not(.chip), button.row-main:hover .row-title > span:not(.chip) { text-decoration: underline; }
.row-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--text-3); }
.dot-danger { background: var(--danger-text); }
.dot-warn { background: var(--warn-text); }
.dot-info { background: var(--info-text); }
.dot-trial { background: var(--trial-text); }

.day-group { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.day-group:first-child { border-top: 0; padding-top: 0; }
.day-date { font-weight: 650; }
.day-rel { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.day-items { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.day-item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.day-main { display: flex; align-items: center; gap: 12px; }
.day-main > div { min-width: 0; }

/* ---------------------------------------------------------------- 头像与标签 */

.mono {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; letter-spacing: -0.02em;
}
.mono-sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.mono-1 { background: var(--mono-1-bg); color: var(--mono-1-text); }
.mono-2 { background: var(--mono-2-bg); color: var(--mono-2-text); }
.mono-3 { background: var(--mono-3-bg); color: var(--mono-3-text); }
.mono-4 { background: var(--mono-4-bg); color: var(--mono-4-text); }
.mono-5 { background: var(--mono-5-bg); color: var(--mono-5-text); }
.mono-6 { background: var(--mono-6-bg); color: var(--mono-6-text); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral-text);
}
.chip-warn { background: var(--warn-bg); color: var(--warn-text); }
.chip-danger { background: var(--danger-bg); color: var(--danger-text); }
.chip-trial { background: var(--trial-bg); color: var(--trial-text); }
.chip-info { background: var(--info-bg); color: var(--info-text); }
.chip-ok { background: var(--ok-bg); color: var(--ok-text); }

.count-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--fill-strong); color: var(--text-2); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 0;
  font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  background: var(--fill); color: var(--text); text-decoration: none;
}
.btn:hover { background: var(--fill-strong); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-grad); color: var(--on-accent); box-shadow: var(--accent-shadow); }
.btn-primary:hover { background: var(--accent-grad); filter: brightness(1.05); }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); }
.btn-danger:hover { background: var(--danger-bg); filter: brightness(0.97); }
.btn-quiet { background: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--fill); color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }

.icon { width: 16px; height: 16px; flex-shrink: 0; display: block; }

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

.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--danger-text); }

.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 0; border-radius: var(--radius-control);
  background: var(--fill); color: var(--text);
  outline: none;
}
.textarea { min-height: 88px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft-strong); outline: none; }
.input[aria-invalid="true"] { box-shadow: 0 0 0 2px var(--danger-text); }
/* 改不了的框(修改一期时的币种、算出来之前的到期日):不填底色,只留一圈细线,一看就不是让人填的 */
.input:disabled, .select:disabled { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); cursor: not-allowed; }
.input-code { font-family: var(--mono-font); letter-spacing: 0.4em; font-size: 20px; text-align: center; }
.input-group { display: flex; gap: 8px; }
.input-group .select { flex: 0 0 auto; width: auto; min-width: 96px; }
/* 账号的登录方式和通过哪个账号登录:并排,各占一半 */
.input-group.login-pair .select { flex: 1 1 0; min-width: 0; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--fill); flex-wrap: wrap; }
.seg button, .seg label { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; }
.seg button[aria-pressed="true"], .seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

/* 宽度放得下提示「搜平台、账号、邮箱、订阅、地区」,不被截成「…订阅、地」 */
.search { position: relative; min-width: 300px; }
.search .input { padding-left: 38px; border-radius: 999px; min-height: 40px; background: var(--surface); box-shadow: var(--shadow-card); }
.search .icon { position: absolute; left: 14px; top: 12px; color: var(--text-3); }
/* 总览页头的搜索框和添加按钮:手机上并成一行,按钮只留图标(见 640px) */
.head-tools { display: flex; align-items: center; gap: 10px; }

.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pick {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px; border: 0; border-radius: var(--radius-inner);
  background: var(--surface-2); cursor: pointer; min-width: 0;
}
.pick:hover { background: var(--fill-strong); }
.pick[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
.pick-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-sub { display: block; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.preview { padding: 12px 14px; border-radius: var(--radius-control); background: var(--accent-soft); color: var(--accent-text); font-size: 13px; }
.note { padding: 12px 14px; border-radius: var(--radius-control); background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.note-warn { background: var(--warn-bg); color: var(--warn-text); }
/* 提示里带一个就地处理的按钮:卡快过期时的「改有效期」、注销前的「先导出备份」 */
.note-action { display: flex; align-items: flex-start; gap: 12px; }
.note-action > :first-child { flex: 1; min-width: 0; }
.note-action .btn { flex-shrink: 0; }

.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.form-actions .grow { flex: 1; }

/* ---------------------------------------------------------------- 列表页 */

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
/* 「需要注意 N」「隐藏邮箱」开关:和搜索框同一个样子,打开时换成强调色 */
.toolbar .btn { height: 36px; background: var(--surface); box-shadow: var(--shadow-card); }
.toolbar .btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }

/* 一条订阅一行(attention.js 的 subRow):头像、正文(标题、状态与原因、属于谁和怎么付)、右边的价格和动作 */
.sub-row { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 10px; border-radius: var(--radius-control); color: inherit; }
.sub-row:hover { background: var(--fill); }
.sub-row + .sub-row { border-top: 1px solid transparent; }
.sub-col { min-width: 0; }
/* 标题链接铺满整行,点哪里都进详情;行里的动作按钮浮在它上面 */
.sub-link { color: inherit; }
.sub-link:hover { text-decoration: none; }
.sub-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-control); }
.sub-link:focus-visible { outline: none; }
.sub-link:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; }
.sub-row .row-side .btn { position: relative; z-index: 1; margin-top: 6px; }
.sub-row .row-side .btn + .btn { margin-left: 6px; }
.sub-row .row-amount { white-space: nowrap; }
/* 需要注意的原因:只着色,不加底色 */
.row-flag-danger { color: var(--danger-text); }
.row-flag-warn { color: var(--warn-text); }
.row-flag-info { color: var(--info-text); }
.row-flag-neutral { color: var(--text-3); }

details.collapse > summary { cursor: pointer; list-style: none; color: var(--text-2); font-weight: 600; padding: 8px 4px; }
details.collapse > summary::-webkit-details-marker { display: none; }
/* 「已结束 2」「已归档的账号（1）」:带上和「更多设置」一样的三角,看得出点得开 */
details.collapse > summary::before { content: "▸"; display: inline-block; width: 1.2em; color: var(--text-3); }
details.collapse[open] > summary::before { content: "▾"; }

/* 添加订阅:上面四项够记一条,其余收在「更多设置」 */
details.more { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 14px 24px; }
details.more > summary::before { content: "▸"; display: inline-block; width: 1.2em; color: var(--text-3); }
details.more[open] > summary::before { content: "▾"; }
.more-body { display: flex; flex-direction: column; gap: 22px; padding: 8px 0 10px; }
.more-title { font-size: 14px; font-weight: 650; margin-bottom: 12px; }
.field > .btn-link { align-self: flex-start; }
.picker-compact { display: flex; flex-wrap: wrap; gap: 8px; }
.picker-compact .pick { padding: 5px 14px 5px 5px; border-radius: 999px; gap: 8px; }
.picker-compact .pick-name { font-size: 13px; }

/* ---------------------------------------------------------------- 账号页:平台 → 账号 → 扩展 */

/* 一个平台一张卡。卡头:图标、平台名(厂商名不同时跟一行小字)、右边的月均和「＋」;卡体是一个个账号块 */
.platform-card { display: flex; flex-direction: column; gap: 6px; }
.platform-head { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.platform-head h2 { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.platform-head .row-equiv { white-space: nowrap; }
.vendor { color: var(--text-3); font-size: 12px; font-weight: 500; letter-spacing: 0; }

/* 账号块之间一根发丝线;账号行本身是 .row-link,整行进账号详情。支付方式页的一个个支付方式也是这样的块 */
.account-block { padding: 10px 0; min-width: 0; }
.account-block + .account-block { border-top: 1px solid var(--line); }
.account-block > .row { padding-top: 0; padding-bottom: 6px; border-top: 0; }
/* 账号行:名字链接铺满整行(.sub-link),行尾的「补上邮箱」浮在上面 */
.account-row { position: relative; }
.account-row:hover { background: var(--fill); }
.account-row .row-side { position: relative; z-index: 1; }

/* 扩展:订阅、角色行、已结束,比账号行向右缩进,左边一条竖线 */
.ext { display: flex; flex-direction: column; margin-left: 12px; padding-left: 10px; border-left: 2px solid var(--rail); min-width: 0; }
.ext .sub-row { padding: 10px 8px; }

/* 角色行:「用它登录：ChatGPT · 工作号」「还没有订阅 · 添加」 */
.role-line { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 8px; border: 0; border-radius: var(--radius-control); background: none; color: var(--text-2); font: inherit; font-size: 13px; text-align: left; overflow-wrap: anywhere; }
a.role-line { cursor: pointer; }
a.role-line:hover { background: var(--fill); color: var(--text); text-decoration: none; }

/* 订阅详情标题上方的面包屑:「ChatGPT · 工作号 ›」 */
.crumb { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-bottom: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.crumb:hover { color: var(--text); text-decoration: none; }
.crumb .mono { width: 20px; height: 20px; border-radius: 6px; font-size: 10px; }

/* 选一个:表单里「这个订阅挂在哪个账号下」的几个账号加「新账号」 */
.choice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-chips button { height: 34px; max-width: 100%; padding: 0 14px; border: 0; border-radius: 999px; background: var(--fill); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice-chips button:hover { background: var(--fill-strong); }
.choice-chips button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 2px var(--accent); }

/* 就地改一项(「补上邮箱」):原地变成一个小输入框,回车保存,Esc 取消 */
.inline-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.inline-edit .input { flex: 1 1 14em; min-width: 0; min-height: 32px; padding: 6px 12px; }
.inline-edit .field-hint { flex-basis: 100%; }

/* 账号详情的红条:一句话,下面每条仍在扣费的订阅一行,行尾「取消续费」 */
.banner-danger .rows { margin-top: 8px; }
.banner-danger .row { padding: 8px 0; }
.banner-danger .row:first-child { padding-top: 0; }
.banner-danger .row-sub { color: inherit; opacity: 0.85; }
.banner-danger .btn { background: var(--surface); color: var(--danger-text); }

/* ---------------------------------------------------------------- 详情 */

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.status-card { position: relative; overflow: hidden; }
.status-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; row-gap: 6px; min-width: 0; }
/* 邮箱默认完整显示,又常常没有备注名:长邮箱在标题里折行,地区标签跟到下一行,不撑出横向滚动 */
.status-title h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; min-width: 0; overflow-wrap: anywhere; }
.status-line { margin-top: 14px; font-size: 16px; font-weight: 600; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 0; }
/* 不常用的操作:主按钮下面一行文字链接,不和主按钮抢;删除靠右 */
.status-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 14px 0 16px; font-size: 13px; }
.status-links .btn-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 500; }
.status-links .btn-link:hover { color: var(--text); }
.status-links .icon { width: 13px; height: 13px; }
.status-links .status-links-end { margin-left: auto; }
/* 为什么需要注意:每行一句话,最多一个就地处理的按钮 */
.attention-rows { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.attention-rows li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.attention-rows .grow { flex: 1 1 12em; min-width: 0; }
/* 补录、修改一期:不常用的几项收起来 */
details.fold > summary { cursor: pointer; list-style: none; color: var(--text-2); font-size: 13px; font-weight: 600; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; display: inline-block; width: 1.2em; color: var(--text-3); }
details.fold[open] > summary::before { content: "▾"; }
details.fold > .form-grid { margin-top: 14px; }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; margin: 0; }
.facts dt { color: var(--text-2); font-size: 13px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
/* 账号详情里即改即存的状态下拉:按内容宽,不撑满一行 */
.facts .select { width: auto; min-height: 36px; padding: 6px 12px; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; font-size: 13px; }
.timeline .when { color: var(--text-3); }

/* ---------------------------------------------------------------- 图表 */

.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; gap: 12px; height: 168px; padding-top: 24px; }
.bar { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; border: 0; background: none; padding: 0; cursor: default; }
.bar-fill { width: 100%; max-width: 40px; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); opacity: 0.85; }
.bar:hover .bar-fill, .bar:focus-visible .bar-fill { opacity: 1; }
/* 最高那根柱子上的金额浮在柱顶(.bars 的 padding-top 留了位置),不占柱子的高度 */
.bar-value { position: absolute; bottom: 100%; margin-bottom: 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.bar-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translate(-50%, 4px); opacity: 0; pointer-events: none; padding: 6px 10px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 12px; white-space: nowrap; transition: opacity .15s ease, transform .15s ease; z-index: 2; }
.bar:hover .bar-tip, .bar:focus-visible .bar-tip { opacity: 1; transform: translate(-50%, 0); }
/* 两头的柱子:提示贴着外侧对齐,不伸出图表 —— 透明时它也占地方,窄屏上会撑出横向滚动 */
.bar:first-child .bar-tip { left: 0; transform: translate(0, 4px); }
.bar:last-child .bar-tip { left: auto; right: 0; transform: translate(0, 4px); }
.bar:first-child:hover .bar-tip, .bar:first-child:focus-visible .bar-tip, .bar:last-child:hover .bar-tip, .bar:last-child:focus-visible .bar-tip { transform: translate(0, 0); }
.bar-axis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 8px; color: var(--text-3); font-size: 12px; text-align: center; border-top: 1px solid var(--line); padding-top: 8px; }
figure { margin: 0; }
details.table-view { margin-top: 12px; }
details.table-view > summary { cursor: pointer; color: var(--text-2); font-size: 13px; }

/* ---------------------------------------------------------------- 弹层与提示 */

dialog {
  border: 0; padding: 0; border-radius: 22px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: var(--backdrop); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-body h2 { font-size: 18px; font-weight: 650; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
/* 编辑弹窗左下角的「删除」:和「取消」「保存」隔开 */
.dialog-actions .grow { flex: 1; }
/* 对话框正文里的管理页按钮、站内链接、分段按钮按内容宽,不撑满一行 */
.dialog-body > .btn, .dialog-body > .btn-link, .dialog-body > .seg { align-self: flex-start; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop); }
.toast-danger { background: var(--danger-text); color: #FFFFFF; }
.toast button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; }

.empty { text-align: center; padding: 40px 16px; color: var(--text-2); }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }
.empty .page-actions { justify-content: center; }

.banner { padding: 12px 16px; border-radius: var(--radius-inner); margin-bottom: 16px; background: var(--info-bg); color: var(--info-text); }
.banner-danger { background: var(--danger-bg); color: var(--danger-text); }

/* ---------------------------------------------------------------- 登录与引导 */

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { justify-content: center; margin-bottom: 28px; padding: 0; }
.auth-title { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; text-align: center; }
.auth-lead { color: var(--text-2); text-align: center; margin-top: 8px; }
.auth-body { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-apple { background: var(--text); color: var(--bg); }
.btn-apple:hover { background: var(--text); filter: brightness(1.15); }
.badge-last { height: 20px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; }
.auth-error { text-align: center; font-size: 13px; color: var(--danger-text); }
.auth-foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--text-3); }
/* 登录页底部的语言下拉:和协议那行字一样小,不抢登录的注意力 */
.auth-lang { margin-top: 12px; display: flex; justify-content: center; }
.auth-lang .select { width: auto; min-height: 32px; padding: 4px 12px; font-size: 12px; color: var(--text-2); }

.onboard { max-width: 560px; margin: 0 auto; padding: 64px 16px; }
.onboard-title { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 28px; }
.onboard-note { margin: 20px 0; display: flex; flex-direction: column; gap: 4px; }
.onboard-note-actions { margin-top: 8px; }
.onboard-summary { font-size: 13px; }
.onboard-later:not([hidden]) { display: flex; flex-direction: column; gap: 16px; }

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

@media (max-width: 1100px) {
  .grid-main, .detail-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side { position: sticky; top: 0; z-index: 20; width: 100%; height: auto; padding: 12px 16px; gap: 10px; flex-direction: row; align-items: center; background: var(--bg); box-shadow: 0 1px 0 var(--line); overflow-x: auto; }
  .side .brand span:last-child { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav a { height: 36px; padding: 0 12px; white-space: nowrap; }
  .nav .count { display: none; }
  /* 顶栏放不下文字:身份只留头像,靠右;三个入口加头像,375px 宽不用横滑 */
  .side .brand { padding: 0; }
  .side-foot { margin: 0 0 0 auto; }
  .identity { padding: 0; }
  .identity-text, .identity-go { display: none; }
  .identity[aria-current="page"] { background: none; box-shadow: none; }
  .identity[aria-current="page"] .mono { box-shadow: 0 0 0 2px var(--accent); }
  .main { padding: 20px 16px 48px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .page-head h1 { font-size: 24px; }
  .search { min-width: 0; width: 100%; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  details.more { padding: 12px 16px; }
  .card { padding: 18px 16px; }
  .day-group { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  /* 总览:搜索和添加并成一行;三个数字收进一张卡排成三行,「需要注意」的前几条进首屏。
     不排三列:375px 宽时每列只剩约 77px,放不下「¥2,240.00」。"未计入…"那句照常显示。 */
  .page-actions:has(> .head-tools) { flex: 1 1 100%; }
  .head-tools { flex: 1; min-width: 0; }
  .head-tools .search { flex: 1; }
  .head-tools .btn { flex-shrink: 0; width: 40px; padding: 0; }
  .head-tools .btn-text { display: none; }
  .stats { gap: 0; background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
  .stats > .card { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px; padding: 12px 16px; background: none; box-shadow: none; border-radius: 0; }
  .stats > .card + .card { border-top: 1px solid var(--line); }
  .stats .stat-value { margin-top: 0; font-size: 20px; }
  .stats .stat-note:not(.faint) { display: none; }
  .stats .stat-note.faint { flex-basis: 100%; margin-top: 2px; }
  /* 两个按钮(逾期的"不续了""我已续费")竖着放,标题不被挤成一条 */
  .row-actions { flex-direction: column-reverse; align-items: flex-end; }
  .sub-row .row-side { display: flex; flex-direction: column; align-items: flex-end; }
  .sub-row .row-side .btn + .btn { margin-left: 0; }
  /* 平台卡头不折行:厂商小字在平台名下面换行,月均和「＋」留在右边 */
  .platform-head { flex-wrap: nowrap; }
  /* 订阅行(账号页、账号详情)不放头像,价格单独占右边一列,属于谁和怎么付最多两行:375px 宽时正文才放得下
     「Claude · testios2120@gmail.com」 */
  .ext { padding-left: 8px; }
  .ext .sub-row { padding: 10px 4px; }
  .sub-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .sub-row > .mono { display: none; }
  .ext .role-line { padding-left: 4px; padding-right: 4px; }
  .sub-row .sub-meta { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .facts dd { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.currency-input { flex: 0 0 auto; width: 104px; text-transform: uppercase; }
