:root {
  --ink: #18202a;
  --muted: #68717c;
  --line: #e7e1d7;
  --paper: #fbfaf7;
  --card: #ffffff;
  --accent: #8b5e34;
  --accent-dark: #54361e;
  --accent-soft: #f1e7d8;
  --green: #27735b;
  --red: #a8453b;
  --shadow: 0 20px 50px rgba(40, 29, 17, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 100% 0, #f7ead9 0, transparent 34rem), var(--paper); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.shell { display: grid; grid-template-columns: 235px minmax(0, 1fr); min-height: 100vh; }
.sidebar { padding: 28px 18px; border-right: 1px solid var(--line); background: rgba(255,255,255,.72); }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 10px 28px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #c6a77f; border-radius: 50%; color: var(--accent-dark); font-weight: 700; background: #fff8ef; }
.brand strong { display: block; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }
.nav { display: grid; gap: 5px; }
.nav a { padding: 11px 12px; border-radius: 10px; color: #5f6872; font-size: 14px; }
.nav a:hover, .nav a.active { color: var(--accent-dark); background: var(--accent-soft); }
.main { width: min(1440px, 100%); padding: 32px clamp(20px, 4vw, 58px) 58px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 28px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; letter-spacing: -.04em; }
h1 { margin-top: 7px; font-size: clamp(28px, 4vw, 44px); line-height: 1.05; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
.lede { max-width: 680px; color: var(--muted); line-height: 1.65; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; background: var(--accent-dark); color: #fff; font-weight: 650; font-size: 13px; }
.button:hover { filter: brightness(1.08); }
.button.secondary { background: #fff; color: var(--accent-dark); border-color: #cfbca4; }
.button.danger { background: #fff4f1; color: var(--red); border-color: #ecc4bc; }
.button.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.button.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.grid { display: grid; gap: 18px; }
.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.84); box-shadow: var(--shadow); }
.card.pad { padding: 22px; }
.metric { padding: 20px; }
.metric small { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 8px; font-size: 31px; letter-spacing: -.06em; }
.metric span { color: var(--green); font-size: 12px; }
.section-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 16px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
label { color: #4d5660; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #d8d0c4; border-radius: 9px; padding: 11px 12px; color: var(--ink); background: #fffefa; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #f0dfca; }
textarea { min-height: 190px; resize: vertical; line-height: 1.5; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.toolbar > * { flex: 1 1 150px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
td strong { font-size: 13px; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.status { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #eef4ed; color: var(--green); font-size: 11px; font-weight: 750; }
.status.deleted, .status.failed { background: #fff0ed; color: var(--red); }
.status.sold_out { background: #fff4dd; color: #966719; }
.status.running, .status.queued { background: #fff6de; color: #926417; }
.notice { padding: 13px 15px; border: 1px solid #dfd4c5; border-radius: 10px; color: #6e5a43; background: #fffaf2; font-size: 13px; line-height: 1.5; }
.notice.error { border-color: #edc2ba; color: var(--red); background: #fff5f3; }
.notice.success { border-color: #bdd9cb; color: var(--green); background: #f1fbf5; }
.progress { height: 8px; overflow: hidden; border-radius: 999px; background: #ede8df; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.import-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.import-item:last-child { border-bottom: 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.empty { padding: 35px; color: var(--muted); text-align: center; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; color: var(--muted); font-size: 13px; }
.hero { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.hero-card { width: min(1020px, 100%); padding: clamp(26px, 6vw, 72px); border: 1px solid var(--line); border-radius: 25px; background: rgba(255,255,255,.82); box-shadow: var(--shadow); }
.hero-card h1 { max-width: 730px; }
.hero-card .lede { font-size: 17px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.login-card { width: min(470px, 100%); }
.login-card .brand { padding: 0 0 28px; }
.login-form { display: grid; gap: 16px; margin-top: 26px; }
.remember { display: flex; align-items: center; gap: 9px; color: #4d5660; font-size: 13px; cursor: pointer; }
.remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent-dark); }
.login-hint { margin: -6px 0 0; font-size: 12px; line-height: 1.5; }
.login-form .button { width: 100%; margin-top: 4px; }
.login-card .notice { margin-top: 16px; }
.viewer-shell { height: 100vh; min-height: 560px; overflow: hidden; padding: 14px clamp(16px, 4vw, 58px) 18px; background: radial-gradient(circle at 85% -5%, #f4e6d3 0, transparent 34rem), #f7f5f1; color: #25221f; }
.viewer-top { width: min(1160px, 100%); height: 38px; margin: 0 auto 10px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.viewer-brand { display: flex; gap: 10px; align-items: center; color: #30281f !important; }
.viewer-brand .brand-mark { width: 33px; height: 33px; font-size: 13px; }
.viewer-brand strong, .viewer-brand small { display: block; }
.viewer-brand strong { font-size: 14px; letter-spacing: -.02em; }
.viewer-brand small { margin-top: 2px; color: #998b7b; font-size: 11px; }
.viewer-admin { padding: 8px 12px; border: 1px solid #ded4c8; border-radius: 999px; color: #8b5e34 !important; font-size: 12px !important; }
.viewer-grid { width: min(1160px, 100%); height: calc(100vh - 62px); margin: auto; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: stretch; }
.viewer-card { overflow: hidden; border: 1px solid #e3dbcf; border-radius: 20px; background: #fff; box-shadow: 0 22px 60px rgba(67, 48, 28, .09); }
.viewer-grid > .viewer-card:first-child { display: flex; flex-direction: column; min-height: 0; }
.stage { position: relative; display: grid; flex: 1 1 auto; min-height: 0; place-items: center; padding: 14px; overflow: hidden; background: radial-gradient(circle at center, #fff 0, #f3eee7 66%, #ece3d8 100%); touch-action: pan-y; user-select: none; }
.stage::after { position: absolute; bottom: 6%; left: 15%; right: 15%; height: 24px; border-radius: 50%; background: rgba(103, 74, 43, .1); filter: blur(14px); content: ''; }
#viewer-image { position: relative; z-index: 1; display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: grab; pointer-events: none; user-select: none; -webkit-user-drag: none; transform-origin: center; transition: transform .12s ease; }
#viewer-image.invert { filter: invert(1); }
.stage.dragging #viewer-image { cursor: grabbing; }
.viewer-loading { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 25px; color: #6f6255; background: rgba(255, 255, 255, .88); font-size: 13px; text-align: center; }
.viewer-loading strong { color: #3c2d21; font-size: 16px; }
.viewer-loading.error strong, .viewer-loading.error { color: var(--red); }
.loading-orb { width: 34px; height: 34px; margin-bottom: 4px; border: 3px solid #eadfd2; border-top-color: #a76d35; border-radius: 50%; animation: viewer-spin .9s linear infinite; }
@keyframes viewer-spin { to { transform: rotate(360deg); } }
.controls { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 9px; flex: 0 0 auto; padding: 11px 18px 13px; border-top: 1px solid #e3dbcf; background: rgba(255,255,255,.92); }
.control { display: grid; place-items: center; width: 42px; height: 40px; padding: 0; border: 1px solid #d8c9b8; border-radius: 11px; background: #fffdfa; color: #6b4727; transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.control svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.control:hover, .control.is-active { border-color: #b7824f; background: #fff3e5; box-shadow: 0 5px 14px rgba(125, 77, 30, .11); transform: translateY(-1px); }
.control-main { width: 48px; height: 44px; border-color: #a76d35; background: #a76d35; color: #fff; box-shadow: 0 6px 16px rgba(125, 77, 30, .2); }
.control-main:hover, .control-main.is-playing { background: #8b5e34; color: #fff; }
.control-main .pause-icon { display: none; }
.control-main.is-playing .play-icon { display: none; }
.control-main.is-playing .pause-icon { display: block; }
.control-divider { width: 1px; height: 23px; margin: 0 5px; background: #e3dbcf; }
.info { height: 100%; overflow: auto; padding: 24px; }
.info h1 { font-size: 27px; }
.info dl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin: 24px 0 0; }
.info dt { color: #8b7b6c; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.info dd { margin: 4px 0 0; color: #3f3328; font-size: 14px; }
.info a { color: #a76d35; }
@media (max-width: 980px) { .shell { grid-template-columns: 1fr; } .sidebar { padding: 15px 18px; border-right: 0; border-bottom: 1px solid var(--line); } .brand { padding-bottom: 13px; } .nav { display: flex; overflow-x: auto; } .nav a { white-space: nowrap; } .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .viewer-shell { height: auto; min-height: 100vh; overflow: visible; } .viewer-grid { height: auto; grid-template-columns: 1fr; } .viewer-grid > .viewer-card:first-child { min-height: 0; } .stage { min-height: min(620px, 68vh); } .info { height: auto; padding: 18px; } }
 @media (max-width: 640px) { .main { padding: 24px 15px 42px; } .topbar, .section-head { align-items: flex-start; flex-direction: column; } .grid.cards, .grid.two, .form-grid { grid-template-columns: 1fr; } .viewer-shell { padding: 12px 10px 20px; } .viewer-top { margin-bottom: 8px; } .stage { min-height: 360px; padding: 8px; } .controls { gap: 5px; padding: 9px 6px 11px; } .control { width: 37px; height: 35px; } .control-main { width: 43px; height: 39px; } th, td { padding: 11px 8px; } }
