/* 3dmtoglb · Graphite Studio */
:root {
  --bg: #0E0F11;
  --panel: #131518;
  --card: #16181C;
  --card-hi: #1B1E22;
  --line: #23262B;
  --line-2: #2B2F35;
  --line-3: #3A3F46;
  --text: #ECEDEE;
  --text-2: #C9CDD2;
  --muted: #9BA1A9;
  --accent: #6FE3D3;
  --accent-bg: #12302C;
  --accent-tint: #18201F;
  --ok-bg: #173A2C; --ok: #7FE0B0;
  --warn-bg: #3D2F12; --warn: #F2C46D; --warn-text: #F6D79A;
  --err-bg: #3E1A1C; --err: #F2A0A0;
  --info-bg: #1B2733; --info: #B9D3EC;
  --flag: #E5534B;
  --point: #FAB733;
  --radius: 10px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --stage-studio: radial-gradient(circle at 50% 45%, #2A2E34 0%, #121417 70%);
  --stage-dark: #0B0C0E;
  --stage-soft: radial-gradient(circle at 50% 40%, #3A3F46 0%, #1A1C20 75%);
}
/* 3dmtostl: same studio, warm accent */
[data-brand="stl"] { --accent: #FF9E64; --accent-bg: #3A2416; --accent-tint: #221A15; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--text-2); }
a:hover { color: #fff; }
.mono { font-family: var(--mono); }
.accent { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--accent); color: var(--bg); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- header / footer ---------- */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 28px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { color: var(--accent); }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 6px; }
.site-nav { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.site-nav a { text-decoration: none; }
.nav-note { color: var(--muted); }
.site-footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-links { display: flex; gap: 18px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); font: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--card-hi); color: var(--text); border-color: var(--line-3); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }
.btn-primary:hover { background: #8BEADD; color: var(--bg); border-color: #8BEADD; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--err); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; border-radius: 10px; font-size: 15px; }
.btn-icon { width: 38px; padding: 0; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- app layout ---------- */
.app { display: flex; flex-wrap: wrap; min-height: min(860px, calc(100vh - 60px)); border-bottom: 1px solid var(--line); }
.panel { flex: 1 1 340px; max-width: 400px; min-width: 300px; border-right: 1px solid var(--line); background: var(--panel); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.intro h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.015em; }
.intro p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px; border: 1.5px dashed var(--line-3); border-radius: 12px; background: var(--card); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-tint); }
.drop-title { font-weight: 600; }
.drop-sub { color: var(--muted); font-size: 12.5px; }
.privacy-note { margin: -8px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

.options { display: flex; flex-direction: column; gap: 10px; }
.seg { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg a { flex: 1; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 500; }
.seg a:hover { color: var(--text); background: var(--card); }
.seg a[aria-current="page"] { background: var(--line); color: var(--text); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.check.disabled { opacity: .55; cursor: not-allowed; }

.files { display: flex; flex-direction: column; gap: 6px; flex-grow: 1; min-height: 0; }
.files-head { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow: auto; max-height: 420px; }
.file { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; padding: 10px 34px 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.file:hover { border-color: var(--line-3); }
.file[aria-current="true"] { border-color: var(--accent); background: var(--card-hi); }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { grid-column: 1 / -1; font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-x { position: absolute; right: 6px; top: 8px; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.file-x:hover { background: var(--line); color: var(--text); }
.file-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); transition: width .2s; }
.file-bar.indeterminate { width: 30% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { left: -30%; } 100% { left: 100%; } }
.pill { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; white-space: nowrap; align-self: start; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.busy { background: var(--line); color: var(--text-2); }
.files-foot { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- stage ---------- */
.stage { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.stage-title { min-width: 0; }
.stage-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-meta { font-size: 12px; color: var(--muted); }
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.viewport { position: relative; flex-grow: 1; min-height: 520px; display: flex; align-items: center; justify-content: center; background: var(--stage-studio); }
.viewport[data-light="dark"] { background: var(--stage-dark); }
.viewport[data-light="soft"] { background: var(--stage-soft); }
.viewport model-viewer { position: absolute; inset: 0; width: 100%; height: 100%; --poster-color: transparent; background: transparent; }
.empty { text-align: center; padding: 24px; color: var(--muted); pointer-events: none; }
.empty-art { opacity: .5; }
.empty-title { margin: 14px 0 2px; color: var(--text-2); font-weight: 600; font-size: 16px; }
.empty-sub { margin: 0; }
.chip { position: absolute; top: 16px; left: 16px; z-index: 2; display: flex; gap: 10px; align-items: center; padding: 7px 12px; border-radius: 99px; background: rgba(22,24,28,0.92); border: 1px solid var(--line-2); font-size: 12.5px; max-width: calc(100% - 32px); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.chip.kept .dot { background: var(--muted); }
.loading { position: absolute; z-index: 2; display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-radius: 99px; background: rgba(22,24,28,0.92); border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.state-card { position: relative; z-index: 2; max-width: 460px; margin: 24px; padding: 22px; border-radius: 14px; background: rgba(19,21,24,0.96); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 12px; }
.state-card h2 { margin: 0; font-size: 18px; }
.state-card p { margin: 0; color: var(--text-2); }
.state-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.note { display: flex; gap: 10px; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; }
.note svg { flex-shrink: 0; margin-top: 2px; }
.note.review { background: var(--warn-bg); color: var(--warn-text); }
.note.error { background: var(--err-bg); color: var(--err); }
.note.info { background: var(--info-bg); color: var(--info); }

.looks { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); background: rgba(14,15,17,0.6); }
.look-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.look-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.swatch { display: inline-flex; gap: 7px; align-items: center; height: 32px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
.swatch.plain { border-radius: 8px; }
.swatch[aria-pressed="true"] { border-color: var(--accent); }
.sw { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.sw.gem { width: 11px; height: 11px; border-radius: 1px; transform: rotate(45deg); }
.sw-file { background: conic-gradient(#D9DCDF 0 25%, #E8C46A 0 50%, #E7A88F 0 75%, #EAF4FF 0); }
.look-note { font-size: 12px; color: var(--muted); margin-left: auto; }
/* STL print check, under the preview */
.print-check { display: flex; flex-wrap: wrap; gap: 10px 28px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--panel); font-size: 13px; }
.print-check .pc-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.print-check .pc-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.print-check .pc-val { color: var(--text); font-family: var(--mono); font-size: 12.5px; }
.print-check .pc-status { display: flex; gap: 8px; align-items: flex-start; }
.print-check .pc-status svg { flex-shrink: 0; margin-top: 2px; }
.print-check .ok { color: var(--ok); } .print-check .warn { color: var(--warn); }
.print-check .weights { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.print-check .weights span b { font-weight: 500; color: var(--muted); font-family: var(--font); margin-right: 5px; }
.print-check .pc-note { flex-basis: 100%; font-size: 12px; color: var(--muted); }

/* ---------- review dialog ---------- */
dialog.review { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--text); }
dialog.review[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.review-head-left, .review-head-right { display: flex; align-items: center; gap: 16px; }
.review-head-right { gap: 8px; }
.review-name { font-weight: 600; font-size: 15px; }
.review-body { display: flex; flex-wrap: wrap; flex-grow: 1; min-height: 0; }
.review-stage { flex: 999 1 560px; min-width: 0; position: relative; display: flex; align-items: center; justify-content: center; min-height: 420px; background: var(--stage-studio); }
.review-stage model-viewer { position: absolute; inset: 0; width: 100%; height: 100%; background: transparent; }
.review-tools { position: absolute; left: 16px; bottom: 16px; display: flex; gap: 8px; }
.legend { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 14px; padding: 8px 12px; border-radius: 8px; background: rgba(22,24,28,0.92); border: 1px solid var(--line-2); font-size: 12px; color: var(--text-2); }
.legend span { display: flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; display: inline-block; }
.lg-remove { background: var(--flag); opacity: .8; }
.lg-point { background: var(--point); }
.review-side { flex: 1 1 380px; max-width: 440px; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.review-issues { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line); }
.review-objects { padding: 6px 18px 18px; overflow: auto; flex-grow: 1; }
.group-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 14px 0 6px; }
.obj { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 8px; cursor: pointer; }
.obj:hover { background: var(--card-hi); outline: 1px solid var(--point); }
.obj input { width: 16px; height: 16px; accent-color: var(--flag); }
.obj b { font-weight: 600; }
.obj .sub { display: block; color: var(--muted); font-size: 12.5px; }
.obj .size { font-family: var(--mono); color: var(--muted); font-size: 12px; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--err-bg); color: var(--err); margin-left: 4px; }
details.grp > summary { list-style: none; }
details.grp > summary::-webkit-details-marker { display: none; }
details.grp > summary .obj { grid-template-columns: auto 1fr auto auto; }
.caret { color: var(--muted); transition: transform .15s; padding: 0 4px; }
details.grp[open] .caret { transform: rotate(90deg); }
details.grp .inner { padding-left: 18px; }

/* ---------- toasts / overlays ---------- */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: center; background: #1F2226; color: var(--text); border: 1px solid var(--line-2); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: min(560px, calc(100vw - 24px)); }
.toast.error { border-color: #5A2A2D; }
.drop-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(14,15,17,.82); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.drop-overlay div { padding: 28px 40px; border: 2px dashed var(--accent); border-radius: 16px; font-size: 20px; font-weight: 600; color: var(--accent); }
.turnstile-slot { position: fixed; right: 16px; bottom: 16px; z-index: 70; }

/* ---------- content below the app ---------- */
.content { max-width: 1120px; margin: 0 auto; padding: 72px 28px 48px; display: flex; flex-direction: column; gap: 72px; }
.block { display: flex; flex-direction: column; gap: 20px; }
.block h2 { margin: 0; font-size: 28px; letter-spacing: -0.015em; }
.cards3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.card h3 { margin: 8px 0 6px; font-size: 16px; }
.card p { margin: 0; color: var(--muted); }
.grid-feat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.grid-feat > div { padding: 18px 20px; background: var(--bg); }
.grid-feat p { margin: 4px 0 0; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.two-col > div { display: flex; flex-direction: column; gap: 14px; }
.lead { margin: 0; color: var(--text-2); font-size: 15px; }
.ticks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.ticks li::before { content: "✓"; color: var(--accent); margin-right: 10px; }
.faq { gap: 0; }
.faq h2 { margin-bottom: 16px; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 8px 0 0; color: var(--muted); max-width: 760px; }

/* ---------- prose pages ---------- */
.prose { max-width: 760px; margin: 0 auto; padding: 56px 28px 72px; }
.prose h1 { font-size: 32px; letter-spacing: -0.02em; margin: 0 0 6px; }
.prose h2 { font-size: 19px; margin: 34px 0 8px; }
.prose p, .prose li { color: var(--text-2); }
.prose .updated { color: var(--muted); margin: 0 0 24px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 8px 0; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--muted); font-weight: 500; }
.draft-banner { background: var(--warn-bg); color: var(--warn-text); padding: 10px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 18px; }

/* ---------- share page ---------- */
.share { display: flex; flex-direction: column; min-height: calc(100vh - 130px); }
.share .viewport { min-height: 70vh; }
.share-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .site-header { padding: 12px 16px; }
  .nav-note { display: none; }
  .site-nav { gap: 16px; }
  .panel { max-width: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .file-list { max-height: none; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .file { min-width: 220px; max-width: 260px; }
  .viewport { min-height: 380px; }
  .stage-head { padding: 12px 16px; }
  .looks { padding: 12px 16px; }
  .look-note { margin-left: 0; }
  .cards3, .grid-feat { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; gap: 40px; }
  .content { padding: 48px 16px 32px; gap: 56px; }
  .review-side { max-width: none; border-left: 0; border-top: 1px solid var(--line); }
  .review-stage { min-height: 46vh; }
  .review-head { padding: 12px 16px; }
  .legend { display: none; }
}
@media (max-width: 560px) {
  .brand-tag { display: none; }
  .stage-actions { width: 100%; }
  .stage-actions .btn:not(.btn-icon) { flex: 1; }
  .look-group { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .swatch { flex-shrink: 0; height: 40px; }
  .review-head-right { width: 100%; }
  .review-head-right .btn { flex: 1; }
}
@media (max-width: 1000px) {
  .review-side { max-width: none; border-left: 0; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ================= admin ================= */
.admin-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.login-card h1 { margin: 6px 0 0; font-size: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card input { height: 42px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: inherit; }
.login-card input:focus { border-color: var(--accent); outline: none; }
.form-error { margin: 0; color: var(--err); font-size: 13.5px; }
.admin { display: flex; min-height: 100vh; }
.admin-nav { width: 232px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.admin-nav .brand { padding: 4px 8px 18px; display: flex; gap: 10px; align-items: center; }
.admin-nav > a { text-decoration: none; padding: 9px 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.admin-nav > a[aria-current="page"] { background: #1F2226; color: #fff; }
.count { font-size: 12px; padding: 0 7px; border-radius: 99px; background: var(--warn-bg); color: var(--warn); }
.admin-nav-foot { margin-top: auto; padding: 10px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.admin-nav-foot form { margin: 0; }
.admin-nav-foot .link { color: var(--text-2); font-weight: 400; }
.admin-main { flex: 1; min-width: 0; padding: 24px 28px 48px; }
.admin-main > section { display: flex; flex-direction: column; gap: 18px; }
.admin-top { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.admin-top h1 { margin: 0; font-size: 22px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); min-width: 260px; color: var(--muted); }
.search input { border: 0; background: transparent; color: var(--text); font: inherit; outline: none; width: 100%; }
select { height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.tile .label { color: var(--muted); font-size: 12.5px; }
.tile .value { font-family: var(--mono); font-size: 24px; font-weight: 500; margin-top: 2px; }
.tile .tnote { color: var(--muted); font-size: 12px; }
.admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.admin-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; position: relative; min-width: 0; }
.span2 { grid-column: span 2; }
.card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.legend-inline { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.legend-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }
.chart { height: 160px; margin-top: 8px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line-2); }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; cursor: default; min-width: 2px; border-radius: 4px 4px 0 0; }
.bar:hover, .bar:focus-visible { background: rgba(255,255,255,.04); outline: none; }
.bar .seg-a { background: #2FA898; }
.bar .seg-b { background: #C98F2E; }
.bar > div:first-child { border-radius: 4px 4px 0 0; }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: #1F2226; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; min-width: 150px; box-shadow: 0 8px 20px rgba(0,0,0,.4); }
.chart-tip .row { display: flex; align-items: center; gap: 8px; }
.chart-tip .row i { width: 12px; height: 2px; display: inline-block; }
.chart-tip b { font-family: var(--mono); }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.chart-table table, .kvtable { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.chart-table td, .chart-table th { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.chart-table td:first-child, .chart-table th:first-child { text-align: left; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
.kv .mono { color: var(--text-2); }
.kv-bar { grid-column: 1 / -1; height: 3px; background: var(--line); border-radius: 2px; margin-top: -4px; }
.kv-bar i { display: block; height: 100%; background: var(--text-2); border-radius: 2px; opacity: .5; }
.table-card { padding: 0; overflow: hidden; gap: 0; }
.chips { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.chipf { height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.chipf[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bg); color: var(--text); }
.chip-note { margin-left: auto; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.admin-table th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; padding: 10px 12px; }
.admin-table td { padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.admin-table tbody tr { cursor: pointer; }
.admin-table tbody tr:hover { background: #16181C; }
.admin-table .right { text-align: right; white-space: nowrap; }
.admin-table .right a, .admin-table .right button { margin-left: 12px; }
.thumb { width: 52px; height: 40px; border-radius: 6px; background: radial-gradient(circle, #2A2E34, #16181C); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.site-tag { display: inline-block; font: 600 10px/1 var(--mono); padding: 3px 5px; border-radius: 4px; margin-right: 7px; vertical-align: 1px; }
.site-tag.glb { background: #12302C; color: #6FE3D3; }
.site-tag.stl { background: #3A2416; color: #FF9E64; }
.fname { font-weight: 600; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsub { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); }
.empty-row { text-align: center; color: var(--muted); padding: 32px !important; }
dialog.detail { width: min(1180px, 96vw); height: min(820px, 92vh); padding: 0; border: 1px solid var(--line-2); border-radius: 14px; background: var(--bg); color: var(--text); }
dialog.detail[open] { display: flex; flex-direction: column; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.detail-name { font-weight: 600; font-size: 16px; }
.detail-body { display: flex; flex: 1; min-height: 0; flex-wrap: wrap; }
.detail-view { flex: 999 1 480px; position: relative; min-height: 360px; background: var(--stage-studio); display: flex; align-items: center; justify-content: center; }
.detail-view model-viewer { position: absolute; inset: 0; width: 100%; height: 100%; background: transparent; }
.detail-seg { position: absolute; top: 12px; left: 12px; width: 240px; }
.detail-side { flex: 1 1 340px; max-width: 420px; border-left: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.detail-side h3 { margin: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 500; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.settings-row:last-child { border-bottom: 0; }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); } .err-text { color: var(--err); }
@media (max-width: 1100px) {
  /* size and download links are in the detail view; keep the list readable without sideways scrolling */
  .admin-table { min-width: 520px; }
  .admin-table .col-size, .admin-table .col-files { display: none; }
  .fname { max-width: 220px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid, .admin-grid.three { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
}
@media (max-width: 760px) {
  .admin { flex-direction: column; }
  .admin-nav { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-nav .brand { padding: 4px 8px; width: 100%; }
  .admin-nav-foot { margin: 0; flex-direction: row; flex-wrap: wrap; width: 100%; }
  .admin-main { padding: 16px; }
  .search { min-width: 0; flex: 1; }
  .detail-side { max-width: none; border-left: 0; }
}
