/* ==========================================================================
   元气罐 Web 控制台 · 纯静态样式
   品牌：主色橙 #F97316 / 深橙 #EA580C，奶油底 #FFF8F0，墨色 #1C1917
   无外部字体、无外部图片、无构建步骤
   ========================================================================== */

/* ---------------------------------------------------------------- 设计变量 */
:root {
  --orange-300: #FDBA74;
  --orange-400: #FB923C;
  --orange-500: #F97316;
  --orange-600: #EA580C;
  --orange-700: #C2410C;
  --orange-50: #FFF3E4;
  --cream: #FFF8F0;
  --cream-deep: #FBEEDF;
  --ink: #1C1917;
  --ink-soft: #44403C;
  --muted: #78716C;
  --line: #EADFD3;
  --line-strong: #DCC9B4;
  --card: #FFFFFF;
  --success: #15803D;
  --success-soft: #DCFCE7;
  --warning: #B45309;
  --warning-soft: #FEF3C7;
  --danger: #B91C1C;
  --danger-soft: #FEE2E2;
  --ring: rgba(249, 115, 22, 0.42);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(28, 25, 23, 0.04), 0 18px 36px -26px rgba(120, 53, 15, 0.45);
  --shadow-pop: 0 24px 64px -18px rgba(28, 25, 23, 0.42);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --max-width: 1160px;
}

/* ---------------------------------------------------------------- 重置 / 基础 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(920px 520px at 10% -12%, rgba(249, 115, 22, 0.12), transparent 62%),
    radial-gradient(720px 420px at 102% -4%, rgba(234, 88, 12, 0.09), transparent 58%),
    linear-gradient(180deg, #fff8f0 0%, #fff8f0 58%, #fff3e6 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--orange-700);
  text-decoration-color: rgba(234, 88, 12, 0.45);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--orange-600);
}

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

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

[hidden] {
  display: none !important;
}

/* 焦点可见（键盘用户） */
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 8px;
}

::selection {
  background: rgba(249, 115, 22, 0.25);
}

/* ---------------------------------------------------------------- 工具类 */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

.hint {
  margin-top: 10px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}

.hint code {
  font-size: 0.86em;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--cream-deep);
  color: var(--ink-soft);
}

.hint-strong {
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid #FECACA;
  color: var(--danger);
  font-size: 0.88rem;
  line-height: 1.5;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------------------------------------------------------------- 跳转链接 */
.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: 2000;
  padding: 8px 14px;
  border-radius: 0 0 10px 10px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
  color: #fff;
}

/* ---------------------------------------------------------------- 顶栏 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(255, 248, 240, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 8px rgba(234, 88, 12, 0.22));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.14rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.brand-beta {
  padding: 2px 7px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transform: translateY(-1px);
}

.brand-tagline {
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

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

.header-did {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.header-quota {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(120, 113, 108, 0.15);
}

.health-pill[data-status="ok"] .health-dot {
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

.health-pill[data-status="warning"] .health-dot {
  background: #F59E0B;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.health-pill[data-status="danger"] .health-dot {
  background: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
}

.health-pill[data-status="warning"] {
  color: var(--warning);
  border-color: #FDE68A;
  background: #FFFBEB;
}

.health-pill[data-status="danger"] {
  color: var(--danger);
  border-color: #FECACA;
  background: #FEF2F2;
}

.health-pill[data-status="ok"] {
  color: var(--success);
  border-color: #BBF7D0;
  background: #F0FDF4;
}

/* ---------------------------------------------------------------- 主区域 */
.site-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 40px) 48px;
}

/* ---------------------------------------------------------------- 登录页 */
.login-view {
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 4vw, 34px);
}

.login-hero {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  padding-top: clamp(8px, 3vw, 28px);
}

.hero-logo {
  width: 88px;
  height: 88px;
  filter: drop-shadow(0 14px 22px rgba(234, 88, 12, 0.26));
  animation: jar-float 6.5s ease-in-out infinite;
}

.hero-title {
  margin-top: 12px;
  font-size: clamp(2rem, 5vw, 2.7rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.hero-tagline {
  margin-top: 10px;
  font-size: clamp(1.02rem, 2.4vw, 1.22rem);
  font-weight: 700;
  color: var(--orange-700);
}

.hero-beta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-desc {
  margin: 12px auto 0;
  max-width: 560px;
  font-size: 0.94rem;
  color: var(--muted);
}

.hero-desc-soft {
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--muted);
  opacity: 0.9;
}

.login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 20px;
  align-items: start;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 26px);
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.card-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease,
    box-shadow 0.16s ease, transform 0.08s ease;
  user-select: none;
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.84rem;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.btn-primary {
  background: var(--orange-600);
  border-color: var(--orange-600);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(234, 88, 12, 0.75);
}

.btn-primary:hover:not(:disabled) {
  background: var(--orange-700);
  border-color: var(--orange-700);
  color: #fff;
}

.btn-secondary {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--cream);
  border-color: var(--orange-400);
  color: var(--orange-700);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--cream-deep);
  color: var(--orange-700);
}

.btn-warning {
  background: var(--warning-soft);
  border-color: #FDE68A;
  color: #92400E;
}

.btn-warning:hover:not(:disabled) {
  background: #FDE68A;
  color: #78350F;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #991B1B;
  border-color: #991B1B;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--cream-deep);
  color: var(--ink);
}

/* ---------------------------------------------------------------- 表单 */
.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:hover {
  border-color: var(--orange-300);
}

.input:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.search-field {
  position: relative;
  display: block;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 230px;
  padding-left: 34px;
}

/* ---------------------------------------------------------------- 登录表单卡片 */
.login-card .card-title {
  margin-bottom: 18px;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-actions .hint {
  margin-top: -2px;
}

.saved-identity {
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fffdfa, var(--cream));
}

.identity-did {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
  word-break: break-all;
}

.saved-identity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.login-status {
  min-height: 1.4em;
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--orange-700);
}

/* ---------------------------------------------------------------- 登录页特性 */
.feature-card {
  background: linear-gradient(180deg, #fffdfa 0%, #fff7ee 100%);
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 6px;
}

.feature-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.feature-num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--orange-50);
  border: 1px solid #FDBA74;
  color: var(--orange-700);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
}

.feature-list h3 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
}

.feature-list p {
  margin-top: 3px;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.55;
}

.feature-foot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------- 控制台 */
.console-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.9rem;
  line-height: 1.5;
}

.banner strong {
  font-weight: 800;
}

.banner-warning {
  background: var(--warning-soft);
  border-color: #FDE68A;
  color: #92400E;
}

.banner-danger {
  background: var(--danger-soft);
  border-color: #FECACA;
  color: #991B1B;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 18px;
}

.identity-card .identity-did {
  margin-bottom: 4px;
}

.dev-badge.badge {
  margin-bottom: 2px;
}

.header-dev-badge {
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-warning {
  background: var(--warning-soft);
  border: 1px solid #FDE68A;
  color: #92400E;
}

.badge-beta {
  background: var(--orange-50);
  border: 1px solid #FDBA74;
  color: var(--orange-700);
}

/* 我的罐（测试版：容量 / 用量 / 文件数） */
.jar-card {
  background: linear-gradient(180deg, #fffdfa 0%, #fff8f0 100%);
}

.jar-card-head {
  align-items: flex-start;
}

.jar-card-sub {
  margin-top: 4px;
  font-size: 0.82rem;
}

.jar-level-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 14px;
}

.jar-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff3e4, #ffe4c4);
  border: 1px solid #fdba74;
  color: var(--orange-700);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.4;
  word-break: break-word;
}

.jar-capacity {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 2px;
}

.jar-capacity .muted {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.jar-capacity strong {
  font-size: 1.42rem;
  font-weight: 900;
  color: var(--ink);
}

.plan-note {
  display: inline-block;
  max-width: 100%;
  margin: 10px 0 2px;
  padding: 5px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.76rem;
  color: var(--muted);
  word-break: break-word;
}

.jar-usage {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

/* 容量进度 */
.quota-numbers {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 0;
}

.quota-numbers strong {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.quota-numbers .muted {
  font-size: 0.86rem;
}

.quota-bar {
  position: relative;
  height: 12px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--cream-deep);
  border: 1px solid var(--line);
  overflow: hidden;
}

.quota-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange-400), var(--orange-600));
  transition: width 0.45s ease;
}

.jar-card.is-warning .quota-fill {
  background: linear-gradient(90deg, #f59e0b, #dc2626);
}

.jar-card.is-warning .quota-numbers strong {
  color: var(--danger);
}

/* 上传 */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: clamp(22px, 4vw, 34px) 18px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 249, 242, 0.92));
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.drop-zone.is-dragover {
  border-color: var(--orange-500);
  background: linear-gradient(180deg, #fff7ed, #ffedd5);
  box-shadow: inset 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.drop-icon {
  width: 34px;
  height: 34px;
  color: var(--orange-600);
}

.drop-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.drop-hint {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 460px;
}

.upload-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.upload-empty {
  margin-top: 14px;
  font-size: 0.84rem;
}

.upload-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fffdfa;
}

.upload-item[data-status="error"] {
  border-color: #FECACA;
  background: #fffafa;
}

.upload-item[data-status="done"] {
  border-color: #BBF7D0;
  background: #f7fef9;
}

.upload-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.upload-name {
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-meta {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--muted);
}

.upload-progress {
  height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--cream-deep);
  border: 1px solid var(--line);
  overflow: hidden;
}

.upload-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange-400), var(--orange-600));
  transition: width 0.2s ease;
}

.upload-item[data-status="done"] .upload-progress-fill {
  background: linear-gradient(90deg, #4ADE80, #16A34A);
}

.upload-item[data-status="error"] .upload-progress-fill {
  background: linear-gradient(90deg, #F87171, #DC2626);
}

.upload-status {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.upload-status.is-error {
  color: var(--danger);
}

.upload-status.is-success {
  color: var(--success);
}

.upload-cid {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.upload-cid code {
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.upload-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* ---------------------------------------------------------------- 文件表格卡片 */
.files-card {
  min-width: 0;
}

.files-head {
  align-items: center;
  flex-wrap: wrap;
}

.files-head .muted {
  margin-top: 4px;
  font-size: 0.84rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.files-table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.files-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.files-table tbody tr {
  transition: background-color 0.14s ease;
}

.files-table tbody tr:hover {
  background: #fffaf3;
}

.files-table tbody tr:last-child td {
  border-bottom: none;
}

.file-name {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: var(--ink);
}

.file-size,
.file-time {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.cid-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.5;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background-color 0.14s ease;
}

.cid-chip:hover {
  border-color: var(--orange-400);
  background: #fff7ed;
  color: var(--orange-700);
}

.replica-badges {
  display: inline-flex;
  gap: 5px;
}

.replica-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--orange-50);
  border: 1px solid #FDBA74;
  color: var(--orange-700);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.row-action {
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.row-action:hover {
  background: var(--cream-deep);
  color: var(--orange-700);
}

.row-action.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: clamp(30px, 6vw, 52px) 16px;
  text-align: center;
}

.empty-logo {
  width: 58px;
  height: 58px;
  opacity: 0.6;
  margin-bottom: 4px;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 800;
}

.empty-state p {
  max-width: 380px;
  font-size: 0.86rem;
}

/* ---------------------------------------------------------------- 对话框 */
.dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  height: fit-content;
  padding: clamp(18px, 3vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-pop);
  overflow-y: auto;
}

.dialog::backdrop {
  background: rgba(28, 25, 23, 0.46);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dialog-title {
  font-size: 1.08rem;
  font-weight: 800;
}

.dialog-file {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.84rem;
  word-break: break-all;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.dialog-actions .btn {
  min-width: 96px;
}

.copy-row {
  display: flex;
  gap: 8px;
}

.copy-row .input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.share-result {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
}

.share-result .field-label {
  margin-bottom: 8px;
}

.share-result .muted {
  margin-top: 10px;
  font-size: 0.82rem;
}

.verify-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.verify-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffdfa;
  font-size: 0.88rem;
}

.verify-item[data-status="ok"] {
  border-color: #BBF7D0;
  background: #f7fef9;
}

.verify-item[data-status="bad"] {
  border-color: #FECACA;
  background: #fffafa;
}

.verify-node {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--orange-50);
  border: 1px solid #FDBA74;
  color: var(--orange-700);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.verify-detail {
  flex: 1;
  min-width: 0;
  color: var(--ink-soft);
}

.verify-flag {
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.verify-item[data-status="ok"] .verify-flag {
  background: var(--success-soft);
  color: var(--success);
}

.verify-item[data-status="bad"] .verify-flag {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------------------------------------------------------------- Toast */
.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 0.86rem;
  line-height: 1.5;
  box-shadow: 0 14px 30px -14px rgba(28, 25, 23, 0.6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: #166534;
}

.toast-error {
  background: #991B1B;
}

.toast-info {
  background: var(--ink);
}

/* ---------------------------------------------------------------- 页脚 */
.site-footer {
  flex: 0 0 auto;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 40px) 30px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.site-footer p + p {
  margin-top: 3px;
}

.site-footer .muted {
  font-size: 0.76rem;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--cream);
  font-weight: 700;
  text-align: center;
}

/* ---------------------------------------------------------------- 动画 */
@keyframes jar-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 900px) {
  .login-grid {
    grid-template-columns: 1fr;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-header {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .header-actions {
    gap: 8px;
  }

  .header-did {
    max-width: 140px;
  }

  .header-quota {
    display: none;
  }

  .files-head {
    align-items: stretch;
  }

  .card-tools {
    width: 100%;
  }

  .search-field {
    flex: 1;
    min-width: 0;
  }

  .search-input {
    width: 100%;
  }

  /* 窄屏把表格折叠为卡片列表 */
  .files-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .files-table,
  .files-table tbody,
  .files-table tr,
  .files-table td {
    display: block;
    width: 100%;
  }

  .files-table tr {
    margin-bottom: 10px;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fffdfa;
  }

  .files-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    text-align: right;
  }

  .files-table td:last-child {
    border-bottom: none;
  }

  .files-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: left;
    padding-top: 2px;
  }

  .files-table td[data-label="名称"] {
    align-items: center;
  }

  .file-name {
    max-width: none;
    text-align: right;
    word-break: break-all;
    white-space: normal;
  }

  .files-table td[data-label="CID"] {
    align-items: center;
  }

  .files-table td[data-label="操作"] {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
  }

  .files-table td[data-label="操作"] .row-actions {
    justify-content: flex-start;
  }

  .files-table td[data-label="操作"]::before {
    padding-top: 0;
  }

  .row-action {
    padding: 6px 10px;
    background: var(--cream);
    border-color: var(--line);
  }
}

@media (max-width: 520px) {
  .brand-tagline {
    display: none;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .health-pill {
    padding: 4px 9px;
    font-size: 0.74rem;
  }

  .header-did {
    display: none;
  }

  .jar-card-head {
    align-items: center;
  }

  .hero-logo {
    width: 72px;
    height: 72px;
  }

  .toast-container {
    right: 50%;
    transform: translateX(50%);
    bottom: 14px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .btn {
    width: 100%;
  }

  .copy-row {
    flex-direction: column;
  }

  .copy-row .btn {
    width: 100%;
  }
}

/* 极窄屏 ≥360px 仍可用 */
@media (max-width: 400px) {
  body {
    font-size: 15px;
  }

  .btn {
    padding: 9px 14px;
  }

  .card {
    padding: 16px;
  }

  .drop-zone {
    padding: 20px 12px;
  }

  .upload-row {
    flex-direction: column;
    gap: 2px;
  }

  .upload-meta {
    flex: initial;
  }
}

/* 尊重系统减少动效设置 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
