:root {
    --color-primary: #1e4082;
    --color-primary-dark: #16305f;
    --color-accent: #2ea3ad;
    /* Matches mcirn.com's real CTA/hover gold (--e-global-color-accent:
       #FCB614 in their site CSS) — kept separate from --color-accent above
       rather than replacing it, since gold text on white fails contrast for
       body copy; mcirn.com only ever uses it on button backgrounds. */
    --color-gold: #fcb614;
    --color-bg: #ffffff;
    --color-text: #1f2430;
    --color-muted: #5b6472;
    --color-border: #dde2e8;
    --color-danger: #b3261e;
    --color-success: #1e7a3c;
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@font-face {
    font-family: 'Roboto';
    src: url('fonts/roboto-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto';
    src: url('fonts/roboto-500.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto';
    src: url('fonts/roboto-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto';
    src: url('fonts/roboto-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.site-header {
    background: var(--color-primary);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-header img.logo {
    height: 36px;
}

.site-header .site-title {
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
}

.site-header.admin-header {
    background: var(--color-primary-dark);
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 0.5rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
}

.header-brand:hover {
    text-decoration: none;
}

.site-header .header-actions {
    color: #fff;
    font-size: 0.9rem;
}

.site-header .header-actions a {
    color: #fff;
    margin-left: 1rem;
}

@media (max-width: 600px) {
    .site-header .header-actions a {
        margin-left: 0;
        margin-right: 0.85rem;
    }

    .site-header .header-actions {
        display: block;
        width: 100%;
        line-height: 1.8;
    }
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Vertical spacing between whatever top-level sections a page stacks here
   (.card or otherwise) — margin rather than flexbox `gap` on main itself,
   since main isn't a flex container and this needs to work regardless of
   how many sections a given page has. */
main > * + * {
    margin-top: 1.5rem;
}

main.admin-main {
    max-width: 1100px;
}

/* Admin left-hand nav — see templates/admin/layout.php for the active-link
   logic (computed from the current request path, not passed in per route). */
.admin-body {
    display: flex;
    max-width: 1320px;
    margin: 0 auto;
}

.admin-body main.admin-main {
    max-width: none;
    margin: 0;
    flex: 1;
    min-width: 0; /* lets a wide table scroll inside .card instead of stretching this column */
}

.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #f7f9fc;
    border-right: 1px solid var(--color-border);
    padding: 2rem 0;
}

.admin-sidebar a {
    display: block;
    padding: 0.65rem 1.5rem;
    color: var(--color-text);
    font-size: 0.92rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.admin-sidebar a:hover {
    background: #eef2f8;
    text-decoration: none;
}

.admin-sidebar a.active {
    border-left-color: var(--color-primary);
    background: #eef2f8;
    color: var(--color-primary);
    font-weight: 600;
}

@media (max-width: 800px) {
    .admin-body {
        flex-direction: column;
        max-width: none;
    }

    .admin-sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto;
        padding: 0.5rem 0.75rem;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .admin-sidebar a {
        flex-shrink: 0;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.6rem 0.9rem;
        white-space: nowrap;
    }

    .admin-sidebar a.active {
        border-left-color: transparent;
        border-bottom-color: var(--color-primary);
    }
}

.site-footer {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.85rem;
    padding: 2rem 1.5rem;
}

.card {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.5rem;
    /* Lets any wide table.table inside scroll sideways within the card
       instead of forcing the whole page to scroll horizontally on a phone —
       a no-op for every other card, since only actual overflow triggers it. */
    overflow-x: auto;
}


.btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn:hover {
    background: var(--color-primary-dark);
    text-decoration: none;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
}

/* Street/City/State/Zip — see FormRenderer::address(). Reset fieldset/legend's
   default browser chrome (border, padding, legend indent) so it reads as a
   normal .form-group with a label, not a visually distinct boxed section. */
.address-group {
    border: none;
    padding: 0;
    margin: 0 0 1rem;
}

.address-group legend {
    display: block;
    width: 100%;
    font-weight: 500;
    margin-bottom: 0.35rem;
    padding: 0;
}

.address-field {
    margin-bottom: 0.75rem;
}

.address-field-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 600px) {
    .address-field-row {
        grid-template-columns: 1fr;
    }
}

.checkbox-option,
.radio-option {
    display: block;
    font-weight: 400;
    margin-bottom: 0.4rem;
}

/* Search + chips UI multiselect.js builds over .multiselect-options' real
   checkboxes (see FormRenderer::multiselect()) — for long option lists
   (credentials, specialties, etc.) where scrolling a plain checkbox list
   isn't practical. */
.multiselect {
    position: relative;
}

.multiselect-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.multiselect-chips:not(:empty) {
    margin-bottom: 0.5rem;
}

.multiselect-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--color-primary);
    color: #fff;
    border-radius: 999px;
    padding: 0.3rem 0.4rem 0.3rem 0.8rem;
    font-size: 0.85rem;
}

.multiselect-chip-remove {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    border-radius: 50%;
    color: #fff;
    width: 1.1rem;
    height: 1.1rem;
    line-height: 1;
    cursor: pointer;
    font-size: 0.85rem;
}

.multiselect-chip-remove:hover {
    background: rgba(255, 255, 255, 0.45);
}

.multiselect-search {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
}

.multiselect-dropdown {
    position: absolute;
    z-index: 10;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

.multiselect-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.55rem 0.8rem;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.multiselect-dropdown-item:hover,
.multiselect-dropdown-item:focus {
    background: #f4f6fa;
}

.required {
    color: var(--color-danger);
}

.help-text {
    color: var(--color-muted);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.field-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.payment-options {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.payment-option {
    flex: 1;
}

@media (max-width: 700px) {
    .payment-options {
        flex-direction: column;
    }
}

.password-meter {
    margin-top: 0.5rem;
}

.password-meter-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--color-border);
    overflow: hidden;
}

.password-meter-bar::after {
    content: "";
    display: block;
    height: 100%;
    width: var(--strength-pct, 0%);
    background: var(--strength-color, var(--color-border));
    transition: width 0.2s ease, background-color 0.2s ease;
}

.password-meter-label {
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fdecea;
    color: var(--color-danger);
    border: 1px solid #f5c6c3;
}

.alert-success {
    background: #e9f7ee;
    color: var(--color-success);
    border: 1px solid #bfe6cb;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

.badge-test {
    background: #fff4e0;
    color: #a66400;
    border: 1px solid #f0d49a;
}

.badge-live {
    background: #e9f7ee;
    color: var(--color-success);
    border: 1px solid #bfe6cb;
}

/* Dashboard charts — hand-rolled with CSS (bars) and conic-gradient
   (donut), no charting library, consistent with this project's
   no-build-step/no-CDN-dependency approach. */
.charts-row {
    display: flex;
}

.chart-card {
    flex: 1;
    min-width: 0;
}

/* Plain margin instead of flexbox `gap` — same cross-browser-safe pattern
   as .payment-options below, since gap wasn't rendering reliably here. */
.chart-card:first-child {
    margin-right: 1.5rem;
}

@media (max-width: 700px) {
    .charts-row {
        flex-direction: column;
    }

    .chart-card:first-child {
        margin-right: 0;
        margin-bottom: 1.5rem;
    }
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 140px;
    margin-top: 1rem;
}

.bar-chart-bar {
    flex: 1;
    min-height: 2px;
    background: var(--color-primary);
    border-radius: 2px 2px 0 0;
}

.bar-chart-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--color-muted);
}

.donut-wrap {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.donut-chart {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    flex-shrink: 0;
}

.donut-chart-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.donut-chart-hole strong {
    font-size: 1.3rem;
    line-height: 1.1;
}

.donut-chart-hole span {
    font-size: 0.7rem;
    color: var(--color-muted);
}

.chart-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
}

.chart-legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.chart-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

table.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table.table th,
table.table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.activity-list {
    list-style: none;
    padding: 0;
}

.activity-list li {
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}

.activity-list li:last-child {
    border-bottom: none;
}

textarea.code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
}

.form-schema-editor {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.form-schema-editor-col {
    flex: 1;
    min-width: 0;
}

@media (max-width: 700px) {
    .form-schema-editor {
        flex-direction: column;
    }
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.filter-form .form-group {
    margin-bottom: 0;
    min-width: 140px;
}

.activities-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.view-toggle {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}

.view-toggle-btn {
    background: #fff;
    border: none;
    padding: 0.4rem 0.9rem;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--color-muted);
    cursor: pointer;
}

.view-toggle-btn + .view-toggle-btn {
    border-left: 1px solid var(--color-border);
}

.view-toggle-btn[aria-pressed="true"] {
    background: var(--color-primary);
    color: #fff;
}

.activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.activity-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    color: var(--color-text);
    background: #fff;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.activity-card:hover {
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.activity-card-thumb {
    aspect-ratio: 16 / 9;
    background: var(--color-primary);
    overflow: hidden;
    flex-shrink: 0;
}

.activity-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.activity-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    font-size: 2.5rem;
    font-weight: 600;
}

.activity-card-body {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
}

.activity-card-title {
    margin: 0;
    font-size: 1.05rem;
    color: var(--color-text);
}

.activity-card-desc {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.88rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.activity-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
}

.activity-card-price {
    font-weight: 600;
    color: var(--color-primary);
}

/* Mirrors mcirn.com's button style: 9px rounded corners, navy background,
   inverts to gold on hover (--e-global-color-accent in their site CSS). */
.activity-card-cta {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-primary);
    border-radius: 9px;
    padding: 0.4rem 0.9rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.activity-card:hover .activity-card-cta {
    background: var(--color-gold);
    color: var(--color-primary);
}

/* List view: same markup, laid out as rows instead of a grid of cards */
.activities-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.activities-grid.view-list .activity-card {
    flex-direction: row;
    align-items: stretch;
}

.activities-grid.view-list .activity-card-thumb {
    width: 140px;
    aspect-ratio: auto;
    flex-shrink: 0;
}

.activities-grid.view-list .activity-card-thumb-placeholder {
    font-size: 1.75rem;
}

.activities-grid.view-list .activity-card-body {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
}

.activities-grid.view-list .activity-card-title {
    flex: 1;
}

.activities-grid.view-list .activity-card-desc {
    flex: 2;
    -webkit-line-clamp: 1;
    line-clamp: 1;
}

.activities-grid.view-list .activity-card-footer {
    flex-shrink: 0;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    margin-top: 0;
}

@media (max-width: 600px) {
    .activities-grid.view-list .activity-card {
        flex-direction: column;
    }

    .activities-grid.view-list .activity-card-thumb {
        width: 100%;
        aspect-ratio: 16 / 9;
    }

    .activities-grid.view-list .activity-card-body {
        flex-direction: column;
        align-items: stretch;
    }

    .activities-grid.view-list .activity-card-footer {
        flex-direction: row;
        align-items: center;
    }
}
