:root {
  --ink: #172033;
  --ink-soft: #354057;
  --muted: #6d778b;
  --line: #e2e7ef;
  --line-strong: #d3dae6;
  --canvas: #f4f6fb;
  --surface: #fff;
  --surface-soft: #f8f9fc;
  --primary: #6256e8;
  --primary-dark: #4d43c8;
  --primary-soft: #efedff;
  --success: #16845a;
  --success-soft: #e8f7f0;
  --warning: #9b6705;
  --warning-soft: #fff5d9;
  --danger: #b4473c;
  --danger-soft: #fff0ee;
  --info: #315fc7;
  --info-soft: #edf3ff;
  --shadow-sm: 0 1px 2px rgba(26, 35, 55, .04), 0 6px 20px rgba(26, 35, 55, .05);
  --shadow-lg: 0 24px 60px rgba(26, 35, 55, .16);
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar: 232px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
body.is-menu-open { overflow: hidden; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(98, 86, 232, .28); outline-offset: 2px; }
*[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.15; letter-spacing: -.035em; }
h1 { margin-bottom: 8px; font-size: clamp(29px, 3vw, 42px); }
h2 { margin-bottom: 12px; font-size: 20px; }
h3 { margin-bottom: 7px; font-size: 16px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 1000; left: 12px; top: 12px; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

/* App shell */
.app-shell { min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.app-sidebar { position: sticky; z-index: 50; top: 0; display: flex; min-height: 100dvh; height: 100dvh; flex-direction: column; padding: 20px 14px 14px; border-right: 1px solid var(--line); background: rgba(255,255,255,.97); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 7px; }
.brand, .mobile-brand { font-size: 21px; font-weight: 900; letter-spacing: -.065em; }
.brand span, .mobile-brand span { color: var(--primary); }
.sidebar-close { display: none; }
.workspace-switcher { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 9px; margin: 17px 0 20px; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.workspace-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--primary); color: #fff; font-weight: 850; }
.workspace-switcher span:last-child { min-width: 0; }
.workspace-switcher small, .workspace-switcher strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-switcher small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.workspace-switcher strong { font-size: 13px; }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-nav a, .sidebar-logout { display: flex; min-height: 44px; align-items: center; gap: 11px; width: 100%; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; font-weight: 720; cursor: pointer; }
.sidebar-nav a > span, .sidebar-logout > span { display: grid; width: 22px; place-items: center; color: #929bad; font-size: 18px; }
.sidebar-nav a:hover, .sidebar-logout:hover { color: var(--ink); background: var(--surface-soft); }
.sidebar-nav a[aria-current="page"] { color: var(--primary-dark); background: var(--primary-soft); }
.sidebar-nav a[aria-current="page"] > span { color: var(--primary); }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar-foot form { margin: 0; }
.app-workspace { min-width: 0; }
.app-topbar { position: sticky; z-index: 30; top: 0; display: flex; height: 64px; align-items: center; justify-content: flex-end; padding: 0 clamp(20px, 3vw, 42px); border-bottom: 1px solid rgba(226,231,239,.92); background: rgba(244,246,251,.91); backdrop-filter: blur(14px); }
.mobile-menu-button, .mobile-brand { display: none; }
.quick-add { display: inline-flex; min-height: 38px; align-items: center; gap: 6px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink-soft); font-size: 13px; font-weight: 780; }
.quick-add:hover { border-color: #c8c2ff; color: var(--primary-dark); }
.app-content { width: min(100%, 1440px); min-width: 0; margin: 0 auto; padding: 28px clamp(20px, 3vw, 42px) 70px; }
.mobile-bottom-nav { display: none; }
.app-overlay { position: fixed; z-index: 40; inset: 0; background: rgba(18, 24, 38, .48); }
.icon-button { display: inline-grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-size: 20px; }

/* Public and auth */
.public-body { min-height: 100dvh; background: radial-gradient(circle at 10% 10%, #efedff 0, transparent 34%), var(--canvas); }
.public-header { display: flex; height: 70px; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 6vw, 88px); }
.public-header nav { display: flex; align-items: center; gap: 18px; color: var(--muted); font-weight: 700; }
.public-main { display: grid; min-height: calc(100dvh - 70px); place-items: center; padding: 32px clamp(18px, 6vw, 88px) 70px; }
.auth-layout { display: grid; width: min(100%, 1040px); grid-template-columns: minmax(0, .9fr) minmax(420px, 1fr); align-items: center; gap: clamp(46px, 8vw, 100px); }
.auth-intro h1 { max-width: 540px; font-size: clamp(40px, 5vw, 64px); }
.auth-intro > p:not(.eyebrow) { max-width: 500px; color: var(--muted); font-size: 17px; }
.auth-intro ul, .auth-steps { display: grid; gap: 12px; padding: 0; margin: 28px 0 0; list-style: none; color: var(--ink-soft); font-weight: 720; }
.auth-intro li { display: flex; align-items: center; gap: 10px; }
.auth-intro li span { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: 12px; }
.auth-steps { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.auth-steps li { display: grid; justify-items: start; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.58); font-size: 12px; }
.auth-card { padding: clamp(26px, 4vw, 38px); border: 1px solid rgba(226,231,239,.9); border-radius: var(--radius-lg); background: rgba(255,255,255,.96); box-shadow: var(--shadow-lg); }
.auth-card-heading { margin-bottom: 23px; }
.auth-card-heading h2 { margin-bottom: 5px; font-size: 27px; }
.auth-card-heading p, .auth-footnote { margin: 0; color: var(--muted); }
.auth-footnote { margin-top: 20px; text-align: center; }
.auth-footnote a { color: var(--primary-dark); font-weight: 800; }

/* Common content */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.compact-page-header { align-items: center; }
.page-header > div { min-width: 0; }
.page-header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.page-header-actions form { margin: 0; }
.page-subtitle { max-width: 720px; margin: 0; color: var(--muted); font-size: 15px; }
.eyebrow { margin: 0 0 7px; color: var(--primary); font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.breadcrumbs a:hover { color: var(--primary-dark); }
.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.compact-panel { padding: 19px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; }
.section-heading p:not(.eyebrow) { margin: 5px 0 0; color: var(--muted); }
.compact-heading { margin-bottom: 13px; }
.text-link { color: var(--primary-dark); font-weight: 800; }
.text-link:hover { text-decoration: underline; }
.button-row, .button-row > div, .card-actions, .form-actions, .dialog-actions, .action-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.card-menu { position: relative; margin-left: auto; }
.card-menu > summary { list-style: none; cursor: pointer; }
.card-menu > summary::-webkit-details-marker { display: none; }
.card-menu > div { position: absolute; z-index: 18; top: calc(100% + 5px); right: 0; display: grid; width: 205px; overflow: hidden; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-lg); }
.card-menu form { margin: 0; }
.card-menu a, .card-menu button { display: flex; width: 100%; min-height: 38px; align-items: center; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-soft); text-align: left; cursor: pointer; font-size: 11px; font-weight: 750; }
.card-menu a:hover, .card-menu button:hover { background: var(--surface-soft); }
.card-menu .text-danger { color: var(--danger); }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(98,86,232,.17); cursor: pointer; font-weight: 800; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { background: var(--primary-dark); }
.button:active { transform: translateY(1px); }
.button:disabled, .button.is-loading { opacity: .48; cursor: not-allowed; box-shadow: none; transform: none; }
.button-small { min-height: 36px; padding: 0 12px; font-size: 12px; }
.button-secondary { border-color: var(--line-strong); background: #fff; color: var(--ink-soft); box-shadow: none; }
.button-secondary:hover { border-color: #c9c3ff; background: var(--primary-soft); color: var(--primary-dark); }
.button-success { background: var(--success); box-shadow: 0 8px 18px rgba(22,132,90,.17); }
.button-success:hover { background: #0f6c49; }
.button-danger { border-color: #f1d1cd; background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.button-danger:hover { background: #ffe4e0; }
.button-block { width: 100%; }
.notice { display: grid; grid-template-columns: 24px minmax(0,1fr); align-items: start; gap: 10px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid transparent; border-radius: 11px; font-weight: 650; }
.notice > span:first-child { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 900; }
.notice a { text-decoration: underline; font-weight: 850; }
.notice-success { border-color: #ccebdd; background: var(--success-soft); color: #126847; }
.notice-success > span:first-child { background: var(--success); color: #fff; }
.notice-error { border-color: #f3d2ce; background: var(--danger-soft); color: #963c34; }
.notice-error > span:first-child { background: var(--danger); color: #fff; }
.status-badge { display: inline-flex; width: fit-content; min-height: 24px; align-items: center; padding: 3px 8px; border-radius: 999px; background: #f0f2f6; color: var(--muted); font-size: 10px; font-style: normal; font-weight: 850; white-space: nowrap; }
.status-success { background: var(--success-soft); color: var(--success); }
.status-danger { background: var(--danger-soft); color: var(--danger); }
.status-warning { background: var(--warning-soft); color: var(--warning); }
.status-info { background: var(--info-soft); color: var(--info); }
.status-neutral { background: #f0f2f6; color: var(--muted); }
.status-dot { display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: #adb5c3; }
.status-dot.is-active { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.text-danger { color: var(--danger) !important; }
.empty-state { display: grid; justify-items: center; padding: 42px 20px; text-align: center; }
.empty-state > span:first-child { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 12px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: 23px; }
.empty-state p { max-width: 480px; margin-bottom: 16px; color: var(--muted); }
.compact-empty { padding: 26px 14px; }
.empty-inline { margin: 18px 0 0; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 17px; margin-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; gap: 7px; }

/* Forms */
.form-stack { display: grid; gap: 15px; }
.compact-form { gap: 13px; }
.form-grid { display: grid; gap: 13px; }
.form-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; color: var(--ink-soft); font-weight: 760; }
.field > small, .field-help, .field-label-row small { color: var(--muted); font-size: 11px; font-weight: 500; }
.field input, .field select, .field textarea, .form-stack input, .form-stack select, .form-stack textarea, .library-toolbar select, .activity-filters select { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; }
textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .form-stack input:focus, .form-stack textarea:focus { border-color: var(--primary); outline: 3px solid rgba(98,86,232,.14); }
.password-field { display: grid; grid-template-columns: minmax(0,1fr) auto; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; }
.password-field input { border: 0; border-radius: 0; outline: 0 !important; }
.password-field button { min-width: 54px; border: 0; background: transparent; color: var(--primary-dark); cursor: pointer; font-weight: 800; }
.choice-fieldset { display: grid; min-width: 0; gap: 9px; padding: 0; margin: 0; border: 0; }
.choice-fieldset > legend { padding: 0; margin-bottom: 8px; font-weight: 800; }
.segmented-cards { display: grid; gap: 8px; }
.segmented-cards-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented-cards label { position: relative; cursor: pointer; }
.segmented-cards input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-cards label > span { display: grid; min-height: 62px; align-content: center; gap: 2px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; }
.segmented-cards small { color: var(--muted); font-size: 11px; font-weight: 500; }
.segmented-cards input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); box-shadow: 0 0 0 2px rgba(98,86,232,.1); }
.compact-options label > span { min-height: 56px; }
.switch-row { position: relative; display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.switch-row input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch-track { display: flex; width: 40px; height: 23px; align-items: center; padding: 3px; border-radius: 999px; background: #bcc4d1; transition: background .15s ease; }
.switch-track span { width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s ease; }
.switch-row input:checked + .switch-track { background: var(--success); }
.switch-row input:checked + .switch-track span { transform: translateX(17px); }
.switch-row strong, .switch-row small { display: block; }
.switch-row small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }
.search-input { display: grid; min-width: 0; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 7px; min-height: 43px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; }
.search-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(98,86,232,.12); }
.search-input input { min-width: 0; width: 100%; height: 40px; padding: 0; border: 0; background: transparent; outline: 0; }
.search-input > span { color: var(--muted); font-size: 19px; }
.search-input button { height: 31px; padding: 0 10px; border: 0; border-radius: 7px; background: var(--surface-soft); color: var(--primary-dark); cursor: pointer; font-size: 12px; font-weight: 800; }

/* Dashboard */
.attention-stack { margin-bottom: 18px; }
.attention-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.attention-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.attention-item:hover { border-color: #c7c1ff; }
.attention-icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.attention-danger .attention-icon { background: var(--danger-soft); color: var(--danger); }
.attention-warning .attention-icon { background: var(--warning-soft); color: var(--warning); }
.attention-item strong, .attention-item small { display: block; }
.attention-item small { margin-top: 2px; color: var(--muted); }
.attention-item b { color: var(--primary-dark); font-size: 12px; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.metric-strip article { display: flex; min-width: 0; align-items: center; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.metric-icon { display: grid; flex: 0 0 auto; width: 38px; height: 38px; place-items: center; border-radius: 10px; font-weight: 900; }
.metric-icon-violet { background: var(--primary-soft); color: var(--primary); }
.metric-icon-green { background: var(--success-soft); color: var(--success); }
.metric-icon-blue { background: var(--info-soft); color: var(--info); }
.metric-icon-red { background: var(--danger-soft); color: var(--danger); }
.metric-icon-neutral { background: #f0f2f6; color: var(--muted); }
.metric-strip strong, .metric-strip small { display: block; }
.metric-strip strong { font-size: 24px; line-height: 1; }
.metric-strip small { margin-top: 5px; color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(270px, .62fr); align-items: start; gap: 18px; }
.utility-stack { display: grid; gap: 14px; }
.operational-list { display: grid; }
.operational-row { display: grid; grid-template-columns: auto minmax(0,1fr) minmax(170px,.62fr) auto; align-items: center; gap: 12px; min-height: 63px; padding: 9px 4px; border-top: 1px solid var(--line); }
.operational-row:hover { background: var(--surface-soft); }
.operational-name, .operational-next { min-width: 0; }
.operational-name strong, .operational-name small, .operational-next strong, .operational-next small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operational-name small, .operational-next small { color: var(--muted); font-size: 11px; }
.operational-next { text-align: right; }
.operational-next strong { margin-top: 2px; font-size: 12px; }
.row-chevron { color: #a6aebb; font-size: 24px; }
.status-list { display: grid; gap: 0; margin: 0 0 16px; }
.status-list > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 0; border-top: 1px solid var(--line); }
.status-list dt { color: var(--muted); }
.status-list dd { margin: 0; text-align: right; font-weight: 780; }
.quick-guide ol { display: grid; gap: 9px; padding: 0; margin: 0; list-style: none; }
.quick-guide li { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.quick-guide li span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: #eef0f4; font-size: 10px; font-weight: 900; }
.quick-guide li.is-done { color: var(--ink-soft); }
.quick-guide li.is-done span { background: var(--success-soft); color: var(--success); }

/* List toolbars and account rows */
.summary-chips { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 8px; margin-bottom: 14px; }
.summary-chips-four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.summary-chips a { display: flex; min-height: 50px; align-items: center; justify-content: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--muted); }
.summary-chips a:hover, .summary-chips a[aria-current="page"] { border-color: #c9c3ff; background: var(--primary-soft); color: var(--primary-dark); }
.summary-chips strong { color: var(--ink); font-size: 16px; }
.summary-chips a[aria-current="page"] strong { color: var(--primary-dark); }
.list-panel { padding: 18px 20px; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.search-form { width: min(100%, 590px); }
.connection-state { display: flex; align-items: center; gap: 9px; }
.connection-state small, .connection-state strong { display: block; white-space: nowrap; }
.connection-state small { color: var(--muted); font-size: 10px; }
.list-count { color: var(--muted); font-size: 12px; }
.account-table { display: grid; border-top: 1px solid var(--line); }
.account-card-row { display: grid; grid-template-columns: minmax(190px, .95fr) minmax(250px, 1.2fr) auto; align-items: center; gap: 15px; min-height: 68px; padding: 10px 3px; border-bottom: 1px solid var(--line); }
.account-profile { display: grid; min-width: 0; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 10px; }
.account-profile > span:last-child { min-width: 0; }
.account-profile strong, .account-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-profile small { color: var(--muted); }
.account-avatar { display: grid; flex: 0 0 auto; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--primary-soft); object-fit: cover; }
.account-avatar-fallback { color: var(--primary); font-weight: 900; }
.account-avatar-large { width: 52px; height: 52px; }
.account-status-copy { min-width: 0; }
.account-status-copy small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-primary-action { justify-self: end; }
.account-primary-action form { margin: 0; }
.onboarding-banner { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; border: 1px solid #d8d3ff; border-radius: 12px; background: var(--primary-soft); }
.onboarding-step { display: inline-flex; min-height: 27px; align-items: center; padding: 0 9px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 850; }
.onboarding-banner p { margin: 2px 0 0; color: var(--muted); }
.advanced-panel, .danger-panel { margin-top: 14px; padding: 0; overflow: hidden; }
.advanced-panel > summary, .danger-panel > summary { display: flex; min-height: 60px; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 18px; cursor: pointer; list-style: none; }
.advanced-panel > summary::-webkit-details-marker, .danger-panel > summary::-webkit-details-marker { display: none; }
.advanced-panel > summary strong, .advanced-panel > summary small, .danger-panel > summary strong, .danger-panel > summary small { display: block; }
.advanced-panel > summary small, .danger-panel > summary small { color: var(--muted); }
.advanced-panel[open] > summary > span:last-child, .danger-panel[open] > summary > span:last-child { transform: rotate(45deg); }
.advanced-panel > form, .advanced-panel > dl, .danger-panel > div { padding: 0 18px 18px; }
.danger-panel { border-color: #f1d1cd; }

/* Spaces */
.space-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.space-summary-card { display: grid; min-width: 0; gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.space-summary-card:hover { border-color: #ccc7fa; box-shadow: var(--shadow-sm); }
.space-summary-card.is-paused { background: #fbfcfe; }
.space-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.space-card-schedule small, .space-card-schedule strong, .space-card-schedule span { display: block; }
.space-card-schedule small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.space-card-schedule strong { margin: 3px 0 2px; }
.space-card-schedule span { color: var(--muted); font-size: 11px; }
.mini-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 0; }
.mini-stats div { padding: 8px 9px; border-radius: 8px; background: var(--surface-soft); }
.mini-stats dt { color: var(--muted); font-size: 10px; }
.mini-stats dd { margin: 2px 0 0; font-size: 16px; font-weight: 850; }
.next-run-line { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 9px; padding-top: 11px; border-top: 1px solid var(--line); }
.next-run-line small, .next-run-line strong { display: block; }
.next-run-line small { color: var(--muted); font-size: 10px; }
.next-run-line strong { margin-top: 2px; font-size: 12px; }
.editor-layout { display: grid; grid-template-columns: minmax(0,1fr) 276px; align-items: start; gap: 17px; }
.editor-main { display: grid; min-width: 0; gap: 14px; }
.editor-rail { min-width: 0; }
.sticky-summary { position: sticky; top: 82px; }
.sticky-summary h2 { margin-bottom: 8px; }
.sticky-summary p:not(.eyebrow) { color: var(--muted); }
.sticky-summary .button + .button { margin-top: 8px; }
.sticky-summary > small { display: block; margin-top: 12px; color: var(--muted); text-align: center; }
.form-section { position: relative; padding: 20px; }
.form-section .section-number { position: absolute; top: 18px; right: 18px; display: grid; width: 27px; height: 27px; place-items: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 900; }
.account-picker { position: relative; }
.account-combobox { grid-template-columns: auto minmax(0,1fr); }
.picker-options { position: absolute; z-index: 20; top: calc(100% + 5px); left: 0; right: 0; display: none; max-height: 320px; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow-lg); }
.picker-options.is-open { display: grid; gap: 3px; }
.picker-option { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 58px; padding: 7px 8px; border: 0; border-radius: 9px; background: #fff; text-align: left; cursor: pointer; }
.picker-option:hover, .picker-option.is-active, .picker-option.is-selected { background: var(--primary-soft); }
.picker-option:disabled { opacity: .54; cursor: not-allowed; }
.picker-option > span:nth-child(2) { min-width: 0; }
.picker-option strong, .picker-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-option small { color: var(--muted); }
.picker-option em { margin-top: 3px; }
.picker-option b { opacity: 0; color: var(--primary); }
.picker-option.is-selected b { opacity: 1; }
.picker-empty { margin: 0; padding: 12px; color: var(--muted); }
.selected-account { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 55px; padding: 7px 9px; border: 1px solid #c8c2ff; border-radius: 10px; background: var(--primary-soft); }
.selected-account-avatar { display: grid; width: 38px; height: 38px; overflow: hidden; place-items: center; border-radius: 50%; background: #fff; color: var(--primary); }
.selected-account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.selected-account strong, .selected-account small, .selected-account em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-account small { color: var(--muted); }
.selected-account em { color: var(--success); font-size: 10px; font-style: normal; font-weight: 800; }
.selected-account button { border: 0; background: transparent; color: var(--primary-dark); cursor: pointer; font-weight: 800; }
.cadence-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 6px; }
.cadence-button { min-height: 43px; padding: 5px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; cursor: pointer; font-size: 11px; font-weight: 800; }
.cadence-button:hover, .cadence-button.is-selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.schedule-panel { display: grid; grid-template-columns: minmax(0,1fr) minmax(150px,.32fr); align-items: end; gap: 12px; margin: 14px 0; }
.daily-times-panel { grid-template-columns: 1fr; align-items: stretch; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.inline-advanced { margin-top: 8px; border: 1px dashed var(--line-strong); border-radius: 8px; }
.inline-advanced summary { padding: 8px 10px; color: var(--primary-dark); cursor: pointer; font-size: 11px; font-weight: 800; }
.inline-advanced label { display: grid; gap: 5px; padding: 0 10px 10px; font-size: 11px; font-weight: 750; }
.inline-advanced input { min-height: 39px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; }
.field-label-row, .preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.time-chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.time-chip { display: flex; align-items: center; padding: 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.time-chip input { width: 106px; min-height: 35px; padding: 5px 7px; border: 0; background: transparent; }
.time-chip button { display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 6px; background: var(--danger-soft); color: var(--danger); cursor: pointer; }
.text-button { width: fit-content; min-height: 38px; padding: 0; border: 0; background: transparent; color: var(--primary-dark); cursor: pointer; font-weight: 850; }
.day-picker { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 6px; }
.day-picker label { position: relative; cursor: pointer; }
.day-picker input { position: absolute; opacity: 0; pointer-events: none; }
.day-picker span { display: grid; min-height: 39px; place-items: center; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-size: 11px; font-weight: 800; }
.day-picker input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.schedule-preview { display: grid; gap: 9px; padding: 12px; margin-top: 14px; border: 1px solid #cde8db; border-radius: 10px; background: #f4fbf7; }
.schedule-preview.is-error { border-color: #f1d1cd; background: var(--danger-soft); }
.preview-head small, .preview-head strong { display: block; }
.preview-head small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.preview-runs { display: flex; flex-wrap: wrap; gap: 5px; }
.preview-runs span { padding: 4px 7px; border: 1px solid #dbece4; border-radius: 7px; background: #fff; font-size: 10px; font-weight: 750; }
.schedule-preview > p { margin: 0; color: #266b50; font-size: 11px; font-weight: 750; }
.preview-warnings { display: grid; gap: 5px; }
.preview-warnings:empty { display: none; }
.preview-warnings p { margin: 0; padding: 7px 8px; border-radius: 7px; background: var(--warning-soft); color: #8a5a12; font-size: 10px; font-weight: 720; }
.space-context { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 13px; }
.space-context-main { display: flex; min-width: 0; align-items: center; gap: 12px; }
.space-context-main > div { min-width: 0; }
.space-context h1 { overflow: hidden; margin: 0; font-size: clamp(27px, 3vw, 38px); text-overflow: ellipsis; white-space: nowrap; }
.space-context p { margin: 3px 0 0; color: var(--muted); }
.title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.title-line h1 { margin: 0; }
.space-context-stats { display: flex; align-items: center; gap: 20px; }
.space-context-stats span { min-width: 90px; }
.space-context-stats small, .space-context-stats strong { display: block; }
.space-context-stats small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.space-context-stats strong { max-width: 190px; margin-top: 2px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.context-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 11px; background: #fff; scrollbar-width: none; }
.context-tabs::-webkit-scrollbar { display: none; }
.context-tabs a { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; padding: 0 14px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 780; white-space: nowrap; }
.context-tabs a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-dark); }
.action-bar { margin-bottom: 15px; }
.action-bar form { margin: 0; }
.schedule-summary-line { padding: 12px 14px; border-radius: 10px; background: var(--surface-soft); }
.schedule-summary-line strong, .schedule-summary-line span { display: block; }
.schedule-summary-line span { margin-top: 3px; color: var(--muted); }
.run-list { display: grid; gap: 7px; padding: 0; margin: 13px 0 0; list-style: none; }
.run-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.run-list li span { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: 10px; font-weight: 900; }
.recent-activity { margin-top: 17px; }
.simple-job-list { display: grid; }
.simple-job-list a { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; min-height: 55px; padding: 8px 2px; border-top: 1px solid var(--line); }
.simple-job-list strong, .simple-job-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.simple-job-list small { color: var(--muted); }

/* Content */
.content-top-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(250px,.55fr); align-items: start; gap: 16px; margin-bottom: 16px; }
.dropzone { display: grid; min-height: 156px; justify-items: center; align-content: center; gap: 6px; padding: 20px; border: 1.5px dashed #b8c0df; border-radius: 12px; background: #fbfbff; text-align: center; cursor: pointer; }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; background: var(--primary-soft); color: var(--primary); font-size: 22px; }
.dropzone small, .file-summary { color: var(--muted); font-size: 11px; }
.file-summary { font-weight: 750; }
.selected-file-preview { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; }
.selected-file-preview img { flex: 0 0 auto; width: 48px; height: 72px; border-radius: 7px; background: #edf0f5; object-fit: cover; }
.selected-video-preview { position: relative; flex: 0 0 auto; width: 72px; height: 72px; overflow: hidden; border-radius: 7px; background: #172033; }
.selected-video-preview video { display: block; width: 100%; height: 100%; object-fit: cover; }
.selected-video-preview small { position: absolute; right: 4px; bottom: 4px; padding: 2px 5px; border-radius: 5px; background: rgba(23,32,51,.78); color: #fff; font-size: 8px; font-weight: 850; pointer-events: none; }
.upload-rejection { flex: 1 0 100%; margin: 0; padding: 7px 9px; border-radius: 7px; background: var(--danger-soft); color: var(--danger); font-size: 10px; font-weight: 750; }
.upload-advanced-panel { margin-top: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.upload-advanced-panel > summary { min-height: 48px; padding: 10px 12px; }
.upload-advanced-grid { display: grid; gap: 12px; padding: 0 12px 12px; }
.content-summary-panel form { margin-bottom: 8px; }
.library-panel { padding: 20px; }
.library-toolbar, .activity-filters { display: grid; grid-template-columns: minmax(220px,1fr) 150px 130px auto; align-items: end; gap: 8px; padding: 11px; margin-bottom: 13px; border-radius: 10px; background: var(--surface-soft); }
.library-toolbar > label:not(.search-input), .activity-filters > label:not(.search-input) { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 750; }
.library-toolbar select, .activity-filters select { min-height: 41px; padding: 8px 9px; }
.bulk-action-bar { position: sticky; z-index: 10; top: 72px; display: grid; grid-template-columns: auto minmax(110px,1fr) auto auto auto auto; align-items: center; gap: 7px; padding: 9px 11px; margin-bottom: 11px; border: 1px solid #c9c3ff; border-radius: 10px; background: #faf9ff; box-shadow: var(--shadow-sm); }
.bulk-action-hint { color: var(--muted); font-size: 11px; font-weight: 750; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.story-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow-sm); }
.library-heading { align-items: flex-start; }
.library-heading p { max-width: 720px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.library-heading-actions { display: flex; align-items: center; gap: 8px; }
.library-heading-actions [aria-disabled="true"] { opacity: .48; pointer-events: none; }
.story-sequence-badge { position: absolute; z-index: 3; top: 8px; right: 8px; display: grid; min-width: 28px; height: 28px; place-items: center; padding: 0 6px; border: 2px solid #fff; border-radius: 8px; background: rgba(23,32,51,.72); color: #fff; font-size: 10px; font-weight: 900; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.order-help { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 11px; padding: 11px 13px; margin-bottom: 14px; border: 1px solid #d8d3ff; border-radius: 10px; background: var(--primary-soft); color: var(--ink-soft); }
.order-help > span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: #fff; color: var(--primary); font-size: 18px; font-weight: 900; }
.order-help p { margin: 0; font-size: 12px; }
.story-card--ordering { overflow: visible; cursor: default; transition: opacity .15s ease, transform .19s ease, box-shadow .19s ease; }
.story-card--ordering.sortable-chosen { z-index: 8; border-color: #a9a1ff; box-shadow: 0 12px 28px rgba(23,32,51,.16); }
.story-card--ordering.sortable-ghost { border: 2px dashed var(--primary); background: var(--primary-soft); opacity: .28; }
.story-card--ordering.sortable-drag, .story-card--ordering.sortable-fallback { opacity: .96; transform: rotate(1deg) scale(1.025); box-shadow: 0 18px 42px rgba(23,32,51,.24); }
.sortable-fallback { pointer-events: none !important; }
.is-sorting-media, .is-sorting-media * { cursor: grabbing !important; }
.story-order-tools { position: absolute; z-index: 5; top: 7px; left: 7px; right: 7px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.story-order-number, .drag-handle { display: grid; height: 34px; place-items: center; border: 2px solid #fff; border-radius: 9px; box-shadow: 0 2px 9px rgba(0,0,0,.2); }
.story-order-number { width: 34px; }
.story-order-number { background: var(--primary); color: #fff; font-size: 12px; font-weight: 900; }
.drag-handle { pointer-events: auto; grid-template-columns: auto auto; width: auto; min-width: 84px; gap: 4px; padding: 0 8px; border-color: #fff; background: rgba(23,32,51,.84); color: #fff; cursor: grab; font-size: 11px; font-weight: 900; touch-action: none; }
.drag-handle-icon { font-size: 16px; line-height: 1; }
.drag-handle-label { letter-spacing: .01em; }
.drag-handle:active { cursor: grabbing; }
.drag-handle:focus-visible { outline: 3px solid rgba(98,86,232,.35); outline-offset: 2px; }
.order-move-actions { display: grid; grid-template-columns: 34px 34px minmax(0,1fr); align-items: center; gap: 5px; }
.order-move-actions button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--primary-dark); cursor: pointer; font-weight: 900; }
.order-move-actions button:disabled { opacity: .35; cursor: default; }
.order-move-actions span { justify-self: end; color: var(--muted); font-size: 10px; font-weight: 800; }
.order-action-bar { position: sticky; z-index: 12; bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; margin-top: 16px; border: 1px solid var(--line-strong); border-radius: 11px; background: rgba(255,255,255,.96); box-shadow: var(--shadow-lg); backdrop-filter: blur(12px); }
.order-action-bar p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 750; }
.has-order-changes .order-action-bar { border-color: #c9c3ff; }
.has-order-changes .order-action-bar p { color: var(--primary-dark); }
.order-action-bar > div { display: flex; gap: 8px; }
.story-select { position: absolute; z-index: 3; top: 7px; left: 7px; cursor: pointer; }
.story-select input { position: absolute; opacity: 0; }
.story-select > span:nth-of-type(1) { display: grid; width: 27px; height: 27px; place-items: center; border: 2px solid #fff; border-radius: 8px; background: rgba(23,32,51,.54); color: transparent; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.story-select input:checked + span { background: var(--primary); color: #fff; }
.story-preview { display: block; aspect-ratio: 9 / 16; overflow: hidden; background: #edf0f5; }
.story-preview img, .story-preview video { display: block; width: 100%; height: 100%; object-fit: cover; }
.story-preview--video { position: relative; background: #111827; }
.media-kind-badge { position: absolute; z-index: 2; right: 7px; bottom: 7px; padding: 3px 6px; border-radius: 6px; background: rgba(23,32,51,.76); color: #fff; font-size: 8px; font-weight: 900; pointer-events: none; }
.story-card-body { display: grid; gap: 9px; padding: 11px; }
.story-card-title { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 6px; }
.story-card-title > span:first-child { min-width: 0; }
.story-card-title strong, .story-card-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-card-title strong { font-size: 12px; }
.story-card-title small { color: var(--muted); font-size: 10px; }
.story-meta-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.story-meta-chips span { max-width: 100%; overflow: hidden; padding: 4px 7px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-soft); font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.story-edit-panel { border-top: 1px solid var(--line); }
.story-edit-panel > summary { display: flex; min-height: 36px; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; color: var(--primary-dark); font-size: 11px; font-weight: 850; }
.story-edit-panel > summary::-webkit-details-marker { display: none; }
.story-edit-panel[open] > summary > span:last-child { transform: rotate(45deg); }
.story-edit-panel-body { display: grid; gap: 8px; padding-top: 8px; }
.policy-toggle { display: grid; grid-template-columns: repeat(2,1fr); padding: 3px; border-radius: 8px; background: var(--surface-soft); }
.policy-toggle button { min-height: 30px; padding: 0 4px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 800; }
.media-edit-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 4px; }
.media-edit-actions--video { grid-template-columns: 1fr; }
.media-edit-actions button { display: grid; min-width: 0; min-height: 38px; place-items: center; align-content: center; gap: 0; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink-soft); cursor: pointer; font-size: 10px; font-weight: 850; line-height: 1.05; }
.media-edit-actions button > span:first-child { color: var(--primary-dark); font-size: 16px; line-height: .9; }
.media-edit-actions button:hover { border-color: #c9c3ff; background: var(--primary-soft); color: var(--primary-dark); }
.media-edit-actions .media-delete-button { border-color: #f0d7d3; color: var(--danger); }
.media-edit-actions .media-delete-button > span:first-child { color: var(--danger); }
.media-edit-actions .media-delete-button:hover { border-color: #e8bcb6; background: var(--danger-soft); color: var(--danger); }
.media-edit-actions button:disabled { opacity: .42; cursor: not-allowed; }
.policy-toggle button.is-selected { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 4px rgba(0,0,0,.09); }

/* Activity */
.activity-panel { padding: 19px; }
.activity-filters { grid-template-columns: minmax(240px,1fr) 180px 140px auto; }
.filter-advanced { grid-column: 1 / -1; border-top: 1px solid var(--line); }
.filter-advanced summary { width: fit-content; padding-top: 10px; color: var(--primary-dark); cursor: pointer; font-size: 11px; font-weight: 850; }
.filter-advanced > div { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; padding-top: 10px; }
.filter-advanced label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 750; }
.filter-advanced select, .filter-advanced input { width: 100%; min-height: 41px; padding: 8px 9px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; }
.activity-table { display: grid; }
.activity-head, .activity-row { display: grid; grid-template-columns: 145px minmax(150px,1fr) minmax(170px,1fr) 155px minmax(145px,.8fr) 20px; align-items: center; gap: 12px; }
.activity-head { min-height: 35px; padding: 0 7px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.activity-row { min-height: 64px; padding: 8px 7px; border-bottom: 1px solid var(--line); }
.activity-row:hover { background: var(--surface-soft); }
.activity-row > span { min-width: 0; }
.activity-row strong, .activity-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.job-detail-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(280px,.62fr); align-items: start; gap: 17px; }
.attempt-timeline { position: relative; display: grid; gap: 0; padding: 0; margin: 0; list-style: none; }
.attempt-timeline li { position: relative; display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 12px; padding: 0 0 22px; }
.attempt-timeline li::before { content: ''; position: absolute; left: 9px; top: 16px; bottom: 0; width: 1px; background: var(--line-strong); }
.attempt-timeline li:last-child { padding-bottom: 0; }
.attempt-timeline li:last-child::before { display: none; }
.timeline-mark { position: relative; z-index: 1; display: block; width: 19px; height: 19px; border: 5px solid var(--success-soft); border-radius: 50%; background: var(--success); }
.attempt-failed .timeline-mark { border-color: var(--danger-soft); background: var(--danger); }
.attempt-timeline li > div > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.attempt-timeline small { color: var(--muted); }
.attempt-timeline p { margin: 7px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 12px; }
.error-detail { border-color: #f1d1cd; }
.error-detail > strong { color: var(--danger); }
.error-detail p { margin: 6px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.technical-list dd { max-width: 160px; overflow-wrap: anywhere; }

/* Setup, dialog and errors */
.setup-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,.55fr); align-items: start; gap: 16px; }
.setup-status-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 13px 0; border-top: 1px solid var(--line); }
.setup-status-row:first-child { border-top: 0; }
.setup-status-row strong, .setup-status-row small { display: block; }
.setup-status-row small { color: var(--muted); }
.setup-check { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: var(--warning-soft); color: var(--warning); font-weight: 900; }
.setup-check.is-done { background: var(--success-soft); color: var(--success); }
.copy-field { display: grid; grid-template-columns: minmax(0,1fr) auto; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 9px; }
.copy-field code { overflow: hidden; padding: 10px; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.copy-field button { border: 0; background: var(--surface-soft); color: var(--primary-dark); cursor: pointer; font-weight: 800; }
.confirm-dialog { width: min(calc(100% - 28px), 430px); padding: 0; border: 0; border-radius: 16px; box-shadow: var(--shadow-lg); }
.confirm-dialog::backdrop { background: rgba(17,23,36,.52); backdrop-filter: blur(2px); }
.dialog-card { display: grid; justify-items: center; padding: 27px; text-align: center; }
.dialog-icon { display: grid; width: 46px; height: 46px; place-items: center; margin-bottom: 11px; border-radius: 13px; background: var(--danger-soft); color: var(--danger); font-size: 20px; font-weight: 900; }
.dialog-card p { color: var(--muted); }
.dialog-card > small { max-width: 330px; margin: -4px 0 14px; color: var(--muted); font-size: 10px; }
.state-page { display: grid; min-height: 60dvh; place-content: center; justify-items: center; text-align: center; }
.state-code { color: var(--primary); font-size: clamp(64px, 12vw, 120px); font-weight: 900; letter-spacing: -.09em; line-height: 1; }
.state-page p { max-width: 520px; color: var(--muted); }
.toast-region { position: fixed; z-index: 100; right: 16px; bottom: 16px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 360px; padding: 11px 14px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); }

@media (max-width: 1279px) {
  .story-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .cadence-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 1023px) {
  .app-shell { display: block; }
  .app-sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: min(82vw, 280px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .app-sidebar.is-open { transform: translateX(0); }
  .sidebar-close { display: inline-grid; }
  .app-topbar { justify-content: space-between; padding: 0 20px; background: rgba(255,255,255,.94); }
  .mobile-menu-button, .mobile-brand { display: inline-grid; }
  .mobile-brand { margin-right: auto; margin-left: 8px; }
  .dashboard-grid, .job-detail-grid { grid-template-columns: minmax(0,1fr) minmax(250px,.54fr); }
  .story-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .activity-head, .activity-row { grid-template-columns: 135px minmax(140px,1fr) minmax(155px,1fr) 140px 20px; }
  .activity-head span:nth-child(5), .activity-row span:nth-child(5) { display: none; }
}

@media (max-width: 767px) {
  .app-topbar { height: 58px; padding: 0 14px; }
  .quick-add span:last-child { display: none; }
  .quick-add { width: 40px; min-height: 40px; justify-content: center; padding: 0; font-size: 18px; }
  .app-content { padding: 20px 14px calc(88px + env(safe-area-inset-bottom)); }
  .mobile-bottom-nav { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4,1fr); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); box-shadow: 0 -8px 22px rgba(23,32,51,.08); backdrop-filter: blur(14px); }
  .mobile-bottom-nav a { display: grid; min-height: 48px; place-items: center; align-content: center; gap: 1px; border-radius: 9px; color: var(--muted); }
  .mobile-bottom-nav a > span { font-size: 18px; }
  .mobile-bottom-nav small { font-size: 9px; font-weight: 750; }
  .mobile-bottom-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-dark); }
  .page-header { align-items: flex-start; flex-direction: column; gap: 13px; margin-bottom: 17px; }
  .page-header h1 { font-size: 29px; }
  .page-header > .button { width: 100%; }
  .page-header-actions { width: 100%; justify-content: stretch; }
  .page-header-actions > *, .page-header-actions form { flex: 1 1 auto; }
  .page-header-actions .button { width: 100%; }
  .panel { padding: 17px; border-radius: 12px; }
  .attention-grid, .space-card-grid, .dashboard-grid, .content-top-grid, .job-detail-grid, .setup-grid, .editor-layout { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metric-strip article { padding: 12px; }
  .metric-strip strong { font-size: 21px; }
  .operational-row { grid-template-columns: auto minmax(0,1fr) auto; }
  .operational-next { grid-column: 2; text-align: left; }
  .summary-chips { display: flex; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
  .summary-chips::-webkit-scrollbar { display: none; }
  .summary-chips a { flex: 0 0 auto; min-width: 105px; }
  .list-panel { padding: 14px; }
  .list-toolbar { align-items: stretch; flex-direction: column; }
  .search-form { width: 100%; }
  .connection-state { display: none; }
  .account-card-row { grid-template-columns: minmax(0,1fr) auto; gap: 9px; padding: 12px 2px; }
  .account-status-copy { grid-column: 1 / -1; padding-left: 52px; }
  .account-status-copy small { white-space: normal; }
  .account-primary-action { grid-column: 2; grid-row: 1; }
  .space-summary-card { padding: 14px; }
  .sticky-summary { position: static; }
  .editor-rail { grid-row: auto; }
  .editor-rail .sticky-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .editor-rail .sticky-summary .eyebrow, .editor-rail .sticky-summary h2, .editor-rail .sticky-summary p, .editor-rail .sticky-summary small { grid-column: 1 / -1; }
  .form-grid-two, .segmented-cards-two, .schedule-panel { grid-template-columns: 1fr; }
  .day-picker { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .space-context { align-items: flex-start; flex-direction: column; }
  .space-context-stats { width: 100%; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); }
  .context-tabs { margin-left: -4px; margin-right: -4px; }
  .action-bar .button, .action-bar form { flex: 1 1 auto; }
  .action-bar form .button { width: 100%; }
  .library-toolbar, .activity-filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .library-toolbar .search-input, .activity-filters .search-input { grid-column: 1 / -1; }
  .filter-advanced > div { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .library-toolbar > .button, .activity-filters > .button { align-self: end; }
  .story-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .library-heading { align-items: stretch; flex-direction: column; }
  .library-heading-actions { justify-content: space-between; }
  .order-action-bar { bottom: 70px; align-items: stretch; flex-direction: column; }
  .order-action-bar > div { display: grid; grid-template-columns: 1fr 1fr; }
  .order-action-bar .button { width: 100%; }
  .bulk-action-bar { top: 64px; grid-template-columns: auto minmax(0,1fr) auto auto; }
  .bulk-action-hint { display: none; }
  .activity-head { display: none; }
  .activity-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 13px 2px; }
  .activity-row > span { display: block !important; }
  .activity-row > span::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
  .activity-row > span:nth-child(1), .activity-row > span:nth-child(2) { grid-column: auto; }
  .activity-row > span:nth-child(3), .activity-row > span:nth-child(4), .activity-row > span:nth-child(5) { grid-column: 1 / -1; }
  .activity-row .row-chevron { position: absolute; right: 18px; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination > div .button { flex: 1; }
  .public-header { padding: 0 18px; }
  .public-header nav > a:first-child { display: none; }
  .public-main { padding: 20px 15px 44px; }
  .auth-layout { grid-template-columns: 1fr; gap: 22px; }
  .auth-intro { display: none; }
  .auth-card { width: 100%; padding: 24px 19px; }
}

@media (max-width: 479px) {
  body { font-size: 13px; }
  .page-header h1, .space-context h1 { font-size: 26px; }
  .attention-item { grid-template-columns: auto minmax(0,1fr); }
  .attention-item b { grid-column: 2; }
  .metric-icon { width: 34px; height: 34px; }
  .metric-strip small { font-size: 10px; }
  .space-card-head { align-items: flex-start; }
  .card-actions > *, .card-actions form { flex: 1 1 45%; }
  .card-actions .button { width: 100%; }
  .cadence-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .selected-account { grid-template-columns: auto minmax(0,1fr); }
  .selected-account button { grid-column: 2; justify-self: start; }
  .editor-rail .sticky-summary { grid-template-columns: 1fr; }
  .editor-rail .sticky-summary > * { grid-column: 1 !important; }
  .action-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .action-bar > a:first-child { grid-column: 1 / -1; }
  .space-context-stats { gap: 10px; }
  .space-context-stats span { min-width: 0; }
  .space-context-stats strong { max-width: 150px; }
  .library-toolbar, .activity-filters { grid-template-columns: 1fr; }
  .library-toolbar .search-input, .activity-filters .search-input { grid-column: 1; }
  .filter-advanced > div { grid-template-columns: 1fr; }
  .story-grid { grid-template-columns: 1fr; }
  .story-grid--ordering { gap: 12px 8px; }
  .story-order-number, .drag-handle { height: 38px; }
  .story-order-number { width: 38px; }
  .order-move-actions { grid-template-columns: 40px 40px minmax(0,1fr); }
  .order-move-actions button { width: 40px; height: 40px; }
  .story-card-body { padding: 8px; }
  .bulk-action-bar { grid-template-columns: 1fr auto; }
  .bulk-action-bar > strong, .bulk-loop-select { grid-column: 1 / -1; }
  .bulk-action-bar .button { min-height: 34px; font-size: 10px; }
  .activity-row { grid-template-columns: 1fr; }
  .account-primary-action .button { min-width: 92px; padding: 0 9px; }
  .setup-status-row { grid-template-columns: auto minmax(0,1fr); }
  .setup-status-row > .status-badge { grid-column: 2; }
}

.container-model-panel, .container-create-panel, .loop-manager, .loop-create-panel { margin-top: 16px; }
.schedule-command-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; margin-top: 16px; }
.schedule-command-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px; }
.schedule-command-panel h2, .loop-page-heading h2 { margin: 0 0 6px; }
.schedule-command-panel p:not(.eyebrow), .loop-page-heading p { margin: 0; color: var(--muted); }
.schedule-command-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.schedule-status-panel { display: grid; gap: 12px; padding: 16px; }
.schedule-container-panel, .space-settings-panel, .loop-delete-panel { margin-top: 16px; }
.schedule-container-list { display: grid; gap: 10px; }
.schedule-container-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, auto); gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.schedule-container-main { display: grid; gap: 10px; min-width: 0; }
.schedule-container-title { min-width: 0; }
.schedule-container-title h3 { margin: 8px 0 3px; font-size: 18px; }
.schedule-container-title p { margin: 0; color: var(--muted); }
.container-metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.container-metric-row div { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.container-metric-row dt { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.container-metric-row dd { margin: 3px 0 0; color: var(--ink); font-weight: 900; }
.schedule-container-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; }
.schedule-container-actions form { margin: 0; }
.schedule-container-actions .button { width: 100%; }
.schedule-container-actions [aria-disabled="true"] { opacity: .55; pointer-events: none; }
.space-settings-form { padding: 0 18px 18px; }
.loop-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 18px; }
.loop-edit-stats { margin: 14px 0 0; }
.container-model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.container-model-grid > div { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 3px 9px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.container-model-grid span { display: grid; grid-row: span 2; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 900; }
.container-model-grid strong, .container-model-grid small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.container-model-grid small { color: var(--muted); }
.container-preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.container-preset-card { display: grid; gap: 9px; align-content: start; min-height: 155px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.container-preset-card strong { color: var(--ink); font-size: 16px; }
.container-preset-card small { color: var(--muted); line-height: 1.45; }
.container-preset-card .button { align-self: end; width: 100%; }
.container-custom-create { margin-top: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.container-custom-create summary { padding: 13px 14px; color: var(--primary-dark); cursor: pointer; font-weight: 850; }
.container-custom-create form { padding: 0 14px 14px; }
.loop-card-list { display: grid; gap: 14px; }
.loop-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.loop-card > form:first-child { min-width: 0; }
.space-loop-overview { margin-top: 18px; }
.space-loop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.space-loop-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.space-loop-card h3 { margin: 7px 0 4px; font-size: 18px; }
.space-loop-card p { margin: 0; color: var(--muted); }
.compact-status-list { margin: 0; }
.space-loop-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.space-loop-actions form { margin: 0; }
.bulk-loop-select { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 850; }
.bulk-loop-select select, .media-loop-policy select { min-height: 34px; max-width: 180px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font: inherit; font-size: 11px; }
.media-loop-policy { grid-template-columns: minmax(0, 1fr) repeat(2, minmax(58px, auto)); }
.segmented-cards-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.destination-fieldset { margin-top: 4px; }
.feed-caption-input textarea,
.media-destination-form textarea { width: 100%; min-height: 66px; resize: vertical; }
.media-destination-form { display: grid; gap: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.media-destination-form strong { overflow: hidden; color: var(--ink-soft); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.media-destination-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.media-destination-form label { display: flex; min-width: 0; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 800; }
.media-destination-form input[type="checkbox"] { width: 14px; height: 14px; }
.media-destination-form .button { width: 100%; }

@media (max-width: 760px) {
  .schedule-command-grid, .schedule-command-panel, .schedule-container-card { grid-template-columns: 1fr; }
  .schedule-status-panel { display: none; }
  .schedule-command-actions, .loop-page-heading { align-items: stretch; flex-direction: column; }
  .schedule-command-actions .button, .loop-page-heading .button { width: 100%; }
  .container-metric-row, .schedule-container-actions { grid-template-columns: 1fr; }
  .container-model-grid, .container-preset-grid { grid-template-columns: 1fr; }
  .space-loop-grid { grid-template-columns: 1fr; }
  .space-loop-actions > *, .space-loop-actions form, .space-loop-actions .button { flex: 1 1 auto; width: 100%; }
  .loop-card { grid-template-columns: 1fr; }
  .bulk-loop-select { width: 100%; }
  .bulk-loop-select select { flex: 1; max-width: none; }
  .media-loop-policy { grid-template-columns: 1fr 1fr; }
  .media-loop-policy select { grid-column: 1 / -1; max-width: none; }
  .media-destination-options { grid-template-columns: 1fr; }
  .segmented-cards-three { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
