:root {
    --pages-ink: #172033;
    --pages-muted: #64748b;
    --pages-line: #e3e9f2;
    --pages-surface: #ffffff;
    --pages-canvas: #f4f7fb;
    --pages-blue: #2563eb;
    --pages-blue-soft: #eff6ff;
}

/* Compact table rail */
.pages-table-panel { background: #fff; border-right-color: var(--pages-line); }
.pages-panel-header {
    min-height: 66px;
    padding: 12px 14px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #fff, #f8fafc);
}
.pages-panel-header > div { display: grid; line-height: 1.05; }
.pages-panel-header strong { color: var(--pages-ink); font-size: .94rem; }
.pages-panel-kicker {
    color: #8794aa;
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    margin-bottom: 5px;
}
.pages-table-count {
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dce4ef;
    border-radius: 999px;
    background: #fff;
    color: #526078;
    font-size: .72rem;
    font-weight: 800;
}
.pages-table-search {
    position: relative;
    margin: 10px 12px;
    color: #8a98ac;
}
.pages-table-search > i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .8rem;
    pointer-events: none;
}
.pages-table-search input {
    width: 100%;
    height: 36px;
    border: 1px solid #dce4ef;
    border-radius: 10px;
    background: #f8fafc;
    padding: 0 34px 0 32px;
    color: var(--pages-ink);
    font-size: .78rem;
    outline: none;
    transition: border-color .16s, box-shadow .16s, background .16s;
}
.pages-table-search input:focus {
    background: #fff;
    border-color: #8ab4ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.pages-table-search button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #748198;
}
.pages-table-search button:hover { background: #e9eef6; color: var(--pages-ink); }
.pages-table-panel .table-list { padding: 0 8px 12px !important; }
.pages-table-panel .table-list li {
    min-height: 42px;
    padding: 5px 8px !important;
    margin: 2px 0;
    border: 0 !important;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: #334155;
    font-size: .79rem;
    cursor: pointer;
    transition: background .15s, color .15s, transform .15s;
}
.pages-table-panel .table-list li:hover { background: #f1f5f9 !important; transform: translateX(1px); }
.pages-table-panel .table-list li:focus-visible { outline: 3px solid rgba(37, 99, 235, .22); outline-offset: -2px; }
.pages-table-panel .table-list li.active {
    background: linear-gradient(135deg, #2563eb, #3b82f6) !important;
    color: #fff !important;
    box-shadow: 0 5px 14px rgba(37, 99, 235, .22);
}
.pages-table-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #edf2f8;
    color: #53637a;
    flex: 0 0 auto;
}
.active .pages-table-icon { background: rgba(255,255,255,.18); color: #fff; }
.pages-table-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.pages-table-arrow { margin-left: auto; font-size: .7rem; opacity: .45; }
.active .pages-table-arrow { opacity: .9; }
.pages-table-empty { padding: 32px 16px; color: #94a3b8; text-align: center; font-size: .78rem; }
.pages-table-empty i { display: block; margin-bottom: 7px; font-size: 1.25rem; }

/* Workspace context */
.right-workspace { background: var(--pages-canvas); }
#pagesToolbar { min-height: 58px; padding: 8px 14px; gap: 10px; border-bottom-color: var(--pages-line); background: rgba(255,255,255,.94); }
.pages-toolbar-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--pages-blue-soft);
    color: var(--pages-blue);
}
.pages-toolbar-context { display: grid; line-height: 1.05; }
.pages-toolbar-context small { color: #8794a8; font-size: .64rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 5px; }
.pages-toolbar-context strong { color: var(--pages-ink); font-size: .84rem; }
.pages-toolbar-hint { color: #748198; font-size: .7rem; }
.pages-toolbar-hint i { color: #10b981; margin-right: 5px; }
.workspace-content { padding: 16px !important; }
#pageConfigContainer { max-width: 1480px; margin: 0 auto; }

/* Shared section language */
#pageConfigContainer .section-card {
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--pages-line);
    border-radius: 14px;
    background: var(--pages-surface);
    box-shadow: 0 3px 12px rgba(30, 41, 59, .045);
}
.section-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.section-heading.compact { margin-bottom: 12px; }
.section-heading-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 10px;
    font-size: .95rem;
}
.section-heading-icon.is-blue { color: #2563eb; background: #eaf2ff; }
.section-heading-icon.is-amber { color: #c27803; background: #fff7dc; }
.section-heading-icon.is-violet { color: #7c3aed; background: #f3eefe; }
.section-heading-copy { display: grid; min-width: 0; line-height: 1.15; }
.section-heading-copy strong { color: var(--pages-ink); font-size: .87rem; }
.section-heading-copy small { margin-top: 4px; color: var(--pages-muted); font-size: .69rem; }
.section-count {
    margin-left: auto;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #526078;
    font-size: .67rem;
    font-weight: 750;
    white-space: nowrap;
}

/* Page-type selector */
.page-type-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 9px; }
.page-type-option { position: relative; min-width: 0; }
.page-type-option > input,
.function-option > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.page-type-option > label {
    position: relative;
    min-height: 68px;
    margin: 0;
    padding: 10px 37px 10px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e1e7f0;
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
    transition: border-color .16s, box-shadow .16s, transform .16s, background .16s;
}
.page-type-option > label:hover { border-color: #bdc9da; transform: translateY(-1px); box-shadow: 0 5px 12px rgba(30, 41, 59, .07); }
.page-type-option > input:focus-visible + label { outline: 3px solid rgba(37, 99, 235, .23); outline-offset: 2px; }
.page-type-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 10px;
    color: var(--page-accent, #64748b);
    background: var(--page-soft, #f1f5f9);
    font-size: 1rem;
}
.page-type-copy { display: grid; min-width: 0; line-height: 1.1; }
.page-type-copy strong { color: #263349; font-size: .78rem; }
.page-type-copy small { margin-top: 5px; color: #7a879b; font-size: .62rem; line-height: 1.2; }
.page-type-state {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    color: transparent;
    font-size: .68rem;
}
.page-type-option.is-selected > label { border-color: var(--page-accent, #2563eb); background: var(--page-selected, #f8fbff); box-shadow: inset 0 0 0 1px var(--page-accent, #2563eb); }
.page-type-option.is-selected .page-type-state { border-color: var(--page-accent, #2563eb); background: var(--page-accent, #2563eb); color: #fff; }
.page-type-option.is-disabled > label { background: #f8fafc; cursor: not-allowed; opacity: .53; transform: none; box-shadow: none; }
.page-type-settings {
    position: absolute;
    right: 7px;
    bottom: 7px;
    z-index: 2;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #8491a5;
    font-size: .72rem;
}
.page-type-settings:hover:not(:disabled) { background: rgba(15,23,42,.07); color: var(--page-accent, #2563eb); }
.page-type-settings:focus-visible, .section-action:focus-visible { outline: 3px solid rgba(37,99,235,.22); }
.page-color-blue   { --page-accent:#2563eb; --page-soft:#eaf2ff; --page-selected:#f7faff; }
.page-color-green  { --page-accent:#059669; --page-soft:#e8faf3; --page-selected:#f6fdf9; }
.page-color-violet { --page-accent:#7c3aed; --page-soft:#f2edff; --page-selected:#fbf9ff; }
.page-color-cyan   { --page-accent:#0891b2; --page-soft:#e7f9fd; --page-selected:#f6fcfe; }
.page-color-slate  { --page-accent:#526078; --page-soft:#edf1f6; --page-selected:#f8fafc; }
.page-color-amber  { --page-accent:#b77905; --page-soft:#fff6dc; --page-selected:#fffcf5; }
.page-color-orange { --page-accent:#ea580c; --page-soft:#fff0e7; --page-selected:#fffaf7; }
.page-color-red    { --page-accent:#dc2626; --page-soft:#feecec; --page-selected:#fff8f8; }
.page-color-pink   { --page-accent:#db2777; --page-soft:#fdeaf3; --page-selected:#fff8fb; }
.pages-key-notice {
    margin: -2px 0 12px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #f5d785;
    border-radius: 9px;
    background: #fffbeb;
    color: #7c5b13;
    font-size: .7rem;
}
.pages-key-notice > button { margin-left: auto; border: 0; background: transparent; color: #9a6700; font-weight: 750; }

/* Key and capability cards */
.section-action {
    margin-left: auto;
    height: 31px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #dce4ef;
    border-radius: 8px;
    background: #fff;
    color: #45546b;
    font-size: .7rem;
    font-weight: 700;
}
.section-action:hover { border-color: #aebcd0; background: #f8fafc; }
.key-columns-summary { display: flex; flex-wrap: wrap; gap: 7px; padding-left: 47px; }
.key-column-chip {
    padding: 5px 9px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 7px;
    background: #fff8dc;
    color: #7b5a0b;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .68rem;
    font-weight: 700;
}
.key-column-empty { color: #8a97aa; font-size: .7rem; font-style: italic; }
.functionality-grid { display: grid; grid-template-columns: repeat(3, minmax(200px, 1fr)); gap: 8px; }
.function-option > label {
    min-height: 58px;
    margin: 0;
    padding: 9px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.function-option > label:hover { border-color: #c4cfde; background: #fbfcfe; }
.function-option > input:focus-visible + label { outline: 3px solid rgba(124,58,237,.2); outline-offset: 2px; }
.function-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 9px;
    background: #f3f0ff;
    color: #7c3aed;
}
.function-copy { display: grid; min-width: 0; line-height: 1.08; }
.function-copy strong { color: #2c384d; font-size: .73rem; }
.function-copy small { margin-top: 4px; color: #8490a2; font-size: .6rem; line-height: 1.2; }
.function-switch {
    width: 31px;
    height: 18px;
    margin-left: auto;
    padding: 2px;
    flex: 0 0 auto;
    border-radius: 99px;
    background: #cbd5e1;
    transition: background .16s;
}
.function-switch span { display: block; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.25); transition: transform .16s; }
.function-option.is-selected > label { border-color: #c4b5fd; background: #fbfaff; }
.function-option.is-selected .function-switch { background: #7c3aed; }
.function-option.is-selected .function-switch span { transform: translateX(13px); }

@media (max-width: 1199.98px) {
    .page-type-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
    .functionality-grid { grid-template-columns: repeat(2, minmax(200px, 1fr)); }
}
@media (max-width: 767.98px) {
    .main-area { flex-direction: column !important; }
    .left-panel { width: 100% !important; max-height: 40vh; overflow-y: auto; flex-shrink: 0; transition: max-height .25s ease; }
    .left-panel.collapsed { max-height: 0; overflow: hidden; }
    .right-workspace { flex: 1 1 auto; width: 100% !important; }
    .workspace-content { padding: 9px !important; }
    #pageConfigContainer .section-card { padding: 12px; border-radius: 12px; }
    .page-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .functionality-grid { grid-template-columns: 1fr; }
    .section-heading-copy small { display: none; }
    .key-columns-summary { padding-left: 0; }
}
@media (max-width: 420px) {
    .page-type-grid { grid-template-columns: 1fr; }
    .page-type-option > label { min-height: 62px; }
    .section-count { display: none; }
    .section-action span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .pages-table-panel *, #pageConfigContainer * { transition: none !important; }
}

/* Pages module colour-mode bridge. Kept below the original component styling so
   both generated and server-rendered surfaces use one isolated token set. */
.pages-module {
    --pages-header-height: 66px;
    --pages-ink: var(--pp-text);
    --pages-muted: var(--pp-text-muted);
    --pages-line: var(--pp-border);
    --pages-line-strong: var(--pp-border-strong);
    --pages-surface: var(--pp-surface);
    --pages-surface-soft: var(--pp-surface-soft);
    --pages-surface-raised: var(--pp-surface-raised);
    --pages-canvas: var(--pp-app-bg);
    --pages-input: var(--pp-input-bg);
    --pages-hover: var(--pp-surface-muted);
    --pages-blue: var(--pp-accent);
    --pages-blue-soft: var(--pp-accent-soft);
    --pages-shadow: 0 12px 30px var(--pp-shadow-color);
    --pages-success: var(--bs-success);
    --pages-info: var(--bs-info);
    --pages-warning: var(--bs-warning);
    --pages-danger: var(--bs-danger);
    --pages-overlay: color-mix(in srgb, var(--pp-app-bg) 72%, transparent);
    background: var(--pages-canvas);
    color: var(--pages-ink);
}

.pages-module .main-area,
.pages-module .right-workspace,
.pages-module .workspace-content,
.pages-module #pagesWorkspace {
    background: var(--pages-canvas) !important;
    color: var(--pages-ink);
}

.pages-module .pages-table-panel {
    background: var(--pages-surface) !important;
    color: var(--pages-ink);
    border-color: var(--pages-line) !important;
}

/* The table rail and workspace context row share an exact baseline and height. */
.pages-module .pages-panel-header,
.pages-module #pagesToolbar {
    box-sizing: border-box;
    flex: 0 0 var(--pages-header-height);
    width: 100%;
    height: var(--pages-header-height);
    min-height: var(--pages-header-height);
    max-height: var(--pages-header-height);
    margin: 0;
    padding: 10px 14px !important;
    align-items: center;
    background: var(--pages-surface) !important;
    border-color: var(--pages-line) !important;
}

.pages-module .pages-panel-header { background: var(--pages-surface) !important; }
.pages-module .pages-panel-header strong,
.pages-module .pages-toolbar-context strong { color: var(--pages-ink); }
.pages-module .pages-panel-kicker,
.pages-module .pages-toolbar-context small,
.pages-module .pages-toolbar-hint { color: var(--pages-muted); }

.pages-module .pages-table-count,
.pages-module .section-count {
    color: var(--pages-muted);
    background: var(--pages-surface-soft);
    border-color: var(--pages-line);
}

.pages-module .pages-table-search { margin: 7px 9px; color: var(--pages-muted); }
.pages-module .pages-table-search input {
    height: 34px;
    color: var(--pages-ink);
    background: var(--pages-input);
    border-color: var(--pages-line);
}
.pages-module .pages-table-search input::placeholder { color: var(--pages-muted); opacity: .82; }
.pages-module .pages-table-search input:focus { background: var(--pages-input); border-color: var(--pages-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pages-blue) 18%, transparent); }
.pages-module .pages-table-search button { color: var(--pages-muted); }
.pages-module .pages-table-search button:hover { color: var(--pages-ink); background: var(--pages-hover); }

/* Dense enough for large schemas while retaining a comfortable click target. */
.pages-module .pages-table-panel .table-list { padding: 0 6px 9px !important; }
.pages-module .pages-table-panel .table-list li {
    min-height: 34px;
    padding: 3px 6px !important;
    margin: 1px 0;
    gap: 7px;
    color: var(--pages-ink);
    background: transparent;
    border-radius: 8px;
    font-size: .76rem;
}
.pages-module .pages-table-panel .table-list li:hover { color: var(--pages-ink); background: var(--pages-hover) !important; }
.pages-module .pages-table-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    color: var(--pages-muted);
    background: var(--pages-surface-soft);
    font-size: .72rem;
}
.pages-module .pages-table-panel .table-list li.active {
    color: var(--pp-accent-contrast) !important;
    background: linear-gradient(135deg, var(--pages-blue), color-mix(in srgb, var(--pages-blue) 72%, var(--pages-surface-raised))) !important;
}
.pages-module .pages-table-empty { color: var(--pages-muted); }

.pages-module .pages-toolbar-icon { color: var(--pages-blue); background: var(--pages-blue-soft); }

.pages-module #pageConfigContainer .section-card {
    color: var(--pages-ink);
    background: var(--pages-surface) !important;
    border-color: var(--pages-line) !important;
    box-shadow: var(--pages-shadow);
}

.pages-module .section-heading-copy strong,
.pages-module .page-type-copy strong,
.pages-module .function-copy strong,
.pages-module h1,
.pages-module h2,
.pages-module h3,
.pages-module h4,
.pages-module h5,
.pages-module h6,
.pages-module label,
.pages-module .form-label { color: var(--pages-ink); }

.pages-module .section-heading-copy small,
.pages-module .page-type-copy small,
.pages-module .function-copy small,
.pages-module .text-muted,
.pages-module .text-secondary,
.pages-module .form-text,
.pages-module .key-column-empty { color: var(--pages-muted) !important; }

.pages-module .page-type-option > label,
.pages-module .function-option > label {
    color: var(--pages-ink);
    background: var(--pages-surface-raised);
    border-color: var(--pages-line);
}
.pages-module .page-type-option > label:hover,
.pages-module .function-option > label:hover {
    color: var(--pages-ink);
    background: var(--pages-hover);
    border-color: var(--pages-line-strong);
}
.pages-module .page-type-option.is-selected > label,
.pages-module .function-option.is-selected > label {
    color: var(--pages-ink);
    background: color-mix(in srgb, var(--page-accent, var(--pages-blue)) 12%, var(--pages-surface-raised));
}
.pages-module .page-type-option.is-disabled > label {
    color: var(--pages-muted);
    background: var(--pages-surface-soft);
}
.pages-module .page-type-state { border-color: var(--pages-line-strong); }
.pages-module .page-type-settings { color: var(--pages-muted); }
.pages-module .page-type-settings:hover:not(:disabled) { background: var(--pages-hover); }

.pages-module :where(.page-type-icon, .section-heading-icon, .function-icon) {
    color: var(--page-accent, var(--section-accent, var(--pages-blue)));
    background: color-mix(in srgb, currentColor 15%, var(--pages-surface-raised));
}
.pages-module .section-heading-icon.is-blue { --section-accent: var(--pages-blue); }
.pages-module .section-heading-icon.is-amber { --section-accent: color-mix(in srgb, var(--pages-warning) 72%, var(--pages-blue)); }
.pages-module .section-heading-icon.is-violet { --section-accent: color-mix(in srgb, var(--pages-blue) 72%, var(--pages-danger)); }
.pages-module .function-icon { --section-accent: color-mix(in srgb, var(--pages-blue) 76%, var(--pages-danger)); }

/* Page identities retain useful colour differentiation, but every tone is
   composed from application/semantic variables rather than a fixed palette. */
.pages-module .page-color-blue   { --page-accent: var(--pages-blue); }
.pages-module .page-color-green  { --page-accent: color-mix(in srgb, var(--pages-success) 72%, var(--pages-blue)); }
.pages-module .page-color-violet { --page-accent: color-mix(in srgb, var(--pages-blue) 68%, var(--pages-danger)); }
.pages-module .page-color-cyan   { --page-accent: color-mix(in srgb, var(--pages-info) 72%, var(--pages-blue)); }
.pages-module .page-color-slate  { --page-accent: color-mix(in srgb, var(--pages-muted) 78%, var(--pages-blue)); }
.pages-module .page-color-amber  { --page-accent: color-mix(in srgb, var(--pages-warning) 78%, var(--pages-blue)); }
.pages-module .page-color-orange { --page-accent: color-mix(in srgb, var(--pages-warning) 62%, var(--pages-danger)); }
.pages-module .page-color-red    { --page-accent: color-mix(in srgb, var(--pages-danger) 84%, var(--pages-blue)); }
.pages-module .page-color-pink   { --page-accent: color-mix(in srgb, var(--pages-danger) 66%, var(--pages-blue)); }
.pages-module .page-type-icon {
    color: var(--page-accent);
    background: color-mix(in srgb, var(--page-accent) 15%, var(--pages-surface-raised));
}
.pages-module .page-type-option.is-selected > label {
    border-color: var(--page-accent);
    box-shadow: inset 0 0 0 1px var(--page-accent);
}
.pages-module .page-type-option.is-selected .page-type-state {
    border-color: var(--page-accent);
    background: var(--page-accent);
    color: var(--pp-accent-contrast);
}

.pages-module .section-action {
    color: var(--pages-ink);
    background: var(--pages-surface-raised);
    border-color: var(--pages-line);
}
.pages-module .section-action:hover { color: var(--pages-ink); background: var(--pages-hover); border-color: var(--pages-line-strong); }
.pages-module .key-column-chip {
    color: color-mix(in srgb, var(--pages-warning) 78%, var(--pages-ink));
    background: color-mix(in srgb, var(--pages-warning) 15%, var(--pages-surface-raised));
}
.pages-module .pages-key-notice {
    color: var(--pages-ink);
    background: color-mix(in srgb, var(--pages-warning) 12%, var(--pages-surface-raised));
    border-color: color-mix(in srgb, var(--pages-warning) 42%, var(--pages-line));
}
.pages-module .pages-key-notice > button { color: color-mix(in srgb, var(--pages-warning) 72%, var(--pages-ink)); }

.pages-module .function-switch { background: var(--pages-line-strong); }
.pages-module .function-switch span { background: var(--pages-surface-raised); }
.pages-module .function-option.is-selected .function-switch {
    background: var(--pages-blue);
}
.pages-module .function-option.is-selected .function-switch span {
    background: var(--pp-accent-contrast);
}
.pages-module .pages-table-panel li.active .pages-table-icon {
    color: var(--pp-accent-contrast);
    background: color-mix(in srgb, var(--pp-accent-contrast) 16%, transparent);
}

.pages-module :where(.form-control, .form-select, textarea, input[type="text"], input[type="search"], input[type="number"]) {
    color: var(--pages-ink) !important;
    background-color: var(--pages-input) !important;
    border-color: var(--pages-line-strong) !important;
}
.pages-module :where(.form-control, textarea, input)::placeholder { color: var(--pages-muted) !important; opacity: .82; }
.pages-module :where(.form-control, .form-select):focus { border-color: var(--pages-blue) !important; box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--pages-blue) 18%, transparent) !important; }
.pages-module .form-check-input { background-color: var(--pages-input); border-color: var(--pages-line-strong); }
.pages-module .form-check-input:checked { background-color: var(--pages-blue); border-color: var(--pages-blue); }

.pages-module .table,
.pages-module .table-responsive {
    --bs-table-bg: var(--pages-surface);
    --bs-table-color: var(--pages-ink);
    --bs-table-border-color: var(--pages-line);
    color: var(--pages-ink) !important;
    border-color: var(--pages-line) !important;
}
.pages-module .table > :not(caption) > * > * { color: var(--pages-ink) !important; background: var(--pages-surface) !important; border-color: var(--pages-line) !important; }
.pages-module .table thead > tr > * { background: var(--pages-surface-soft) !important; }

/* Page settings, key columns and click-action dialogs. */
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .modal-content {
    overflow: hidden;
    color: var(--pages-ink) !important;
    background: var(--pages-surface-raised) !important;
    border: 1px solid var(--pages-line) !important;
    border-radius: 14px;
    box-shadow: 0 24px 60px var(--pp-shadow-color) !important;
}
.pages-module #pageSettingsModal .modal-dialog { max-width: min(620px, calc(100vw - 24px)); }
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .modal-body {
    max-height: min(68vh, 680px);
    overflow-y: auto;
    scrollbar-color: var(--pages-line-strong) transparent;
}
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .modal-header {
    min-height: 54px;
    padding: .65rem .85rem !important;
    color: var(--pp-accent-contrast) !important;
    background: linear-gradient(135deg, var(--pages-blue), color-mix(in srgb, var(--pages-blue) 68%, var(--pages-surface-raised))) !important;
    border-color: color-mix(in srgb, var(--pp-accent-contrast) 20%, transparent) !important;
}
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .modal-title { color: var(--pp-accent-contrast) !important; }
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-close {
    box-sizing: border-box;
    width: 32px;
    height: 32px;
    margin: 0 0 0 auto;
    padding: 8px;
    border-radius: 9px;
    opacity: .82;
    background-image: none !important;
    filter: none !important;
    position: relative;
}
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-close::before,
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-close::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--pp-accent-contrast);
}
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-close:hover { background-color: color-mix(in srgb, var(--pp-accent-contrast) 16%, transparent); opacity: 1; }
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .modal-body,
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .modal-footer {
    color: var(--pages-ink) !important;
    background: var(--pages-surface-raised) !important;
    border-color: var(--pages-line) !important;
}
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .modal-body { padding: .9rem !important; }
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .modal-footer { padding: .7rem .9rem !important; }
.pages-module .modal-backdrop.show { background: var(--pages-overlay); opacity: .76; }

.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) :where(hr, .border, .table-bordered) { border-color: var(--pages-line) !important; }
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-secondary {
    color: var(--pages-ink);
    background: var(--pages-surface-muted, var(--pages-surface-soft));
    border-color: var(--pages-line-strong);
}
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-secondary:hover { background: var(--pages-hover); }
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-primary {
    color: var(--pp-accent-contrast);
    background: var(--pages-blue);
    border-color: var(--pages-blue);
}
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-outline-primary {
    color: var(--pages-blue);
    border-color: color-mix(in srgb, var(--pages-blue) 68%, var(--pages-line));
}
.pages-module :where(#pageSettingsModal, #keyColumnsModal, #clickActionModal) .btn-outline-primary:hover {
    color: var(--pp-accent-contrast);
    background: var(--pages-blue);
    border-color: var(--pages-blue);
}

/* ── Click Action inline Guide ── */
#clickActionModal .ca-guide-btn {
    display: inline-flex; align-items: center; gap: .35rem;
    color: var(--pp-accent-contrast); background: color-mix(in srgb, var(--pp-accent-contrast) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--pp-accent-contrast) 40%, transparent); border-radius: 7px;
    font-weight: 600; padding: .15rem .6rem;
}
#clickActionModal .ca-guide-btn:hover { background: color-mix(in srgb, var(--pp-accent-contrast) 30%, transparent); }
#clickActionModal .ca-guide-btn.is-on { background: var(--pp-accent-contrast); color: var(--pages-blue); }
.ca-guide {
    margin: 0 0 .9rem; padding: .8rem .95rem; border-radius: 10px;
    background: color-mix(in srgb, var(--pages-blue) 6%, var(--pp-surface, #fff));
    border: 1px solid color-mix(in srgb, var(--pages-blue) 26%, var(--pages-line));
    font-size: .82rem; color: var(--pp-text, #334155);
}
.ca-guide-head { display: flex; align-items: center; gap: .45rem; font-weight: 800; color: var(--pages-blue); margin-bottom: .35rem; }
.ca-guide-lead { margin: 0 0 .6rem; color: var(--pp-muted, #64748b); }
.ca-guide-table { width: 100%; border-collapse: collapse; margin: 0 0 .6rem; }
.ca-guide-table th, .ca-guide-table td { text-align: left; padding: .32rem .5rem; border-bottom: 1px solid color-mix(in srgb, var(--pages-blue) 14%, var(--pages-line)); vertical-align: top; }
.ca-guide-table th { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--pp-muted, #94a3b8); }
.ca-guide-table td:first-child { width: 42%; font-weight: 600; }
.ca-guide-note { border-top: 1px dashed color-mix(in srgb, var(--pages-blue) 22%, var(--pages-line)); padding-top: .55rem; }
.ca-guide-note p { margin: 0 0 .4rem; }
.ca-guide-note ol { margin: .1rem 0 .5rem 1.1rem; padding: 0; }
.ca-guide-note li { margin-bottom: .3rem; }
.ca-guide code { background: color-mix(in srgb, var(--pages-blue) 12%, transparent); color: var(--pages-blue); padding: .04em .35em; border-radius: 4px; font-size: .92em; }

/* Bootstrap tooltips are appended to body, which is the module scope here. */
.pages-module .pages-tooltip .tooltip-inner {
    color: var(--pages-ink);
    background: var(--pages-surface-raised);
    border: 1px solid var(--pages-line-strong);
    box-shadow: 0 8px 24px var(--pp-shadow-color);
    font-size: .7rem;
    font-weight: 650;
}
.pages-module .pages-tooltip.bs-tooltip-top .tooltip-arrow::before { border-top-color: var(--pages-line-strong); }
.pages-module .pages-tooltip.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: var(--pages-line-strong); }

@media (max-width: 767.98px) {
    .pages-module { --pages-header-height: 60px; }
    .pages-module .pages-panel-header,
    .pages-module #pagesToolbar { padding: 8px 10px !important; }
    .pages-module .pages-table-panel .table-list li { min-height: 36px; }
}
