:root {
  --bg: #eceff3;
  --bg-soft: #f6f7f9;
  --panel: #ffffff;
  --ink: #1a1f27;
  --muted: #6b7585;
  --line: rgba(26, 31, 39, 0.1);
  --accent: #c9971a;
  --accent-2: #e0b33a;
  --danger: #d64545;
  --ok: #1f9d63;
  --shadow: 0 10px 40px rgba(20, 28, 40, 0.08);
  --radius: 22px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
  --composer-h: 158px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}
button, select, textarea { font: inherit; }
a { color: inherit; }

/* ===== Auth (login / register) ===== */
.auth-page {
  min-height: 100vh;
  color: #f3efe6;
  background: #12151c;
}
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 18% -8%, rgba(201, 151, 26, 0.22), transparent 58%),
    radial-gradient(720px 480px at 92% 12%, rgba(62, 92, 120, 0.28), transparent 55%),
    linear-gradient(160deg, #161a22 0%, #10141b 48%, #0d1016 100%);
}
.auth-bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(243, 239, 230, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243, 239, 230, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}
.auth-bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: authFloat 12s ease-in-out infinite;
}
.auth-bg-glow-a {
  width: 280px;
  height: 280px;
  left: 8%;
  top: 18%;
  background: rgba(201, 151, 26, 0.18);
}
.auth-bg-glow-b {
  width: 340px;
  height: 340px;
  right: 4%;
  bottom: 8%;
  background: rgba(78, 110, 140, 0.2);
  animation-delay: -4s;
}
@keyframes authFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -18px, 0); }
}

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2.5rem 1.25rem;
}
.auth-stage {
  width: min(420px, 100%);
  display: grid;
  gap: 1.5rem;
}
.auth-brand {
  text-align: center;
}
.auth-brand-name {
  margin: 0 0 0.55rem;
  font-family: var(--display);
  font-size: clamp(2.8rem, 9vw, 3.8rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: #e8c45a;
  text-shadow: 0 2px 24px rgba(201, 151, 26, 0.25);
}
.auth-headline {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #f3efe6;
}
.auth-lead {
  margin: 0;
  color: #9aa3b0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth-card {
  background: rgba(18, 22, 30, 0.72);
  border: 1px solid rgba(243, 239, 230, 0.1);
  border-radius: 20px;
  padding: 1.35rem 1.35rem 1.15rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  animation: authRise 0.55s ease-out both;
}
@keyframes authRise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-form { display: grid; gap: 0.9rem; }
.auth-field {
  display: grid;
  gap: 0.4rem;
}
.auth-field > span {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #a8b0bc;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.auth-optional {
  font-size: 0.7rem;
  color: #6f7886;
  letter-spacing: 0;
  padding: 0.08rem 0.35rem;
  border: 1px solid rgba(243, 239, 230, 0.12);
  border-radius: 999px;
}
.auth-field input {
  width: 100%;
  border: 1px solid rgba(243, 239, 230, 0.12);
  border-radius: 12px;
  background: rgba(8, 11, 16, 0.72);
  color: #f3efe6;
  padding: 0.88rem 1rem;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.auth-field input::placeholder { color: #6f7886; }
.auth-field input:hover { border-color: rgba(232, 196, 90, 0.28); }
.auth-field input:focus {
  border-color: rgba(232, 196, 90, 0.55);
  background: rgba(10, 13, 18, 0.9);
}
/* 修浏览器自动填充把输入框刷成白底 */
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f3efe6;
  caret-color: #f3efe6;
  box-shadow: 0 0 0 1000px #12161e inset;
  transition: background-color 9999s ease-in-out 0s;
}

.auth-submit {
  appearance: none;
  border: 0;
  margin-top: 0.2rem;
  border-radius: 12px;
  padding: 0.92rem 1.2rem;
  background: linear-gradient(120deg, #e0b33a, #c9971a 55%, #a87d0f);
  color: #14110a;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.auth-submit:hover { filter: brightness(1.05); transform: translateY(-1px); }
.auth-submit:active { transform: translateY(0); }

.auth-error {
  margin: 0;
  color: #ff8b8b;
  font-size: 0.88rem;
  line-height: 1.4;
}
.auth-foot {
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem 0.7rem;
  color: #7d8794;
  font-size: 0.84rem;
}
.auth-foot a {
  color: #e8c45a;
  text-decoration: none;
  font-weight: 600;
}
.auth-foot a:hover { text-decoration: underline; }

/* legacy helpers still used elsewhere */
.shell {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 4.5rem 0 5rem;
}
.cta {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 0.85rem 1.4rem;
  background: linear-gradient(120deg, #d4a017, #b8860b);
  color: #111;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.error { color: #ff6b6b; font-size: 0.92rem; }
.login-foot { display: none; }

/* ===== Studio layout ===== */
.studio {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -120px, rgba(224, 179, 58, 0.16), transparent 60%),
    linear-gradient(180deg, #f4f6f8 0%, var(--bg) 40%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(246, 247, 249, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.studio .brand {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  color: #9a7410;
  line-height: 1;
  text-decoration: none;
}
.topbar-tag {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.ghost-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.86rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.ghost-btn:hover { color: var(--ink); border-color: rgba(26,31,39,0.22); }
.ghost-btn.nav-active {
  color: var(--ink);
  border-color: rgba(201, 151, 26, 0.45);
  background: #fff8e8;
  font-weight: 600;
}
.ghost-btn-sm {
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 8px;
}
.ghost-btn-danger:hover {
  color: var(--danger);
  border-color: rgba(214, 69, 69, 0.35);
}

.feed {
  width: min(1100px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.25rem 0 calc(var(--composer-h) + 2.5rem);
  min-height: calc(100vh - 64px);
}
.feed-empty {
  text-align: center;
  padding: 4.5rem 1rem 2rem;
  color: var(--muted);
}
.empty-title {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  color: var(--ink);
  font-weight: 600;
}
.empty-sub { margin: 0 auto; max-width: 28em; line-height: 1.5; font-size: 0.95rem; }

.day-group { margin-bottom: 1.75rem; }
.day-label {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.entry {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.05rem 1.15rem 1.1rem;
  margin-bottom: 1rem;
}
.entry.active {
  border-color: rgba(201, 151, 26, 0.45);
  box-shadow: 0 0 0 2px rgba(224, 179, 58, 0.18), var(--shadow);
}
.entry-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--ink);
}
.entry-meta {
  margin-top: 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.entry-media {
  margin-top: 0.9rem;
  width: min(280px, 58vw);
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--line);
}
.entry-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}
.entry-media.pending,
.entry-media.fail {
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  color: #c9d0da;
  font-size: 0.88rem;
  aspect-ratio: auto;
  min-height: 120px;
  width: min(420px, 100%);
}
.entry-media.fail { color: #ffb4b4; background: #2a1515; }
.entry-bar {
  width: 100%;
  max-width: 220px;
  height: 5px;
  margin-top: 0.7rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
}
.entry-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}
.entry-actions button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.entry-actions button:hover {
  border-color: rgba(26,31,39,0.22);
}
.entry-actions button.danger {
  color: var(--danger);
  border-color: rgba(214, 69, 69, 0.28);
  background: rgba(214, 69, 69, 0.06);
}
.entry-actions button.danger:hover {
  border-color: rgba(214, 69, 69, 0.5);
  background: rgba(214, 69, 69, 0.12);
}

.jump-bottom {
  position: fixed;
  right: 1.25rem;
  bottom: calc(var(--composer-h) + 1rem);
  z-index: 25;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 0.86rem;
}

.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 0.75rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(236,239,243,0.92) 28%, var(--bg));
}
.composer-inner {
  width: min(860px, 100%);
  margin: 0 auto;
}
.composer-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(20, 28, 40, 0.12);
  padding: 0.7rem 0.9rem 0.6rem;
}
.composer-box textarea {
  width: 100%;
  border: 0;
  resize: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1;
  min-height: 64px;
  max-height: 140px;
  padding: 0.25rem 0;
}
.composer-box textarea::placeholder { color: #9aa3b0; }
.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.35rem;
}
.pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  color: var(--ink);
  cursor: pointer;
}
.pill select {
  border: 0;
  background: transparent;
  outline: none;
  color: inherit;
  cursor: pointer;
  max-width: 7.5rem;
}
.pill.check input { accent-color: var(--accent); }
.pill.muted {
  color: var(--muted);
  cursor: default;
  background: transparent;
  border-color: transparent;
}
.send {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 0.55rem 0.55rem 1rem;
  background: linear-gradient(120deg, var(--accent), #a87d0f);
  color: #111;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(168, 125, 15, 0.28);
}
.send:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.send-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.35);
  font-size: 1rem;
  line-height: 1;
}
.composer-status {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0 0.35rem;
}
.composer-status.busy { color: #9a7410; }
.composer-status.err { color: var(--danger); }

.rewrite-review {
  width: min(700px, 100%);
  margin: 0.5rem auto 0;
  padding: 0.65rem 0.7rem;
  border: 1px solid rgba(201, 151, 26, 0.35);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(20, 28, 40, 0.12);
}
.rewrite-review[hidden] {
  display: none !important;
}
.rewrite-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}
.rewrite-review-head > div {
  display: grid;
  gap: 0.18rem;
}
.rewrite-review-head strong {
  font-size: 0.84rem;
}
.rewrite-review-head span {
  color: var(--muted);
  font-size: 0.72rem;
}
.rewrite-review textarea {
  width: 100%;
  min-height: 88px;
  max-height: 160px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  padding: 0.55rem 0.65rem;
  color: var(--ink);
  background: var(--bg-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}
.rewrite-review textarea:focus {
  border-color: rgba(201, 151, 26, 0.55);
}
.rewrite-review-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
}
.confirm-generate {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: linear-gradient(120deg, var(--accent), #a87d0f);
  color: #111;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.confirm-generate:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.studio.review-open {
  --composer-h: 365px;
}

/* Viewer */
.viewer {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(920px, calc(100vw - 1.5rem));
  width: 100%;
}
.viewer::backdrop {
  background: rgba(12, 16, 22, 0.55);
  backdrop-filter: blur(6px);
}
.viewer-panel {
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1rem;
}
.viewer-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.viewer-head h2 { margin: 0; font-size: 1.05rem; }
.viewer-meta { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.82rem; }
.viewer video {
  width: 100%;
  max-height: min(70vh, 720px);
  background: #000;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.viewer-script {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.5;
  max-height: 140px;
  overflow: auto;
}
.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

@media (max-width: 720px) {
  .entry-media { width: min(220px, 70vw); }
  .send-label { display: none; }
  .send { padding: 0.45rem; }
  .composer-bar { align-items: flex-end; }
  :root { --composer-h: 176px; }
  .studio.review-open { --composer-h: 400px; }
}

.account-page {
  width: min(1100px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
  display: grid;
  gap: 1rem;
}
.account-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 0.25rem;
}
.page-lead {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 40em;
}
.page-lead a {
  color: #9a7410;
  font-weight: 600;
  text-decoration: none;
}
.page-lead a:hover { text-decoration: underline; }
.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 110px));
  gap: 0.65rem;
}
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  box-shadow: var(--shadow);
}
.metric-card-warn {
  border-color: rgba(201, 151, 26, 0.4);
  background: #fffaf0;
}
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.2rem;
}
.metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 0;
}
.account-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem 1.25rem;
}
.account-card h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.card-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  max-width: 52em;
}
.card-sub a {
  color: #9a7410;
  font-weight: 600;
  text-decoration: none;
}
.card-sub a:hover { text-decoration: underline; }
.account-card .muted { color: var(--muted); font-size: 0.86rem; }
.account-card code,
.copyable {
  font-size: 0.82rem;
  background: var(--bg-soft);
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.copyable {
  cursor: pointer;
  border: 1px solid transparent;
}
.copyable:hover {
  border-color: rgba(201, 151, 26, 0.35);
  background: #fff8e8;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 0.85rem;
}
.stat-row strong { display: block; font-size: 1.15rem; }
.stat-row span { color: var(--muted); font-size: 0.78rem; }

/* Forms: label | input 对齐 */
.field {
  display: grid;
  gap: 0.35rem;
}
.field > span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: var(--bg-soft);
  color: var(--ink);
  outline: none;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: rgba(26, 31, 39, 0.18);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(201, 151, 26, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 151, 26, 0.12);
  background: #fff;
}
.apply-form,
.settings-form {
  display: grid;
  gap: 0.9rem;
  max-width: 520px;
}
.apply-form .field,
.settings-form .field,
.form-align .field {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem 1rem;
}
.apply-form .field > span,
.settings-form .field > span,
.form-align .field > span {
  text-align: right;
  line-height: 1.35;
}
.form-align {
  max-width: 520px;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-left: calc(7.5rem + 1rem);
  min-height: 2.6rem;
}
.cta-compact {
  width: auto;
  min-width: 120px;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
}
.empty-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0 0.15rem;
}
.table-wrap {
  overflow-x: auto;
  margin: 0 -0.15rem;
}
.table-wrap-spaced {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}
.col-actions { text-align: right; white-space: nowrap; }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--muted); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
}
.badge-ok {
  background: rgba(31, 157, 99, 0.1);
  border-color: rgba(31, 157, 99, 0.22);
  color: #167a4c;
}
.badge-warn {
  background: rgba(201, 151, 26, 0.12);
  border-color: rgba(201, 151, 26, 0.28);
  color: #8a6508;
}
.badge-danger {
  background: rgba(214, 69, 69, 0.1);
  border-color: rgba(214, 69, 69, 0.22);
  color: #b53636;
}
.ok-line { color: var(--ok); font-size: 0.9rem; }
.media-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-top: 0.5rem;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-top: 0.65rem;
}
.media-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-soft);
}
.media-item img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #ddd;
}
.media-item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.45rem 0.55rem 0.55rem;
  font-size: 0.78rem;
}
.voice-list {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.voice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}
.danger-text {
  color: var(--danger) !important;
}
.media-preview {
  min-height: 72px;
  display: flex;
  align-items: center;
}
.media-preview img {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.file-cta {
  display: inline-flex;
  cursor: pointer;
  margin: 0;
}
.ledger-card { overflow-x: auto; }
.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.ledger-head h2 { margin: 0; }
.bill-pos { color: var(--ok); font-weight: 600; }
.bill-neg { color: var(--danger); font-weight: 600; }
.users-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 1rem;
}
.users-search input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  background: var(--bg-soft);
  outline: none;
}
.users-search input[type="search"]:focus {
  border-color: rgba(201, 151, 26, 0.45);
}
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.user-actions .ghost-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  background: var(--bg-soft);
}
.data-table thead th:first-child { border-radius: 8px 0 0 8px; }
.data-table thead th:last-child { border-radius: 0 8px 8px 0; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: rgba(246, 247, 249, 0.65); }
.data-table .col-actions { text-align: right; }
@media (max-width: 820px) {
  .account-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; }
  .metric-strip { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .form-align .field,
  .apply-form .field,
  .settings-form .field {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .form-align .field > span,
  .apply-form .field > span,
  .settings-form .field > span { text-align: left; }
  .form-actions { padding-left: 0; justify-content: stretch; }
  .form-actions .cta { width: 100%; }
  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .topbar-right {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }
}
