:root {
  --black: #0d0d0d;
  --ink: #12110f;
  --panel: #171511;
  --panel-2: #1e1a14;
  --line: rgba(217, 185, 126, .16);
  --line-strong: rgba(217, 185, 126, .34);
  --gold-dark: #a68444;
  --gold: #bfa065;
  --gold-light: #d9b97e;
  --copper: #a67e4e;
  --white: #f8f6f0;
  --muted: #99958b;
  --danger: #ff7a74;
  --success: #bfa065;
  --shadow: 0 26px 80px rgba(0, 0, 0, .45);
  --radius: 18px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--black); scroll-behavior: smooth; }
body { min-height: 100dvh; margin: 0; background: var(--black); color: var(--white); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
img, video { max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--gold); color: var(--black); }

.boot-screen { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--muted); font-size: 13px; letter-spacing: .08em; }
.boot-screen img { width: 64px; height: 64px; animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.05); filter: drop-shadow(0 0 22px rgba(191, 160, 101, .45)); } }

.button, .icon-button, .text-button { border: 0; cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 11px; padding: 0 17px; font-size: 12px; font-weight: 800; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: var(--black); box-shadow: 0 12px 35px rgba(166, 132, 68, .18); }
.button-secondary { border: 1px solid var(--line-strong); background: rgba(255,255,255,.025); color: var(--white); }
.button-danger { border: 1px solid rgba(255,122,116,.28); background: rgba(255,122,116,.06); color: #ffaaa6; }
.text-button { padding: 0; background: none; color: var(--gold-light); font-size: 11px; font-weight: 800; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 11px; display: grid; place-items: center; }
.icon-button:hover { border-color: var(--line-strong); color: var(--gold-light); }
.kicker { display: inline-flex; color: var(--gold-light); font-size: 9px; font-weight: 900; letter-spacing: .2em; text-transform: uppercase; }
.muted { color: var(--muted); }
.empty-state { min-height: 230px; border: 1px dashed var(--line-strong); border-radius: var(--radius); display: grid; place-content: center; justify-items: center; padding: 30px; text-align: center; background: rgba(255,255,255,.015); }
.empty-state img { width: 58px; height: 58px; margin-bottom: 18px; opacity: .9; }
.empty-state h3 { margin: 0 0 8px; font-size: 19px; }
.empty-state p { max-width: 420px; margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.field { display: grid; gap: 8px; }
.field > span { color: #c8c3b7; font-size: 10px; font-weight: 750; }
.field input, .field textarea, .field select, .search-input { width: 100%; border: 1px solid var(--line); outline: 0; background: #11100e; color: var(--white); border-radius: 11px; padding: 0 13px; transition: border-color .18s, box-shadow .18s; }
.field input, .field select, .search-input { height: 46px; }
.field textarea { min-height: 96px; padding-top: 12px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .search-input:focus { border-color: rgba(217,185,126,.55); box-shadow: 0 0 0 3px rgba(191,160,101,.08); }
.field small { color: #77736b; font-size: 9px; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-error { border: 1px solid rgba(255,122,116,.24); background: rgba(255,122,116,.06); color: #ffaaa6; border-radius: 10px; padding: 11px 12px; font-size: 11px; }

/* Login */
.login-screen { min-height: 100dvh; display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(420px, .85fr); background: var(--black); }
.login-visual { position: relative; min-height: 100dvh; overflow: hidden; padding: clamp(32px, 5vw, 70px); display: flex; flex-direction: column; justify-content: space-between; isolation: isolate; }
.login-visual::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(0,0,0,.05), rgba(0,0,0,.72)), repeating-linear-gradient(90deg, transparent 0 79px, rgba(217,185,126,.045) 80px), repeating-linear-gradient(0deg, transparent 0 79px, rgba(217,185,126,.045) 80px); z-index: -3; }
.login-visual::after { content: ""; position: absolute; width: 78vw; aspect-ratio: 1; border-radius: 50%; right: -50vw; top: -22vw; background: radial-gradient(circle at 32% 45%, var(--gold-light), var(--gold) 22%, var(--copper) 40%, transparent 66%); filter: blur(5px); opacity: .85; z-index: -2; }
.login-orbit { position: absolute; width: 68vw; height: 25vw; right: -35vw; top: 23vw; border: 1px solid rgba(217,185,126,.28); border-radius: 50%; transform: rotate(-14deg); z-index: -1; }
.login-brand { width: 190px; height: 80px; object-fit: contain; object-position: left center; }
.login-copy { max-width: 670px; padding: 60px 0; }
.login-copy h1 { max-width: 680px; margin: 18px 0 22px; font-size: clamp(54px, 7vw, 105px); line-height: .88; letter-spacing: -.075em; }
.login-copy h1 i { color: var(--gold-light); font-family: Georgia, serif; font-weight: 400; }
.login-copy p { max-width: 520px; margin: 0; color: #bab5aa; font-size: 14px; line-height: 1.7; }
.login-visual > small { color: #77736a; font-size: 9px; letter-spacing: .12em; }
.login-form-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 46px; background: #100f0d; border-left: 1px solid var(--line); }
.login-form { width: min(390px, 100%); }
.login-form h2 { margin: 13px 0 28px; font-size: 40px; letter-spacing: -.055em; }
.login-form > p { margin: 0 0 34px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.login-form .field { margin-bottom: 16px; }
.login-form .button { width: 100%; margin-top: 8px; }
.login-form [data-login-error]:not(:empty) { margin-bottom: 14px; }
.google-login { margin-bottom: 19px; transition: opacity .2s; }
.google-login[aria-busy="true"] { opacity: .55; pointer-events: none; }
.google-login [data-google-button] { min-height: 44px; display: flex; justify-content: center; overflow: hidden; border-radius: 11px; }
.google-login iframe { max-width: 100%; }
.login-divider { display: flex; align-items: center; gap: 11px; margin: 18px 0 0; color: #6f6b63; font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.login-form [data-password-login] { margin: 0; }
.security-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; color: #77736a; font-size: 9px; line-height: 1.55; }
.security-note i { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 15px rgba(191,160,101,.55); }

/* Admin */
.admin-shell { min-height: 100dvh; display: grid; grid-template-columns: 76px 1fr; background: #0f0e0c; }
.admin-rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 13px; background: #0a0a09; border-right: 1px solid var(--line); z-index: 10; }
.rail-brand { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(255,255,255,.02); }
.rail-brand img { width: 29px; height: 29px; }
.rail-nav { display: grid; gap: 8px; margin-top: 18px; }
.rail-nav button { position: relative; width: 46px; height: 46px; border: 0; border-radius: 13px; background: transparent; color: #77736c; cursor: pointer; font-size: 17px; }
.rail-nav button:hover, .rail-nav button.active { background: rgba(191,160,101,.1); color: var(--gold-light); }
.rail-nav button.active::before { content: ""; position: absolute; left: -13px; top: 12px; bottom: 12px; width: 2px; background: var(--gold); }
.rail-bottom { margin-top: auto; display: grid; gap: 9px; }
.rail-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, var(--gold-light), var(--gold-dark)); color: var(--black); font-size: 10px; font-weight: 900; }
.admin-page { min-width: 0; }
.admin-topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(20px, 4vw, 52px); border-bottom: 1px solid var(--line); background: rgba(13,13,13,.88); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 8; }
.admin-wordmark { display: flex; align-items: center; gap: 12px; }
.admin-wordmark img { width: 128px; height: 46px; object-fit: contain; }
.admin-wordmark span { padding-left: 11px; border-left: 1px solid var(--line-strong); color: var(--gold-light); font-size: 8px; font-weight: 900; letter-spacing: .2em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-admin { display: grid; text-align: right; }
.topbar-admin b { max-width: 180px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.topbar-admin small { color: var(--muted); font-size: 8px; }
.admin-content { width: min(1480px, 100%); margin: 0 auto; padding: clamp(25px, 4vw, 55px); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-heading h1 { margin: 9px 0 7px; font-size: clamp(32px, 4vw, 53px); letter-spacing: -.06em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 35px; }
.metric { min-height: 130px; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, rgba(255,255,255,.028), rgba(255,255,255,.008)); }
.metric span { color: #89857b; font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.metric b { display: block; margin: 18px 0 4px; font-size: 33px; letter-spacing: -.055em; }
.metric small { color: var(--gold); font-size: 8px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 16px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading span { color: var(--muted); font-size: 9px; }
.client-grid, .presentation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.client-card, .presentation-card { position: relative; min-height: 240px; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, #171510, #11100e); cursor: pointer; transition: transform .2s, border-color .2s; }
.client-card:hover, .presentation-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.client-card-art, .presentation-card-art { position: relative; height: 128px; padding: 20px; overflow: hidden; background: linear-gradient(135deg, #0d0d0d, #2a2116); }
.client-card-art::before, .presentation-card-art::before { content: ""; position: absolute; width: 160px; height: 160px; right: -55px; top: -75px; border-radius: 50%; background: radial-gradient(circle, var(--gold-light), var(--gold-dark) 48%, transparent 70%); opacity: .7; }
.client-card-art img { position: relative; width: 55px; height: 55px; z-index: 1; }
.client-card-body, .presentation-card-body { flex: 1; padding: 17px; }
.client-card-body h3, .presentation-card-body h3 { margin: 8px 0 7px; font-size: 15px; }
.client-card-body p, .presentation-card-body p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.presentation-card-open { display: block; flex: 1; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.presentation-card-duplicate { position: absolute; z-index: 2; top: 10px; right: 10px; min-height: 29px; border: 1px solid rgba(217,185,126,.42); border-radius: 8px; padding: 0 9px; background: rgba(13,13,13,.75); color: var(--gold-light); cursor: pointer; font-size: 8px; font-weight: 850; }
.presentation-card-duplicate:hover { background: var(--gold); color: var(--black); }
.card-meta { display: flex; justify-content: space-between; align-items: center; color: #7e796f; font-size: 8px; }
.status { display: inline-flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .08em; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--copper); }
.status-published::before { background: var(--gold-light); box-shadow: 0 0 11px rgba(217,185,126,.5); }
.status-draft::before { background: #66635d; }
.status-review::before { background: var(--copper); }
.create-card { min-height: 240px; border: 1px dashed var(--line-strong); border-radius: 16px; background: rgba(191,160,101,.025); color: var(--muted); display: grid; place-content: center; justify-items: center; gap: 10px; cursor: pointer; }
.create-card:hover { color: var(--white); background: rgba(191,160,101,.05); }
.create-card i { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--gold-light); font-size: 22px; font-style: normal; }
.create-card b { font-size: 11px; }
.create-card small { font-size: 8px; }

.client-header-card { display: flex; align-items: center; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #15130f; margin-bottom: 28px; }
.client-header-icon { width: 62px; height: 62px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 15px; background: #0d0d0d; border: 1px solid var(--line-strong); }
.client-header-icon img { width: 39px; height: 39px; }
.client-header-card > div:nth-child(2) { min-width: 0; flex: 1; }
.client-header-card h2 { margin: 0 0 5px; font-size: 21px; }
.client-header-card p { margin: 0; color: var(--muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-url { max-width: 430px; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 13px; border: 1px solid var(--line); border-radius: 11px; background: #0e0d0b; }
.copy-url code { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #a9a399; font-size: 9px; }

/* Editor */
.editor-shell { height: calc(100dvh - 76px); display: grid; grid-template-columns: 255px minmax(0, 1fr) 320px; overflow: hidden; }
.editor-sidebar, .editor-comments { min-height: 0; background: #11100e; }
.editor-sidebar { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.editor-comments { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.editor-panel-head { min-height: 68px; padding: 15px 17px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.editor-panel-head div { display: grid; gap: 4px; }
.editor-panel-head span { color: var(--gold-light); font-size: 7px; font-weight: 900; letter-spacing: .14em; }
.editor-panel-head b { font-size: 11px; }
.slide-list { position: relative; min-height: 0; overflow-y: auto; padding: 10px; }
.slide-row { position: relative; display: grid; grid-template-columns: 28px 68px minmax(0, 1fr) 26px; gap: 8px; align-items: center; width: 100%; padding: 8px; margin-bottom: 7px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #99958b; cursor: pointer; text-align: left; transition: opacity .16s, border-color .16s, background .16s, transform .16s; }
.slide-row:hover, .slide-row.active { background: #1a1712; border-color: var(--line); color: var(--white); }
.slide-row.active { box-shadow: inset 2px 0 var(--gold); }
.slide-row.selected { border-color: rgba(217,185,126,.42); background: rgba(191,160,101,.08); }
.slide-row.active.selected { border-color: var(--gold-light); }
.slide-order { min-width: 0; display: grid; place-items: center; gap: 2px; }
.slide-order > span { font: 8px ui-monospace, monospace; }
.slide-drag-handle { width: 25px; height: 23px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #716c62; cursor: grab; touch-action: none; font-size: 15px; line-height: 1; }
.slide-drag-handle:hover, .slide-drag-handle:focus-visible { background: rgba(191,160,101,.1); color: var(--gold-light); outline: none; }
.slide-drag-handle:active { cursor: grabbing; }
.slide-list.is-reordering { user-select: none; }
.slide-list.is-reordering .slide-row { transition: none; }
.slide-row.dragging { opacity: .5; border-color: var(--gold); background: rgba(191,160,101,.1); box-shadow: 0 10px 28px rgba(0,0,0,.36), inset 2px 0 var(--gold); }
.slide-drop-indicator { height: 3px; margin: -3px 5px 4px; border-radius: 999px; background: var(--gold-light); box-shadow: 0 0 0 3px rgba(217,185,126,.12), 0 0 15px rgba(217,185,126,.65); pointer-events: none; }
.slide-list.is-saving-order { pointer-events: none; opacity: .72; }
.slide-thumb { aspect-ratio: 16/9; border-radius: 5px; overflow: hidden; background: #29241b; }
.slide-thumb img, .slide-thumb video { width: 100%; height: 100%; object-fit: cover; }
.slide-row-main { min-width: 0; display: grid; gap: 3px; }
.slide-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; }
.slide-row small { color: #69655d; font-size: 7px; }
.slide-row-actions { position: relative; display: grid; justify-items: end; align-self: stretch; align-content: start; }
.slide-more { width: 25px; height: 26px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #8e897e; cursor: pointer; font-size: 10px; font-weight: 900; letter-spacing: 1px; line-height: 1; }
.slide-more:hover, .slide-more:focus-visible { border-color: var(--line-strong); background: rgba(191,160,101,.1); color: var(--gold-light); outline: 0; }
.slide-menu { position: absolute; z-index: 40; top: 29px; right: 0; width: 164px; padding: 5px; border: 1px solid var(--line-strong); border-radius: 10px; background: #211d16; box-shadow: 0 18px 45px rgba(0,0,0,.55); }
.slide-menu[hidden] { display: none; }
.slide-menu button { width: 100%; min-height: 30px; border: 0; border-radius: 6px; padding: 0 8px; background: transparent; color: #ded9cf; cursor: pointer; text-align: left; font-size: 9px; font-weight: 750; }
.slide-menu button:hover { background: rgba(191,160,101,.12); color: var(--white); }
.slide-menu button:disabled { opacity: .4; cursor: not-allowed; }
.slide-menu .danger, .danger-text { color: #ffaaa6; }
.slide-menu .danger:hover { background: rgba(255,122,116,.12); color: #ffd0cc; }
.slide-add-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 9px 10px 12px; }
.slide-add-actions .button { width: 100%; min-height: 38px; padding: 0 7px; font-size: 8px; }
.upload-slides { display: block; grid-column: 1 / -1; }
.upload-slides input { display: none; }
.editor-canvas-wrap { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #0c0c0b; }
.editor-toolbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.editor-toolbar-group { display: flex; align-items: center; gap: 8px; }
.editor-status { min-height: 38px; border: 1px solid var(--line); background: #13110e; color: #c7c1b5; border-radius: 9px; padding: 0 10px; font-size: 9px; }
.editor-design-tools { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 18px; border-bottom: 1px solid var(--line); background: #11100e; overflow-x: auto; }
.design-add { display: flex; align-items: center; flex: 0 0 auto; gap: 6px; }
.design-add > span { color: var(--gold-light); font-size: 7px; font-weight: 900; letter-spacing: .13em; margin-right: 2px; }
.design-add .button { min-height: 31px; padding: 0 9px; font-size: 8px; }
.design-layer-fields { display: flex; align-items: end; gap: 7px; min-width: 650px; }
.design-layer-fields .field { min-width: 78px; }
.design-layer-fields .field:first-child { min-width: 150px; flex: 1; }
.design-layer-fields input, .design-layer-fields select { min-height: 31px; padding: 0 7px; font-size: 8px; }
.design-layer-fields input[type=color] { padding: 3px; }
.design-layer-fields .button { min-height: 31px; padding: 0 8px; font-size: 8px; }
.editor-canvas { position: relative; min-height: 0; flex: 1; display: grid; place-items: center; padding: 26px; overflow: auto; transition: background .16s, outline-color .16s; }
.editor-canvas.is-file-drop { background: rgba(191,160,101,.08); outline: 2px dashed var(--gold-light); outline-offset: -14px; }
.editor-sidebar { transition: background .16s, outline-color .16s; }
.editor-sidebar.is-file-drop { background: rgba(191,160,101,.09); outline: 2px dashed var(--gold-light); outline-offset: -7px; }
.editor-shell.is-file-drop .editor-canvas { background: rgba(191,160,101,.05); outline: 2px dashed rgba(217,185,126,.65); outline-offset: -14px; }
.canvas-drop-hint { position: absolute; bottom: 13px; left: 50%; transform: translateX(-50%); padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(13,13,13,.78); color: #8b867b; font-size: 8px; pointer-events: none; opacity: .72; }
.editor-canvas.is-file-drop .canvas-drop-hint { color: var(--gold-light); opacity: 1; }
.slide-stage { position: relative; width: min(100%, 1040px); aspect-ratio: 16/9; overflow: hidden; border: 1px solid rgba(255,255,255,.14); background: #17130e; box-shadow: var(--shadow); }
.slide-stage img, .slide-stage video { width: 100%; height: 100%; }
.slide-layer { position: absolute; z-index: 2; box-sizing: border-box; display: flex; align-items: center; overflow: hidden; padding: .18em .28em; font-family: Inter, Arial, sans-serif; font-weight: 850; line-height: 1.02; letter-spacing: -.035em; white-space: pre-wrap; text-shadow: 0 2px 14px rgba(0,0,0,.35); user-select: none; }
.slide-layer-text, .slide-layer-shape, .slide-layer-icon { cursor: move; }
.slide-layer-icon { justify-content: center; }
.slide-layer-fade { animation: layerFade .52s ease both; }
.slide-layer-rise { animation: layerRise .58s cubic-bezier(.2,.8,.2,1) both; }
.slide-layer-zoom { animation: layerZoom .52s cubic-bezier(.2,.8,.2,1) both; }
@keyframes layerFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes layerRise { from { opacity: 0; transform: translateY(14%); } to { opacity: 1; transform: translateY(0); } }
@keyframes layerZoom { from { opacity: 0; transform: scale(.84); } to { opacity: 1; transform: scale(1); } }
.slide-stage-copy { position: absolute; left: 6%; bottom: 8%; width: 70%; text-shadow: 0 4px 24px #000; }
.slide-stage-copy span { color: var(--gold-light); font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.slide-stage-copy h2 { margin: 8px 0 0; font-size: clamp(24px, 4vw, 57px); line-height: .95; letter-spacing: -.055em; }
.slide-stage-index { position: absolute; right: 3%; bottom: 4%; min-width: 58px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: rgba(0,0,0,.48); font: 800 10px ui-monospace, monospace; color: #fff; letter-spacing: .04em; text-align: center; text-shadow: 0 1px 8px #000; }
.editor-properties { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; align-items: end; gap: 13px; background: #100f0d; }
.editor-property-fields { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) 150px 54px; gap: 10px; }
.field-color input { height: 46px; padding: 5px; cursor: pointer; }
.editor-property-actions { flex: 0 0 auto; }
.editor-property-actions .button { min-width: 132px; }
.comments-list { min-height: 0; flex: 1; overflow-y: auto; padding: 13px; }
.comment-card { padding: 12px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 11px; background: #171510; }
.comment-card.resolved { opacity: .58; }
.comment-head { display: flex; align-items: center; gap: 8px; }
.comment-avatar { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--gold-dark); color: #fff; font-size: 8px; font-weight: 900; }
.comment-head div { min-width: 0; flex: 1; display: grid; gap: 2px; }
.comment-head b { font-size: 9px; }
.comment-head small { color: #77736a; font-size: 7px; }
.comment-page { color: var(--gold-light); font-size: 7px; font-weight: 900; }
.comment-card p { margin: 10px 0 0 36px; color: #c2bdb2; font-size: 9px; line-height: 1.55; }
.comment-actions { display: flex; gap: 13px; margin: 9px 0 0 36px; }
.comment-card .text-button { font-size: 8px; }
.live-view { margin: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(191,160,101,.04); }
.live-view i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 14px rgba(191,160,101,.65); }
.live-view div { display: grid; gap: 2px; }
.live-view b { font-size: 9px; }
.live-view small { color: var(--muted); font-size: 7px; }

/* Administrators */
.admin-list { display: grid; gap: 10px; }
.admin-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 13px; align-items: center; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: #15130f; }
.admin-row-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, var(--gold-light), var(--gold-dark)); color: var(--black); font-size: 10px; font-weight: 900; }
.admin-row div:nth-child(2) { display: grid; gap: 3px; }
.admin-row b { font-size: 11px; }
.admin-row small { color: var(--muted); font-size: 8px; }

/* Public portal */
.public-shell { min-height: 100dvh; background: var(--black); }
.public-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 0 clamp(20px, 5vw, 70px); border-bottom: 1px solid var(--line); }
.public-brand { display: flex; align-items: center; gap: 13px; }
.public-brand img { width: 132px; height: 48px; object-fit: contain; }
.public-brand span { padding-left: 12px; border-left: 1px solid var(--line-strong); color: var(--gold-light); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.public-header > div:last-child { display: grid; text-align: right; gap: 2px; }
.public-header b { font-size: 10px; }
.public-header small { color: var(--muted); font-size: 8px; }
.portal-hero { position: relative; overflow: hidden; min-height: 410px; padding: clamp(58px, 9vw, 125px) clamp(20px, 8vw, 120px); display: flex; align-items: flex-end; isolation: isolate; }
.portal-hero::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 99px, rgba(217,185,126,.04) 100px), repeating-linear-gradient(0deg, transparent 0 99px, rgba(217,185,126,.04) 100px); z-index: -2; }
.portal-hero::after { content: ""; position: absolute; width: 70vw; aspect-ratio: 1; right: -38vw; top: -42vw; border-radius: 50%; background: radial-gradient(circle, var(--gold-light), var(--gold) 23%, var(--copper) 43%, transparent 68%); opacity: .7; z-index: -1; }
.portal-hero > div { max-width: 900px; }
.portal-hero h1 { margin: 14px 0 18px; font-size: clamp(43px, 7vw, 94px); line-height: .93; letter-spacing: -.075em; }
.portal-hero p { max-width: 620px; margin: 0; color: #aaa59a; font-size: 13px; line-height: 1.7; }
.portal-library { padding: 45px clamp(20px, 8vw, 120px) 100px; }
.portal-library-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 20px; }
.portal-library-heading > div:first-child { display: grid; gap: 5px; }
.portal-library-heading h2 { margin: 0; font-size: 21px; }
.portal-library-heading span { color: var(--muted); font-size: 9px; }
.portal-filters { display: flex; align-items: center; gap: 8px; }
.portal-filters .search-input { width: 210px; height: 40px; font-size: 10px; }
.portal-filters select { height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 9px; background: #11100e; color: var(--white); font-size: 9px; }
.portal-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.portal-card { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: #15130f; transition: transform .2s, border-color .2s; }
.portal-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.portal-card-cover { position: relative; aspect-ratio: 16/9; overflow: hidden; background: linear-gradient(145deg, #0d0d0d, #2b2115); }
.portal-card-cover-link { display: block; cursor: pointer; }
.portal-card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .24s ease; }
.portal-card-cover-link:hover img { transform: scale(1.025); }
.portal-card-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0,0,0,.55)); }
.portal-card.is-locked { opacity: .72; }
.portal-card.is-locked:hover { transform: none; border-color: var(--line); }
.portal-status { position: absolute; z-index: 2; top: 12px; left: 12px; display: inline-flex; align-items: center; min-height: 24px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 9px; background: rgba(13,13,13,.82); color: var(--gold-light); font-size: 7px; font-weight: 900; letter-spacing: .12em; }
.portal-status.status-draft { color: #c0bcb1; border-color: rgba(192,188,177,.25); }
.portal-status.status-review { color: #ffd292; border-color: rgba(217,185,126,.5); }
.portal-card-body { padding: 18px; }
.portal-card-body span { color: var(--gold-light); font-size: 7px; font-weight: 900; letter-spacing: .14em; }
.portal-card-body h3 { margin: 9px 0 8px; font-size: 16px; }
.portal-card-body p { min-height: 36px; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.portal-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; color: #888379; font-size: 8px; }
.portal-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.portal-card-actions .button { min-height: 34px; padding: 0 10px; border-radius: 8px; font-size: 8px; white-space: nowrap; }
.portal-locked { color: #aaa59a; font-size: 8px; }
.portal-no-results { margin-top: 18px; }
.portal-no-results[hidden] { display: none !important; }
.home-shell { min-height: 100dvh; display: grid; place-items: center; padding: 30px; background: radial-gradient(circle at 80% 10%, rgba(166,132,68,.22), transparent 36%), #0d0d0d; }
.home-card { width: min(720px, 100%); text-align: center; }
.home-card img { width: 205px; height: 92px; object-fit: contain; }
.home-card h1 { margin: 35px 0 15px; font-size: clamp(46px, 8vw, 88px); line-height: .92; letter-spacing: -.075em; }
.home-card h1 i { color: var(--gold-light); font-family: Georgia, serif; font-weight: 400; }
.home-card p { max-width: 580px; margin: 0 auto 28px; color: var(--muted); line-height: 1.7; }

/* Viewer */
.viewer-shell { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: #080808; }
.viewer-header { min-height: 72px; display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 15px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(13,13,13,.94); z-index: 6; }
.viewer-title { min-width: 0; display: grid; gap: 4px; }
.viewer-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.viewer-title span { color: var(--muted); font-size: 8px; }
.viewer-logo img { width: 120px; height: 42px; object-fit: contain; }
.viewer-actions { display: flex; justify-content: flex-end; gap: 8px; }
.viewer-actions button { min-height: 38px; }
.viewer-stage-wrap { min-height: 0; flex: 1; position: relative; display: grid; place-items: center; padding: 20px 68px; }
.viewer-stage { position: relative; height: min(70dvh, calc((100vw - 160px) * .5625)); max-width: calc(100vw - 150px); aspect-ratio: 16/9; overflow: hidden; background: #17130e; box-shadow: 0 30px 90px rgba(0,0,0,.62); transform: translate(var(--viewer-pan-x, 0px), var(--viewer-pan-y, 0px)) scale(var(--viewer-zoom, 1)); transform-origin: center; touch-action: none; }
.viewer-stage img, .viewer-stage video { width: 100%; height: 100%; }
.viewer-stage .slide-stage-copy { left: 6%; bottom: 8%; }
.viewer-arrow { position: absolute; z-index: 3; top: 50%; transform: translateY(-50%); width: 44px; height: 70px; border: 1px solid var(--line); background: rgba(20,18,14,.68); backdrop-filter: blur(12px); border-radius: 12px; color: var(--gold-light); font-size: 30px; cursor: pointer; }
.viewer-arrow:hover { border-color: var(--line-strong); }
.viewer-arrow:disabled { opacity: .22; cursor: default; }
.viewer-arrow.prev { left: 15px; }
.viewer-arrow.next { right: 15px; }
.viewer-zoom-controls { position: absolute; z-index: 4; right: 17px; bottom: 14px; display: none; gap: 6px; }
.viewer-zoom-controls button { min-width: 38px; height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(13,13,13,.78); color: var(--gold-light); font-weight: 900; cursor: pointer; }
#app:fullscreen { width: 100vw; height: 100vh; background: #080808; }
#app:fullscreen .viewer-header, #app:fullscreen .viewer-footer { display: none; }
#app:fullscreen .viewer-shell { height: 100vh; }
#app:fullscreen .viewer-stage-wrap { padding: 28px 80px; }
#app:fullscreen .viewer-stage { width: min(100%, calc((100vh - 56px) * 1.7777)); height: auto; max-width: 100%; }
.viewer-footer { min-height: 78px; display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-top: 1px solid var(--line); background: #0d0d0d; }
.viewer-footer > span { width: 30px; text-align: center; color: #f3d496; font: 800 10px ui-monospace, monospace; text-shadow: 0 1px 9px rgba(217,185,126,.5); }
.progress { width: min(190px, 20vw); height: 2px; background: #2c2923; }
.progress i { display: block; height: 100%; background: var(--gold); transition: width .25s; }
.viewer-thumbs { min-width: 0; flex: 1; display: flex; gap: 7px; overflow-x: auto; padding: 3px; }
.viewer-thumbs button { flex: 0 0 88px; aspect-ratio: 16/9; padding: 0; overflow: hidden; border: 1px solid transparent; border-radius: 5px; background: #1c1914; cursor: pointer; }
.viewer-thumbs button.active { border-color: var(--gold-light); box-shadow: 0 0 0 2px rgba(191,160,101,.15); }
.viewer-thumbs img, .viewer-thumbs video { width: 100%; height: 100%; object-fit: cover; }
.viewer-end { position: absolute; z-index: 4; left: 50%; bottom: 95px; transform: translateX(-50%); width: min(590px, calc(100% - 32px)); display: flex; align-items: center; gap: 18px; padding: 14px 15px; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(17,16,13,.93); backdrop-filter: blur(18px); box-shadow: var(--shadow); }
.viewer-end div { flex: 1; display: grid; gap: 4px; }
.viewer-end span { color: var(--gold-light); font-size: 7px; font-weight: 900; letter-spacing: .14em; }
.viewer-end b { font-size: 11px; }
.comment-drawer { position: fixed; z-index: 20; top: 0; right: 0; bottom: 0; width: min(390px, 94vw); display: flex; flex-direction: column; border-left: 1px solid var(--line); background: #11100e; box-shadow: -30px 0 80px rgba(0,0,0,.5); animation: drawer .22s ease-out; }
@keyframes drawer { from { transform: translateX(100%); } }
.drawer-head { min-height: 72px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.drawer-head div { display: grid; gap: 3px; }
.drawer-head span { color: var(--gold-light); font-size: 7px; font-weight: 900; letter-spacing: .14em; }
.drawer-head b { font-size: 15px; }
.drawer-comments { min-height: 0; flex: 1; overflow-y: auto; padding: 15px; }
.drawer-form { padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 9px; }
.drawer-form input, .drawer-form textarea { width: 100%; border: 1px solid var(--line); background: #171510; color: #fff; border-radius: 9px; outline: 0; padding: 10px; font-size: 10px; }
.drawer-form textarea { height: 76px; resize: none; }
.drawer-form .honeypot { position: absolute; left: -10000px; opacity: 0; pointer-events: none; }

/* Dialogs and toast */
dialog.modal { width: min(590px, calc(100% - 28px)); max-height: 90dvh; overflow: auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; background: #15130f; color: var(--white); box-shadow: 0 35px 120px rgba(0,0,0,.72); }
dialog.modal::backdrop { background: rgba(0,0,0,.73); backdrop-filter: blur(6px); }
.modal-head { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.modal-head div { display: grid; gap: 4px; }
.modal-head span { color: var(--gold-light); font-size: 7px; font-weight: 900; letter-spacing: .15em; }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 20px; border-top: 1px solid var(--line); }
.quality-list { display: grid; gap: 9px; }
.quality-option { width: 100%; min-height: 72px; display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: #11100e; color: var(--white); text-align: left; cursor: pointer; }
.quality-option.active { border-color: var(--gold); background: rgba(191,160,101,.06); }
.quality-radio { width: 16px; height: 16px; border: 1px solid #666158; border-radius: 50%; }
.quality-option.active .quality-radio { border: 4px solid var(--gold); }
.quality-option div { display: grid; gap: 3px; }
.quality-option b { font-size: 11px; }
.quality-option span { color: var(--muted); font-size: 8px; }
.quality-option strong { color: var(--gold-light); font-size: 10px; }
.pdf-preparing { display: grid; gap: 9px; margin-top: 16px; color: #a9a399; }
.pdf-preparing div:first-child { display: grid; gap: 3px; }
.pdf-preparing b { color: var(--white); font-size: 12px; }
.pdf-preparing span { font-size: 10px; }
.pdf-progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); }
.pdf-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-light)); transition: width .2s ease; }
#toast-root { position: fixed; z-index: 100; left: 50%; bottom: 26px; transform: translateX(-50%); pointer-events: none; }
.toast { min-width: 230px; max-width: min(460px, calc(100vw - 30px)); display: flex; align-items: center; gap: 9px; padding: 12px 15px; border: 1px solid var(--line-strong); border-radius: 11px; background: #171510; box-shadow: var(--shadow); color: #e9e5dc; font-size: 10px; animation: toast-in .2s ease-out; }
.toast i { color: var(--gold-light); font-style: normal; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
#upload-root { position: fixed; z-index: 130; right: 24px; bottom: 24px; pointer-events: none; }
.upload-status { width: min(370px, calc(100vw - 30px)); padding: 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(23,21,16,.97); box-shadow: 0 24px 70px rgba(0,0,0,.58); backdrop-filter: blur(18px); pointer-events: auto; animation: upload-in .22s ease-out; }
.upload-status-head { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 10px; align-items: center; }
.upload-status-head > div { min-width: 0; display: grid; gap: 3px; }
.upload-status-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.upload-status-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 8px; }
.upload-status-head strong { color: var(--gold-light); font-size: 11px; }
.upload-status-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(191,160,101,.08); color: var(--gold-light); font-size: 16px; font-weight: 900; }
.upload-progress { height: 4px; margin: 12px 0 10px; overflow: hidden; border-radius: 999px; background: #302b23; }
.upload-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-dark), var(--gold-light)); transition: width .18s ease-out; }
.upload-status-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.upload-status-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8e897f; font-size: 8px; }
.upload-status-foot button { width: 24px; height: 24px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #89847a; cursor: pointer; font-size: 16px; }
.upload-status-foot button:hover { background: rgba(255,255,255,.06); color: var(--white); }
.upload-status.processing .upload-progress i { animation: upload-pulse 1s ease-in-out infinite alternate; }
.upload-status.success { border-color: rgba(191,160,101,.65); }
.upload-status.success .upload-status-icon { background: var(--gold); color: var(--black); }
.upload-status.error { border-color: rgba(223,92,83,.62); }
.upload-status.error .upload-status-icon, .upload-status.error .upload-status-head strong { color: #ff9f98; }
@keyframes upload-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes upload-pulse { to { filter: brightness(1.45); opacity: .62; } }

@media (max-width: 1180px) {
  .editor-shell { grid-template-columns: 230px minmax(0,1fr); }
  .editor-comments { position: fixed; z-index: 20; top: 76px; right: 0; bottom: 0; width: 340px; box-shadow: -20px 0 60px rgba(0,0,0,.5); }
  .client-grid, .presentation-grid, .portal-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 820px) {
  .login-screen { display: block; }
  .login-visual { min-height: 44dvh; padding: 28px; }
  .login-copy { padding: 40px 0 20px; }
  .login-copy h1 { font-size: 52px; }
  .login-visual > small, .login-copy p { display: none; }
  .login-form-wrap { min-height: 56dvh; padding: 34px 24px 55px; border: 0; border-top: 1px solid var(--line); }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-rail { position: fixed; z-index: 30; left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 68px; flex-direction: row; justify-content: center; padding: 9px 12px calc(9px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); }
  .rail-brand, .rail-bottom { display: none; }
  .rail-nav { display: flex; margin: 0; }
  .rail-nav button.active::before { left: 12px; right: 12px; top: auto; bottom: -9px; width: auto; height: 2px; }
  .admin-topbar { height: 68px; padding: 0 16px; }
  .admin-wordmark img { width: 110px; }
  .admin-wordmark span, .topbar-admin { display: none; }
  .admin-content { padding: 26px 17px 95px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .client-grid, .presentation-grid, .portal-grid { grid-template-columns: 1fr; }
  .client-header-card { align-items: flex-start; flex-wrap: wrap; }
  .copy-url { max-width: 100%; width: 100%; }
  .editor-shell { height: calc(100dvh - 136px); grid-template-columns: 92px minmax(0,1fr); }
  .editor-sidebar { min-width: 0; }
  .editor-panel-head { justify-content: center; padding: 10px 5px; }
  .editor-panel-head div { display: none; }
  .slide-list { padding: 6px; }
  .slide-row { grid-template-columns: 26px minmax(0,1fr) 26px; gap: 4px; padding: 5px; }
  .slide-row-main { display: none; }
  .slide-row-actions { grid-column: 3; }
  .slide-menu { right: 0; }
  .slide-order > span { display: none; }
  .slide-drag-handle { width: 24px; height: 35px; }
  .upload-slides { margin: 6px; }
  .upload-slides .button { width: 100%; padding: 0; font-size: 0; }
  .upload-slides .button::after { content: "+"; font-size: 20px; }
  .editor-toolbar { padding: 9px; min-height: 58px; }
  .editor-toolbar .button span, .editor-toolbar .button-secondary { display: none; }
  .editor-canvas { padding: 8px; }
  .editor-properties { grid-template-columns: 1fr 1fr; padding: 9px; }
  .editor-properties { display: grid; grid-template-columns: 1fr auto; align-items: end; }
  .editor-property-fields { grid-template-columns: 1fr; }
  .editor-property-fields .field:nth-child(2) { display: none; }
  .editor-property-fields .field:nth-child(3) { display: none; }
  .editor-property-fields .field-color { display: none; }
  .editor-property-actions .button { min-width: 0; padding: 0 11px; }
  .editor-comments { top: 68px; bottom: 68px; width: min(340px, 92vw); }
  #upload-root { left: 12px; right: 12px; bottom: 82px; }
  .upload-status { width: 100%; }
  .public-header { padding: 0 17px; }
  .public-header > div:last-child { display: none; }
  .portal-hero { min-height: 330px; padding: 65px 20px; }
  .portal-library { padding: 34px 17px 80px; }
  .viewer-header { min-height: 62px; grid-template-columns: 1fr auto; padding: 0 10px; }
  .viewer-logo { display: none; }
  .viewer-actions .button span { display: none; }
  .viewer-stage-wrap { padding: 12px 0 58px; align-items: center; overflow: hidden; }
  .viewer-stage { width: 100%; height: auto; max-width: 100%; }
  .viewer-arrow { top: auto; bottom: 5px; width: 46px; height: 42px; font-size: 24px; }
  .viewer-arrow.prev { left: calc(50% - 55px); }
  .viewer-arrow.next { right: calc(50% - 55px); }
  .viewer-zoom-controls { display: flex; }
  .viewer-footer { min-height: 68px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .progress { width: 60px; }
  .viewer-thumbs button { flex-basis: 68px; }
  .viewer-end { bottom: 78px; display: grid; gap: 10px; }
  .viewer-end .button { width: 100%; }
  .portal-library-heading { align-items: flex-start; flex-direction: column; }
  .portal-filters { width: 100%; flex-wrap: wrap; }
  .portal-filters .search-input { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
}

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .metric { min-height: 105px; }
  .login-form h2 { font-size: 34px; }
  .login-brand { width: 145px; height: 58px; }
  .login-copy h1 { font-size: 45px; }
  .public-brand img { width: 112px; }
  .portal-hero h1 { font-size: 42px; }
}

@media (max-width: 760px) and (orientation: landscape) {
  #app:fullscreen .viewer-stage-wrap { padding: 0 58px; }
  #app:fullscreen .viewer-stage { width: min(100%, 177.77dvh); max-width: none; }
  #app:fullscreen .viewer-arrow { top: 50%; bottom: auto; width: 42px; height: 58px; }
  #app:fullscreen .viewer-arrow.prev { left: 8px; }
  #app:fullscreen .viewer-arrow.next { right: 8px; }
}

@media (max-width: 760px) and (orientation: portrait) {
  #app:fullscreen .viewer-stage-wrap { padding: 0; min-height: 100dvh; }
  #app:fullscreen .viewer-stage { width: 100vw; max-width: none; height: auto; }
  #app:fullscreen .viewer-arrow { bottom: max(18px, env(safe-area-inset-bottom)); }
}
