:root {
  color-scheme: light;
  --ink: #161b19;
  --muted: #6d7470;
  --line: #dfe4e1;
  --soft: #f3f5f4;
  --paper: #ffffff;
  --green: #18a578;
  --green-dark: #0e7655;
  --yellow: #f2c94c;
  --coral: #ef6f61;
  --blue: #5f7fdb;
  --radius: 8px;
  font-family: "Microsoft YaHei UI", "PingFang SC", Arial, sans-serif;
  background: #ecefed;
  color: var(--ink);
}

.preview-color-section .color-picker { grid-template-columns: minmax(0, 1fr); }
.preview-color-section .section-heading { gap: 10px; }
.preview-color-section .section-heading p { line-height: 1.6; }
.preview-color-section .color-picker-meta { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; }
.preview-color-section .color-picker-meta > :nth-child(n+3) { grid-column: 1 / -1; }
.preview-color-section .effect-preview-box { min-height: 74px; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 8px; }
.preview-color-section .effect-preview-box small { white-space: nowrap; text-align: center; }
.preview-color-section .effect-sample { min-width: 0; min-height: 42px; }
.preview-color-section .color-value-fields { grid-template-columns: minmax(0, 1fr) 76px; align-self: center; }
.preview-color-section .swatch-grid { grid-template-columns: repeat(10, minmax(0,1fr)); gap: 5px; }
.preview-color-section .swatch { width: 100%; height: 24px; }
.font-pagination { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; }
.font-pagination .button { min-height: 34px; padding: 0 12px; }
.font-page-jump { display: flex; align-items: center; gap: 8px; }
.font-page-jump select { max-width: 96px; padding: 6px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); }
.font-preview .font-cloud-label { color: #c5d0ca; font-size: 12px; -webkit-text-stroke: 0; text-shadow: none; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.login-dialog { width: min(420px, calc(100% - 32px)); padding: 32px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); }
.login-dialog::backdrop { background: rgba(15,25,20,.5); backdrop-filter: blur(4px); }
.login-dialog h2 { margin: 12px 0; }
.login-dialog p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.login-dialog .login-kicker { color: var(--green-dark); font-weight: 700; }
.login-dialog label { display: block; margin: 20px 0 8px; font-size: 13px; }
.login-dialog input { width: 100%; padding: 12px; border: 1px solid #bac8c0; border-radius: 6px; }
.login-dialog .button { width: 100%; }
#loginError { min-height: 22px; color: #b83d36; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: #ecefed; }
button, input, select { font: inherit; }
button { color: inherit; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; color: inherit; text-decoration: none; }
.brand-mark { position: relative; width: 31px; height: 31px; border: 3px solid var(--ink); }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ""; position: absolute; background: var(--green); }
.brand-mark::before { width: 10px; height: 5px; right: -5px; top: 4px; }
.brand-mark::after { width: 5px; height: 10px; left: 4px; bottom: -5px; background: var(--coral); }
.brand-mark span { width: 9px; height: 9px; right: 4px; bottom: 4px; background: var(--yellow); }
.brand b { display: block; font-size: 13px; letter-spacing: 0; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; }

.view-switch { display: flex; align-items: center; align-self: stretch; gap: 24px; }
.view-tab { position: relative; height: 100%; padding: 0 2px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.view-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; }
.view-tab.is-active { color: var(--ink); }
.view-tab.is-active::after { background: var(--green); }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 5px; padding: 0 6px; border-radius: 10px; background: var(--soft); font-size: 11px; }
.header-status { justify-self: end; color: var(--muted); font-size: 12px; }
.header-status span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(24,165,120,.12); }

.view { display: none; }
.view.is-active { display: block; }
.studio-shell { width: min(1440px, 100%); margin: 0 auto; display: grid; grid-template-columns: minmax(360px, 510px) minmax(580px, 1fr); min-height: calc(100vh - 68px); }
.preview-column { position: sticky; top: 68px; height: calc(100vh - 68px); height: calc(100dvh - 68px); display: flex; flex-direction: column; gap: 0; min-width: 0; overflow: hidden; align-self: start; padding: 28px 34px 24px; border-right: 1px solid #d7ddda; background: #e7ebe8; }
.preview-column > :not(.preview-color-section) { flex-shrink: 0; }
.preview-column .preview-color-section { flex: 1 1 auto; min-height: 0; margin-top: 18px; padding: 18px 10px 20px 0; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; scrollbar-width: thin; overscroll-behavior: contain; border-top: 1px solid #d7ddda; border-bottom: 0; }
.section-kicker { display: flex; justify-content: space-between; margin-bottom: 14px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.section-kicker span:last-child { color: var(--green-dark); }
.preview-stage { position: relative; width: min(100%, max(120px, calc(100vh - 390px))); width: min(100%, max(120px, calc(100dvh - 390px))); height: auto; min-height: 0; aspect-ratio: 1; align-self: center; overflow: hidden; contain: layout paint; border: 1px solid #cfd6d2; background: #d9dfdb; }
.preview-canvas-shell { position: absolute; inset: 0; }
#previewCanvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.preview-frame-overlay { position: absolute; z-index: 2; left: 11.429%; top: 11.429%; width: 77.143%; height: 77.143%; object-fit: contain; pointer-events: none; }
.preview-text-overlay { position: absolute; z-index: 3; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.asset-status { position: absolute; top: 12px; right: 12px; min-height: 25px; display: inline-flex; align-items: center; padding: 0 9px; border: 1px solid rgba(255,255,255,.7); border-radius: 13px; background: rgba(18,24,22,.78); color: #fff; backdrop-filter: blur(7px); font-size: 9px; font-weight: 800; }
.preview-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.preview-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.button { min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 10px; padding: 0 18px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-weight: 700; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button-secondary { border-color: #bfc8c3; background: #fff; }
.button-secondary:hover { border-color: var(--ink); }
.button-primary { min-height: 52px; background: var(--ink); color: #fff; }
.button-primary:hover { background: #29312e; }
.button-primary span { font-size: 20px; }
.button-risk { background: #fff1d2; border-color: #efc564; white-space: nowrap; }
.upload-button { position: relative; }

.config-column { padding: 36px clamp(30px, 4vw, 70px) 80px; background: var(--paper); }
.config-header { display: flex; align-items: end; justify-content: space-between; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.config-header p, .admin-titlebar p { margin: 0 0 7px; color: var(--green-dark); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.config-header h1, .admin-titlebar h1 { margin: 0; font-size: clamp(26px, 3vw, 40px); line-height: 1.1; letter-spacing: 0; }
.text-button { border: 0; padding: 6px 0; background: transparent; color: var(--muted); cursor: pointer; border-bottom: 1px solid currentColor; font-size: 12px; }
.config-section { padding: 28px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.step-number { display: grid; place-items: center; width: 32px; height: 27px; flex: 0 0 auto; background: var(--ink); color: #fff; font: 700 11px/1 Consolas, monospace; }
.section-heading h2 { margin: 0; font-size: 17px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

.frame-toolbar { display: grid; grid-template-columns: minmax(190px, 1fr) auto auto auto; align-items: center; gap: 10px; margin-bottom: 12px; }
.frame-search { min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.frame-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 11px; }
.frame-filters { display: flex; gap: 4px; }
.frame-filter { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; }
.frame-filter.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }
.frame-result-count { color: var(--muted); font: 700 10px Consolas, monospace; white-space: nowrap; }
.frame-upload-button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 11px; border: 1px solid var(--ink); border-radius: 5px; background: var(--ink); color: #fff; cursor: pointer; font-size: 10px; font-weight: 800; white-space: nowrap; }
.frame-upload-button:hover { background: #2c3431; }
.frame-upload-button span { font-size: 16px; line-height: 1; }
.frame-grid { max-height: 574px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; padding: 2px 7px 2px 2px; overflow-y: auto; scrollbar-color: #aeb8b3 #eef1ef; scrollbar-width: thin; }
.frame-grid-empty { grid-column: 1 / -1; min-height: 180px; display: grid; place-items: center; border: 1px dashed #cbd2ce; color: var(--muted); font-size: 11px; }
.frame-card, .font-card { position: relative; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; text-align: left; cursor: pointer; }
.frame-card:hover, .font-card:hover { border-color: #929d97; }
.frame-card.is-selected, .font-card.is-selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.frame-card.is-selected::after, .font-card.is-selected::after { content: "✓"; position: absolute; top: 7px; right: 7px; display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; }
.frame-thumb { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; overflow: hidden; background: #e8ecea; }
.frame-thumb img { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.frame-card div:not(.frame-thumb) { padding: 9px; }
.frame-card b { display: block; font-size: 12px; }
.frame-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.frame-card .asset-type { color: var(--green-dark); }

.id-editor { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 12px; }
.input-wrap { position: relative; display: block; min-height: 70px; padding: 11px 52px 9px 13px; border: 1px solid #bfc8c3; border-radius: var(--radius); }
.input-wrap:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(24,165,120,.1); }
.input-wrap > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.input-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 18px; font-weight: 800; }
.input-wrap small { position: absolute; right: 13px; bottom: 13px; color: var(--muted); font-size: 10px; }
.toggle-row { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.toggle-row b, .toggle-row small { display: block; }
.toggle-row b { font-size: 12px; }
.toggle-row small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.toggle-row input { position: absolute; opacity: 0; }
.toggle-row i { position: relative; width: 38px; height: 22px; flex: 0 0 auto; border-radius: 12px; background: #ccd2cf; transition: background .2s; }
.toggle-row i::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: white; transition: transform .2s; }
.toggle-row input:checked + i { background: var(--green); }
.toggle-row input:checked + i::after { transform: translateX(16px); }

.font-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; margin-bottom: 12px; }
.font-collection-link { color: var(--green-dark); font-size: 11px; text-decoration: none; white-space: nowrap; }
.font-collection-link:hover { text-decoration: underline; }
.font-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.font-filter { min-height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--muted); cursor: pointer; font-size: 11px; }
.font-filter.is-active { color: #fff; background: var(--ink); border-color: var(--ink); }
.font-load-status { display: flex; align-items: center; gap: 7px; min-height: 36px; margin-bottom: 12px; padding: 8px 11px; border-radius: 5px; color: var(--green-dark); background: #edf6f1; font-size: 11px; line-height: 1.5; }
.font-load-status::before { content: ""; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.font-load-status[data-state="loading"]::before { animation: font-pulse .8s ease-in-out infinite alternate; }
.font-load-status[data-state="error"] { color: #a53d30; background: #fff0ed; }
@keyframes font-pulse { to { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .font-load-status[data-state="loading"]::before { animation: none; } }
.font-grid { max-height: 540px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 2px 6px 2px 2px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #aeb8b3 #eef1ef; }
.font-card { min-height: 112px; padding: 0 12px 12px; }
.font-card:disabled { cursor: not-allowed; opacity: .6; }
.font-card:focus-visible, .font-filter:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.font-preview img { display: block; width: 100%; height: 44px; object-fit: contain; object-position: left center; filter: drop-shadow(0 0 4px var(--effect-rgba, #18a578)); }
.font-card-footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 10px; }
.font-card.is-selected .font-card-load { color: var(--green-dark); font-weight: 700; }
.font-library-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.font-search input { min-width: 0; }
.font-preview { display: block; min-height: 59px; margin: 0 -12px 10px; padding: 14px 12px 8px; background: #202724; color: #fff; font-size: 22px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-text-stroke: 1px var(--effect-rgba, #18a578); text-shadow: 0 0 9px var(--effect-rgba, #18a578); }
.font-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.font-meta b { min-width: 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.license-tag { padding: 3px 5px; border-radius: 3px; background: #e8f5ef; color: var(--green-dark); font-size: 9px; white-space: nowrap; }
.license-tag.risk { background: #fff0d4; color: #8a5a00; }
.risk-panel { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; margin-top: 12px; padding: 13px; border: 1px solid #efc564; border-radius: var(--radius); background: #fffaf0; }
.risk-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--yellow); font-weight: 900; }
.risk-panel b { font-size: 12px; }
.risk-panel p { margin: 4px 0 0; color: #6f5b31; font-size: 10px; line-height: 1.6; }
.ai-result { margin-top: 12px; padding: 13px 14px; border-left: 4px solid var(--green); background: #edf8f3; }
.ai-result > span { color: var(--green-dark); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.ai-result p { margin: 6px 0 3px; font-size: 13px; }
.ai-result small { color: var(--muted); font-size: 9px; }

.color-picker { display: grid; grid-template-columns: minmax(320px, 1.45fr) minmax(220px, .75fr); gap: 16px; padding: 14px; border: 1px solid #cfd6d2; border-radius: var(--radius); background: #252a28; color: #fff; }
.color-picker-controls { min-width: 0; }
.sv-picker { position: relative; width: 100%; aspect-ratio: 1.72; overflow: hidden; border: 1px solid rgba(255,255,255,.22); border-radius: 5px; cursor: crosshair; outline: 0; touch-action: none; }
.sv-picker:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.sv-picker canvas { display: block; width: 100%; height: 100%; }
.sv-cursor { position: absolute; width: 18px; height: 18px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 1px 5px rgba(0,0,0,.85), inset 0 0 0 1px rgba(0,0,0,.3); transform: translate(-50%, -50%); pointer-events: none; }
.picker-slider-row { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 10px; margin-top: 12px; color: #c5ccc8; font-size: 10px; font-weight: 700; }
.picker-slider-row input { width: 100%; height: 16px; margin: 0; border-radius: 8px; appearance: none; cursor: pointer; }
.hue-slider { background: linear-gradient(90deg, #f00 0%, #ff0 16.6%, #0f0 33.3%, #0ff 50%, #00f 66.6%, #f0f 83.3%, #f00 100%); }
.alpha-slider { background-color: #fff; background-image: linear-gradient(90deg, transparent, var(--effect-color)), linear-gradient(45deg, #c5c5c5 25%, transparent 25%), linear-gradient(-45deg, #c5c5c5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #c5c5c5 75%), linear-gradient(-45deg, transparent 75%, #c5c5c5 75%); background-size: auto, 12px 12px, 12px 12px, 12px 12px, 12px 12px; background-position: 0 0, 0 0, 0 6px, 6px -6px, -6px 0; }
.picker-slider-row input::-webkit-slider-thumb { width: 20px; height: 20px; appearance: none; border: 3px solid #fff; border-radius: 50%; background: transparent; box-shadow: 0 1px 5px rgba(0,0,0,.7); }
.picker-slider-row input::-moz-range-thumb { width: 15px; height: 15px; border: 3px solid #fff; border-radius: 50%; background: transparent; box-shadow: 0 1px 5px rgba(0,0,0,.7); }
.color-picker-meta { display: flex; flex-direction: column; gap: 13px; min-width: 0; }
.effect-preview-box { min-height: 102px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid rgba(255,255,255,.14); border-radius: 6px; background: #171b1a; }
.effect-preview-box small { color: #aeb7b2; font-size: 9px; }
.effect-sample { display: grid; place-items: center; min-width: 74px; min-height: 56px; color: white; font-size: 31px; font-weight: 900; -webkit-text-stroke: 2px var(--effect-rgba, #18a578); text-shadow: 0 0 13px var(--effect-rgba, #18a578), 3px 3px 0 var(--effect-rgba, #18a578); }
.color-value-fields { display: grid; grid-template-columns: 1fr 100px; gap: 8px; }
.color-value-fields label { display: block; }
.color-value-fields label > span { display: block; margin-bottom: 5px; color: #aeb7b2; font-size: 9px; }
.color-value-fields input { width: 100%; height: 38px; border: 1px solid rgba(255,255,255,.16); border-radius: 4px; outline: 0; background: #343a37; color: #fff; font: 700 12px Consolas, monospace; }
.color-value-fields label:first-child input { padding: 0 10px; text-transform: uppercase; }
.color-value-fields label > div { position: relative; }
.color-value-fields input[type="number"] { padding: 0 27px 0 9px; }
.color-value-fields label b { position: absolute; right: 9px; top: 11px; color: #aeb7b2; font-size: 10px; }
.preset-label { display: block; margin-bottom: 7px; color: #aeb7b2; font-size: 9px; }
.swatch-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.swatch { position: relative; aspect-ratio: 1; min-width: 0; border: 2px solid transparent; border-radius: 4px; cursor: pointer; }
.swatch.is-selected { border-color: #fff; box-shadow: 0 0 0 2px #111; }
.swatch.is-selected::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-shadow: 0 1px 4px #000; font-size: 10px; font-weight: 900; }
.color-tip { margin: auto 0 0; color: #8e9893; font-size: 9px; line-height: 1.6; }

.submit-panel { margin-top: 28px; padding: 20px; border: 1px solid #cbd2ce; border-radius: var(--radius); background: #f6f8f7; }
.selection-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; }
.selection-summary > div { padding: 0 15px; border-right: 1px solid var(--line); }
.selection-summary > div:first-child { padding-left: 0; }
.selection-summary > div:last-child { border: 0; }
.selection-summary small, .selection-summary b { display: block; }
.selection-summary small { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.selection-summary b { font-size: 12px; }
.safe-text { color: var(--green-dark); }
.risk-text { color: #a16400; }
.consent-row { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 14px; color: var(--muted); cursor: pointer; font-size: 11px; line-height: 1.5; }
.consent-row input { margin: 2px 0 0; accent-color: var(--green); }
.submit-panel .button-primary { width: 100%; }

.admin-view { min-height: calc(100vh - 68px); background: #f2f4f3; }
.admin-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 46px 0 80px; }
.admin-titlebar { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.admin-titlebar > div > span { display: block; margin-top: 10px; color: var(--muted); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 28px 0 20px; }
.metric-grid article { position: relative; min-height: 130px; padding: 18px; border: 1px solid var(--line); border-top: 4px solid var(--green); background: #fff; }
.metric-grid article:nth-child(2) { border-top-color: var(--yellow); }
.metric-grid article:nth-child(3) { border-top-color: var(--coral); }
.metric-grid small, .metric-grid strong, .metric-grid span { display: block; }
.metric-grid small { color: var(--muted); font-size: 11px; }
.metric-grid strong { margin: 10px 0 5px; font-size: 34px; }
.metric-grid span { color: var(--muted); font-size: 10px; }
.admin-toolbar { display: grid; grid-template-columns: 1fr 210px; gap: 10px; margin-bottom: 12px; }
.search-box { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 13px; border: 1px solid var(--line); background: #fff; }
.search-box input { width: 100%; border: 0; outline: 0; }
.admin-toolbar select { border: 1px solid var(--line); padding: 0 12px; background: #fff; }
.submission-list { display: grid; gap: 8px; }
.submission-row { display: grid; grid-template-columns: 96px 1.1fr .8fr .8fr .75fr auto; align-items: center; gap: 16px; min-height: 100px; padding: 12px; border: 1px solid var(--line); background: #fff; }
.submission-thumb { width: 76px; height: 76px; object-fit: cover; border: 1px solid var(--line); background: var(--soft); }
.submission-cell small, .submission-cell b { display: block; }
.submission-cell small { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.submission-cell b { font-size: 12px; word-break: break-word; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 12px; background: #e8f5ef; color: var(--green-dark); font-size: 9px; font-weight: 800; }
.status-pill.ai { background: #fff0d4; color: #8a5a00; }
.detail-button { min-height: 36px; border: 1px solid #bfc8c3; background: #fff; cursor: pointer; font-size: 11px; font-weight: 700; }
.empty-state { display: none; min-height: 350px; place-items: center; align-content: center; padding: 50px 20px; border: 1px dashed #c8cfcb; background: #fff; text-align: center; }
.empty-state.is-visible { display: grid; }
.empty-state h2 { margin: 18px 0 7px; font-size: 18px; }
.empty-state p { max-width: 420px; margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.empty-graphic { position: relative; width: 72px; height: 72px; border: 3px solid #bdc7c1; border-radius: 50%; }
.empty-graphic::after { content: ""; position: absolute; width: 28px; height: 11px; left: 19px; bottom: -8px; border: 3px solid var(--green); background: #fff; }

.detail-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 24px 80px rgba(0,0,0,.24); }
.detail-dialog::backdrop { background: rgba(14,19,17,.58); backdrop-filter: blur(3px); }
.studio-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; }
.text-transform-tools { margin-top: 16px; padding: 16px; border: 1px solid var(--line); background: #fafcfb; }
.transform-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 12px; }
.transform-control { display: grid; grid-template-columns: 84px minmax(0, 1fr) 64px; gap: 12px; align-items: center; margin-top: 12px; font-size: 12px; }
.transform-control small { color: var(--muted); }
.transform-control input[type=range] { width: 100%; min-width: 0; accent-color: var(--green); }
.transform-control input[type=number] { width: 100%; min-width: 0; height: 34px; border: 1px solid var(--line); padding: 4px 6px; background: white; }
.transform-tip { margin: 14px 0 0; font-size: 11px; line-height: 1.8; color: var(--muted); }
.text-drag-handle { position: absolute; z-index: 4; padding: 0; min-width: 0; border: 1px dashed rgba(24,165,120,.6); border-radius: 3px; background: transparent; transform: translate(-50%,-50%); cursor: grab; touch-action: none; }
.text-drag-handle:hover, .text-drag-handle:focus-visible { border: 2px dashed var(--green); outline: none; }
.text-drag-handle.is-dragging { cursor: grabbing; }
.history-header { padding: 28px 28px 20px; border-bottom: 1px solid var(--line); }
.history-header p { margin: 0; font-size: 11px; color: var(--green-dark); }
.history-header h2 { margin: 8px 0 12px; font-size: 24px; }
.history-header span { font-size: 12px; color: var(--muted); line-height: 1.8; }
.history-list { padding: 20px; display: grid; gap: 12px; }
.history-item { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 16px; padding: 14px; border: 1px solid var(--line); }
.history-item img { width: 100%; aspect-ratio: 1; border: 1px solid var(--line); }
.history-item h3 { margin: 0 0 6px; overflow-wrap: anywhere; font-size: 16px; }
.history-item p { margin: 5px 0; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; line-height: 1.6; }
.history-item .delete-button { margin-top: 8px; padding: 0 12px; }
.status-pill.withdrawn { color: #8b554b; background: #fbeae6; }
.history-empty { padding: 40px 12px; text-align: center; color: var(--muted); font-size: 13px; }
@media(max-width: 480px) { .studio-tools { gap: 4px; } .studio-tools .button { padding: 0 12px; } .transform-control { grid-template-columns: 76px minmax(0,1fr) 60px; gap: 8px; } .history-item { grid-template-columns: 70px minmax(0,1fr); gap: 10px; } .history-list { padding: 12px; } }
.dialog-close { position: absolute; z-index: 2; top: 10px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); cursor: pointer; font-size: 24px; line-height: 1; }
.dialog-layout { display: grid; grid-template-columns: 300px 1fr; }
.dialog-layout img { width: 100%; height: 100%; min-height: 430px; object-fit: cover; background: var(--soft); }
.dialog-info { padding: 38px 30px; }
.dialog-info > small { color: var(--green-dark); font-weight: 800; }
.dialog-info h2 { margin: 8px 0 22px; font-size: 25px; }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.detail-list div { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.detail-list small, .detail-list b { display: block; }
.detail-list small { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.detail-list b { font-size: 12px; }
.delete-button { margin-top: 24px; min-height: 38px; border: 1px solid #e1aaa3; background: #fff5f3; color: #a53c31; cursor: pointer; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 26px; min-width: 220px; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 6px; background: var(--ink); color: #fff; text-align: center; font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
  .studio-shell { grid-template-columns: 390px minmax(0, 1fr); }
  .preview-column { padding: 24px 22px; }
  .frame-grid { grid-template-columns: repeat(3, 1fr); }
  .font-grid { grid-template-columns: repeat(2, 1fr); }
  .swatch-grid { grid-template-columns: repeat(4, 1fr); }
  .submission-row { grid-template-columns: 84px 1fr 1fr 1fr auto; }
  .submission-row .submission-date { display: none; }
}

@media (max-width: 780px) {
  .app-header { height: auto; min-height: 62px; grid-template-columns: 1fr auto; padding: 10px 16px; }
  .brand small, .header-status { display: none; }
  .view-switch { grid-column: 1 / -1; height: 42px; justify-content: center; order: 3; }
  .studio-shell { display: block; }
  .preview-column { position: relative; top: 0; height: auto; display: block; overflow: visible; padding: 18px 16px; border-right: 0; border-bottom: 1px solid #d7ddda; }
  .preview-column .preview-color-section { overflow: visible; padding-right: 0; scrollbar-gutter: auto; }
  .preview-stage { width: 100%; height: auto; min-height: 0; aspect-ratio: 1; }
  .config-column { padding: 28px 16px 60px; }
  .config-header { align-items: flex-start; }
  .config-header h1, .admin-titlebar h1 { font-size: 28px; }
  .frame-toolbar { grid-template-columns: 1fr auto; }
  .frame-search { grid-column: 1 / -1; }
  .frame-filters { overflow-x: auto; padding-bottom: 2px; }
  .frame-upload-button { grid-column: 1 / -1; width: 100%; }
  .frame-grid { max-height: 660px; grid-template-columns: repeat(2, 1fr); }
  .id-editor { grid-template-columns: 1fr; }
  .font-grid { grid-template-columns: 1fr 1fr; }
  .font-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .font-collection-link { grid-column: 1 / -1; }
  .risk-panel { grid-template-columns: auto 1fr; }
  .risk-panel .button { grid-column: 1 / -1; }
  .color-picker { grid-template-columns: 1fr; }
  .selection-summary { gap: 12px; }
  .selection-summary > div { padding: 0; border: 0; }
  .admin-shell { width: calc(100% - 32px); padding-top: 28px; }
  .admin-titlebar { display: block; }
  .admin-titlebar .button { margin-top: 16px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-grid article { min-height: 105px; }
  .admin-toolbar { grid-template-columns: 1fr; }
  .admin-toolbar select { min-height: 44px; }
  .submission-row { grid-template-columns: 72px 1fr auto; gap: 11px; }
  .submission-thumb { width: 64px; height: 64px; }
  .submission-row .hide-mobile { display: none; }
  .dialog-layout { grid-template-columns: 1fr; }
  .dialog-layout img { height: min(78vw, 420px); min-height: 0; }
  .dialog-info { padding: 24px 20px; }
}

@media (max-width: 420px) {
  .frame-grid, .font-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .font-preview { font-size: 17px; }
  .swatch-grid { grid-template-columns: repeat(4, 1fr); }
  .selection-summary { grid-template-columns: 1fr; }
  .preview-actions { grid-template-columns: 1fr; }
}
