/* =========================================================
   CorpAI Media — Design tokens & global layout
   Corporate, navy / white / light-gray. Soft shadows,
   rounded cards, restrained hover motion.
   (Selectors are unchanged from the original build — only
   token values and a small number of visual rules changed,
   so no id/class/name relied on by JS or the backend moved.)
   ========================================================= */

:root {
    --color-background: #f3f5f8;
    --color-background-alt: #e9edf3;
    --color-surface: #fbfcfe;
    --color-surface-raised: #ffffff;
    --color-text: #1c2733;
    --color-text-secondary: #4d586a;
    --color-muted: #5c6773;
    --color-border: #dfe4ea;
    --color-border-strong: #c7ced8;
    --color-primary: #16294a;
    --color-primary-hover: #0f1e38;
    --color-primary-soft: #eaf0f9;
    --color-accent: #2c4570;
    --color-accent-soft: #eaf0f9;
    --color-success: #1f7a4d;
    --color-success-bg: #e7f4ec;
    --color-warning: #8a6a1f;
    --color-warning-bg: #f7f0dd;
    --color-error: #b3261e;
    --color-error-bg: #f9e9e8;
    --color-info: #2c4570;
    --color-info-bg: #eaf0f9;
    --color-linkedin: #0a66c2;
    --color-meta: #0866ff;
    --color-on-primary: #ffffff;

    --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

    --text-display: 2.5rem;
    --text-h1: 2rem;
    --text-h2: 1.25rem;
    --text-h3: 1.0625rem;
    --text-body: 1rem;
    --text-secondary: 0.9375rem;
    --text-caption: 0.8125rem;
    --text-label: 0.8125rem;

    --leading-tight: 1.2;
    --leading-snug: 1.35;
    --leading-body: 1.6;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 48px;
    --space-10: 64px;

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --shadow-sm: 0 2px 10px rgba(22, 41, 74, 0.06);
    --shadow-md: 0 10px 28px rgba(22, 41, 74, 0.12);

    --transition-soft: all 0.2s ease;

    --nav-height: 64px;
    --sidebar-width: 272px;
    --content-max: 1080px;
    --content-narrow: 720px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

html {
    scroll-behavior: auto;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-body);
    line-height: var(--leading-body);
    color: var(--color-text);
    background: var(--color-background);
    min-height: 100vh;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-primary);
    line-height: var(--leading-tight);
}

h1 {
    font-size: var(--text-h1);
    margin: 0;
}

h2 {
    font-size: var(--text-h2);
    margin: 0;
}

h3 {
    font-size: var(--text-h3);
    margin: 0;
}

p {
    margin: 0;
}

ul {
    margin: 0;
    padding: 0;
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -40px;
    z-index: 100;
    background: var(--color-primary);
    color: #fff;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
}

.skip-link:focus {
    top: var(--space-2);
}

/* ---------- Navbar ---------- */

.navbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    background: var(--color-primary);
    border-bottom: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.navbar__inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-7);
    gap: var(--space-6);
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-width: 0;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: var(--transition-soft);
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.18);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.brand__mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-sm);
}

.brand__mark svg {
    width: 18px;
    height: 18px;
}

.brand__name {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    color: #fff;
}

.navbar__nav {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.82);
    font-size: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-soft);
}

.nav-link:hover,
.nav-link:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    font-weight: 600;
}

.nav-link--emphasis {
    background: #fff;
    color: var(--color-primary);
}

.nav-link--emphasis:hover,
.nav-link--emphasis:focus-visible {
    background: var(--color-background);
    color: var(--color-primary);
}

/* ---------- App shell ---------- */

.app-shell {
    display: flex;
    min-height: calc(100vh - var(--nav-height));
    align-items: stretch;
}

.sidebar {
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    background: var(--color-surface-raised);
    border-right: 1px solid var(--color-border);
    padding: var(--space-7) var(--space-5);
    position: sticky;
    top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
    overflow-y: auto;
}

.sidebar__section + .sidebar__section {
    margin-top: var(--space-7);
}

.sidebar__title {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: var(--space-3);
    padding: 0 var(--space-3);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: var(--text-secondary);
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: var(--transition-soft);
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
    color: var(--color-primary);
    background: var(--color-background);
}

.sidebar-link.active {
    color: var(--color-primary);
    background: var(--color-primary-soft);
    border-left: 3px solid var(--color-primary);
    font-weight: 600;
}

.sidebar-backdrop {
    display: none;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.page {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-8) var(--space-7) var(--space-10);
}

body.is-auth .page {
    max-width: var(--content-narrow);
    padding-top: var(--space-10);
}

body.is-auth .sidebar,
body.is-auth .menu-toggle,
body.is-auth .sidebar-backdrop {
    display: none;
}

.page-header {
    margin-bottom: var(--space-8);
    max-width: 720px;
}

.eyebrow {
    margin: 0 0 var(--space-3);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-accent);
}

.lead {
    margin-top: var(--space-4);
    color: var(--color-text-secondary);
    font-size: 1.0625rem;
    max-width: 62ch;
}

.page-header .template-link {
    margin-top: var(--space-5);
}

.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--color-border);
    padding: var(--space-5) var(--space-7);
    color: var(--color-muted);
    font-size: var(--text-caption);
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

/* ---------- Flash ---------- */

.flash-container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0;
    display: grid;
    gap: var(--space-3);
}

.flash-container:not(:empty) {
    padding: var(--space-6) var(--space-7) 0;
}

.flash-container.is-toast {
    position: fixed;
    top: calc(var(--nav-height) + var(--space-4));
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    width: min(560px, calc(100% - 32px));
    max-width: min(560px, calc(100% - 32px));
    padding: 0;
    margin: 0;
}

.flash-container.is-toast .alert {
    box-shadow: var(--shadow-md);
}

body.is-auth .flash-container {
    max-width: var(--content-narrow);
}

/* ---------- Home / About grids ---------- */

.section {
    margin-bottom: var(--space-8);
}

.grid-two,
.grid-three,
.grid-four {
    display: grid;
    gap: var(--space-5);
}

.grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-5);
}

.stat-value {
    display: block;
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-primary);
    line-height: 1;
}

.stat-label {
    display: block;
    margin-top: var(--space-2);
    color: var(--color-muted);
    font-size: var(--text-caption);
}

.feature-list {
    margin-top: var(--space-4);
    padding-left: 1.1rem;
    color: var(--color-text-secondary);
    display: grid;
    gap: var(--space-2);
}

.feature-list li {
    padding-left: var(--space-1);
}

/* ---------- Auth ---------- */

.auth-page {
    display: flex;
    justify-content: center;
}

.auth-container {
    width: 100%;
}

.auth-title {
    margin-bottom: var(--space-2);
}

.auth-subtitle {
    color: var(--color-muted);
    margin-bottom: var(--space-6);
}

.auth-footer {
    text-align: center;
    color: var(--color-muted);
    font-size: var(--text-secondary);
}

.auth-footer a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Posts ---------- */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
}

.posts-section {
    display: grid;
    gap: var(--space-5);
    margin-top: var(--space-7);
}

.posts-section__header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: var(--space-4);
}

.posts-section__header h2 { margin: 0 0 var(--space-2); }
.posts-section__header .lead { margin: 0; }
.pending-post-card { overflow: hidden; }

.pending-post-card__body {
    padding: var(--space-5);
    display: grid;
    gap: var(--space-4);
}

.pending-post-card__details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4) var(--space-6);
    margin: 0;
}

.pending-post-card__details div { display: grid; gap: var(--space-1); }
.pending-post-card__details dt { color: var(--color-muted); font-size: var(--text-caption); }
.pending-post-card__details dd { margin: 0; font-size: var(--text-secondary); font-weight: 600; }

.pending-post-card__content {
    margin: 0;
    max-height: 15rem;
    overflow: auto;
}

.pending-post-card__images,
.pending-post-card__image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.pending-post-image {
    position: relative;
    width: min(130px, calc(33.333% - 10px));
    aspect-ratio: 1;
    overflow: hidden;
    margin: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-background-alt);
}

.pending-post-image img { width: 100%; height: 100%; object-fit: cover; }

.pending-post-image__remove {
    position: absolute;
    right: 5px;
    bottom: 5px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 4px 7px;
    color: #fff;
    background: rgba(28, 39, 51, .82);
    cursor: pointer;
}

.pending-post-card__actions,
.pending-post-card__edit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.pending-post-card__approval-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.badge--approved { background: var(--color-success-bg); color: var(--color-success); border-color: #c3ddc9; }

.pending-post-card__edit-actions[hidden],
.pending-post-card__editor[hidden],
.pending-post-card__image-editor[hidden],
.pending-post-card__images[hidden],
.pending-post-edit[hidden] { display: none; }

.pending-post-card__edit-actions .pending-post-regenerate {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.pending-post-retries { color: var(--color-muted); font-size: var(--text-caption); }

.pending-post-message {
    flex-basis: 100%;
    min-height: 1.2em;
    margin: 0;
    color: var(--color-success);
    font-size: var(--text-secondary);
}

.pending-post-message.is-error { color: var(--color-error); }
.pending-posts-empty { display: grid; justify-items: start; gap: var(--space-3); }

.settings-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    padding: var(--space-6);
}
.settings-card__copy { max-width: 680px; }
.settings-card__copy h2 { margin: 0 0 var(--space-2); }
.settings-card__copy p { margin-top: var(--space-2); }
.settings-card__status { font-weight: 600; color: var(--color-text); }
.settings-card__control { display: grid; justify-items: end; gap: var(--space-3); min-width: 190px; }
.settings-card__message { min-height: 1.2em; margin: 0; color: var(--color-success); font-size: var(--text-secondary); }
@media (max-width: 640px) {
    .settings-card { align-items: stretch; flex-direction: column; }
    .settings-card__control { justify-items: start; }
}

.posts-section--published {
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border);
}

.button--danger { color: #fff; background: var(--color-error); border-color: var(--color-error); }
.button--danger:hover { background: #8f1c17; }

.post-card__image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: var(--color-background-alt);
    border-bottom: 1px solid var(--color-border);
}

.post-card__content {
    padding: var(--space-5);
    display: grid;
    gap: var(--space-3);
}

.post-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.post-card__caption {
    color: var(--color-text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.post-card hr {
    display: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .grid-four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .posts-section__header { align-items: start; flex-direction: column; }
}

@media (max-width: 900px) {
    .menu-toggle {
        display: inline-flex;
    }

    body.is-auth .menu-toggle {
        display: none;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        z-index: 30;
        height: calc(100vh - var(--nav-height));
        transform: none;
        display: none;
        box-shadow: var(--shadow-md);
    }

    body.nav-open .sidebar {
        display: block;
    }

    body.nav-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: var(--nav-height) 0 0 0;
        background: rgba(22, 41, 74, 0.32);
        z-index: 25;
    }

    body.is-auth .sidebar,
    body.is-auth.nav-open .sidebar,
    body.is-auth .sidebar-backdrop,
    body.is-auth.nav-open .sidebar-backdrop {
        display: none;
    }

    .grid-two,
    .grid-three,
    .stat-row {
        grid-template-columns: 1fr;
    }

    .navbar__inner,
    .page,
    .flash-container,
    .site-footer {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    h1,
    .page-header h1 {
        font-size: 1.75rem;
    }
}

@media (max-width: 640px) {
    .navbar {
        height: auto;
        min-height: var(--nav-height);
    }

    .navbar__inner {
        padding-top: var(--space-3);
        padding-bottom: var(--space-3);
        flex-wrap: wrap;
    }

    .navbar__nav {
        width: 100%;
        flex-wrap: wrap;
        order: 3;
    }

    .page {
        padding-top: var(--space-6);
    }

    .grid-four {
        grid-template-columns: 1fr;
    }

    .site-footer {
        flex-direction: column;
    }
}

/* =========================================================
   Notification checkbox
   ========================================================= */

.notification-field {
    margin-top: 32px;
}

.notification-checkbox {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-top: 10px;
    width: auto !important;
    min-height: 0 !important;
}

/* Completely reset the generic .field-group input styles */
.notification-checkbox > input#notify-check {
    all: unset;

    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;

    flex: 0 0 18px !important;

    box-sizing: border-box !important;

    display: block !important;

    border: 1.5px solid #9ca3af !important;
    border-radius: 4px !important;

    background: #ffffff !important;

    cursor: pointer !important;
}

.notification-checkbox > input#schedule-hitl {
    all: unset;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    box-sizing: border-box !important;
    flex: 0 0 18px !important;
    display: block !important;
    border: 1.5px solid #9ca3af !important;
    border-radius: 4px !important;
    background: #fff !important;
    cursor: pointer !important;
}
.notification-checkbox > input#schedule-hitl:checked {
    background: #16294a !important;
    border-color: #16294a !important;
}
.notification-checkbox > input#schedule-hitl:checked::after {
    content: "✓";
    display: block;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.notification-preferences,
.schedule-approval-preferences {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-3);
}
.notification-preferences[hidden],
.schedule-approval-preferences[hidden] { display: none; }
.schedule-approval-option { margin-bottom: 0; }
.schedule-approval-option .field-help { margin: 4px 0 0 28px; }

/* Checked */
.notification-checkbox > input#notify-check:checked {
    background: #16294a !important;
    border-color: #16294a !important;
}

/* Check mark */
.notification-checkbox > input#notify-check:checked::after {
    content: "✓";
    display: block;
    width: 100%;
    height: 100%;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

/* Text beside checkbox */
.notification-checkbox > span {
    display: inline !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;

    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 18px !important;
    color: #374151 !important;

    cursor: pointer;
}

/* =========================================================
   Generate button loading spinner
   ========================================================= */

.button-spinner {
    display: none;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: button-spin 0.7s linear infinite;
}

.button.is-loading .button-spinner {
    display: inline-block;
}

.button.is-loading .button-label {
    opacity: 0.92;
}

.button.button--secondary.is-loading .button-spinner {
    border-color: rgba(22, 41, 74, 0.2);
    border-top-color: var(--color-primary);
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

.form-actions .field-error {
    flex-basis: 100%;
    margin: 0;
}

#generated-content.is-streaming {
    caret-color: var(--color-primary);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.schedule-modal-open {
    overflow: hidden;
}

.schedule-modal[hidden] {
    display: none !important;
}

.schedule-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: var(--space-4);
}

.schedule-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 41, 74, 0.32);
}

.schedule-modal__dialog {
    position: relative;
    width: min(100%, 360px);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-5);
    display: grid;
    gap: var(--space-4);
}

.schedule-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.schedule-modal__header h2 {
    font-size: 1.125rem;
}

.schedule-modal__close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
    color: var(--color-text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    display: grid;
    place-items: center;
}

.schedule-modal__close:hover,
.schedule-modal__close:focus-visible {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.schedule-modal__body {
    display: grid;
    gap: var(--space-3);
}

.schedule-picker__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.schedule-picker__nav-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
    color: var(--color-primary);
    font-size: 1.25rem;
    line-height: 1;
}

.schedule-picker__nav-btn:hover,
.schedule-picker__nav-btn:focus-visible {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
}

.schedule-picker__controls {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    align-items: center;
    gap: var(--space-2);
}

.schedule-picker__period {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    min-width: 0;
}

.schedule-picker__period select {
    min-height: 36px;
    padding: 0 var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
}

.schedule-picker__period select:first-child { width: 112px; }
.schedule-picker__period select:last-child { width: 78px; }

.schedule-picker__weekdays,
.schedule-picker__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.schedule-picker__weekdays span {
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
    padding: var(--space-1) 0;
}

.schedule-picker__day {
    min-height: 36px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text);
    font-size: var(--text-caption);
}

.schedule-picker__day--empty {
    pointer-events: none;
}

.schedule-picker__day:hover,
.schedule-picker__day:focus-visible {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
}

.schedule-picker__day.is-today {
    font-weight: 700;
}

.schedule-picker__day.is-selected {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.schedule-picker__time {
    margin: 0;
}

.schedule-picker__time input[type="time"] {
    min-height: 40px;
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
}

.schedule-modal__actions {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .schedule-modal__dialog {
        width: 100%;
    }

    .schedule-modal__actions .button {
        width: 100%;
    }
}

/* =========================================================
   Content Calendar
   ========================================================= */

.calendar-page {
    width: 100%;
}


.calendar-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}


/* =========================================================
   FullCalendar overrides
   ========================================================= */

#content-calendar {
    width: 100%;
    font-family: var(--font-sans);
}


/* Calendar header */

.fc .fc-toolbar {
    margin-bottom: var(--space-5);
}


.fc .fc-toolbar-title {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-ink);
}


/* Buttons */

.fc .fc-button {
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: none;
}


.fc .fc-button:hover {
    background: var(--color-primary-strong);
    border-color: var(--color-primary-strong);
}


.fc .fc-button:focus {
    box-shadow: none;
}


.fc .fc-button-active {
    background: var(--color-primary-strong) !important;
    border-color: var(--color-primary-strong) !important;
}


/* Calendar cells */

.fc .fc-daygrid-day {
    min-height: 120px;
}


.fc .fc-daygrid-day-number {
    color: var(--color-ink);
    font-weight: 600;
    padding: var(--space-2);
}


/* Today */

.fc .fc-day-today {
    background: var(--color-surface-muted) !important;
}


/* Events */

.fc .fc-event {
    border: none;
    border-radius: var(--radius-sm);
    padding: 3px 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
}


/* Week / Day time slots */

.fc .fc-timegrid-slot {
    height: 3.5rem;
}


/* Weekday headings */

.fc .fc-col-header-cell-cushion {
    color: var(--color-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}


/* Remove unnecessary focus outline */

.fc a {
    text-decoration: none;
}

/* Read-only scheduled event details */
.event-details-modal[hidden] {
    display: none !important;
}

.event-details-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: var(--space-4);
}

.event-details-modal__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: rgba(22, 41, 74, 0.42);
    cursor: default;
}

.event-details-card {
    position: relative;
    width: min(100%, 560px);
    max-height: min(720px, calc(100vh - 32px));
    overflow-y: auto;
    padding: var(--space-6);
    display: grid;
    gap: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-raised);
    box-shadow: var(--shadow-md);
}

.event-details-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.event-details-card__header h2 {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.4rem;
}

.event-details-card__close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
    color: var(--color-text-secondary);
    font-size: 1.4rem;
    line-height: 1;
}

.event-details-card__close:hover,
.event-details-card__close:focus-visible {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.event-details-card__meta {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.event-details-card__meta > div,
.event-details-card__section {
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.event-details-card__meta dt,
.event-details-card__section h3 {
    margin: 0 0 var(--space-2);
    color: var(--color-muted);
    font-size: var(--text-caption);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.event-details-card__meta dd {
    margin: 0;
    color: var(--color-text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.event-details-card__status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border: 1px solid #e6d6a4;
    border-radius: 999px;
    background: var(--color-warning-bg);
    color: var(--color-text-secondary);
    font-size: var(--text-caption);
}

.event-details-card__section h3 {
    color: var(--color-primary);
}

.event-details-card__section p {
    margin: 0;
    color: var(--color-text-secondary);
    line-height: var(--leading-body);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.event-details-card__section img {
    display: block;
    max-width: 100%;
    max-height: 260px;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.event-details-card__images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: var(--space-3);
}

.event-details-card__images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.company-logo-upload {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-5);
}

.company-logo-preview {
    width: 112px;
    height: 112px;
    padding: var(--space-2);
    object-fit: contain;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-background-alt);
    background-image: linear-gradient(45deg, #dfe4ea 25%, transparent 25%),
                      linear-gradient(-45deg, #dfe4ea 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #dfe4ea 75%),
                      linear-gradient(-45deg, transparent 75%, #dfe4ea 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.company-logo-upload .field-group { flex: 1 1 280px; }

.fc .fc-daygrid-event {
    min-width: 0;
}

.calendar-event-content {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
    overflow: hidden;
}

.calendar-event-content__image {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 4px;
    object-fit: cover;
}

.calendar-event-content__title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event-content__count {
    flex: 0 0 auto;
    font-size: 0.7rem;
    opacity: .85;
}

body.event-details-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .event-details-card {
        padding: var(--space-5);
    }

    .event-details-card__meta {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 768px) {

    .calendar-card {
        padding: var(--space-3);
    }


    .fc .fc-toolbar {
        flex-direction: column;
        gap: var(--space-3);
    }


    .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }


    .fc .fc-toolbar-title {
        font-size: 1.3rem;
    }


    .fc .fc-daygrid-day {
        min-height: 90px;
    }

}

/* Compact Login / Sign Up viewport */
body.is-auth .page {
    max-width: 560px;
    height: calc(100vh - var(--nav-height));
    padding-top: 24px;
    padding-bottom: 24px;
}

/* Platform selection */

.platform-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.platform-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.platform-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    appearance: auto;
}

.platform-checkbox span {
    margin: 0;
}

.platform-note {
    display: block;
    margin-top: 10px;
}
