/* Quotlet 网站：扁平风格。
   - 没有边框、阴影、卡片外框；分区靠留白和纯色色块
   - 全页只有一个重点：额度块（大号数字 + 粗进度条，底色是状态色的淡色）
   - 状态用实心色块：执行中绿、等待授权琥珀；已完成最常见，只是灰字
   - 深色底和 Mac app 面板同色（#1C1C1E）
   主题：跟随系统，或在右上角固定成浅色 / 深色（html[data-theme]）。 */
:root {
  --bg: #FFFFFF; --fill: #F3F4F6; --fill2: #E8E9EC; --hover: #F7F7F9;
  --fg: #1C1C1E; --fg2: #48484A; --muted: #6E6E73; --line: #EDEDF0;
  --ink: #1C1C1E; --inkfg: #FFFFFF;
  --green: #1E9E57; --green-ink: #137A42; --green-tint: #E8F6EE;
  --amber: #E8A300; --amber-ink: #835600; --amber-tint: #FDF4DE;
  --red: #E5484D; --red-ink: #C2272D; --red-tint: #FDECEC;
  --blue: #2563EB; --data: #C8643F; --data-strong: #9A4426;
  --track: rgba(28, 28, 30, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C1C1E; --fill: #2A2A2D; --fill2: #343438; --hover: #252528;
    --fg: #F5F5F7; --fg2: #C7C7CC; --muted: #98989D; --line: #2E2E31;
    --ink: #F5F5F7; --inkfg: #1C1C1E;
    --green: #32C46F; --green-ink: #4BD487; --green-tint: #1C3326;
    --amber: #F0B429; --amber-ink: #F5C451; --amber-tint: #3A3018;
    --red: #FF6B6B; --red-ink: #FF8A85; --red-tint: #3F2324;
    --blue: #5B9BFF; --data: #D67352; --data-strong: #F4A588;
    --track: rgba(245, 245, 247, .1);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1C1C1E; --fill: #2A2A2D; --fill2: #343438; --hover: #252528;
  --fg: #F5F5F7; --fg2: #C7C7CC; --muted: #98989D; --line: #2E2E31;
  --ink: #F5F5F7; --inkfg: #1C1C1E;
  --green: #32C46F; --green-ink: #4BD487; --green-tint: #1C3326;
  --amber: #F0B429; --amber-ink: #F5C451; --amber-tint: #3A3018;
  --red: #FF6B6B; --red-ink: #FF8A85; --red-tint: #3F2324;
  --blue: #5B9BFF; --data: #D67352; --data-strong: #F4A588;
  --track: rgba(245, 245, 247, .1);
  color-scheme: dark;
}

* { box-sizing: border-box }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--blue) }
button { font: inherit; color: inherit }
[hidden] { display: none !important }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px }
.num { font-variant-numeric: tabular-nums }
.sub { font-size: 13px; color: var(--fg2) }
.muted { color: var(--muted) }

/* ---------- 顶栏：白底，选中项是实心墨色 ---------- */
header { position: sticky; top: 0; z-index: 5; background: var(--bg) }
.bar { max-width: 1040px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px }
.left { display: flex; align-items: center; gap: 28px; min-width: 0 }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--fg); text-decoration: none; flex: none }
.brand img { width: 26px; height: 26px; border-radius: 7px }
nav { display: flex; gap: 4px }
nav a { padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--fg2); text-decoration: none; white-space: nowrap }
nav a:hover { background: var(--fill); color: var(--fg) }
nav a.on { background: var(--ink); color: var(--inkfg); font-weight: 600 }
.right { display: flex; align-items: center; gap: 12px; flex: none }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--fill) }
.seg button { width: 30px; height: 28px; border: none; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center }
.seg button:hover { color: var(--fg) }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--inkfg) }
.seg svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--fill2); color: var(--fg); display: grid; place-items: center; font-size: 13px; font-weight: 700; text-decoration: none }
.avatar:hover { background: var(--ink); color: var(--inkfg) }

main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 72px; display: flex; flex-direction: column; gap: 36px }
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.015em }
h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap }
.head .title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap }
section { display: flex; flex-direction: column; gap: 14px }
.plan { font-size: 13px; font-weight: 600; color: var(--fg2); padding: 3px 10px; border-radius: 999px; background: var(--fill) }

/* ---------- 额度块：全页的重点 ---------- */
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px }
.limit { border-radius: 20px; padding: 22px 24px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; background: var(--fill) }
.limit.l-ok { background: var(--green-tint) }
.limit.l-warn { background: var(--amber-tint) }
.limit.l-crit { background: var(--red-tint) }
.limit .label { font-size: 14px; font-weight: 600; color: var(--fg) }
.big { font-size: 56px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.035em }
.big small { font-size: .5em; font-weight: 600; letter-spacing: 0; margin-left: 2px }
.l-ok .big { color: var(--green-ink) } .l-warn .big { color: var(--amber-ink) } .l-crit .big { color: var(--red-ink) }
.meter { position: relative; height: 10px; border-radius: 999px; background: var(--track) }
.meter > .fill { height: 100%; border-radius: 999px; background: var(--fg) }
.l-ok .fill { background: var(--green) } .l-warn .fill { background: var(--amber) } .l-crit .fill { background: var(--red) }
.meter > .tick { position: absolute; top: -4px; width: 3px; height: 18px; margin-left: -1.5px; border-radius: 2px; background: var(--fg); opacity: .55 }
.reset { font-size: 13.5px; color: var(--fg2); display: flex; flex-wrap: wrap; gap: 2px 10px }
.reset b { color: var(--fg); font-weight: 600 }

.health { font-size: 13px; font-weight: 700; padding: 3px 11px; border-radius: 999px }
.h-ok { color: #FFFFFF; background: var(--green) }
.h-warn { color: #3D2A00; background: var(--amber) }
.h-crit { color: #FFFFFF; background: var(--red) }

/* 设备：一行状态条，不单独占一张卡片 */
.devices { display: flex; flex-wrap: wrap; gap: 8px }
.devchip { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 12px; border-radius: 999px; background: var(--fill); font-size: 13.5px; min-width: 0 }
.devchip b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.devchip .muted { white-space: nowrap }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none }
.dot.on { background: var(--green) }

/* ---------- 筛选 ---------- */
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px }
.chip { min-height: 32px; padding: 0 14px; border: none; border-radius: 999px; background: transparent; font-size: 13.5px; font-weight: 500; color: var(--fg2); cursor: pointer; white-space: nowrap }
.chip:hover { background: var(--fill); color: var(--fg) }
.chip.on { background: var(--fill2); color: var(--fg); font-weight: 600 }
.chip .n { margin-left: 6px; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--ink); color: var(--inkfg) }

/* ---------- 会话列表：没有外框，按天分组，整行可点 ---------- */
.list { display: flex; flex-direction: column; gap: 22px }
.group { display: flex; flex-direction: column; gap: 2px }
.day { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 14px 6px; font-size: 13px; color: var(--muted) }
.day b { font-size: 14px; color: var(--fg); font-weight: 700 }
.srow {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 4px 18px;
  padding: 12px 14px; border-radius: 14px; color: inherit; text-decoration: none;
}
.srow:hover { background: var(--hover) }
.srow.s-waiting { background: var(--amber-tint) }
.srow .t { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.srow .meta { display: flex; gap: 12px; font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap }
.srow .meta span { overflow: hidden; text-overflow: ellipsis }
.srow .meta .detail { color: var(--amber-ink); font-weight: 600 }
.srow .side { text-align: right; white-space: nowrap }
.srow .tok { font-size: 15px; font-weight: 700 }
.srow .when { font-size: 13px; color: var(--muted) }
@media (max-width: 640px) {
  .srow { grid-template-columns: minmax(0, 1fr) auto; padding: 12px }
  .srow .st { grid-column: 1; grid-row: 1; justify-self: start }
  .srow .main { grid-column: 1 / -1; grid-row: 2 }
  .srow .side { grid-column: 2; grid-row: 1; display: flex; gap: 10px; align-items: baseline }
  .day { padding: 0 12px 6px }
}

/* 状态：执行中、等待授权是实心色块；已完成只是灰字 */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; white-space: nowrap; color: var(--muted); justify-self: start }
.st-live, .st-warn { padding: 3px 10px 3px 8px; border-radius: 999px }
.st-live { background: var(--green); color: #FFFFFF }
.st-warn { background: var(--amber); color: #3D2A00 }
.st i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none }
.st-live i { animation: blink 1.6s ease-in-out infinite }
.st-warn i { border-radius: 1px; transform: rotate(45deg); width: 6px; height: 6px }
.st-done { font-weight: 600; color: var(--muted) }
.st-done i { width: 9px; height: 5px; border-radius: 0; background: none; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateY(-2px) rotate(-45deg) }
.st-quiet { font-weight: 600 }
.st-quiet i { background: none; border: 1.5px solid currentColor; box-sizing: border-box }
@keyframes blink { 50% { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .st-live i { animation: none } }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); background: var(--fill); border-radius: 16px }
.more { align-self: center }
.link { font-size: 14px; font-weight: 600; color: var(--fg); text-decoration: none; padding: 8px 16px; border-radius: 999px; background: var(--fill) }
.link:hover { background: var(--fill2) }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 18px;
  border-radius: 999px; border: none; background: var(--ink); color: var(--inkfg); font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn.secondary { background: var(--fill); color: var(--fg) }
.btn.secondary:hover { background: var(--fill2) }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13.5px }

/* ---------- 通用色块（详情、统计、设备） ---------- */
.card { background: var(--fill); border-radius: 18px; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0 }
.card .label { font-size: 14px; font-weight: 600; color: var(--fg) }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px }

.back { font-size: 13.5px; font-weight: 600; color: var(--fg2); text-decoration: none; align-self: flex-start; padding: 6px 12px 6px 10px; border-radius: 999px; background: var(--fill) }
.back:hover { color: var(--fg); background: var(--fill2) }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 28px; font-size: 14.5px; margin: 0 }
.kv dt { color: var(--muted) }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px }
.timeline li { display: grid; grid-template-columns: 96px 120px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px }
.timeline li:nth-child(odd) { background: var(--hover) }
.timeline .when { font-size: 13px; color: var(--muted) }
@media (max-width: 640px) { .timeline li { grid-template-columns: 80px 1fr } .timeline li .sub { grid-column: 2 } }

/* 统计 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px }
.tile .v { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; letter-spacing: -.02em }
.chart { position: relative }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible }
.chart .grid-line { stroke: var(--track); stroke-width: 1 }
.chart .axis { fill: var(--muted); font-size: 11px }
.chart .bar { fill: var(--data); pointer-events: none }
.chart .hit { fill: transparent; cursor: default }
.chart .bar.on { fill: var(--data-strong) }
.tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--inkfg);
  border-radius: 10px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transform: translate(-50%, -100%);
}
.share { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 6px 0 }
.share .meter { grid-column: 1 / -1; height: 6px }
.share .meter > .fill { background: var(--data) }
.share .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500 }
details summary { font-size: 13px; color: var(--fg2); cursor: pointer }
details table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px }
details th, details td { text-align: left; padding: 6px 8px }
details th { color: var(--muted); font-weight: 600 }
details tbody tr:nth-child(odd) { background: var(--bg) }

/* 设备页 */
.dev { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 }
.dev + .dev { border-top: 1px solid var(--line) }
.dev .name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere }
.online { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--muted) }
.online.on { color: var(--green-ink) }

/* ---------- 未登录 ---------- */
.landing { max-width: 440px; margin: 120px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 18px; align-items: flex-start }
.landing img { width: 64px; height: 64px; border-radius: 15px }
.landing h1 { font-size: 34px }
.landing p { margin: 0; color: var(--fg2); line-height: 1.6; font-size: 16px }

.notice { background: var(--fill); border-radius: 16px; padding: 16px 20px; color: var(--fg2) }

@media (max-width: 640px) {
  .big { font-size: 48px }
  /* 第一行 Logo + 主题 + 头像，第二行导航 */
  .bar { height: auto; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand right" "nav nav"; gap: 10px 12px; padding: 10px 16px }
  .left { display: contents }
  .brand { grid-area: brand }
  .right { grid-area: right }
  nav { grid-area: nav; overflow-x: auto }
  nav a { padding: 6px 13px }
  main { padding: 16px 16px 56px; gap: 28px }
  .limit { padding: 18px 18px 16px }
}
