/* ZhuaPic visual system: shared tokens, surfaces and interaction states. */
:root, :root[data-theme="light"] {
  --ink: #242923; --muted: #7a8278; --line: #e4e8e1; --panel: #fff;
  --soft: #f4f6f1; --field: #f7f8f5; --page: #fafbf8;
  --accent: #cceb79; --green: #448351; --blue: #498a97; --gold: #ab8742; --violet: #788d64;
  --shadow: 0 12px 36px #2532210a; --on-primary: #fff; --primary: #283026;
}
:root[data-theme="dark"] {
  --ink: #ecf0eb; --muted: #a6afa5; --line: #383e39; --panel: #202421;
  --soft: #282e29; --field: #252a26; --page: #171a18;
  --accent: #cceb79; --green: #9aca8f; --blue: #87bec7; --gold: #c8ac72; --violet: #9eae88;
  --shadow: 0 12px 36px #0002; --on-primary: #20261b; --primary: #d4f568;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ecf0eb; --muted: #a6afa5; --line: #383e39; --panel: #202421;
    --soft: #282e29; --field: #252a26; --page: #171a18;
    --accent: #cceb79; --green: #9aca8f; --blue: #87bec7; --gold: #c8ac72; --violet: #9eae88;
    --shadow: 0 12px 36px #0002; --on-primary: #20261b; --primary: #d4f568;
  }
}
html:root body.ui-v4 { margin: 0; background: var(--page) !important; color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; font-weight: 400; line-height: 1.6; letter-spacing: 0; }
html:root .ui-v4 [hidden] { display: none !important; }
html:root .ui-v4 :is(h1,h2,h3,p) { letter-spacing: 0; }
html:root .ui-v4 h1 { font-size: 28px; font-weight: 650; line-height: 1.35; }
html:root .ui-v4 h2 { font-size: 20px; font-weight: 650; }
html:root .ui-v4 h3 { font-size: 15px; font-weight: 600; }
html:root .ui-v4 :is(button,input,select,textarea) { font-family: inherit; letter-spacing: 0; }
html:root .ui-v4 :is(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),select,textarea) { min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--ink); font-size: 13px; font-weight: 450; box-shadow: none; }
html:root .ui-v4 input::placeholder, html:root .ui-v4 textarea::placeholder { color: var(--muted); opacity: .8; font-weight: 400; }
html:root .ui-v4 label { font-size: 12px; color: var(--muted); font-weight: 500; }
html:root .ui-v4 :is(input[type="checkbox"],input[type="range"]) { accent-color: var(--green); }
html:root .ui-v4 :is(.primary-button,.ghost-button,.danger-button,.icon-button,.tile-action) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 9px 15px; font-size: 13px; font-weight: 550; border-radius: 6px; white-space: nowrap; line-height: 1.4; text-decoration: none; box-shadow: none; transition: background .16s, border-color .16s, transform .16s; }
html:root .ui-v4 .primary-button { background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary); }
html:root .ui-v4 :is(.ghost-button,.icon-button,.tile-action) { color: var(--ink); background: var(--panel); border: 1px solid var(--line); }
html:root .ui-v4 .danger-button { color: #b44640; background: #fcece9; border: 1px solid #efcfca; }
html:root .ui-v4 :is(.ghost-button,.icon-button,.tile-action):hover { background: var(--soft); border-color: var(--muted); }
html:root .ui-v4 .primary-button:hover { filter: brightness(1.12); transform: translateY(-1px); }
html:root .ui-v4 :is(.primary-button,.ghost-button,.icon-button):active { transform: translateY(1px); }
html:root .ui-v4 button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
html:root .ui-v4 .icon-button { width: 38px; height: 38px; min-width: 38px; padding: 9px; }
html:root .ui-v4 .icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; }
html:root .ui-v4 :focus-visible { outline: 2px solid var(--green); outline-offset: 3px; box-shadow: none; }
html:root .ui-v4 .brand { gap: 11px; color: var(--ink); text-decoration: none; min-width: 0; }
html:root .ui-v4 .brand-logo { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; box-shadow: none; background: none; }
html:root .ui-v4 .brand strong { display: block; color: var(--ink); font-size: 18px; font-weight: 650; line-height: 1.4; }
html:root .ui-v4 .brand small { font-size: 11px; line-height: 1.5; color: var(--muted); font-weight: 400; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
html:root .ui-v4 .topbar { margin: 0; padding: 24px 0; min-height: 86px; gap: 16px; border-bottom: 1px solid var(--line); }
html:root .ui-v4 .top-actions { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
html:root .ui-v4 .top-compact-control { min-height: 38px; background: transparent; border: 0; padding: 0; gap: 8px; border-radius: 0; }
html:root .ui-v4 .top-compact-control label { font-size: 11px; }
html:root .ui-v4 .top-compact-control select { min-height: 38px; padding: 7px 28px 7px 10px; width: auto; min-width: 86px; }
html:root .ui-v4 .page { width: min(1120px, calc(100% - 64px)); max-width: 1120px; padding: 0; margin: 0 auto; }
html:root .ui-v4 .workspace { display: block; width: min(880px,100%); margin: 56px auto 0; padding: 0; }
html:root .ui-v4 .intro-panel { display: block; min-height: 0; background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; margin: 0 0 28px; text-align: left; overflow: visible; }
html:root .ui-v4 .intro-panel h1 { margin: 10px 0 12px; max-width: 100%; font-size: 34px; font-weight: 650; overflow-wrap: anywhere; }
html:root .ui-v4 .intro-panel > p:not(.eyebrow) { font-size: 14px; color: var(--muted); margin: 0; max-width: 700px; line-height: 1.8; }
html:root .ui-v4 .intro-panel .eyebrow { display: inline; padding: 0; font-size: 11px; font-weight: 500; border: 0; background: none; color: var(--green); box-shadow: none; }
html:root .ui-v4 .intro-panel :is(.accent-strip,.kinetic-grid,.scan-beam,.signal-stack,.ticker-rail), html:root .ui-v4 .drop-frame, html:root .ui-v4 .drop-icon { display: none; }
html:root .ui-v4 .intro-panel :is(h1,p):empty { display: none; }
html:root .ui-v4 .metrics { display: flex; gap: 20px; margin: 18px 0 0; padding: 0; }
html:root .ui-v4 .metrics span { display: inline; background: none; padding: 0; border: 0; box-shadow: none; font-size: 11px; color: var(--muted); }
html:root .ui-v4 .metrics span:last-child { display: none; }
html:root .ui-v4 .metrics b { font-weight: 600; color: var(--ink); }
html:root .ui-v4 .upload-panel { display: block; width: 100%; padding: 0; margin: 0; background: none !important; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
html:root .ui-v4 .dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 330px; padding: 36px 24px; border: 1px dashed var(--line); border-radius: 8px; background: var(--panel) !important; box-shadow: none; transform: none; cursor: pointer; overflow: hidden; transition: border-color .2s, background .2s; }
html:root .ui-v4 .dropzone::before, html:root .ui-v4 .dropzone::after, html:root .ui-v4 .dropzone p::after { content: none; display: none; }
html:root .ui-v4 .dropzone:hover, html:root .ui-v4 .dropzone.dragging { border-color: var(--green); background: var(--soft) !important; box-shadow: none; transform: none; }
html:root .ui-v4 .upload-emblem { position: relative; display: grid; place-items: center; width: 84px; height: 84px; margin: 0 0 24px; transform: perspective(400px) rotateX(var(--tilt-y,0deg)) rotateY(var(--tilt-x,0deg)) rotate(-7deg); transition: transform .25s; }
html:root .ui-v4 .upload-emblem::before { content: ""; position: absolute; inset: 5px -5px -5px 5px; border: 1px solid var(--line); border-radius: 22px; transform: rotate(14deg); }
html:root .ui-v4 .upload-emblem img { width: 76px; height: 76px; position: relative; filter: drop-shadow(0 8px 10px #25322112); }
html:root .ui-v4 .dropzone:hover .upload-emblem { transform: perspective(400px) rotateX(var(--tilt-y,0deg)) rotateY(var(--tilt-x,0deg)) rotate(0deg) translateY(-4px); }
html:root .ui-v4 .dropzone h2 { font-size: 20px; line-height: 1.5; font-weight: 550; margin: 0 0 10px; }
html:root .ui-v4 .dropzone p { font-size: 12px; font-weight: 400; color: var(--muted); margin: 0; line-height: 1.8; }
html:root .ui-v4.upload-has-files .dropzone { min-height: 180px; padding: 24px; }
html:root .ui-v4.upload-has-files .upload-emblem { width: 48px; height: 48px; margin-bottom: 14px; }
html:root .ui-v4.upload-has-files .upload-emblem img { width: 44px; height: 44px; }
html:root .ui-v4.upload-has-files .upload-emblem::before { border-radius: 13px; }
html:root .ui-v4 .queue-panel { padding: 24px 0 0; border: 0; background: none; box-shadow: none; border-radius: 0; margin: 0; }
html:root .ui-v4 .queue-head { margin-bottom: 12px; }
html:root .ui-v4 .queue-head h2 { font-size: 15px; margin: 0; }
html:root .ui-v4 .queue-head p { font-size: 11px; margin: 3px 0 0; color: var(--muted); font-weight: 400; }
html:root .ui-v4 .queue-item { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: none; min-height: 80px; }
html:root .ui-v4 .queue-item::before { background: color-mix(in srgb, var(--accent) 24%, transparent); }
html:root .ui-v4 .queue-item strong { font-size: 13px; font-weight: 550; }
html:root .ui-v4 .queue-item small { font-size: 11px; }
html:root .ui-v4 .queue-item.done { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
html:root .ui-v4 .queue-item.done::before { opacity: .2; }
html:root .ui-v4 footer { font-size: 11px; color: var(--muted); margin: 32px 0 24px; text-align: center; }
html:root .ui-v4 .dashboard-shell { width: min(1320px, calc(100% - 64px)); padding: 0; margin: 0 auto; }
html:root .ui-v4 .dashboard-nav { width: 100%; display: flex; gap: 28px; margin: 12px 0 28px; padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
html:root .ui-v4 .dashboard-nav button { display: flex; gap: 8px; align-items: center; justify-content: center; white-space: nowrap; min-height: 48px; padding: 10px 0; font-weight: 500; font-size: 13px; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; }
html:root .ui-v4 .dashboard-nav button.active { background: none; color: var(--ink); border-color: var(--green); }
html:root .ui-v4 :is(.dashboard-nav,.admin-nav) svg { width: 18px; height: 18px; flex: none; }
html:root .ui-v4 :is(.admin-panel,.config-section,.brand-editor) { min-height: 0; border: 0; border-radius: 0; background: none; box-shadow: none; padding: 0; }
html:root .ui-v4 .admin-panel { margin: 0; }
html:root .ui-v4 .config-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
html:root .ui-v4 .section-title { margin: 0 0 24px; }
html:root .ui-v4 .inline-help { font-size: 12px; color: var(--muted); font-weight: 400; }
html:root .ui-v4 .profile-panel { max-width: 760px; }
html:root .ui-v4 .admin-layout { width: 100%; max-width: none; padding: 0; margin: 0; }
html:root .ui-v4 .admin-shell { display: grid; grid-template-columns: 218px minmax(0,1fr); min-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: visible; box-shadow: none; background: var(--page); }
html:root .ui-v4 .admin-side { display: flex; flex-direction: column; gap: 0; position: sticky; top: 0; align-self: start; height: 100dvh; min-height: 0; overflow-y: auto; padding: 28px 16px 20px; background: var(--panel); border-right: 1px solid var(--line); color: var(--ink); }
html:root .ui-v4 .admin-side .brand { padding: 0 8px; margin-bottom: 36px; }
html:root .ui-v4 .admin-side .brand-logo { width: 34px; height: 34px; flex-basis: 34px; }
html:root .ui-v4 .admin-side .brand strong { font-size: 16px; }
html:root .ui-v4 .admin-side .brand small { font-size: 10px; }
html:root .ui-v4 .admin-nav { display: flex; flex-direction: column; gap: 5px; margin: 0; overflow: visible; }
html:root .ui-v4 .admin-nav button { display: flex; align-items: center; gap: 11px; min-height: 42px; width: 100%; padding: 10px 13px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; text-align: left; box-shadow: none; white-space: nowrap; }
html:root .ui-v4 .admin-nav button:hover { background: var(--soft); color: var(--ink); }
html:root .ui-v4 .admin-nav button.active { background: var(--soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--green); }
html:root .ui-v4 .admin-nav button.active svg { color: var(--green); }
html:root .ui-v4 .admin-side-note { margin-top: auto; padding: 24px 8px 0; background: none; border: 0; font-size: 10px; color: var(--muted); overflow-wrap: anywhere; }
html:root .ui-v4 .admin-main { width: 100%; min-width: 0; padding: 28px 40px 48px; }
html:root .ui-v4 .admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 0 26px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
html:root .ui-v4 .admin-toolbar h1 { margin: 0; font-size: 25px; }
html:root .ui-v4 .admin-toolbar p { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
html:root .ui-v4 .admin-kicker { display: none; }
html:root .ui-v4 .status-pill { font-size: 10px; font-weight: 500; padding: 5px 8px; background: var(--soft) !important; color: var(--green); border: 1px solid var(--line); border-radius: 4px; }
html:root .ui-v4 :is(.overview-metrics,.user-metrics) { border: 0; border-radius: 0; background: none; gap: 16px; }
html:root .ui-v4 :is(.overview-metrics,.user-metrics) article { border: 1px solid var(--line); border-radius: 8px; padding: 20px; background: var(--panel); }
html:root .ui-v4 :is(.overview-metrics,.user-metrics) strong { font-size: 30px; font-weight: 550; }
html:root .ui-v4 :is(.overview-metrics,.user-metrics) :is(span,small) { font-size: 12px; font-weight: 400; }
html:root .ui-v4 :is(.runtime-strip,.policy-summary,.storage-health-grid) { background: none; border-color: var(--line); border-radius: 6px; }
html:root .ui-v4 .storage-job { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 18px; box-shadow: none; }
html:root .ui-v4 .storage-job strong { font-size: 14px; }
html:root .ui-v4 .storage-job-track { height: 5px; border-radius: 3px; background: var(--line); }
html:root .ui-v4 .storage-job-track i { background: var(--green); }
html:root .ui-v4 .login-shell { width: min(400px,calc(100% - 40px)); border: 0; padding: 36px 0; margin: 80px auto; box-shadow: none; background: none; }
html:root .ui-v4 .login-shell .brand { margin-bottom: 32px; }
html:root .ui-v4 .ag-panel { --ag-accent: var(--green); background: none; padding: 0; }
html:root .ui-v4 .ag-toolbar { padding: 12px 0; margin-bottom: 24px; border-top: 0; }
html:root .ui-v4 .ag-summary .top-actions { margin-left: 12px; flex-wrap: nowrap; gap: 5px; }
html:root .ui-v4 .ag-summary select { padding: 6px 8px; font-size: 12px; max-width: 130px; }
html:root .ui-v4 .ag-day-head h3 { font-size: 16px; }
html:root .ui-v4 .ag-day-head span { font-size: 11px; }
html:root .ui-v4 .ag-wall { gap: 24px 18px; }
html:root .ui-v4 .ag-photo { background: var(--soft); }
html:root .ui-v4 .ag-caption strong { font-weight: 500; }
html:root .ui-v4 .ag-caption > span { font-size: 11px; }
html:root .ui-v4 .ag-caption .ag-owner { display: flex; justify-content: flex-start; align-items: center; gap: 5px; margin-top: 2px; min-width: 0; }
.ag-owner svg { width: 12px; height: 12px; flex: none; }
html:root .ui-v4 .ag-caption .ag-owner span { text-transform: none; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-more { position: absolute; top: 8px; right: 8px; z-index: 2; display: grid; place-items: center; width: 30px; height: 30px; padding: 5px; color: #283026; background: #ffffffed; border: 0; border-radius: 6px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.ag-more svg { width: 19px; height: 19px; }
.ag-tile:hover .ag-more, .ag-tile:focus-within .ag-more { opacity: 1; }
html:root .ui-v4 .ag-motion { top: auto; bottom: 8px; left: 8px; right: auto; }
.ag-context { position: fixed; z-index: 150; width: 216px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); box-shadow: 0 8px 32px #17201126; animation: context-in .12s ease-out; }
.ag-context-name { padding: 6px 9px 10px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-context button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 35px; padding: 7px 9px; color: var(--ink); font-size: 12px; font-weight: 400; text-align: left; border: 0; border-radius: 4px; background: none; cursor: pointer; }
.ag-context button:hover, .ag-context button:focus { background: var(--soft); outline: none; }
.ag-context button svg { width: 16px; height: 16px; color: var(--muted); }
.ag-context [data-context="delete"], .ag-context [data-context="delete"] svg { color: #cd6258; }
.ag-context hr { border: 0; border-top: 1px solid var(--line); margin: 5px; }
@keyframes context-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
html:root .ui-v4 .ag-viewer { background: #151914; color: #ecf0e9; }
html:root .ui-v4 .ag-viewer select { background: #252d21; color: #e6eddf; border-color: #404b38; }
html:root .ui-v4 .ag-details { background: #20271c; }
html:root .ui-v4 .ag-details .ag-url { background: #151914; color: #e6eddf; border-color: #404b38; }
html:root .ui-v4 .ag-viewer-copy [data-ag="copy"] { background: #d4f568; color: #283026; }
html:root .ui-v4 .ag-viewer-foot { margin: 0; text-align: left; }
@media (hover: none) { .ag-more { opacity: 1; } }
@media (max-width: 1100px) {
  html:root .ui-v4 .admin-shell { grid-template-columns: 188px minmax(0,1fr); }
  html:root .ui-v4 .admin-main { padding: 24px; }
  html:root .ui-v4 .admin-toolbar { align-items: flex-start; flex-wrap: wrap; }
  html:root .ui-v4 :is(.overview-metrics,.user-metrics) { gap: 12px; }
}
@media (max-width: 760px) {
  html:root .ui-v4 .page, html:root .ui-v4 .dashboard-shell { width: calc(100% - 32px); }
  html:root .ui-v4 .topbar { padding: 18px 0; min-height: 76px; }
  html:root .ui-v4.mode-classic .topbar { flex-direction: row; align-items: center; flex-wrap: wrap; }
  html:root .ui-v4.mode-classic .topbar .brand small { display: none; }
  html:root .ui-v4 .brand small { max-width: 190px; white-space: nowrap; }
  html:root .ui-v4 .workspace { margin-top: 32px; }
  html:root .ui-v4 .intro-panel h1 { font-size: 27px; }
  html:root .ui-v4 .intro-panel > p:not(.eyebrow) { font-size: 12px; }
  html:root .ui-v4 .dropzone { min-height: 310px; padding: 28px 16px; }
  html:root .ui-v4 .dropzone h2 { font-size: 18px; }
  html:root .ui-v4 .dropzone p { max-width: 260px; }
  html:root .ui-v4 .admin-shell { display: block; }
  html:root .ui-v4 .admin-side { position: sticky; top: 0; height: auto; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: row; align-items: center; gap: 12px; overflow: hidden; z-index: 20; }
  html:root .ui-v4 .admin-side .brand { padding: 0; margin: 0; flex: none; }
  html:root .ui-v4 .admin-side .brand span { display: none; }
  html:root .ui-v4 .admin-side .brand-logo { width: 30px; height: 30px; flex-basis: 30px; }
  html:root .ui-v4 .admin-nav { display: flex; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  html:root .ui-v4 .admin-nav button { width: auto; flex: none; min-height: 36px; padding: 8px 10px; font-size: 12px; gap: 6px; }
  html:root .ui-v4 .admin-nav svg { width: 15px; height: 15px; }
  html:root .ui-v4 .admin-side-note { display: none; }
  html:root .ui-v4 .admin-main { padding: 22px 16px 36px; }
  html:root .ui-v4 .admin-toolbar { margin-bottom: 20px; padding-bottom: 20px; }
  html:root .ui-v4 .admin-toolbar h1 { font-size: 23px; }
  html:root .ui-v4 .admin-toolbar .top-actions { gap: 6px; }
  html:root .ui-v4 .admin-toolbar .top-actions .ghost-button { padding: 8px 10px; font-size: 12px; }
  html:root .ui-v4 .dashboard-nav { gap: 12px; margin-bottom: 24px; }
  html:root .ui-v4 .dashboard-nav button { flex: 1; gap: 6px; font-size: 12px; }
  html:root .ui-v4 .dashboard-nav svg { width: 16px; height: 16px; }
  html:root .ui-v4 .ag-wall { gap: 20px 12px; }
  html:root .ui-v4 .ag-panel { padding: 0 !important; }
  html:root .ui-v4 .admin-tab .ag-toolbar { flex-wrap: wrap; }
  html:root .ui-v4 .admin-tab .ag-summary { width: 100%; }
  html:root .ui-v4 .admin-tab .ag-summary .top-actions { margin-left: auto; }
  html:root .ui-v4 .admin-tab .ag-tools { margin-left: auto; }
  html:root .ui-v4 :is(.overview-metrics,.user-metrics) { grid-template-columns: repeat(2,minmax(0,1fr)); }
  html:root .ui-v4 :is(.overview-metrics,.user-metrics) article { padding: 14px; }
  html:root .ui-v4 :is(.overview-metrics,.user-metrics) strong { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  html:root .ui-v4 *, html:root .ui-v4 *::before { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  html:root .ui-v4 .upload-emblem { transform: none !important; }
}
