/* InSnap 账号门户（/account/*）：应用式外壳——顶栏 + 左侧栏 + 主区；浅色为主，跟随系统深色。
   只服务登录后的管理页面，与营销站（site.css）互不依赖。 */
:root {
  color-scheme: light dark;
  --bg: #f4f5f9;
  --panel: #ffffff;
  --text: #171a23;
  --muted: #6a7080;
  --line: #e4e7ef;
  --soft: #eef1f8;
  --accent: #2f7bff;
  --accent-ink: #ffffff;
  --danger: #e5484d;
  --ok: #17a34a;
  --warn: #b7791f;
  --shadow: 0 1px 2px rgba(20, 24, 40, 0.06), 0 8px 24px -12px rgba(20, 24, 40, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f15;
    --panel: #151823;
    --text: #eceef5;
    --muted: #8d93a6;
    --line: #262a38;
    --soft: #1d2130;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -12px rgba(0, 0, 0, 0.6);
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 24px; letter-spacing: -0.02em; line-height: 1.2; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
h4 { font-size: 14px; font-weight: 650; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.ap-muted { color: var(--muted); font-size: 14px; }
.ap-grow { flex: 1; }
.ap-mono { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.ap-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ===== 顶栏 ===== */
.ap-root { min-height: 100vh; display: flex; flex-direction: column; }
.ap-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ap-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.ap-brand img { width: 30px; height: 30px; border-radius: 8px; }
.ap-brand em { font-style: normal; font-weight: 500; color: var(--muted); }
.ap-user-wrap { position: relative; }
.ap-user { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 6px; background: none; border: 0; border-radius: 10px; cursor: pointer; font-weight: 600; }
.ap-user:hover { background: var(--soft); }
.ap-user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-pop { position: absolute; right: 0; top: 46px; min-width: 230px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.ap-pop-head { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ap-pop-head span { overflow: hidden; text-overflow: ellipsis; }
.ap-pop a, .ap-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; color: var(--text); text-align: left; cursor: pointer; }
.ap-pop a:hover, .ap-pop button:hover { background: var(--soft); }

.ap-avatar { display: grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.ap-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ap-avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.ap-avatar.xl { width: 96px; height: 96px; font-size: 38px; }

/* ===== 侧栏 + 主区 ===== */
.ap-body { flex: 1; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.ap-side { position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); display: flex; flex-direction: column; gap: 2px; padding: 20px 14px; border-right: 1px solid var(--line); background: var(--panel); }
.ap-nav-i { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 550; }
.ap-nav-i:hover { background: var(--soft); }
.ap-nav-i[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.ap-count { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 1px 8px; }
.ap-count:empty { display: none; }
.ap-side-h { margin: 22px 12px 6px; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.ap-side-meter { display: grid; gap: 8px; padding: 14px 12px 0; border-top: 1px solid var(--line); }
.ap-main { min-width: 0; padding: 28px 36px 80px; }
.ap-center { width: 100%; max-width: 480px; margin: 0 auto; padding: 56px 20px 80px; }
.ap-center-text { text-align: center; margin-bottom: 14px; }
.ap-center-row { display: flex; justify-content: center; margin-top: 24px; }

.ap-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 22px; }
.ap-sortline { display: inline-flex; margin-top: 6px; }

/* ===== 控件 ===== */
.ap-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; }
.ap-btn:hover { background: var(--soft); }
.ap-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ap-btn.primary:hover { filter: brightness(1.08); }
.ap-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.ap-btn.small { height: 32px; padding: 0 12px; font-size: 13.5px; }
.ap-btn.block { width: 100%; }
.ap-btn:disabled { opacity: 0.55; cursor: default; }
.ap-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }
.ap-input, .ap-select { height: 40px; width: 100%; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.ap-input:focus, .ap-select:focus, .ap-search:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.ap-select { width: auto; height: 32px; padding: 0 8px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; }
.ap-searchbox { display: flex; align-items: center; gap: 8px; width: min(420px, 100%); height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--muted); }
.ap-searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.ap-search { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); height: 100%; }
.ap-code { text-align: center; letter-spacing: 0.3em; font-family: var(--mono); font-size: 20px; }
.ap-form { display: grid; gap: 14px; }
.ap-label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.ap-row { display: flex; gap: 10px; }
.ap-row > .ap-input, .ap-row > .ap-select { flex: 1; min-width: 0; }
.ap-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.ap-actions.left { justify-content: flex-start; }
.ap-actions.tight { margin: 0; flex: none; }
.ap-readonly { height: 40px; display: flex; align-items: center; padding: 0 12px; border-radius: 10px; background: var(--soft); color: var(--text); font-weight: 500; word-break: break-all; }
.ap-ib { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.ap-ib:hover { background: var(--soft); color: var(--text); }
.ap-ib.danger { color: var(--danger); }
.ap-ib.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ===== 卡片 / 提示 ===== */
.ap-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.ap-card + .ap-card, .ap-stack > * + *, .ap-stack + .ap-card, .ap-card + .ap-stack { margin-top: 16px; }
.ap-card h3 + p, .ap-card p + p { margin-top: 6px; }
.ap-card-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.ap-note { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); font-size: 14px; }
.ap-note.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.ap-note.bad { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.ap-note.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.ap-msg:empty { display: none; }
.ap-msg { margin-top: 12px; }
.ap-badge { flex: none; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); letter-spacing: 0.02em; }
.ap-badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.ap-badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.ap-badge.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.ap-chip { display: inline-block; margin-top: 8px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.ap-meter { height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.ap-meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.ap-meter.hot i { background: var(--warn); }
.ap-meter.big { height: 10px; }
.ap-usage { display: grid; gap: 10px; margin-top: 20px; }
.ap-empty { grid-column: 1 / -1; display: grid; gap: 10px; justify-items: start; }
.ap-gate { margin-bottom: 18px; }
.ap-gatecard { display: flex; gap: 18px; align-items: center; justify-content: space-between; }

/* ===== 媒体网格 ===== */
.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.ap-media { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s; }
.ap-media:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.ap-thumb { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 0; border-radius: 9px; overflow: hidden; background: var(--soft); cursor: zoom-in; }
.ap-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ap-ext { font: 700 12px/1 var(--mono); letter-spacing: 0.08em; color: var(--muted); }
.ap-play { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; }
.ap-play .ap-i { fill: currentColor; stroke: none; width: 22px; height: 22px; margin-left: 3px; }
.ap-ext { position: absolute; left: 10px; bottom: 8px; }
.ap-media-body { padding: 12px 4px 4px; }
.ap-media-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-media-foot { display: flex; align-items: center; gap: 2px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.ap-views { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; color: var(--muted); font-size: 13px; }
.ap-views .ap-i { width: 16px; height: 16px; }

/* ===== 弹窗 / 预览 / 提示条 ===== */
.ap-dialog { width: min(420px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.ap-dialog.wide { width: min(560px, calc(100vw - 32px)); }
.ap-dialog::backdrop, .ap-viewer::backdrop { background: rgba(10, 12, 20, 0.55); }
.ap-dialog h3 { font-size: 18px; }
.ap-dialog > p { margin-top: 8px; }
.ap-dlg-head { display: flex; align-items: center; justify-content: space-between; }
.ap-links { display: grid; gap: 8px; margin: 14px 0 18px; }
.ap-link-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.ap-link-row.off { opacity: 0.55; }
.ap-link-meta { display: grid; min-width: 0; gap: 2px; }
.ap-viewer { width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 16px; background: var(--panel); color: var(--text); overflow: hidden; }
.ap-viewer-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.ap-stage { display: grid; place-items: center; padding: 16px; min-height: 240px; background: var(--bg); }
.ap-stage img, .ap-stage video { max-width: 100%; max-height: calc(100vh - 140px); border-radius: 8px; }
.ap-toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 10px; background: #1b1e2a; color: #fff; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); transition: opacity 0.18s, transform 0.18s; }
.ap-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ===== 资料 / 许可证 / 登录 / 确认 ===== */
.ap-profile { display: flex; gap: 26px; align-items: flex-start; }
.ap-profile-body { flex: 1; min-width: 0; display: grid; gap: 16px; }
.ap-profile-body .ap-row { max-width: 420px; }
.ap-sub { display: flex; justify-content: space-between; align-items: baseline; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.ap-row-item { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ap-row-item:last-child { border-bottom: 0; }
.ap-login { margin-top: 24px; }
.ap-login h1 { font-size: 22px; }
.ap-login > p { margin-top: 8px; }
.ap-google { margin-top: 20px; }
.ap-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.ap-or::before, .ap-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.ap-connect h1 { font-size: 22px; }
.ap-facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 20px 0 0; }
.ap-facts dt { color: var(--muted); font-size: 14px; }
.ap-facts dd { margin: 0; font-weight: 600; }
.ap-big { font-size: 22px; letter-spacing: 0.12em; }

/* ===== 加载画面 ===== */
.ap-splash { display: grid; justify-items: center; gap: 16px; padding: 18vh 20px 12vh; text-align: center; }
.ap-splash img { width: 56px; height: 56px; border-radius: 14px; }
.ap-splash-t { font: 650 20px/1.2 var(--font); letter-spacing: -0.02em; }
.ap-spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: ap-rot 0.8s linear infinite; }
@keyframes ap-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ap-spin { animation-duration: 3s; } .ap-media { transition: none; } }
html:not(.js) .ap-splash { display: none; }

/* ===== 窄屏：侧栏变成顶部横条 ===== */
@media (max-width: 860px) {
  .ap-body { grid-template-columns: 1fr; }
  .ap-side { position: static; height: auto; flex-direction: row; gap: 4px; padding: 8px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .ap-side-h, .ap-side-meter, .ap-side > .ap-grow { display: none; }
  .ap-nav-i { white-space: nowrap; padding: 8px 12px; }
  .ap-main { padding: 20px 16px 64px; }
  .ap-profile { flex-direction: column; }
  .ap-gatecard { flex-direction: column; align-items: flex-start; }
  .ap-user-name { display: none; }
}
