:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #111827;
  background: #f3f4f6;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(160deg, #eef2ff 0%, #f8fafc 45%, #f3f4f6 100%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.shell { width: min(100%, 920px); margin: 0 auto; padding: 18px 14px 40px; }
.hidden { display: none !important; }
.card { background: rgba(255,255,255,.96); border: 1px solid rgba(229,231,235,.9); border-radius: var(--radius); padding: 18px; box-shadow: 0 10px 25px rgba(15,23,42,.06); }
.login-card { max-width: 430px; margin: 10vh auto 0; text-align: center; }
.brand-mark { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 8px; background:#111827; color:white; display:grid; place-items:center; font-weight:800; font-size:20px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 14px; }
.muted, .meta { color: #6b7280; font-size: 14px; }
.stack { display: grid; gap: 14px; text-align: left; }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #d1d5db; background: white; border-radius: 8px; padding: 12px 13px; outline: none; transition: .15s; }
textarea { resize: vertical; min-height: 140px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.primary { border: 0; border-radius: 8px; min-height: 48px; padding: 12px 18px; color: white; background: #111827; font-weight: 750; }
.primary:disabled { opacity:.55; cursor:not-allowed; }
.ghost { border: 1px solid #d1d5db; border-radius: 8px; background: white; padding: 9px 13px; }
.small { min-height: 38px; }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding: 8px 2px 16px; }
.tabs { display:grid; grid-template-columns: repeat(3,1fr); gap:8px; margin-bottom:14px; }
.tab { border:0; background:#e5e7eb; color:#4b5563; border-radius:8px; padding:11px 8px; font-weight:700; }
.tab.active { background:#111827; color:white; }
.panel { display:grid; gap:14px; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.check { display:flex; align-items:center; gap:10px; min-height:48px; padding-top:22px; }
.check input { width:20px; height:20px; }
.result { text-align:center; }
.result img { width:100%; max-height:70vh; object-fit:contain; border-radius:8px; background:#e5e7eb; }
.link-button { display:block; text-decoration:none; margin-top:12px; }
.loading { min-height:240px; display:grid; place-items:center; align-content:center; color:#6b7280; }
.spinner { width:34px; height:34px; border:4px solid #e5e7eb; border-top-color:#111827; border-radius:50%; animation:spin 1s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.gallery { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
.work { background:white; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; box-shadow:0 8px 22px rgba(15,23,42,.05); }
.work-error { border-color:#fecaca; }
.work img { width:100%; aspect-ratio:1/1; object-fit:cover; display:block; background:#e5e7eb; }
.work-placeholder { aspect-ratio:1/1; display:grid; place-items:center; background:#f9fafb; color:#991b1b; font-weight:750; }
.work-body { padding:10px; }
.work-prompt { font-size:13px; line-height:1.45; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.work-meta { color:#6b7280; font-size:12px; margin-top:7px; }
.retry-btn { width:100%; margin-top:10px; }
.empty { color:#6b7280; text-align:center; padding:60px 10px; }
.user-list { display:grid; gap:10px; }
.user-row { background:white; border:1px solid #e5e7eb; border-radius:8px; padding:14px; display:grid; gap:10px; }
.user-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.badge { display:inline-block; border-radius:999px; background:#eef2ff; color:#4338ca; font-size:12px; padding:4px 8px; }
.user-actions { display:grid; grid-template-columns: 1fr auto; gap:8px; }
.usage-table { display:grid; gap:0; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; }
.usage-row { display:grid; grid-template-columns:1.4fr .8fr .8fr .7fr; gap:8px; padding:10px; font-size:13px; border-top:1px solid #e5e7eb; align-items:center; }
.usage-row:first-child { border-top:0; }
.usage-head { background:#f9fafb; font-weight:750; color:#374151; }
.failure-list { display:grid; gap:10px; }
.failure-item { border:1px solid #fee2e2; background:#fff7f7; border-radius:8px; padding:10px; display:grid; gap:6px; font-size:13px; }
.compact { padding:18px 10px; }
.toast { position:fixed; z-index:20; left:50%; top:18px; transform:translateX(-50%); width:min(calc(100% - 28px),520px); background:#111827; color:white; padding:12px 14px; border-radius:8px; box-shadow:0 10px 30px rgba(0,0,0,.2); text-align:center; }
.toast.error { background:#991b1b; }
@media (min-width: 720px) {
  .shell { padding-top:28px; }
  .gallery { grid-template-columns:repeat(3,1fr); }
  .card { padding:22px; }
}
@media (max-width: 520px) {
  .grid2 { grid-template-columns:1fr; }
  .check { padding-top:0; }
  .tabs { grid-template-columns:repeat(3, minmax(0,1fr)); }
  .tab { font-size:13px; }
}
