@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700;800&display=swap');

:root {
  color: #163635; background: #f4f8f6; font-family: 'Open Sans', 'Segoe UI', sans-serif; font-synthesis: none;
  --primary: #0a7a78; --primary-hover: #075f5e; --ink: #163635; --muted: #60716e; --canvas: #f4f8f6;
  --surface: #fff; --mint: #e2f3ec; --line: #d7e5e0; --line-strong: #b9cec7; --danger: #b5473f;
  --blue: #e5eff7; --peach: #f7e9db; --shadow: 0 24px 60px rgba(22,54,53,.12);
  scrollbar-color: #88aaa2 #eef4f1; scrollbar-width: thin; scrollbar-gutter: stable;
}
* { box-sizing: border-box; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-track { background: #eef4f1; }
*::-webkit-scrollbar-thumb { background: #88aaa2; border: 3px solid #eef4f1; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: #607f78; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .56; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 14px; color: white; background: var(--ink); border-radius: 8px; }
.skip-link:focus { top: 16px; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: var(--canvas); }
.login-panel { width: 100%; display: grid; place-items: center; }
.login-form-wrap { width: min(100%, 440px); padding: clamp(28px, 5vw, 42px); border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 22px 55px rgba(22,54,53,.09); }
.login-simple-logo { width: 126px; margin: 0 0 32px; }
.status-chip, .publish-badge, .count-chip, .slot-label { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.status-chip { padding: 7px 11px; color: var(--primary); background: #eaf6f2; }
.status-chip span, .publish-badge span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.login-form-wrap h2 { margin: 28px 0 7px; font-size: 2.05rem; letter-spacing: -.045em; }
.subcopy { margin: 0 0 34px; color: var(--muted); }
.login-help { margin: 24px 0 0; color: var(--muted); font-size: .78rem; text-align: center; }

.field { display: grid; gap: 7px; min-width: 0; margin-bottom: 20px; }
.field label, .label-row label { color: var(--ink); font-size: .8rem; font-weight: 700; }
.label-row { display: flex; justify-content: space-between; gap: 16px; }
.label-row > span { color: var(--muted); font-size: .72rem; }
input, textarea, select { width: 100%; min-height: 46px; padding: 11px 13px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 86px; line-height: 1.5; resize: none; }
.resize-none { resize: none; }
input:hover, textarea:hover, select:hover { border-color: #7d9d95; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,122,120,.12); outline: none; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(181,71,63,.1); }
.field-help, .field-error { min-height: 1.1em; font-size: .71rem; line-height: 1.45; }
.field-help { color: var(--muted); }
.field-error { color: var(--danger); font-weight: 600; }
.password-field, .suffix-field { position: relative; }
.password-field input { padding-right: 52px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.password-toggle { position: absolute; right: 4px; top: 3px; }
.password-toggle:hover { color: var(--primary); background: #eef7f4; }
.suffix-field input { padding-right: 48px; }
.suffix-field > span { position: absolute; right: 13px; top: 13px; color: var(--muted); font-size: .75rem; }

.button { min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 10px; font-weight: 700; transition: background .15s, border-color .15s, transform .15s; }
.button:not(:disabled):active { transform: translateY(1px); }
.button.primary { display: inline-flex; align-items: center; justify-content: center; gap: 12px; color: white; background: var(--primary); }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { color: var(--ink); background: white; border-color: var(--line-strong); }
.button.secondary:hover, .button.ghost:hover { border-color: #7d9d95; background: #edf5f2; }
.button.ghost { color: var(--ink); background: transparent; border-color: var(--line); }
.button.danger { color: white; background: var(--danger); }
.button.danger:hover { background: #913931; }
.button.wide { width: 100%; }
.button.compact { min-height: 38px; padding: 8px 12px; font-size: .75rem; }
.alert { margin-bottom: 20px; padding: 12px 14px; color: var(--ink); background: #e9f6f2; border: 1px solid #b7dcd2; border-radius: 10px; font-size: .82rem; }
.alert.error { color: #7f2f2a; background: #fff1ef; border-color: #edc2bd; }

.app-shell { min-height: 100vh; padding-left: 246px; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; display: flex; width: 246px; padding: 30px 22px 24px; flex-direction: column; border-right: 1px solid var(--line); background: white; }
.brand { display: inline-flex; align-self: flex-start; margin: 0 10px 40px; }
.brand img { width: 126px; }
.nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 10px 12px; color: var(--muted); border-radius: 10px; font-size: .82rem; font-weight: 700; text-decoration: none; }
.nav-item svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.nav-item.active { color: var(--primary); background: #eaf5f1; }
.sidebar-foot { display: grid; gap: 16px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.logout-form { margin: 0; }
.user-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; color: white; background: var(--ink); font-size: .78rem; font-weight: 800; }
.user-row > span:last-child { display: grid; min-width: 0; }
.user-row strong { font-size: .76rem; }
.user-row small { overflow: hidden; color: var(--muted); font-size: .67rem; text-overflow: ellipsis; }
.mobile-header { display: none; }
.workspace { width: min(100%, 1420px); margin: 0 auto; padding: 40px clamp(24px, 4vw, 64px) 64px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 26px; }
.page-header h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.55rem); letter-spacing: -.05em; }
.page-header > div:first-child > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.header-status { display: grid; justify-items: end; gap: 7px; min-width: 170px; }
.publish-badge { padding: 7px 11px; }
.publish-badge.draft { color: #76561b; background: #fff4d7; }
.publish-badge.published { color: #14604d; background: #dff2ea; }
.header-status > span:last-child { color: var(--muted); font-size: .7rem; }
.editor-layout { display: grid; grid-template-columns: minmax(480px, .98fr) minmax(430px, 1.02fr); gap: clamp(24px, 3vw, 42px); align-items: start; }
.editor-panel { padding: clamp(20px, 2.5vw, 32px); border: 1px solid var(--line); border-radius: 16px; background: white; }
.panel-heading, .preview-heading, .banner-form-head, .action-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-heading h2, .preview-heading h2 { margin: 0; font-size: 1.08rem; letter-spacing: -.02em; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: .76rem; }
.count-chip { padding: 7px 10px; color: var(--primary); background: #e9f5f1; white-space: nowrap; }
.editor-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 22px; padding: 5px; background: #edf4f1; border-radius: 11px; }
.editor-switch button { min-height: 40px; padding: 8px 12px; color: var(--muted); background: transparent; border: 0; border-radius: 8px; font-size: .75rem; font-weight: 800; }
.editor-switch button:hover { color: var(--ink); background: rgba(255,255,255,.65); }
.editor-switch button[aria-selected="true"] { color: var(--primary); background: white; box-shadow: 0 2px 8px rgba(22,54,53,.09); }
.campaign-settings { display: grid; grid-template-columns: 1fr 150px; gap: 14px; margin-top: 26px; }
.compact-field { margin-bottom: 8px; }
.banner-rail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 16px 0 4px; }
.banner-tab { position: relative; display: grid; gap: 6px; min-width: 0; padding: 12px; text-align: left; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: #f8faf9; }
.banner-tab:hover { border-color: #8ca9a2; background: #f0f6f4; }
.banner-tab[aria-selected="true"] { color: var(--ink); border-color: var(--primary); background: #eaf5f1; box-shadow: inset 0 0 0 1px var(--primary); }
.banner-tab small { font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.banner-tab strong { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.banner-tab i { position: absolute; width: 7px; height: 7px; right: 9px; top: 9px; border-radius: 50%; background: #a0aaa7; }
.banner-tab.live i { background: #22a477; box-shadow: 0 0 0 3px rgba(34,164,119,.12); }
.group-error { margin: 4px 0 8px; }
.banner-form { min-width: 0; margin: 16px 0 0; padding: 24px 0 0; border: 0; border-top: 1px solid var(--line); }
.story-form { min-width: 0; margin: 16px 0 0; padding: 24px 0 0; border: 0; border-top: 1px solid var(--line); }
.story-form .field > small { color: var(--muted); font-size: .68rem; line-height: 1.45; }
.video-mode-note { display: grid; gap: 4px; margin: 0 0 20px; padding: 13px 14px; color: var(--ink); background: #e9f5f1; border: 1px solid #bddfd5; border-radius: 10px; }
.video-mode-note strong { color: var(--primary); font-size: .75rem; }
.video-mode-note span { color: var(--muted); font-size: .7rem; line-height: 1.45; }
.banner-form-head { margin-bottom: 22px; }
.banner-form-head h3 { margin: 5px 0 0; font-size: 1rem; }
.banner-form-head p { max-width: 500px; margin: 7px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.slot-label { color: var(--primary); font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 700; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; display: block; width: 40px; height: 23px; border-radius: 999px; background: #b5c2be; transition: background .15s; }
.switch-track span { position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track span { transform: translateX(17px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--primary); outline-offset: 3px; }
.field-row { display: grid; grid-template-columns: 1fr 128px; gap: 14px; }
.upload-field { margin-top: 2px; }
.upload-zone { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; width: 100%; min-height: 94px; padding: 15px; text-align: left; color: var(--ink); background: #f8fbfa; border: 1.5px dashed #9dbbb3; border-radius: 12px; transition: border-color .15s, background .15s, box-shadow .15s; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: #edf7f3; }
.upload-zone:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: var(--primary); background: #e2f3ec; }
.upload-icon svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.upload-zone > span:nth-child(2) { display: grid; gap: 4px; min-width: 0; }
.upload-zone strong { font-size: .78rem; }
.upload-zone small { color: var(--muted); font-size: .68rem; font-weight: 500; }
.upload-action { padding: 8px 11px; color: var(--primary); background: white; border: 1px solid #a9c6be; border-radius: 8px; font-size: .7rem; font-weight: 800; white-space: nowrap; }
.upload-progress, .upload-current { padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfc; }
.upload-progress-row { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); font-size: .7rem; font-weight: 700; }
.upload-progress progress { display: block; width: 100%; height: 7px; margin: 10px 0 7px; overflow: hidden; border: 0; border-radius: 999px; background: #dce9e5; accent-color: var(--primary); }
.upload-progress progress::-webkit-progress-bar { background: #dce9e5; border-radius: 999px; }
.upload-progress progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
.text-button { min-height: 32px; padding: 4px 0; color: var(--muted); background: transparent; border: 0; font-size: .7rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--ink); }
.upload-current { display: flex; align-items: center; gap: 10px; }
.upload-file-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; color: white; background: var(--primary); border-radius: 50%; font-size: .7rem; font-weight: 800; }
.upload-current > span:nth-child(2) { display: grid; min-width: 0; flex: 1; }
.upload-current strong { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.upload-current small { color: var(--muted); font-size: .66rem; }
.remove-image-button { min-height: 36px; padding: 7px 10px; color: var(--danger); background: white; border: 1px solid #e0b4af; border-radius: 8px; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.remove-image-button:hover { color: white; background: var(--danger); border-color: var(--danger); }
.remove-image-button:active { transform: translateY(1px); }
.path-details { margin: -6px 0 20px; }
.path-details summary { color: var(--muted); font-size: .7rem; font-weight: 700; cursor: pointer; }
.path-details summary:hover { color: var(--primary); }
.path-field { margin: 12px 0 0; }
.action-bar { align-items: flex-end; margin: 10px -32px -32px; padding: 18px 32px; border-top: 1px solid var(--line); background: #fbfcfc; border-radius: 0 0 16px 16px; }
.dirty-label { color: var(--muted); font-size: .71rem; }
.dirty-label.unsaved { color: #8b5f0e; font-weight: 700; }
.action-buttons { display: flex; gap: 10px; }

.preview-panel { position: sticky; top: 32px; }
.preview-heading { margin-bottom: 13px; }
.preview-heading .eyebrow { margin-bottom: 4px; }
.preview-heading > span { color: var(--muted); font-size: .73rem; font-weight: 700; }
.browser-frame { overflow: hidden; border: 1px solid #bdd1ca; border-radius: 20px; background: white; box-shadow: var(--shadow); }
.browser-bar { display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border-bottom: 1px solid var(--line); background: #f1f5f3; }
.browser-bar > span { width: 7px; height: 7px; border-radius: 50%; background: #b2c0bc; }
.browser-bar > div { overflow: hidden; flex: 1; margin-left: 8px; padding: 5px 12px; color: #768681; background: white; border-radius: 6px; font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.landing-preview { padding: clamp(18px, 3vw, 34px); background: #f8fbfa; }
.preview-brand { display: flex; align-items: center; justify-content: space-between; padding-bottom: 22px; }
.preview-brand img { width: 92px; }
.preview-brand span { padding: 7px 10px; color: white; background: var(--primary); border-radius: 6px; font-size: .58rem; font-weight: 700; }
.preview-section-title { margin: 0 0 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: .7rem; font-weight: 800; }
.preview-banner { overflow: hidden; border: 1px solid #c7ded5; border-radius: 15px; background: var(--mint); }
.preview-banner.theme-blue { background: var(--blue); }
.preview-banner.theme-peach { background: var(--peach); }
.preview-image-wrap { position: relative; display: grid; place-items: center; aspect-ratio: 2 / 1; min-height: 230px; }
.preview-image-wrap img { width: 100%; height: 100%; object-fit: contain; }
.preview-image-wrap > span { color: var(--muted); font-size: .75rem; }
.preview-banner.empty .preview-image-wrap { background: #f1f5f3; }
.preview-banner.empty .preview-image-wrap > span { display: grid; place-items: center; min-height: 230px; width: 100%; color: var(--muted); font-weight: 700; }
.preview-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; background: rgba(255,255,255,.5); }
.preview-bottom > span { padding: 9px 13px; color: white; background: var(--primary); border-radius: 7px; font-size: .62rem; font-weight: 800; }
.preview-bottom small { color: var(--muted); font-size: .58rem; }
.preview-dots { display: flex; justify-content: center; gap: 6px; min-height: 20px; padding-top: 12px; }
.preview-dots span { width: 6px; height: 6px; border-radius: 50%; background: #b7c9c4; }
.preview-dots span.active { width: 18px; border-radius: 99px; background: var(--primary); }
.story-preview { overflow: hidden; border: 1px solid #c7ded5; border-radius: 15px; background: white; }
.story-preview-media { display: grid; place-items: center; min-height: 245px; aspect-ratio: 16 / 10; background: #e7f2ee; }
.story-preview-media img, .story-preview-media video { width: 100%; height: 100%; object-fit: cover; }
.story-preview.video-only .story-preview-media { min-height: 330px; aspect-ratio: 16 / 9; background: #101c1b; }
.story-preview.video-only .story-preview-media video { object-fit: contain; }
.story-preview-media > span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.story-preview-body { padding: 20px; }
.story-preview-body h3 { margin: 5px 0 8px; font-size: clamp(1.05rem, 2.2vw, 1.45rem); line-height: 1.15; letter-spacing: -.035em; }
.story-preview-body > p:not(.eyebrow) { margin: 0 0 16px; color: var(--muted); font-size: .7rem; line-height: 1.55; }
.story-preview-button { display: inline-flex; padding: 9px 12px; color: white; background: var(--primary); border-radius: 7px; font-size: .62rem; font-weight: 800; }
.preview-note { display: flex; align-items: flex-start; gap: 10px; margin: 17px 10px 0; color: var(--muted); }
.preview-note svg { width: 18px; flex: 0 0 18px; fill: none; stroke: var(--primary); stroke-width: 1.8; }
.preview-note p { margin: 0; font-size: .7rem; line-height: 1.5; }
.preview-note strong { color: var(--ink); }

.dialog-backdrop { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 20px; border: 0; background: transparent; }
.dialog-backdrop[open] { display: grid; place-items: center; }
.dialog-backdrop::backdrop { background: rgba(9,27,26,.58); }
.dialog { width: min(100%, 430px); max-height: calc(100dvh - 40px); overflow: auto; padding: 28px; border-radius: 16px; background: white; box-shadow: 0 30px 80px rgba(0,0,0,.24); }
.dialog h2 { margin: 0; font-size: 1.35rem; }
.dialog p { margin: 10px 0 24px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; width: min(calc(100% - 48px), 370px); padding: 14px 16px; color: white; background: var(--ink); border-radius: 11px; box-shadow: 0 16px 40px rgba(0,0,0,.2); font-size: .78rem; font-weight: 700; }

@media (max-width: 1100px) {
  .app-shell { padding-left: 212px; }
  .sidebar { width: 212px; }
  .editor-layout { grid-template-columns: minmax(420px, 1fr) minmax(360px, .9fr); }
  .action-bar { margin-inline: -20px; margin-bottom: -20px; padding-inline: 20px; }
}
@media (max-width: 900px) {
  .app-shell { padding: 0; }
  .sidebar { display: none; }
  .mobile-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
  .workspace { padding-top: 28px; }
  .editor-layout { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
}
@media (max-width: 600px) {
  .login-shell { padding: 16px; }
  .login-form-wrap { padding: 28px 22px; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 14px; }
  .header-status { justify-items: start; }
  .campaign-settings, .field-row { grid-template-columns: 1fr; }
  .banner-rail { gap: 6px; }
  .banner-tab { padding: 10px 8px; }
  .banner-tab strong { display: none; }
  .action-bar { align-items: stretch; flex-direction: column; }
  .action-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .action-buttons .button { padding-inline: 9px; }
  .preview-image-wrap { min-height: 175px; }
  .preview-bottom small { display: none; }
  .upload-zone { grid-template-columns: auto 1fr; }
  .upload-action { grid-column: 1 / -1; width: 100%; text-align: center; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media (forced-colors: active) { :root { scrollbar-color: auto; } .button, input, textarea, select, .banner-tab { border: 1px solid ButtonText; } }
