:root {
  color-scheme: light;
  --navy: #071a42;
  --navy-2: #0d2c66;
  --blue: #1f65d6;
  --blue-soft: #eaf2ff;
  --ink: #172033;
  --muted: #637087;
  --line: #dfe5ee;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --success: #0d7a4c;
  --danger: #b42318;
  --shadow: 0 12px 32px rgba(13, 37, 73, .08);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; }
a { color: inherit; }
button, input { font: inherit; }

.shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: 64px; padding: 0 max(20px, calc((100% - 1180px) / 2)); display: flex; align-items: center; gap: 28px;
  background: var(--navy); color: #fff; box-shadow: 0 3px 14px rgba(7, 26, 66, .2);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #ff7b22; color: #fff; }
.nav { display: flex; align-items: stretch; height: 64px; gap: 4px; }
.nav a { display: flex; align-items: center; padding: 0 15px; color: #cbd7ef; text-decoration: none; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a.active { color: #fff; border-bottom-color: #4d91ff; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; color: #dfe7f7; }
.link-button { border: 0; background: transparent; color: inherit; padding: 6px; cursor: pointer; }
.link-button:hover { color: #fff; text-decoration: underline; }

.main { width: min(1180px, calc(100% - 40px)); margin: 30px auto 56px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.page-head h1 { margin: 0 0 7px; font-size: 26px; line-height: 1.25; }
.page-head p { margin: 0; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 22px; }
.card h2 { margin: 0 0 6px; font-size: 18px; }
.card-subtitle { margin: 0 0 20px; color: var(--muted); line-height: 1.6; }
.metric { font-size: 32px; font-weight: 800; color: var(--navy-2); margin-top: 14px; }
.metric-label { color: var(--muted); }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label, .label { font-weight: 700; font-size: 13px; color: #354158; }
.field input[type="text"], .field input[type="password"], .field input[type="file"], .field input[type="datetime-local"] {
  width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cbd4e1; border-radius: 8px; background: #fff; color: var(--ink);
}
.field input:focus { outline: 3px solid rgba(31, 101, 214, .14); border-color: var(--blue); }
.hint { color: var(--muted); font-size: 12px; line-height: 1.55; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 10px 0 18px; }
.check { display: inline-flex; align-items: center; gap: 7px; color: #354158; }
.check input { width: 16px; height: 16px; }
.button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn { min-height: 40px; border: 0; border-radius: 8px; padding: 9px 15px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1657bc; }
.btn-secondary { background: var(--blue-soft); color: #174f9e; }
.btn-ghost { background: #fff; color: #43506a; border: 1px solid var(--line); }
.btn-danger { background: #fff1f0; color: var(--danger); border: 1px solid #f2b8b3; }
.btn-small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.btn:disabled { cursor: not-allowed; opacity: .48; }

.notice { border-radius: 9px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid; }
.notice-success { color: var(--success); background: #ecfdf5; border-color: #a7e3c8; }
.notice-error { color: var(--danger); background: #fff1f0; border-color: #f2b8b3; }
.notice-info { color: #174f9e; background: var(--blue-soft); border-color: #bfd3f4; }
.compact-notice { margin: -4px 0 14px; padding: 9px 11px; font-size: 12px; }

.preview-frame { border: 1px solid #bfc9d8; border-radius: 9px; overflow: hidden; background: #fff; }
.preview-frame iframe { display: block; width: 100%; height: 60px; border: 0; }
.live-bar { position: relative; display: flex; container-type: size; width: 100%; height: auto; aspect-ratio: var(--preview-ratio); overflow: hidden; }
.live-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.live-art { position: relative; display: flex; align-items: center; flex: 0 0 auto; min-width: 0; height: 100%; overflow: hidden; }
.live-art img { display: block; width: 100%; height: 100%; object-fit: fill; }
.live-phones { position: relative; display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: center; min-width: 0; height: 100%; margin: 0; padding: 13.3333cqh 16.6667cqh; font-size: 20cqh; line-height: 36.6667cqh; white-space: nowrap; }
.live-phones b { display: block; }
.asset-preview { display: block; width: 100%; height: 100%; object-fit: contain; border: 0; background: transparent; }
.asset-meta { display: flex; justify-content: space-between; gap: 14px; margin: 10px 0 16px; color: var(--muted); font-size: 12px; }

.image-manager { padding: 0; overflow: hidden; }
.image-section + .image-section { border-top: 1px solid var(--line); }
.image-manager-head { padding: 16px 22px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.image-manager-head h2 { margin-bottom: 5px; }
.image-manager-head p { margin: 0; color: var(--muted); line-height: 1.6; }
.current-tag { flex: 0 0 auto; align-self: flex-start; margin: 0; white-space: nowrap; }
.drop-zone { display: block; margin-top: 10px; cursor: pointer; outline: none; }
.drop-zone:focus-visible .image-stage { outline: 3px solid rgba(31, 101, 214, .25); outline-offset: -3px; }
.image-stage { position: relative; display: grid; place-items: center; height: 72px; padding: 6px 22px; overflow: hidden; background: linear-gradient(45deg, #eef2f7 25%, transparent 25%), linear-gradient(-45deg, #eef2f7 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eef2f7 75%), linear-gradient(-45deg, transparent 75%, #eef2f7 75%), #f9fbfd; background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.background-image-section .image-stage { height: 82px; }
.background-image-section .asset-visual { max-height: 68px; }
.asset-visual { position: relative; display: block; width: min(100%, var(--asset-width)); aspect-ratio: var(--asset-ratio); max-height: 60px; overflow: hidden; }
.drop-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 8px 12px; border-radius: 3px; color: #fff; background: rgba(7, 26, 66, .82); opacity: 0; transition: opacity .18s ease; pointer-events: none; }
.drop-zone:hover .drop-hint, .drop-zone:focus .drop-hint, .drop-zone.is-dragover .drop-hint { opacity: 1; }
.drop-zone.is-dragover .image-stage { outline: 3px dashed var(--blue); outline-offset: -8px; background-color: var(--blue-soft); }
.drop-zone.is-uploading { pointer-events: none; opacity: .65; }
.file-input-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.image-manager .asset-meta { margin: 0; padding: 9px 22px 13px; border-top: 0; }
.color-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.color-dot { width: 15px; height: 15px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); box-shadow: 0 0 0 3px #fff; }

.text-style-control { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto auto; align-items: center; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.banner-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.banner-preview-head .card-subtitle { margin-bottom: 20px; }
.draft-apply-actions { display: inline-flex; align-items: center; gap: 8px; }
.text-style-copy { display: grid; gap: 4px; }
.mode-switch { display: inline-flex; align-items: center; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #f5f7fa; }
.mode-switch label { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 10px; border-radius: 6px; color: #43506a; cursor: pointer; }
.mode-switch label:has(input:checked) { color: #174f9e; background: #fff; box-shadow: 0 1px 4px rgba(13,37,73,.12); }
.mode-switch input { width: 14px; height: 14px; margin: 0; }
.color-picker { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; color: #43506a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; cursor: pointer; }
.color-picker input[type="color"] { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.text-style-control.is-auto .color-picker { opacity: .55; }

.history-block { margin-top: 20px; padding: 0; }
.history-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 22px; cursor: pointer; list-style: none; }
.history-summary::-webkit-details-marker { display: none; }
.history-summary > span:first-child { display: grid; gap: 4px; }
.history-summary strong { font-size: 16px; }
.history-summary small { color: var(--muted); font-size: 12px; font-weight: 400; }
.history-toggle-label::before { content: "展开"; color: #174f9e; font-size: 12px; font-weight: 700; }
.history-toggle-label::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 9px; border-right: 2px solid #55708f; border-bottom: 2px solid #55708f; transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; }
.history-block[open] .history-summary { border-bottom: 1px solid var(--line); }
.history-block[open] .history-toggle-label::before { content: "收起"; }
.history-block[open] .history-toggle-label::after { transform: rotate(225deg) translate(-1px, -1px); }
.history-body { padding: 18px 22px 22px; }
.version-list { display: grid; gap: 10px; }
.version-card { display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.version-combo-stage { padding: 18px; overflow: hidden; background: #eef2f7; }
.version-combo { border: 1px solid #bfc9d8; border-radius: 7px; }
.version-info { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(230px, auto) auto; align-items: center; gap: 16px; min-width: 0; padding: 13px 16px; border-top: 1px solid var(--line); }
.version-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.version-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-name .tag { flex: 0 0 auto; margin: 0; font-weight: 400; }
.version-detail { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.version-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.version-actions .btn { min-height: 32px; padding: 5px 10px; font-size: 12px; }

.low-frequency { margin-top: 20px; padding: 0; }
.low-frequency summary { padding: 18px 22px; cursor: pointer; font-weight: 800; font-size: 16px; list-style-position: inside; }
.low-frequency[open] summary { border-bottom: 1px solid var(--line); }
.low-frequency-body { padding: 20px 22px 22px; }
.compact-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; align-items: end; gap: 14px; }
.compact-form .field { margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #48556c; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.tag { display: inline-flex; padding: 3px 8px; border-radius: 99px; background: var(--blue-soft); color: #174f9e; font-size: 12px; margin: 1px 4px 1px 0; }
.tag-off { background: #f2f4f7; color: #667085; }
.user-management-grid { align-items: start; }
.user-list { display: grid; gap: 14px; min-width: 0; }
.user-account { padding: 0; overflow: visible; scroll-margin-top: 84px; }
.user-summary { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(250px, 1fr) auto; align-items: center; gap: 18px; padding: 18px 20px; cursor: pointer; list-style: none; }
.user-account:not([open]) > .user-summary { border-radius: 14px; }
.user-summary::-webkit-details-marker { display: none; }
.user-summary:hover { background: #fbfcfe; }
.user-summary:focus-visible { outline: 3px solid rgba(31, 101, 214, .2); outline-offset: -3px; }
.user-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-identity > span:last-child { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 9px; min-width: 0; }
.user-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.user-identity code { color: var(--muted); }
.user-identity small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.user-avatar { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 11px; background: var(--blue-soft); color: #174f9e; font-size: 17px; font-weight: 800; }
.user-overview { display: grid; gap: 6px; min-width: 0; }
.user-statuses, .permission-summary { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.permission-tag { background: #f2f6fb; color: #43506a; }
.tag-warning { background: #fff7e6; color: #9a5b00; }
.user-edit-label { display: inline-flex; align-items: center; justify-content: flex-end; gap: 9px; min-width: 92px; color: #174f9e; font-size: 13px; font-weight: 700; }
.user-edit-action::before { content: "编辑账号"; }
.user-edit-label i { width: 7px; height: 7px; border-right: 2px solid #55708f; border-bottom: 2px solid #55708f; transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; }
.user-account[open] .user-summary { border-radius: 14px 14px 0 0; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.user-account[open] .user-edit-action::before { content: "收起编辑"; }
.user-account[open] .user-edit-label i { transform: rotate(225deg) translate(-1px, -1px); }
.user-edit-body { padding: 20px; border-radius: 0 0 14px 14px; background: var(--surface); }
.edit-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.edit-section-head h3 { margin: 0 0 5px; font-size: 15px; }
.edit-section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.permission-editor { margin-top: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-head h2 { margin: 0 0 6px; font-size: 18px; }
.section-head p { margin: 0; color: var(--muted); line-height: 1.6; }
.app-ad-page { display: grid; gap: 20px; }
.app-ad-page .page-head { margin-bottom: 2px; }
.app-ad-page > .notice { margin-bottom: 0; }
.app-ad-status-grid { gap: 16px; }
.app-ad-status-grid .card { padding: 18px 20px; }
.app-ad-status-grid .metric { margin: 8px 0 5px; font-size: 28px; }
.manifest-state { min-height: 35px; margin: 10px 0 8px; display: flex; align-items: center; }
.tag-live { background: #e9f8f0; color: var(--success); }
.app-carousel { padding-bottom: 18px; }
.carousel-workbench { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .9fr); gap: 16px; align-items: start; }
.live-carousel-preview { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #f6f8fb; }
.live-carousel-stage { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #e9eef5; }
.live-carousel-stage figure { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity .35s ease; pointer-events: none; }
.live-carousel-stage figure.is-active { opacity: 1; pointer-events: auto; }
.live-carousel-stage img { display: block; width: 100%; height: 100%; object-fit: contain; background: #eef2f7; }
.live-carousel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 11px 8px 14px; background: #fff; }
.live-carousel-toolbar > span:first-child { display: flex; align-items: baseline; gap: 9px; }
.live-carousel-toolbar small { color: var(--muted); }
.preview-actions { display: flex; gap: 6px; }
.carousel-preview-empty { display: grid; place-content: center; justify-items: center; gap: 6px; aspect-ratio: 4 / 3; color: var(--muted); background: #f7f9fc; }
.carousel-preview-empty strong { color: var(--ink); }
.carousel-order-panel { min-width: 0; }
.carousel-order-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 32px; margin-bottom: 7px; }
.carousel-order-head > span { display: grid; gap: 2px; }
.carousel-order-head small { color: var(--muted); font-size: 12px; }
.carousel-order-panel.is-dirty { padding: 10px; border: 1px solid #bad3f7; border-radius: 11px; background: #f5f9ff; }
.carousel-order-panel.is-dirty .carousel-order-head small { color: var(--blue); font-weight: 700; }
.carousel-order-list { display: grid; gap: 9px; }
.carousel-order-item { display: grid; grid-template-columns: 28px 64px minmax(82px, 1fr) auto auto; align-items: center; gap: 9px; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
.carousel-order-item img { display: block; width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: #eef2f7; }
.order-number { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; }
.carousel-order-copy { display: grid; gap: 3px; min-width: 0; }
.carousel-order-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carousel-order-copy small { color: var(--muted); }
.order-actions { display: flex; gap: 6px; }
.library-head { margin: 4px 0 14px; }
.app-image-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.app-image-card { padding: 0; overflow: hidden; scroll-margin-top: 142px; }
.app-image-preview { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #e9eef5; }
.app-image-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.app-image-preview .lightbox-trigger { cursor: zoom-in; transition: transform .2s ease, filter .2s ease; }
.app-image-preview:hover .lightbox-trigger { transform: scale(1.018); filter: brightness(.94); }
.app-image-preview .lightbox-trigger:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
.image-state { position: absolute; top: 9px; right: 9px; box-shadow: 0 2px 8px rgba(13,37,73,.16); }
.image-dimensions { position: absolute; left: 9px; bottom: 9px; padding: 3px 7px; border-radius: 5px; background: rgba(7,26,66,.78); color: #fff; font-size: 11px; }
.app-image-settings { padding: 10px 11px 11px; }
.app-image-quick-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.carousel-check { min-width: 0; margin: 0; font-size: 13px; font-weight: 700; }
.compact-schedule { margin-top: 8px; border-top: 1px solid var(--line); }
.compact-schedule summary { padding-top: 8px; color: var(--muted); font-size: 12px; cursor: pointer; }
.schedule-grid { display: grid; grid-template-columns: 1fr; gap: 7px; padding-top: 9px; }
.schedule-grid .field { gap: 4px; margin: 0; }
.app-image-card .schedule-grid input[type="datetime-local"] { min-height: 34px; padding: 5px 7px; border-radius: 6px; font-size: 12px; }
.delete-image-form { position: absolute; right: 9px; bottom: 9px; margin: 0; }
.delete-image-form .btn { min-height: 27px; padding: 3px 8px; background: rgba(255,255,255,.94); box-shadow: 0 2px 8px rgba(13,37,73,.14); }
.floating-file-input { position: fixed; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.floating-upload-button { position: fixed; right: 28px; bottom: 28px; z-index: 80; display: inline-flex; align-items: center; gap: 9px; min-height: 48px; padding: 10px 18px; border-radius: 24px; background: var(--blue); color: #fff; box-shadow: 0 10px 28px rgba(23,79,158,.3); cursor: pointer; transition: transform .16s ease, box-shadow .16s ease; }
.floating-upload-button:hover { transform: translateY(-2px); box-shadow: 0 13px 32px rgba(23,79,158,.36); }
.floating-upload-button span { font-size: 22px; line-height: 1; }
.floating-upload-form.is-uploading .floating-upload-button { pointer-events: none; opacity: .7; }
.floating-upload-form.is-uploading .floating-upload-button strong { font-size: 0; }
.floating-upload-form.is-uploading .floating-upload-button strong::after { content: "上传中…"; font-size: 14px; }
.app-drop-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 28px; background: rgba(7,26,66,.68); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .14s ease, visibility .14s ease; }
.app-drop-overlay.is-visible { opacity: 1; visibility: visible; }
.app-drop-overlay > div { display: grid; justify-items: center; gap: 9px; width: min(520px, 100%); padding: 52px 24px; border: 2px dashed rgba(255,255,255,.8); border-radius: 20px; background: rgba(13,48,109,.92); color: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
.app-drop-overlay strong { font-size: 24px; }
.app-drop-overlay span { color: #d9e5f8; }
.lightbox-open { overflow: hidden; }
.app-image-lightbox { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 64px 28px 28px; background: rgba(3,12,31,.88); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .16s ease, visibility .16s ease; }
.app-image-lightbox.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }
.app-image-lightbox img { display: block; max-width: min(1200px, 94vw); max-height: calc(100vh - 92px); width: auto; height: auto; object-fit: contain; border-radius: 10px; background: #fff; box-shadow: 0 28px 90px rgba(0,0,0,.45); }
.lightbox-close { position: fixed; top: 20px; right: 24px; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.36); border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,.22); }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(420px, 520px); background: var(--navy); }
.login-visual { padding: 64px; display: flex; flex-direction: column; justify-content: flex-end; color: #fff; background: radial-gradient(circle at 18% 18%, #174f9e 0, transparent 35%), linear-gradient(135deg, #071a42, #0c2e6d); }
.login-visual h1 { max-width: 600px; margin: 0 0 14px; font-size: clamp(34px, 5vw, 62px); line-height: 1.05; }
.login-visual p { max-width: 560px; color: #c8d6ef; font-size: 16px; line-height: 1.8; }
.login-panel { background: #fff; padding: 56px; display: flex; align-items: center; }
.login-card { width: 100%; }
.login-card h2 { margin: 0 0 8px; font-size: 28px; }
.login-card > p { color: var(--muted); margin: 0 0 28px; }
.login-card .btn { width: 100%; }
.login-simple { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: #f2f5f9; }
.login-card-compact, .totp-card { width: min(100%, 420px); padding: 30px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 18px 50px rgba(13, 37, 73, .12); }
.login-card-compact h1, .totp-card h1 { margin: 22px 0 22px; font-size: 26px; }
.login-card-compact > p { margin: -12px 0 22px; color: var(--muted); }
.login-brand { display: flex; align-items: center; gap: 10px; color: var(--navy); font-weight: 800; }
.totp-card { width: min(100%, 680px); }
.totp-card h1 { margin-bottom: 8px; }
.totp-setup-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: center; gap: 24px; margin: 22px 0; }
.totp-qr { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.totp-qr img { display: block; width: 100%; aspect-ratio: 1; }
.totp-manual p { color: var(--muted); line-height: 1.7; }
.secret-copy { display: grid; gap: 10px; }
.secret-copy code { display: block; overflow-wrap: anywhere; padding: 12px; border-radius: 8px; background: #f3f6fa; color: var(--navy); font-size: 15px; line-height: 1.7; letter-spacing: .08em; }
.secret-copy .btn { justify-self: start; }
.totp-code-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.totp-code-form .field { margin: 0; }
.totp-code-form .btn { min-height: 42px; }
.trusted-device-option { align-items: flex-start; margin: 2px 0 18px; }
.trusted-device-option span { display: grid; gap: 3px; }
.trusted-device-option small { color: var(--muted); font-weight: 400; line-height: 1.5; }

.empty { color: var(--muted); padding: 22px 0; text-align: center; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }

@media (min-width: 821px) {
  .user-account[open] > .user-summary { position: sticky; top: 64px; z-index: 20; }
}

@media (max-width: 820px) {
  .topbar { height: auto; min-height: 64px; padding: 12px; flex-wrap: wrap; gap: 8px 18px; }
  .nav { order: 3; width: 100%; height: 44px; overflow-x: auto; }
  .nav a { padding: 0 10px; white-space: nowrap; }
  .main { width: min(100% - 24px, 1180px); margin-top: 20px; }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
  .two-col { grid-template-columns: 1fr; }
  .user-management-grid { display: block; }
  .create-user-card { margin-bottom: 16px; }
  .user-summary { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 16px; }
  .user-overview { grid-column: 1 / -1; }
  .user-edit-body { padding: 16px; }
  .app-ad-page .page-head { display: grid; }
  .app-ad-page .page-head .btn { justify-self: start; }
  .carousel-workbench { grid-template-columns: 1fr; }
  .app-image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .carousel-order-item { grid-template-columns: 30px 72px minmax(0, 1fr) auto; gap: 9px; }
  .carousel-order-item img { width: 72px; height: 54px; }
  .carousel-order-item > .tag { grid-column: 3; justify-self: start; }
  .order-actions { grid-column: 4; grid-row: 1 / span 2; }
  .compact-form, .text-style-control { grid-template-columns: 1fr; }
  .image-stage { height: 68px; padding: 5px 12px; }
  .background-image-section .image-stage { height: 76px; }
  .image-manager-head, .image-manager .asset-meta { padding-left: 14px; padding-right: 14px; }
  .color-status { max-width: 48%; justify-content: flex-end; text-align: right; }
  .version-info { grid-template-columns: 1fr; gap: 8px; }
  .login-shell { grid-template-columns: 1fr; background: #fff; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 28px; }
}

@media (max-width: 560px) {
  .login-simple { padding: 18px; }
  .login-card-compact, .totp-card { padding: 24px 20px; }
  .totp-setup-grid, .totp-code-form { grid-template-columns: 1fr; }
  .totp-qr { width: min(220px, 100%); justify-self: center; }
  .app-image-grid { grid-template-columns: 1fr; }
  .floating-upload-button { right: 16px; bottom: 16px; min-height: 44px; padding: 8px 14px; }
}
