/* octa-website app-local layout helpers only. Component styling comes from the Octacer theme
   (.oc-*, .btn, .badge, .oc-card) — net-new components go into octa-core/theme first (skill §1a). */

.ow-appbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.25rem;
    border-bottom: 1px solid rgba(128, 128, 128, .2);
}

.ow-spacer { flex: 1; }

.ow-navlink {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    text-decoration: none;
    color: inherit;
    padding: .4rem .6rem;
    border-radius: .5rem;
}

.ow-user { font-size: .85rem; opacity: .75; }

.ow-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.25rem; }

.ow-hero { padding: 2.5rem 0; text-align: center; }
.ow-hero h1 { font-size: 2rem; margin: .75rem 0 .5rem; }

.ow-muted { opacity: .7; max-width: 640px; margin-inline: auto; }

.ow-cta { display: flex; gap: .75rem; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }

.ow-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 2.5rem;
}

/* ============================================================
   Admin CMS shell (aw-*) + page/form/table helpers.
   App-local layout only; all component styling comes from the
   Octacer theme (.oc-*, .btn, .field-*, .badge, .oc-table).
   ============================================================ */

/* ---- Brand + avatar (used by the admin sidebar) ---- */
.oc-brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.oc-brand-badge { width: 2rem; height: 2rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; flex: 0 0 auto; }
.oc-brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.oc-brand-full { font-weight: 700; font-size: .95rem; color: var(--ink-900); }
.oc-brand-name small { font-size: .68rem; color: var(--ink-400); }
.oc-avatar { width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); flex: 0 0 auto; }

/* ---- Shell layout: fixed left sidebar + scrolling body ---- */
.aw-shell { min-height: 100vh; }
.aw-side {
    position: fixed; inset: 0 auto 0 0; width: 15rem; z-index: 40;
    display: flex; flex-direction: column;
    background: var(--surface); border-right: 1px solid var(--line);
}
.aw-brandbar { padding: 1rem 1.1rem; border-bottom: 1px solid var(--line-2); }
.aw-nav { flex: 1 1 auto; overflow-y: auto; padding: .75rem .6rem; display: flex; flex-direction: column; gap: .1rem; }
.aw-nav-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-400); padding: .9rem .6rem .35rem; }
.aw-navlink {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .65rem; border-radius: .55rem;
    font-size: .85rem; font-weight: 500; color: var(--ink-600);
    text-decoration: none; transition: background .12s ease, color .12s ease;
}
.aw-navlink:hover { background: #f1f5f9; color: var(--ink-900); }
.aw-navlink-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.aw-navlink i { width: 1.05rem; text-align: center; }
.aw-sidefoot { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-top: 1px solid var(--line-2); }
.aw-side-user { flex: 1 1 auto; min-width: 0; }
.aw-side-user .n { font-size: .8rem; font-weight: 600; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-side-user .r { font-size: .7rem; color: var(--ink-400); }

.aw-body { margin-left: 15rem; min-height: 100vh; display: flex; flex-direction: column; }
.aw-appbar { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.7); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.aw-appbar-title { font-weight: 600; font-size: .95rem; color: var(--ink-900); }
.aw-spacer { flex: 1; }
.aw-menu-btn { display: none; }
.aw-main { flex: 1 1 auto; padding: 1.75rem; max-width: 1200px; width: 100%; }

.aw-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 39; }

/* Mobile: collapse the sidebar into a slide-over */
@media (max-width: 900px) {
    .aw-side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    .aw-side.is-open { transform: translateX(0); }
    .aw-body { margin-left: 0; }
    .aw-menu-btn { display: inline-flex; }
    .aw-main { padding: 1.25rem; }
}
@media (min-width: 901px) { .aw-backdrop { display: none !important; } }

/* ---- Page header (title + actions) ---- */
.oc-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.oc-page-title { font-family: 'Montserrat','Inter',sans-serif; font-size: 1.4rem; font-weight: 700; color: var(--ink-900); letter-spacing: -.02em; }
.oc-page-sub { font-size: .85rem; color: var(--ink-500); margin-top: .2rem; max-width: 42rem; }
.oc-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.oc-mb { margin-bottom: 1.25rem; }
.oc-muted { color: var(--ink-500); }

/* ---- Table wrapper (horizontal scroll on overflow, §96) ---- */
.oc-table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow-x: auto; }
.oc-table-wrap .oc-table thead th { background: var(--line-2); }
.oc-cell-title { font-weight: 600; color: var(--ink-900); }
.oc-cell-sub { display: block; font-size: .75rem; color: var(--ink-400); }
.oc-truncate { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-num { text-align: right; font-variant-numeric: tabular-nums; }
.oc-row-actions { display: flex; gap: .25rem; justify-content: flex-end; align-items: center; }
.oc-inline-form { display: inline; }

/* ---- Forms (card + responsive grid + sticky actions) ---- */
.oc-form { padding: 1.5rem; }
.oc-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.oc-form-grid .col-span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .oc-form-grid { grid-template-columns: 1fr; } }
.field { margin-bottom: 1rem; }
.oc-form-grid .field { margin-bottom: 0; }
.oc-form-section-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-400); margin: 1.5rem 0 .75rem; grid-column: 1 / -1; border-top: 1px solid var(--line-2); padding-top: 1.25rem; }
.oc-form-actions { display: flex; gap: .5rem; justify-content: flex-end; align-items: center; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line-2); }

/* Inline checkbox/toggle rows */
.oc-check-row { display: flex; align-items: center; gap: .6rem; }
.oc-check-row label { font-size: .85rem; color: var(--ink-700); font-weight: 500; }

/* ---- Image upload control ---- */
.oc-upload { display: flex; gap: .5rem; align-items: stretch; }
.oc-upload .field-input { flex: 1 1 auto; }
.oc-upload-preview { margin-top: .5rem; }
.oc-upload-preview img { max-height: 6rem; border-radius: .5rem; border: 1px solid var(--line); display: block; }
.oc-upload-status { font-size: .72rem; margin-top: .35rem; }
.oc-upload-status.is-error { color: var(--danger); }
.oc-upload-status.is-ok { color: var(--success); }

/* ---- Toast container (window.ocToast target) ---- */
.oc-toast-wrap { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; }

/* Brand link modifier used by the admin sidebar (flat = no card chrome). */
.oc-brand--flat { padding: 0; background: none; border: none; box-shadow: none; }

/* ASP.NET checkbox tag helpers emit a hidden <input value="false"> immediately after the checkbox, which
   sits between the checkbox and .oc-toggle-track and breaks the theme's `input:checked + .oc-toggle-track`
   adjacent selector. Re-assert the toggle visuals with a general-sibling combinator so it works either way.
   (App-local override — the vendored octacer-theme.css is octa-core-owned and not hand-edited, skill §0a.) */
.oc-toggle input:checked ~ .oc-toggle-track { background: var(--brand-600); }
.oc-toggle input:checked ~ .oc-toggle-track::before { transform: translateX(1.1rem); }
.oc-toggle input:focus-visible ~ .oc-toggle-track { box-shadow: var(--ring); }
.oc-toggle input:disabled ~ .oc-toggle-track { opacity: .5; }
.oc-toggle-success input:checked ~ .oc-toggle-track { background: var(--success); }

/* ---- Small layout utilities (avoid inline style= per skill §1) ---- */
.aw-stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.aw-stat-grid + .aw-stat-grid { margin-top: 1.25rem; }
.aw-stat-link { text-decoration: none; }
.aw-stat-sub { margin-top: .35rem; }
.aw-flex-wrap { display: flex; flex-wrap: wrap; gap: .4rem; }
.aw-chiplist { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ---- Provider settings: "Test connection" action row ---- */
.oc-provider-actions { display: flex; align-items: center; gap: .75rem; margin: .5rem 0 .25rem; flex-wrap: wrap; }
.oc-provider-test:empty { display: none; }

/* ---- AI draft body preview (raw markdown, review-only) ---- */
.ai-preview { max-height: 24rem; overflow: auto; border: 1px solid var(--line); border-radius: .625rem; background: var(--line-2); padding: .75rem 1rem; margin-top: .5rem; }
.ai-preview pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; font-size: .82rem; line-height: 1.5; color: var(--ink-800); font-family: inherit; }
.ai-visual-img { max-height: 12rem; border-radius: .5rem; border: 1px solid var(--line); display: block; }

/* ---- Rendered article preview (friendly, non-technical) ---- */
.ai-article { color: var(--ink-800); line-height: 1.65; }
.ai-article h2 { font-size: 1.25rem; font-weight: 700; margin: 1.25rem 0 .5rem; color: var(--ink-900); }
.ai-article h3 { font-size: 1.05rem; font-weight: 700; margin: 1rem 0 .4rem; color: var(--ink-900); }
.ai-article h4 { font-size: .95rem; font-weight: 700; margin: .85rem 0 .3rem; color: var(--ink-900); }
.ai-article p { margin: .5rem 0; }
.ai-article ul, .ai-article ol { margin: .5rem 0 .5rem 1.35rem; }
.ai-article li { margin: .2rem 0; }
.ai-article a { color: var(--brand-700); text-decoration: underline; }
.ai-article code { background: var(--line-2); padding: .05rem .3rem; border-radius: .25rem; font-size: .85em; }
.ai-article-img { max-width: 100%; border-radius: .5rem; border: 1px solid var(--line); margin: .5rem 0; }
.ai-imgph { border: 1px dashed var(--line); border-radius: .5rem; padding: .5rem .75rem; margin: .5rem 0; font-size: .85rem; color: var(--ink-600); background: var(--line-2); }

/* ---- Numbered step wizard (AI draft) ---- */
.ai-steps { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }
.ai-step-chip { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--ink-500); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .35rem .7rem; }
.ai-step-chip.is-done { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.ai-step-num { display: inline-flex; align-items: center; justify-content: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; font-size: .72rem; font-weight: 700; color: #fff; background: var(--brand-600); flex: 0 0 auto; }
.ai-step-chip.is-done .ai-step-num { background: var(--success); }
.ai-help { font-size: .85rem; color: var(--ink-600); }
.ai-help ol { margin: .4rem 0 .4rem 1.25rem; }
.ai-help li { margin: .2rem 0; }

/* ---- Pager (server-side paged lists, e.g. Leads) ---- */
.oc-pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.oc-pager-info { font-size: .82rem; color: var(--ink-500); }
.oc-pager-nav { display: flex; align-items: center; gap: .5rem; }
.oc-pager-page { font-size: .82rem; color: var(--ink-500); }
.btn.is-disabled { opacity: .5; pointer-events: none; cursor: default; }

/* ---- LP Builder (pattern picker + block-list editor) ---- */
.oc-mt { margin-top: .6rem; }
.lp-violations { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .82rem; }
.lp-violations li { margin: .15rem 0; }

/* Pattern picker (Create) */
.lp-pattern-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .85rem; }
.lp-pattern-card { text-align: left; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; padding: 1rem; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.lp-pattern-card:hover { border-color: var(--brand-400, #818cf8); }
.lp-pattern-card.is-selected { border-color: var(--brand-600, #4f46e5); box-shadow: 0 0 0 2px var(--brand-100, #e0e7ff); }
.lp-pattern-name { font-weight: 700; color: var(--ink-900); margin-bottom: .2rem; }
.lp-pattern-intent { font-size: .82rem; color: var(--ink-500); margin-bottom: .5rem; }
.lp-pattern-recipe { display: flex; flex-wrap: wrap; gap: .3rem; }
.lp-chip { font-size: .68rem; background: var(--brand-50, #eef2ff); color: var(--brand-700, #4338ca); border-radius: 999px; padding: .1rem .5rem; }

/* Editor layout */
.lp-editor-grid { display: grid; grid-template-columns: 1fr 18rem; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .lp-editor-grid { grid-template-columns: 1fr; } }
.lp-side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 1rem; }
.lp-side-card { padding: 1rem; }
.lp-palette { display: flex; flex-direction: column; gap: .4rem; }

/* Block cards */
.lp-blocks { display: flex; flex-direction: column; gap: .85rem; }
.lp-block-card { border: 1px solid var(--line-2); border-radius: 12px; padding: .9rem 1rem 1rem; background: #fcfcfd; }
.lp-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.lp-block-title { font-weight: 700; font-size: .9rem; color: var(--ink-900); display: inline-flex; align-items: center; gap: .4rem; }
.lp-block-actions { display: inline-flex; gap: .15rem; }
.lp-block-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; }
@media (max-width: 640px) { .lp-block-fields { grid-template-columns: 1fr; } }
.lp-block-fields .col-span-2 { grid-column: 1 / -1; }
.lp-json { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; }
