/* ==========================================================================
   Release notes (saas_256)

   Loaded by BOTH index.html and admin/index.html on purpose. The admin preview
   and the user-facing What's new panel share `.release-note-body`, so a single
   stylesheet is what stops "it looked different when I previewed it" — the
   failure a preview button exists to prevent. Admin-only rules
   (.release-composer*) are inert in the app and vice versa.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Shared note body — the rendered markdown subset
   -------------------------------------------------------------------------- */
.release-note-body {
    color: #d1d5db;
    font-size: 0.9rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.release-note-body h3,
.release-note-body h4,
.release-note-body h5,
.release-note-body h6 {
    color: #fff;
    font-weight: 700;
    line-height: 1.3;
    margin: 1.25em 0 0.5em;
}
.release-note-body h3 { font-size: 1.05rem; }
.release-note-body h4 { font-size: 0.98rem; }
.release-note-body h5,
.release-note-body h6 { font-size: 0.92rem; }
.release-note-body > :first-child { margin-top: 0; }

.release-note-body p { margin: 0 0 0.85em; }

.release-note-body ul,
.release-note-body ol {
    margin: 0 0 0.9em;
    padding-left: 1.35em;
}
.release-note-body ul { list-style: disc; }
.release-note-body ol { list-style: decimal; }
.release-note-body li { margin-bottom: 0.4em; }

.release-note-body strong { color: #fff; font-weight: 650; }
.release-note-body em { font-style: italic; }

.release-note-body code {
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 5px;
    color: #c7d2fe;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    padding: 0.1em 0.38em;
    /* A long token must scroll its own container, never widen the panel. */
    overflow-wrap: anywhere;
}

.release-note-body a {
    color: #a5b4fc;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.release-note-body a:hover { color: #c7d2fe; }

.release-note-body hr {
    border: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    margin: 1.25em 0;
}

[data-theme="light"] .release-note-body { color: #374151; }
[data-theme="light"] .release-note-body h3,
[data-theme="light"] .release-note-body h4,
[data-theme="light"] .release-note-body h5,
[data-theme="light"] .release-note-body h6,
[data-theme="light"] .release-note-body strong { color: #111827; }
[data-theme="light"] .release-note-body code {
    background: rgba(79, 70, 229, 0.08);
    border-color: rgba(79, 70, 229, 0.2);
    color: #4338ca;
}
[data-theme="light"] .release-note-body a { color: #4f46e5; }

/* --------------------------------------------------------------------------
   Admin composer
   -------------------------------------------------------------------------- */
.release-composer {
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    margin-top: 1rem;
    padding-top: 0.85rem;
}

.release-composer__toggle {
    align-items: center;
    background: none;
    border: 0;
    color: #fbbf24;
    cursor: pointer;
    display: flex;
    font-size: 0.875rem;
    font-weight: 600;
    gap: 0.5rem;
    padding: 0.25rem 0;
    text-align: left;
    width: 100%;
}
.release-composer__toggle:hover { color: #fcd34d; }
.release-composer__chevron { font-size: 0.7rem; }
.release-composer__hint {
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 400;
}

.release-composer__body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-top: 0.75rem;
}
.release-composer__body.hidden { display: none; }

.release-composer__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.release-composer__input,
.release-composer__textarea {
    background: rgba(55, 65, 81, 0.5);
    border: 1px solid #4b5563;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.875rem;
    padding: 0.5rem 0.65rem;
    width: 100%;
}
.release-composer__input { flex: 1 1 14rem; }
.release-composer__input--narrow { flex: 0 1 10rem; }
/* Reading font, NOT monospace. This box was styled like a code editor and the
   first person to use it asked "is that the code?" — the affordance was lying
   about what goes in here. It is the prose users will read. */
.release-composer__textarea {
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    min-height: 11rem;
    resize: vertical;
}
.release-composer__input:focus,
.release-composer__textarea:focus {
    border-color: #f59e0b;
    outline: none;
}

.release-composer__help {
    color: #9ca3af;
    font-size: 0.72rem;
    line-height: 1.6;
    margin: -0.35rem 0 0;
}
.release-composer__help code {
    background: rgba(148, 163, 184, 0.16);
    border-radius: 4px;
    color: #e5e7eb;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    padding: 0.05em 0.3em;
}
.release-composer__help strong { color: #d1d5db; }

.release-composer__count {
    color: #6b7280;
    font-size: 0.7rem;
    margin: -0.35rem 0 0;
    text-align: right;
}

.release-composer__check {
    align-items: flex-start;
    color: #d1d5db;
    cursor: pointer;
    display: flex;
    font-size: 0.8rem;
    gap: 0.5rem;
    line-height: 1.45;
}
.release-composer__check input { margin-top: 0.15rem; }
.release-composer__check em {
    color: #9ca3af;
    font-style: normal;
}

.release-composer__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding-top: 0.25rem;
}

.release-composer__editing {
    align-self: center;
    color: #fbbf24;
    font-size: 0.75rem;
}
.release-composer__editing.hidden { display: none; }

.release-published {
    border-top: 1px dashed rgba(148, 163, 184, 0.2);
    margin-top: 0.75rem;
    padding-top: 0.85rem;
}
.release-published__label {
    color: #9ca3af;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    margin: 0 0 0.5rem;
    text-transform: uppercase;
}
.release-published__list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.release-published__empty {
    color: #6b7280;
    font-size: 0.78rem;
    margin: 0;
}
.release-published__row {
    align-items: center;
    background: rgba(17, 24, 39, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    padding: 0.5rem 0.7rem;
}
.release-published__row--hidden { opacity: 0.55; }
.release-published__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.release-published__title {
    color: #e5e7eb;
    font-size: 0.85rem;
    font-weight: 600;
}
.release-published__meta {
    color: #6b7280;
    font-size: 0.72rem;
}
.release-published__actions {
    display: flex;
    gap: 0.4rem;
}
.release-published__actions button {
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0.4rem;
    color: #d1d5db;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
}
.release-published__actions button:hover {
    background: rgba(148, 163, 184, 0.22);
    color: #fff;
}

.release-preview {
    border-top: 1px dashed rgba(148, 163, 184, 0.25);
    margin-top: 0.5rem;
    padding-top: 0.85rem;
}
.release-preview.hidden { display: none; }
.release-preview__label {
    color: #9ca3af;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    margin: 0 0 0.5rem;
    text-transform: uppercase;
}
.release-preview__frame {
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.75rem;
    max-height: 22rem;
    overflow-y: auto;
    padding: 1rem 1.1rem;
}
.release-preview__title {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.6rem;
}

/* --------------------------------------------------------------------------
   What's new panel
   -------------------------------------------------------------------------- */
.whats-new-overlay {
    align-items: center;
    background: rgba(3, 7, 18, 0.72);
    backdrop-filter: blur(3px);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 1rem;
    position: fixed;
    z-index: 12000;
}
.whats-new-overlay.hidden { display: none; }
body.whats-new-open { overflow: hidden; }

.whats-new-panel {
    background: #111827;
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 1rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    max-height: min(85vh, 46rem);
    max-width: 40rem;
    width: 100%;
}

.whats-new-header {
    align-items: flex-start;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1.15rem 1.35rem 0.9rem;
}
.whats-new-kicker {
    color: #fbbf24;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin: 0 0 0.3rem;
    text-transform: uppercase;
}
.whats-new-title {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}
.whats-new-meta {
    color: #9ca3af;
    font-size: 0.78rem;
    margin: 0.3rem 0 0;
}
.whats-new-close {
    background: rgba(148, 163, 184, 0.12);
    border: 0;
    border-radius: 0.5rem;
    color: #9ca3af;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.9rem;
    height: 2rem;
    width: 2rem;
}
.whats-new-close:hover { background: rgba(148, 163, 184, 0.22); color: #fff; }

.whats-new-body {
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.1rem 1.35rem;
}

.whats-new-footer {
    align-items: center;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    padding: 0.85rem 1.35rem 1.1rem;
}
.whats-new-nav {
    align-items: center;
    display: flex;
    gap: 0.5rem;
}
.whats-new-nav-btn {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.45rem;
    color: #d1d5db;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
}
.whats-new-nav-btn:hover:not(:disabled) { background: rgba(148, 163, 184, 0.2); color: #fff; }
.whats-new-nav-btn:disabled { cursor: default; opacity: 0.35; }
.whats-new-position { color: #6b7280; font-size: 0.72rem; }

.whats-new-actions {
    display: flex;
    gap: 0.6rem;
    margin-left: auto;
}
.whats-new-pdf {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0.5rem;
    color: #d1d5db;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.45rem 0.8rem;
}
.whats-new-pdf:hover { background: rgba(148, 163, 184, 0.2); color: #fff; }
.whats-new-done {
    background: #f59e0b;
    border: 0;
    border-radius: 0.5rem;
    color: #1f2937;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.45rem 1.1rem;
}
.whats-new-done:hover { background: #fbbf24; }

[data-theme="light"] .whats-new-panel {
    background: #fff;
    border-color: rgba(217, 119, 6, 0.3);
}
[data-theme="light"] .whats-new-title { color: #111827; }
[data-theme="light"] .whats-new-meta,
[data-theme="light"] .whats-new-position { color: #6b7280; }
[data-theme="light"] .whats-new-kicker { color: #b45309; }
[data-theme="light"] .whats-new-nav-btn,
[data-theme="light"] .whats-new-pdf { color: #374151; }

/* Phone: a release note is mostly read on a phone, so the panel goes
   full-bleed rather than floating in a cramped card. */
@media (max-width: 640px) {
    .whats-new-overlay { padding: 0; }
    .whats-new-panel {
        border-radius: 0;
        border-width: 0;
        max-height: 100%;
        height: 100%;
    }
    .whats-new-footer { padding-bottom: max(1.1rem, env(safe-area-inset-bottom)); }
    .whats-new-actions { width: 100%; }
    .whats-new-done { flex: 1; }
}

/* --------------------------------------------------------------------------
   Print / Save as PDF

   The panel itself is NOT printed — a fixed-position overlay prints badly and
   clips. `#whats-new-print` is an off-screen copy that becomes the only visible
   element while printing, so the output is just the note on white paper.
   -------------------------------------------------------------------------- */
#whats-new-print { display: none; }

@media print {
    body.printing-release-note > * { display: none !important; }
    body.printing-release-note #whats-new-print {
        display: block !important;
        color: #000;
        font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
        padding: 0;
    }
    body.printing-release-note #whats-new-print h1 {
        font-size: 20pt;
        margin: 0 0 0.2em;
    }
    body.printing-release-note .whats-new-print-meta {
        color: #555;
        font-size: 10pt;
        margin: 0 0 1.2em;
    }
    /* Force the shared body styles to paper colours — the screen palette is
       light-on-dark and would print as an unreadable grey. */
    body.printing-release-note .release-note-body,
    body.printing-release-note .release-note-body h3,
    body.printing-release-note .release-note-body h4,
    body.printing-release-note .release-note-body h5,
    body.printing-release-note .release-note-body h6,
    body.printing-release-note .release-note-body strong {
        color: #000;
    }
    body.printing-release-note .release-note-body { font-size: 11pt; }
    body.printing-release-note .release-note-body code {
        background: #f2f2f2;
        border-color: #ddd;
        color: #000;
    }
    body.printing-release-note .release-note-body a {
        color: #000;
        text-decoration: underline;
    }
    body.printing-release-note .release-note-body li { page-break-inside: avoid; }
}
