/*
 * com_storyboard frontend styles.
 * Everything is scoped under .com-storyboard so nothing here leaks onto or
 * clashes with the Gantry 5 template's global styles elsewhere on the site.
 */

.com-storyboard {
    --cs-border: #e2e5eb;
    --cs-border-strong: #cbd1db;
    --cs-bg: #f4f6fb;
    --cs-surface: #ffffff;
    --cs-accent: #4f46e5;
    --cs-accent-dark: #4338ca;
    --cs-accent-soft: #eef0fe;
    --cs-danger: #dc2626;
    --cs-danger-soft: #fdecec;
    --cs-success: #16a34a;
    --cs-warning: #b45309;
    --cs-text: #1c2130;
    --cs-text-muted: #6b7280;
    --cs-radius: 10px;
    --cs-radius-sm: 6px;
    --cs-shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
    --cs-shadow-md: 0 6px 20px rgba(17, 24, 39, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    color: var(--cs-text);
    line-height: 1.5;
}

.com-storyboard *,
.com-storyboard *::before,
.com-storyboard *::after {
    box-sizing: inherit;
}

.com-storyboard h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 0.25rem;
}

.com-storyboard a {
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.com-storyboard :focus-visible {
    outline: 2px solid var(--cs-accent);
    outline-offset: 2px;
}

/* ---------- Page-transition loader ---------- */
/* Not scoped under .com-storyboard — page-loader.js appends this directly
   to <body>, outside the component's own markup, so it still shows during
   the moment the NEXT page (which hasn't rendered .com-storyboard yet) is
   loading. */

.cs-page-loader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(244, 246, 251, 0.75);
    backdrop-filter: blur(1px);
}

.cs-page-loader.is-visible {
    display: flex;
}

.cs-page-loader-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid #d7dbe8;
    border-top-color: #4f46e5;
    animation: cs-spin 0.7s linear infinite;
}

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

/* ---------- Guest CTA / sandbox banner ---------- */

.cs-guest-cta {
    max-width: 640px;
    margin: 3rem auto;
    text-align: center;
    padding: 2.5rem 2rem;
    background: linear-gradient(180deg, var(--cs-accent-soft) 0%, var(--cs-surface) 65%);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
}

.cs-guest-cta h1 {
    font-size: 1.75rem;
}

.cs-guest-cta p {
    color: var(--cs-text-muted);
    margin: 0.5rem 0;
}

.cs-guest-cta-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem;
}

.cs-guest-cta-note {
    font-size: 0.85rem;
    color: var(--cs-text-muted);
}

.cs-sandbox-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    background: #fff7e6;
    border: 1px solid #f3c969;
    border-radius: var(--cs-radius-sm);
    padding: 0.65rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #7c4a03;
}

/* ---------- Sandbox read-only preview (?preview=1) ---------- */
/* A guest's export view — same card-grid language as .cs-storyboard-grid/
   .cs-print-card (dashboard/Preview), sized for html2canvas's
   captureSandboxImage() in sandbox.js rather than for pagination, since a
   guest storyboard never gets more than sandbox_max_frames frames. */

.cs-sandbox-preview {
    padding: 1rem 0;
}

.cs-sandbox-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.cs-sandbox-preview-card {
    position: relative;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    overflow: hidden;
    background: var(--cs-surface);
}

.cs-sandbox-preview-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.cs-sandbox-preview-number {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 0.1rem 0.5rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--cs-text);
}

/* ---------- Dashboard ---------- */

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

.cs-dashboard-header h1 {
    margin: 0;
}

.cs-dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cs-recycle-bin-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.35rem;
    margin-left: 0.35rem;
    border-radius: 999px;
    background: var(--cs-danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

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

.cs-storyboard-card {
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    background: var(--cs-surface);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--cs-shadow-sm);
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.cs-storyboard-card:hover {
    box-shadow: var(--cs-shadow-md);
    border-color: var(--cs-border-strong);
    transform: translateY(-2px);
}

.cs-storyboard-card-thumb {
    aspect-ratio: 16 / 9;
    background: var(--cs-bg);
    border-radius: var(--cs-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--cs-border-strong);
    font-size: 1.75rem;
}

.cs-storyboard-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cs-storyboard-card-title {
    font-weight: 600;
    color: var(--cs-text);
    text-decoration: none;
}

.cs-storyboard-card-title:hover {
    color: var(--cs-accent);
}

.cs-storyboard-card-meta {
    font-size: 0.82rem;
    color: var(--cs-text-muted);
}

.cs-storyboard-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.35rem;
}

.cs-storyboard-card-actions-secondary {
    display: flex;
    gap: 0.4rem;
}

/* ---------- Buttons ---------- */

.com-storyboard .cs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--cs-border-strong);
    border-radius: var(--cs-radius-sm);
    background: var(--cs-surface);
    color: var(--cs-text);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.com-storyboard .cs-btn:hover {
    border-color: var(--cs-accent);
    color: var(--cs-accent-dark);
    background: var(--cs-accent-soft);
}

.com-storyboard .cs-btn:active {
    transform: translateY(1px);
}

.com-storyboard .cs-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.com-storyboard .cs-btn:disabled:hover {
    border-color: var(--cs-border-strong);
    background: var(--cs-surface);
    color: var(--cs-text);
}

.com-storyboard .cs-btn-block {
    width: 100%;
    justify-content: center;
}

/* .cs-btn's own display:inline-flex has the same specificity as the
   browser's default [hidden]{display:none} UA rule, and an author
   stylesheet rule always wins that tie — without this, a hidden .cs-btn
   (e.g. #cs-btn-resubmit) renders anyway. */
.com-storyboard .cs-btn[hidden] {
    display: none;
}

/* Primary call-to-action buttons — New Storyboard, Add Frame, Try It Now —
   deliberately stand out as solid/filled so the main action on any screen
   is unambiguous at a glance. Explicit class rather than a structural
   selector, so secondary actions sharing the same <form><button> shape
   (e.g. Duplicate) don't get pulled in by accident. */
.com-storyboard .cs-btn-primary {
    background: var(--cs-accent);
    border-color: var(--cs-accent);
    color: #fff;
    box-shadow: var(--cs-shadow-sm);
}

.com-storyboard .cs-btn-primary:hover {
    background: var(--cs-accent-dark);
    border-color: var(--cs-accent-dark);
    color: #fff;
}

.com-storyboard .cs-btn-danger {
    color: var(--cs-danger);
    border-color: var(--cs-danger);
}

.com-storyboard .cs-btn-danger:hover {
    background: var(--cs-danger-soft);
    color: var(--cs-danger);
    border-color: var(--cs-danger);
}

/* ---------- Editor ---------- */

.com-storyboard-editor {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    min-height: 560px;
}

.cs-editor-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--cs-border);
}

.cs-editor-title-group {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Review-status badge stacked above the autosave text instead of sitting
   inline next to the title — keeps the title row from having to make room
   for it horizontally. */
.cs-editor-status-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    flex-shrink: 0;
}

.cs-editor-title-input,
.cs-editor-desc-input,
.cs-editor-title-display,
.cs-editor-desc-display {
    border: 1px solid transparent;
    border-radius: var(--cs-radius-sm);
    background: transparent;
    padding: 0.1rem 0.4rem;
    margin: 0 0 0 -0.4rem;
    width: 100%;
    font-family: inherit;
    color: var(--cs-text);
    line-height: 1.25;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cs-editor-title-input,
.cs-editor-title-display {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.cs-editor-desc-input,
.cs-editor-desc-display {
    font-size: 0.72rem;
    color: var(--cs-text-muted);
}

.cs-editor-title-input:hover,
.cs-editor-desc-input:hover {
    border-color: var(--cs-border);
}

.cs-editor-title-input:focus,
.cs-editor-desc-input:focus {
    outline: none;
    border-color: var(--cs-accent);
    background: var(--cs-surface);
    box-shadow: 0 0 0 3px var(--cs-accent-soft);
}

/* Click-to-edit display text — a clickable placeholder for the real
   <input>, which stays hidden (see the `hidden` attribute in the
   template) until setupInlineEdit() in editor.js swaps them. */
.cs-editor-title-display,
.cs-editor-desc-display {
    display: block;
    margin-top: 0;
    margin-bottom: 0;
    cursor: pointer;
    border: 1px dashed transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-editor-title-display:hover,
.cs-editor-desc-display:hover {
    border-color: var(--cs-border-strong);
    background: var(--cs-bg);
}

.cs-editor-desc-display.is-placeholder {
    font-style: italic;
    opacity: 0.8;
}

.cs-editor-title-static,
.cs-editor-desc-static {
    cursor: default;
    margin: 0 0 0 -0.4rem;
    padding: 0.1rem 0.4rem;
}

.cs-editor-title-static:hover,
.cs-editor-desc-static:hover {
    background: none;
    border-color: transparent;
}

.cs-review-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--cs-bg);
    color: var(--cs-text-muted);
}

.cs-review-badge[data-status="submitted"] {
    background: var(--cs-accent-soft);
    color: var(--cs-accent-dark);
}

.cs-review-badge[data-status="reviewed"] {
    background: var(--cs-accent-soft);
    color: var(--cs-accent-dark);
}

.cs-review-badge[data-status="changes_requested"] {
    background: var(--cs-danger-soft);
    color: var(--cs-danger);
}

.cs-review-badge[data-status="approved"] {
    background: #e9f7ef;
    color: var(--cs-success);
}

.cs-review-badge[data-status="resubmitted"] {
    background: #fff3da;
    color: var(--cs-warning);
}

/* A small "there's feedback on this" marker — next to a storyboard's title
   (dashboard card, teacher list, editor header) when it has any teacher
   comment at all, independent of the review-status badge above (which
   reflects a teacher's explicit reviewed/changes/approved verdict, not
   whether feedback exists) and independent of read/unread (see
   .cs-feedback-badge below for the unread count on the bell icon). */
.cs-feedback-indicator {
    color: var(--cs-accent);
    font-size: 0.85em;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.cs-feedback-indicator[hidden] {
    display: none;
}

.cs-feedback-bell {
    position: relative;
    /* Compact icon-only button — sits inline next to the review-status
       badge under the title now, not in the toolbar-style actions row it
       used to live in, so the default .cs-btn padding is too roomy. */
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
}

/* Blue for "there's feedback, already read"; green for "something new" —
   see updateFeedbackBadge() in editor.js/preview.js. The two are mutually
   exclusive so the colour always means one specific thing, not just
   "a comment exists somewhere". */
.cs-feedback-bell.has-feedback {
    border-color: var(--cs-accent);
    color: var(--cs-accent-dark);
    background: var(--cs-accent-soft);
}

.cs-feedback-bell.has-unread {
    border-color: var(--cs-success);
    color: var(--cs-success);
    background: #e9f7ef;
}

.cs-feedback-badge {
    position: absolute;
    top: -0.4rem;
    right: -0.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--cs-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
}

.cs-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--cs-border);
}

.cs-review-actions .cs-btn {
    flex: 1;
    justify-content: center;
    font-size: 0.78rem;
    padding: 0.4rem 0.5rem;
}

.cs-editor-status {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cs-text-muted);
    min-width: 8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.cs-editor-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.cs-editor-status[data-state="saving"] { color: var(--cs-accent); }
.cs-editor-status[data-state="saved"] { color: var(--cs-success); }
.cs-editor-status[data-state="unsaved"] { color: var(--cs-warning); }
.cs-editor-status[data-state="save-failed"],
.cs-editor-status[data-state="conflict"] { color: var(--cs-danger); }

.cs-editor-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cs-btn-save {
    color: var(--cs-success);
    border-color: var(--cs-success);
}

.cs-btn-save:hover {
    background: #e9f7ef;
    color: var(--cs-success);
    border-color: var(--cs-success);
}

/* "Back to Dashboard" leaves the editor entirely, unlike everything else
   in this bar — set apart with a divider and pushed to the far edge so a
   stray click among the frequently-used buttons can't land on it. */
.cs-btn-back {
    margin-left: 0.75rem;
    padding-left: 0.9rem;
    border-left: 1px solid var(--cs-border);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    color: var(--cs-text-muted);
}

.cs-btn-back:hover {
    color: var(--cs-danger);
    border-color: var(--cs-border);
    border-left-color: var(--cs-border);
    background: var(--cs-danger-soft);
}

.cs-editor-body {
    flex: 1;
    display: grid;
    grid-template-columns: 140px 1fr 300px;
    gap: 0.6rem;
    min-height: 0;
    margin-top: 0.75rem;
}

.cs-filmstrip {
    overflow-y: auto;
    border-right: 1px solid var(--cs-border);
    padding-right: 0.4rem;
}

.cs-filmstrip-list {
    list-style: none;
    margin: 0 0 0.6rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cs-filmstrip-item {
    border: 2px solid transparent;
    border-radius: var(--cs-radius-sm);
    padding: 0.3rem;
    cursor: pointer;
    position: relative;
    background: var(--cs-surface);
    box-shadow: var(--cs-shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cs-filmstrip-item:hover {
    box-shadow: var(--cs-shadow-md);
}

.cs-filmstrip-item.is-active {
    border-color: var(--cs-accent);
    box-shadow: 0 0 0 3px var(--cs-accent-soft);
}

/* "This frame has teacher feedback" — the icon itself is always in the
   DOM (see renderFilmstrip() in editor.js) and only made visible when its
   parent .cs-filmstrip-item gets the has-feedback class, toggled by
   updateFeedbackIndicators() independently of when the comment list loads. */
.cs-filmstrip-feedback-icon {
    display: none;
    position: absolute;
    top: 0.2rem;
    right: 0.2rem;
    width: 0.9rem;
    height: 0.9rem;
    line-height: 0.9rem;
    border-radius: 50%;
    background: var(--cs-accent);
    color: #fff;
    font-size: 0.55rem;
    text-align: center;
    box-shadow: 0 0 0 1.5px var(--cs-surface);
}

.cs-filmstrip-item.has-feedback .cs-filmstrip-feedback-icon {
    display: block;
}

.cs-filmstrip-thumb {
    aspect-ratio: 16 / 9;
    background: var(--cs-bg);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--cs-text-muted);
    font-weight: 600;
}

.cs-filmstrip-thumb img { width: 100%; height: 100%; object-fit: cover; }

.cs-filmstrip-number {
    display: block;
    text-align: center;
    font-size: 0.78rem;
    color: var(--cs-text-muted);
    padding-top: 0.15rem;
}

.cs-filmstrip-item.is-active .cs-filmstrip-number {
    color: var(--cs-accent-dark);
    font-weight: 600;
}

.cs-filmstrip-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    gap: 3px;
}

.cs-filmstrip-item:hover .cs-filmstrip-actions { display: flex; }

.cs-filmstrip-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--cs-border);
    border-radius: 4px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    box-shadow: var(--cs-shadow-sm);
}

.cs-filmstrip-actions button:hover {
    border-color: var(--cs-accent);
    color: var(--cs-accent-dark);
}

.cs-canvas-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.cs-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
    box-shadow: var(--cs-shadow-sm);
}

.cs-tool-attributes {
    position: absolute;
    z-index: 45;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: calc(100% - 1rem);
    padding: 0.35rem 0.5rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    box-shadow: var(--cs-shadow-md);
}

.cs-tool-attributes[hidden],
.cs-tool-attributes:empty,
.cs-tool-attributes.is-empty {
    display: none;
}

.cs-tool-attributes .cs-tool-option {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
}

.cs-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--cs-text);
    border-radius: var(--cs-radius-sm);
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cs-tool:hover {
    background: var(--cs-bg);
}

.cs-tool.is-active {
    border-color: var(--cs-accent);
    background: var(--cs-accent-soft);
    color: var(--cs-accent-dark);
}

.cs-tool-danger { color: var(--cs-danger); }
.cs-tool-danger:hover { background: var(--cs-danger-soft); }

.cs-tool-option {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--cs-text-muted);
    margin-left: 0.5rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--cs-border);
    white-space: nowrap;
}

/* "Font Size" plus its number input, kept from wrapping onto two lines —
   the spinner-arrowed native number input is wide enough relative to the
   floating attributes box that it could otherwise drop below its label. */
#cs-font-size {
    width: 3.2rem;
    flex-shrink: 0;
    padding: 0.1rem 0.25rem;
    height: 1.6rem;
}

/* Equal specificity to the rule above, so this must come after it to win —
   without this, the `hidden` attribute (used to show/hide per-tool
   attributes) would be silently overridden by display:flex. */
.cs-tool-option[hidden] {
    display: none;
}

.cs-tool-option input[type="color"] {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--cs-border-strong);
    border-radius: 6px;
    cursor: pointer;
}

/* ---------- Right-click context menu ---------- */
/* position:fixed + clientX/clientY (not document-relative coordinates) —
   see wireContextMenu() in editor.js, which positions this directly from
   the contextmenu event. */

.cs-context-menu {
    position: fixed;
    z-index: 1300;
    min-width: 180px;
    padding: 0.3rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-md);
}

.cs-context-menu[hidden] {
    display: none;
}

.cs-context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: none;
    border-radius: var(--cs-radius-sm);
    background: transparent;
    color: var(--cs-text);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.cs-context-menu-item i {
    width: 1rem;
    text-align: center;
    color: var(--cs-text-muted);
    flex-shrink: 0;
}

.cs-context-menu-item:hover {
    background: var(--cs-accent-soft);
    color: var(--cs-accent-dark);
}

.cs-context-menu-item:hover i {
    color: var(--cs-accent-dark);
}

/* ---------- Toolbar popover (Annotate picker) ---------- */
/* Same open/close mechanics as the colour wheel popover — a toggled
   .cs-tool that reveals an absolutely-positioned panel of options. */

.cs-tool-popover-wrap {
    position: relative;
    display: inline-flex;
}

.cs-tool-popover {
    position: absolute;
    z-index: 50;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 450px;
    max-width: calc(100vw - 2rem);
    max-height: 75vh;
    overflow-y: auto;
    padding: 0.6rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.3rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-md);
}

.cs-tool-popover[hidden] {
    display: none;
}

/* ---------- Assets panel ---------- */
/* Same popover mechanics as .cs-tool-popover (toggled by the "Assets"
   toolbar button, closes on outside click via ComStoryboardPopovers) but
   taller/wider — it needs room for a search box, category chips, and a
   scrollable thumbnail grid, not just a short list of options. */

.cs-asset-panel {
    position: absolute;
    z-index: 50;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 450px;
    max-width: calc(100vw - 2rem);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-md);
    overflow: hidden;
}

.cs-asset-panel[hidden] {
    display: none;
}

.cs-asset-panel-search {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem;
    border-bottom: 1px solid var(--cs-border);
    color: var(--cs-text-muted);
}

.cs-asset-panel-search input {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--cs-border-strong);
    border-radius: var(--cs-radius-sm);
    font-size: 0.85rem;
    background: var(--cs-bg);
    color: var(--cs-text);
}

.cs-asset-panel-search input:focus {
    outline: none;
    border-color: var(--cs-accent);
    box-shadow: 0 0 0 3px var(--cs-accent-soft);
}

.cs-asset-panel-categories {
    flex: 0 0 auto;
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0.6rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--cs-border);
}

.cs-asset-category {
    flex-shrink: 0;
    padding: 0.25rem 0.65rem;
    border: 1px solid var(--cs-border-strong);
    border-radius: 999px;
    background: var(--cs-surface);
    color: var(--cs-text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.cs-asset-category:hover {
    border-color: var(--cs-accent);
    color: var(--cs-accent-dark);
}

.cs-asset-category.is-active {
    background: var(--cs-accent);
    border-color: var(--cs-accent);
    color: #fff;
}

.cs-asset-panel-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.6rem;
}

.cs-asset-group-title {
    margin: 0.6rem 0 0.4rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cs-text-muted);
}

.cs-asset-group-title:first-child {
    margin-top: 0;
}

.cs-asset-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.cs-asset-thumb {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.3rem;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    background: var(--cs-bg);
    cursor: grab;
    text-align: center;
}

.cs-asset-thumb:hover {
    border-color: var(--cs-accent);
    background: var(--cs-accent-soft);
}

.cs-asset-thumb img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    padding: 0.3rem;
    pointer-events: none;
}

.cs-asset-thumb-name {
    font-size: 0.68rem;
    color: var(--cs-text-muted);
    line-height: 1.2;
}

.cs-asset-thumb.is-premium {
    cursor: pointer;
}

.cs-asset-thumb.is-premium img {
    opacity: 0.45;
}

.cs-asset-lock {
    position: absolute;
    left: 0.2rem;
    right: 0.2rem;
    bottom: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.15rem 0.3rem;
    border-radius: var(--cs-radius-sm);
    background: var(--cs-warning);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
}

.cs-asset-empty {
    margin: 1rem 0;
    text-align: center;
    color: var(--cs-text-muted);
    font-size: 0.85rem;
}

.cs-tool-popover-toggle {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.4rem;
    font-size: 0.82rem;
    color: var(--cs-text);
    border-bottom: 1px solid var(--cs-border);
    margin-bottom: 0.2rem;
}

.cs-tool-popover-hint {
    margin: 0;
    color: var(--cs-text-muted);
    line-height: 1.35;
}

.cs-tool-popover-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.4rem;
    border: 1px solid transparent;
    border-radius: var(--cs-radius-sm);
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.cs-tool-popover-option:hover {
    border-color: var(--cs-accent);
    background: var(--cs-accent-soft);
}

/* Guest-only restriction (see $shapeTypes in tmpl/sandbox/default.php) —
   the option itself stays clickable so the premium-locked toast fires (see
   the .cs-shape-option click handler in sandbox.js), it just never arms. */
.cs-shape-option.is-premium .cs-tool-popover-swatch {
    opacity: 0.45;
}

.cs-shape-lock {
    flex-shrink: 0;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.4rem;
    border-radius: var(--cs-radius-sm);
    background: var(--cs-warning);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.cs-tool-popover-swatch {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    color: #fff;
    font-size: 0.8rem;
}

.cs-tool-popover-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.cs-tool-popover-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--cs-text);
}

.cs-tool-popover-desc {
    font-size: 0.75rem;
    color: var(--cs-text-muted);
    line-height: 1.3;
}

/* Shape options have no per-shape colour the way annotation types do
   (they're drawn in whatever the Colour/Fill pickers are currently set
   to) — one flat accent background for every swatch instead. */
.cs-shape-option .cs-tool-popover-swatch {
    background: var(--cs-accent);
}

.cs-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cs-bg);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    overflow: auto;
}

.cs-canvas-wrap canvas {
    box-shadow: var(--cs-shadow-md);
    border-radius: 4px;
}

.cs-meta-panel {
    overflow-y: auto;
    border-left: 1px solid var(--cs-border);
    padding-left: 0.6rem;
}

.cs-field-row {
    margin-bottom: 0.55rem;
}

.cs-meta-panel label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--cs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.cs-field-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--cs-text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: normal;
    flex-shrink: 0;
}

.cs-field-help:hover {
    color: var(--cs-accent);
    background: var(--cs-accent-soft);
}

.cs-field-help-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

.cs-field-select {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--cs-text-muted);
    cursor: pointer;
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: normal;
    flex-shrink: 0;
}

.cs-field-select:hover {
    color: var(--cs-accent);
    background: var(--cs-accent-soft);
}

.cs-field-help-description {
    margin: 0 0 0.85rem;
    font-size: 0.88rem;
    color: var(--cs-text);
    line-height: 1.45;
}

.cs-field-help-example {
    margin: 0;
    padding: 0.5rem 0.65rem;
    background: var(--cs-bg);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--cs-text-muted);
    line-height: 1.4;
}

.cs-field-help-example strong {
    font-style: normal;
    color: var(--cs-text);
}

.cs-meta-panel input,
.cs-meta-panel textarea {
    display: block;
    width: 100%;
    margin-top: 0.2rem;
    padding: 0.22rem 0.4rem;
    border: 1px solid var(--cs-border-strong);
    border-radius: var(--cs-radius-sm);
    font-weight: normal;
    font-size: 0.9rem;
    color: var(--cs-text);
    background: var(--cs-surface);
    text-transform: none;
    letter-spacing: normal;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.cs-meta-panel input {
    height: 35px;
}

.cs-meta-panel textarea {
    line-height: 1.2;
    resize: none;
    overflow-y: auto;
    max-height: 12rem;
}

.cs-meta-panel input:focus,
.cs-meta-panel textarea:focus {
    outline: none;
    border-color: var(--cs-accent);
    box-shadow: 0 0 0 3px var(--cs-accent-soft);
}

.cs-feedback-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.cs-feedback-item {
    background: var(--cs-bg);
    border-radius: var(--cs-radius-sm);
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
}

.cs-feedback-item p {
    margin: 0.3rem 0 0;
}

/* Which frame a comment is about (or "Whole storyboard") — every comment
   shows this now, since the list is no longer filtered down to just the
   currently open frame (see loadComments() in editor.js/preview.js). A
   frame-specific tag is a real button (jumps to that frame); "Whole
   storyboard"/deleted-frame ones are plain, non-interactive text. */
.cs-feedback-scope {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--cs-accent-soft);
    color: var(--cs-accent-dark);
    font-size: 0.7rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

button.cs-feedback-scope:hover {
    background: var(--cs-accent);
    color: #fff;
}

.cs-feedback-scope-general {
    background: var(--cs-bg);
    color: var(--cs-text-muted);
    border: 1px solid var(--cs-border);
    cursor: default;
}

.cs-feedback-author {
    font-weight: 600;
    margin-right: 0.4rem;
    color: var(--cs-accent-dark);
}

.cs-feedback-item time {
    color: var(--cs-text-muted);
    font-size: 0.72rem;
}

.cs-feedback-read {
    display: block;
    margin-top: 0.4rem;
    color: var(--cs-text-muted);
    font-size: 0.72rem;
    font-style: italic;
}

.cs-feedback-ack {
    display: inline-flex;
    margin-top: 0.4rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
}

.cs-comment-form {
    margin-top: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cs-comment-scope-hint {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cs-accent-dark);
}

.cs-comment-form textarea {
    width: 100%;
    border: 1px solid var(--cs-border-strong);
    border-radius: var(--cs-radius-sm);
    padding: 0.5rem 0.6rem;
    font-family: inherit;
    font-size: 0.88rem;
    resize: none;
    overflow-y: auto;
    max-height: 12rem;
}

.cs-comment-form textarea:focus {
    outline: none;
    border-color: var(--cs-accent);
    box-shadow: 0 0 0 3px var(--cs-accent-soft);
}

/* ---------- Teacher navigation ---------- */

.cs-breadcrumb {
    display: flex;
    gap: 0.4rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: var(--cs-text-muted);
}

.cs-breadcrumb a {
    color: var(--cs-accent-dark);
    text-decoration: none;
    font-weight: 500;
}

.cs-breadcrumb a:hover { text-decoration: underline; }

.cs-list-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    overflow: hidden;
    box-shadow: var(--cs-shadow-sm);
}

.cs-list-table th {
    text-align: left;
    padding: 0.65rem 0.85rem;
    background: var(--cs-bg);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--cs-text-muted);
    border-bottom: 1px solid var(--cs-border);
}

.cs-list-table td {
    text-align: left;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--cs-border);
}

.cs-list-table tbody tr:last-child td {
    border-bottom: none;
}

.cs-list-table tbody tr:hover {
    background: var(--cs-bg);
}

/* ---------- Teacher dashboard accordion ---------- */
/* Plain nested <details>/<summary> — class -> student -> storyboards —
   needs no JS at all for expand/collapse, and degrades gracefully (still
   readable, just all "open") with CSS/JS disabled. */

.cs-teacher-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cs-teacher-class {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    padding: 0.15rem 0;
}

.cs-teacher-class > summary {
    padding: 0.75rem 1rem;
    font-weight: 700;
}

.cs-teacher-class-body {
    padding: 0.25rem 1rem 0.9rem;
}

.cs-teacher-student-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.cs-teacher-student {
    background: var(--cs-bg);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    padding: 0.1rem 0;
}

.cs-teacher-student > summary {
    padding: 0.55rem 0.75rem;
    font-weight: 600;
}

.cs-teacher-student .cs-list-table {
    margin: 0 0.75rem 0.75rem;
    width: calc(100% - 1.5rem);
    box-shadow: none;
}

.cs-teacher-class summary,
.cs-teacher-student summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    cursor: pointer;
    list-style: none;
}

.cs-teacher-class summary::-webkit-details-marker,
.cs-teacher-student summary::-webkit-details-marker {
    display: none;
}

.cs-teacher-item-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cs-teacher-item-name::before {
    content: '\25B8';
    display: inline-block;
    color: var(--cs-text-muted);
    transition: transform 0.15s ease;
}

details[open] > summary .cs-teacher-item-name::before {
    transform: rotate(90deg);
}

.cs-teacher-count-badge {
    flex-shrink: 0;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--cs-accent-soft);
    color: var(--cs-accent-dark);
    font-size: 0.75rem;
    font-weight: 700;
}

/* ---------- Preview mode ---------- */

.cs-preview {
    max-width: 1100px;
    margin: 0 auto;
}

.cs-preview-description {
    color: var(--cs-text-muted);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.cs-preview-exit {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.cs-preview-layout-switcher {
    display: flex;
    gap: 0.15rem;
    padding: 0.2rem;
    background: var(--cs-bg);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
}

.cs-layout-btn {
    padding: 0.35rem 0.7rem;
    border: none;
    border-radius: var(--cs-radius-sm);
    background: none;
    color: var(--cs-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.cs-layout-btn:hover {
    color: var(--cs-text);
}

.cs-layout-btn.is-active {
    background: var(--cs-surface);
    color: var(--cs-accent-dark);
    box-shadow: var(--cs-shadow-sm);
}

/* Which layout is picked (preview.js toggles [data-print-layout] on
   #cs-preview) decides what's actually shown, on screen AND in print alike
   for Landscape/Portrait — a true WYSIWYG match, not just a print option.
   Timeline is the one exception: on screen it's still the interactive
   frame-by-frame view below (unchanged); only ITS print output is the
   separate paginated .cs-print-timeline-pages further down, gated to
   @media print only since there's no on-screen equivalent for it. */
.cs-preview > h1,
.cs-preview-description,
.cs-preview-stage,
.cs-preview-timeline,
.cs-print-grid-pages {
    display: none;
}

.cs-preview[data-print-layout="timeline"] > h1,
.cs-preview[data-print-layout="timeline"] > .cs-preview-description {
    display: block;
}

.cs-preview[data-print-layout="timeline"] .cs-preview-stage,
.cs-preview[data-print-layout="timeline"] .cs-preview-timeline {
    display: flex;
}

.cs-preview[data-print-layout="landscape"] .cs-print-grid-pages,
.cs-preview[data-print-layout="portrait"] .cs-print-grid-pages {
    display: block;
}

.cs-preview-stage {
    /* display is layout-driven — see [data-print-layout] above, which
       needs the higher specificity to win over this unconditional rule. */
    align-items: center;
    gap: 1rem;
}

.cs-preview-side-nav {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--cs-border-strong);
    background: var(--cs-surface);
    color: var(--cs-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--cs-shadow-sm);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cs-preview-side-nav:hover {
    border-color: var(--cs-accent);
    color: var(--cs-accent-dark);
    background: var(--cs-accent-soft);
}

.cs-preview-side-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

.cs-preview-side-nav:disabled:hover {
    border-color: var(--cs-border-strong);
    color: var(--cs-text);
    background: var(--cs-surface);
}

.cs-preview-frames {
    flex: 1;
    min-width: 0;
}

.cs-preview-frame {
    display: none;
    text-align: center;
}

.cs-preview-frame.is-active { display: block; }

.cs-preview-frame-media img {
    max-width: 100%;
    max-height: 55vh;
    border-radius: var(--cs-radius);
    background: var(--cs-bg);
    box-shadow: var(--cs-shadow-md);
}

.cs-preview-frame-number {
    color: var(--cs-text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.cs-preview-details-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 900px;
    margin: 1rem auto 0;
}

.cs-preview-details {
    text-align: left;
    flex: 1 1 0;
    min-width: 0;
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 0.4rem 0.75rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 0.85rem 1.1rem;
}

.cs-preview-details dt {
    font-weight: 600;
    color: var(--cs-text-muted);
    font-size: 0.85rem;
}

.cs-preview-details dd {
    margin: 0;
}

/* ---------- Preview timeline (screen only) ---------- */

.cs-preview-timeline {
    /* display is layout-driven — see [data-print-layout] above, which
       needs the higher specificity to win over this unconditional rule. */
    gap: 0.6rem;
    overflow-x: auto;
    margin-top: 1.5rem;
    padding: 0.75rem 0.25rem;
    border-top: 1px solid var(--cs-border);
}

.cs-preview-timeline-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    width: 84px;
    border: 2px solid transparent;
    border-radius: var(--cs-radius-sm);
    background: none;
    padding: 0.25rem;
    cursor: pointer;
}

.cs-preview-timeline-item.is-active {
    border-color: var(--cs-accent);
}

.cs-preview-timeline-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    background: var(--cs-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--cs-border-strong);
}

.cs-preview-timeline-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cs-preview-timeline-duration {
    font-size: 0.72rem;
    color: var(--cs-text-muted);
    font-weight: 600;
}

/* ---------- Print/export page header (shared by the Landscape/Portrait
   card grid and the Timeline print pages) — Title top-left, then Version
   (+ date submitted, if any) top-right; Name bottom-left, Page X of Y
   bottom-right. Lives outside @media print because the Landscape/Portrait
   grid now previews on screen too (see [data-print-layout] above) and
   needs the same header there. ---------- */

.cs-print-page-header {
    text-align: left;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #111;
}

.cs-print-page-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.cs-print-page-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.cs-print-page-description {
    font-size: 0.8rem;
    color: #444;
    margin: 0.2rem 0;
}

.cs-print-page-header-meta,
.cs-print-page-name,
.cs-print-page-pageof {
    font-size: 0.72rem;
    color: #444;
    white-space: nowrap;
}

/* ---------- Landscape/Portrait: OCR-template card grid — also the
   on-screen preview for these two layouts, not just what prints (see
   [data-print-layout] above). @media print further down strips the
   on-screen "card" chrome and adds pagination/sizing. ---------- */

.cs-print-grid-page {
    max-width: 1000px;
    margin: 0 auto 2rem;
    padding: 1.25rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-md);
}

.cs-print-card-grid {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.cs-preview[data-print-layout="landscape"] .cs-print-card-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.cs-preview[data-print-layout="portrait"] .cs-print-card-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.cs-print-card {
    display: flex;
    flex-direction: column;
    border-radius: 4px;
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.cs-print-card:hover,
.cs-print-card:focus-visible {
    box-shadow: 0 0 0 2px var(--cs-accent);
    outline: none;
}

/* Keeps the grid's cell count/sizing correct on a half-full last page
   without drawing an empty box. */
.cs-print-card-empty {
    visibility: hidden;
    cursor: default;
}

.cs-print-card-empty:hover,
.cs-print-card-empty:focus-visible {
    box-shadow: none;
}

/* "This frame has feedback" — see updateFrameCardIndicators() in
   preview.js — the same icon the editor's filmstrip uses, just anchored to
   a different corner to stay clear of the frame number/duration badges. */
.cs-print-card-feedback-icon {
    display: none;
    position: absolute;
    bottom: 0.15rem;
    right: 0.15rem;
    width: 1rem;
    height: 1rem;
    line-height: 1rem;
    border-radius: 50%;
    background: var(--cs-accent);
    color: #fff;
    font-size: 0.6rem;
    text-align: center;
    box-shadow: 0 0 0 1.5px #fff;
}

.cs-print-card.has-feedback .cs-print-card-feedback-icon {
    display: block;
}

/* The border the scene/thumbnail itself needs — deliberately not on
   .cs-print-card as a whole, which stays borderless. */
.cs-print-card-media {
    position: relative;
    flex: 0 0 auto;
    aspect-ratio: 16 / 9;
    background: var(--cs-bg);
    border: 1px solid #333;
}

.cs-print-card-media img,
.cs-print-card-media .cs-storyboard-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
}

.cs-print-card-number,
.cs-print-card-duration {
    position: absolute;
    top: 0.15rem;
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.05rem 0.3rem;
    border-radius: 2px;
}

.cs-print-card-number { left: 0.15rem; }
.cs-print-card-duration { right: 0.15rem; }

.cs-print-card-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.3rem 0.35rem;
    font-size: 0.72rem;
    line-height: 1.35;
}

/* Field values joined with ". " server-side (see preview/default.php)
   instead of separate grid columns — reads as one compact line rather
   than a spaced-out table. */
.cs-print-card-row-shot {
    font-weight: 600;
}

.cs-print-card-row-action {
    font-style: italic;
}

/* Screen-hidden; only ever shown inside @media print below. Unlike
   .cs-print-grid-pages (toggled by [data-print-layout] above, since it's
   now also a screen preview), these three have no on-screen use at all. */
.cs-print-footer,
.cs-print-footer-text,
.cs-print-timeline-pages {
    display: none;
}

@media print {
    /* Print isolation: the platform's own sidebar/topbar chrome lives
       outside anything com_storyboard controls, so it can't be targeted by
       selector — instead hide EVERYTHING on the page, then re-show only
       the preview content. Hidden elements still occupy their normal
       layout space (unlike display:none), which is exactly why
       .cs-preview is pulled out of flow with position:absolute below —
       that makes it render at the physical top of the page regardless of
       how much blank space its hidden siblings would otherwise reserve. */
    body * {
        visibility: hidden;
    }

    .cs-preview,
    .cs-preview * {
        visibility: visible;
    }

    .cs-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        /* @page { margin: 1cm } (set in preview/default.php, updated by
           preview.js) already insets the printable area — no extra padding
           needed here, and stacking one on top of the other was eating
           into the room the header/grid/footer need to fit without
           overflowing onto each other. */
        padding: 0;
    }

    /* Every layout replaces these with its own dedicated print structure
       (.cs-print-grid-pages or .cs-print-timeline-pages) — the interactive
       on-screen chrome never prints, Timeline included. */
    .cs-preview-side-nav,
    .cs-preview-timeline,
    .cs-preview-stage,
    .cs-editor-actions,
    .cs-preview-exit {
        display: none !important;
    }

    .cs-preview > h1,
    .cs-preview > .cs-preview-description {
        display: none;
    }

    /* position:fixed (relative to the page box, since nothing between here
       and .cs-preview establishes its own containing block) repeats these
       in the same corners of every printed page, not just the last one —
       shared by every layout (Timeline/Landscape/Portrait), not gated.
       bottom: 0 sits flush with the page's own margin edge (see @page
       above) rather than floating further up into the content area. */
    .cs-print-footer {
        display: block;
        position: fixed;
        left: 0;
        bottom: 0;
    }

    .cs-print-footer-logo {
        height: 0.9cm;
        width: auto;
    }

    .cs-print-footer-text {
        display: block;
        position: fixed;
        right: 0;
        bottom: 0;
        text-align: right;
        line-height: 1.3;
    }

    .cs-print-footer-tagline {
        font-size: 0.65rem;
        font-weight: 600;
        color: #444;
    }

    .cs-print-footer-url {
        font-size: 0.58rem;
        color: #777;
    }

    /* ---------- Landscape/Portrait grid: strip the on-screen "card" look
       (this is the same markup the screen preview uses — see the base
       .cs-print-grid-page rules above), paginate, and reserve room below
       each page's grid so it can't run under the fixed footer. ---------- */

    .cs-print-grid-page {
        max-width: none;
        margin: 0;
        padding: 0;
        background: none;
        border: none;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        /* calc() matches the two @page top/bottom margins (1cm each) —
           without an explicit height the grid's row tracks size to content
           instead of filling (and being bounded by) the actual page. */
        height: calc(100vh - 2cm);
        box-sizing: border-box;
        /* Reserves room for the fixed footer so the grid's last row can't
           render underneath it. */
        padding-bottom: 1.1cm;
        break-after: page;
        page-break-after: always;
    }

    .cs-print-grid-page:last-child {
        break-after: auto;
        page-break-after: auto;
    }

    .cs-print-card-grid {
        flex: 1;
        min-height: 0;
    }

    .cs-print-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* ---------- Timeline: print-only (the on-screen Timeline layout stays
       the interactive frame-by-frame view instead — see [data-print-layout]
       above), portrait, paginated 3 rows per page. ---------- */

    .cs-preview[data-print-layout="timeline"] .cs-print-timeline-pages {
        display: block;
    }

    .cs-print-timeline-page {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 2cm);
        box-sizing: border-box;
        padding-bottom: 1.1cm;
        break-after: page;
        page-break-after: always;
    }

    .cs-print-timeline-page:last-child {
        break-after: auto;
        page-break-after: auto;
    }

    .cs-print-timeline-rows {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 0.3cm;
    }

    .cs-print-timeline-row {
        flex: 1;
        min-height: 0;
        display: grid;
        grid-template-columns: 38% 1fr;
        gap: 0.5cm;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .cs-print-timeline-row-media {
        position: relative;
        border: 1px solid #333;
        overflow: hidden;
    }

    .cs-print-timeline-row-media img,
    .cs-print-timeline-row-media .cs-storyboard-card-thumb {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #aaa;
    }

    .cs-print-timeline-row-number,
    .cs-print-timeline-row-duration {
        position: absolute;
        top: 0.1cm;
        background: rgba(255, 255, 255, 0.9);
        color: #111;
        font-size: 0.65rem;
        font-weight: 700;
        padding: 0.05cm 0.2cm;
        border-radius: 2px;
    }

    .cs-print-timeline-row-number {
        left: 0.1cm;
    }

    .cs-print-timeline-row-duration {
        right: 0.1cm;
    }

    .cs-print-timeline-row-details {
        display: flex;
        flex-direction: column;
        gap: 0.15cm;
        font-size: 0.75rem;
        line-height: 1.35;
        overflow: hidden;
    }

    .cs-print-timeline-row-shot {
        font-weight: 600;
    }

    .cs-print-timeline-row-action {
        font-style: italic;
    }
}

@media (max-width: 900px) {
    /* The editor no longer fits in a fixed viewport-height box once its
       three columns stack into rows below — let the page grow and scroll
       naturally instead of clipping the meta panel/filmstrip. */
    .com-storyboard-editor {
        height: auto;
        min-height: 0;
    }

    .cs-editor-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
    }

    .cs-filmstrip {
        display: flex;
        border-right: none;
        border-bottom: 1px solid var(--cs-border);
        padding-right: 0;
        padding-bottom: 0.6rem;
    }

    .cs-filmstrip-list {
        flex-direction: row;
        overflow-x: auto;
    }

    .cs-filmstrip-item {
        min-width: 90px;
    }

    .cs-meta-panel {
        border-left: none;
        border-top: 1px solid var(--cs-border);
        padding-left: 0;
        padding-top: 0.85rem;
    }

    .cs-guest-cta {
        margin: 1.5rem auto;
        padding: 1.75rem 1.25rem;
    }

    .cs-guest-cta-actions {
        flex-direction: column;
    }

    /* Header bars: title/actions no longer fit on one line once the
       viewport narrows — wrap onto their own rows instead of squeezing or
       overflowing. */
    .cs-editor-header {
        flex-wrap: wrap;
    }

    .cs-editor-title-group {
        flex-basis: 100%;
        order: -1;
    }

    .cs-editor-status {
        min-width: 0;
    }

    .cs-dashboard-header {
        flex-wrap: wrap;
    }

    .cs-dashboard-header-actions {
        flex-wrap: wrap;
    }

    .cs-preview {
        padding: 0 0.25rem;
    }

    .cs-preview-stage {
        gap: 0.5rem;
    }

    .cs-preview-side-nav {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .cs-preview-details-row {
        flex-direction: column;
        max-width: 100%;
    }

    .cs-preview-details {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .cs-editor-header {
        padding: 0.3rem 0;
    }

    .cs-editor-actions {
        flex-wrap: wrap;
        row-gap: 0.4rem;
    }

    .cs-btn-back {
        margin-left: 0;
        padding-left: 0.9rem;
    }

    .cs-toolbar {
        gap: 0.25rem;
    }

    .cs-tool-option {
        margin-left: 0.25rem;
        padding-left: 0.35rem;
    }

    .cs-dashboard-header-actions {
        width: 100%;
    }

    .cs-dashboard-header-actions form,
    .cs-dashboard-header-actions .cs-btn {
        flex: 1;
        justify-content: center;
    }

    .cs-storyboard-grid {
        grid-template-columns: 1fr;
    }

    .cs-preview-stage {
        flex-wrap: wrap;
        justify-content: center;
    }

    .cs-preview-frames {
        order: 1;
        flex-basis: 100%;
    }

    .cs-preview-side-nav-prev { order: 0; }
    .cs-preview-side-nav-next { order: 2; }

    .cs-modal {
        padding: 0.75rem;
    }

    .cs-modal-dialog {
        max-height: min(88vh, 720px);
    }

    .cs-modal-header {
        flex-wrap: wrap;
        padding: 0.85rem 1rem;
    }

    .cs-preview-modal-open-full {
        order: 1;
        flex-basis: 100%;
        justify-content: center;
    }

    .cs-recycle-item {
        flex-wrap: wrap;
    }

    .cs-recycle-item-actions {
        width: 100%;
    }

    .cs-recycle-item-actions .cs-btn {
        flex: 1;
        justify-content: center;
    }

    .cs-color-popover {
        width: min(220px, calc(100vw - 3rem));
    }

    .cs-tool-popover {
        width: min(280px, calc(100vw - 3rem));
        grid-template-columns: 1fr;
    }

    .cs-toast-container {
        left: 0.75rem;
        right: 0.75rem;
        top: 0.75rem;
        transform: none;
        max-width: none;
    }
}

/* ---------- Toast notifications ---------- */
/* Not scoped under .com-storyboard — toast.js appends this directly to
   <body>, same reasoning as .cs-page-loader (see above): it needs to sit
   above everything regardless of which component view is currently
   rendering .com-storyboard's own markup. */

.cs-toast-container {
    position: fixed;
    z-index: 1400;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(360px, calc(100vw - 2rem));
}

.cs-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.7rem 0.8rem;
    background: #1c2130;
    color: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(17, 24, 39, 0.25);
    font-size: 0.85rem;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cs-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.cs-toast i.fa-circle-check { color: #4ade80; }
.cs-toast i.fa-circle-exclamation { color: #f87171; }
.cs-toast i.fa-circle-info { color: #93c5fd; }

.cs-toast > i {
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.cs-toast > span {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.cs-toast-close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 0.85rem;
}

.cs-toast-close:hover {
    color: #fff;
}

/* ---------- Dashboard: modals (storyboard preview + recycle bin) ---------- */
/* Generic modal chrome shared by every dashboard modal — the preview modal
   and the recycle bin modal both use these same classes for the overlay,
   dialog frame, header, and close button, and each adds their own
   *-body-specific classes for their actual content. */

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

.cs-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.cs-modal[hidden] {
    display: none;
}

.cs-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
}

.cs-modal-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 860px;
    max-height: min(80vh, 720px);
    background: var(--cs-surface);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-md);
    overflow: hidden;
}

.cs-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--cs-border);
}

.cs-modal-header h2 {
    flex: 1;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--cs-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--cs-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: var(--cs-radius-sm);
}

.cs-modal-close:hover {
    background: var(--cs-bg);
    color: var(--cs-text);
}

.cs-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

/* ---------- Landscape/Portrait per-frame popup ---------- */

.cs-frame-modal-dialog {
    max-width: 960px;
}

.cs-frame-modal-media {
    text-align: center;
    margin-bottom: 1rem;
}

.cs-frame-modal-media img {
    max-width: 100%;
    max-height: 40vh;
    border-radius: var(--cs-radius);
    background: var(--cs-bg);
    box-shadow: var(--cs-shadow-md);
}

/* The details container's own content (the cloned .cs-preview-details-row
   markup — see openFrameModal() in preview.js) already has its layout/
   spacing from the existing .cs-preview-details rules; this just adds
   room before the feedback thread below it. */
.cs-frame-modal-details {
    margin-bottom: 1rem;
}

.cs-modal-loading,
.cs-modal-error,
.cs-modal-empty {
    margin: 2rem 0;
    text-align: center;
    color: var(--cs-text-muted);
}

.cs-modal-error {
    color: var(--cs-danger);
}

.cs-preview-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.85rem;
}

.cs-preview-modal-frame {
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    overflow: hidden;
    background: var(--cs-bg);
}

.cs-preview-modal-frame-thumb {
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cs-surface);
    color: var(--cs-border-strong);
    font-size: 1.4rem;
    overflow: hidden;
}

.cs-preview-modal-frame-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cs-preview-modal-frame-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.55rem;
    font-size: 0.72rem;
    color: var(--cs-text-muted);
}

.cs-preview-modal-frame-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--cs-accent-soft);
    color: var(--cs-accent-dark);
    font-weight: 600;
    font-size: 0.68rem;
}

/* ---------- Field help (educational glossary) modal ---------- */

.cs-field-help-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cs-field-help-item {
    width: 100%;
    text-align: left;
    display: block;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    background: var(--cs-surface);
    cursor: default;
}

button.cs-field-help-item {
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

button.cs-field-help-item:hover {
    border-color: var(--cs-accent);
    background: var(--cs-accent-soft);
}

.cs-field-help-term {
    display: block;
    font-weight: 700;
    color: var(--cs-text);
    margin-bottom: 0.15rem;
}

.cs-field-help-desc {
    display: block;
    font-size: 0.85rem;
    color: var(--cs-text-muted);
    line-height: 1.4;
}

.cs-field-help-hint {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    color: var(--cs-text-muted);
}

/* ---------- Recycle bin list ---------- */

.cs-recycle-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cs-recycle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    background: var(--cs-bg);
}

.cs-recycle-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.cs-recycle-item-title {
    font-weight: 600;
    color: var(--cs-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-recycle-item-meta {
    font-size: 0.78rem;
    color: var(--cs-text-muted);
}

.cs-recycle-item-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* ---------- Colour wheel picker ---------- */
/* Markup/behaviour built by color-wheel.js — see that file's build()
   function for the exact structure this styles. The native <input
   type="color"> stays in the DOM (hidden) so existing $('#cs-color').val()
   reads/writes elsewhere in editor.js/sandbox.js keep working unchanged. */

.cs-color-picker {
    position: relative;
    display: inline-block;
}

.cs-color-swatch {
    display: inline-flex;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 1px solid var(--cs-border-strong);
    border-radius: var(--cs-radius-sm);
    cursor: pointer;
    background-color: #000;
    box-shadow: var(--cs-shadow-sm);
}

.cs-color-swatch:hover {
    border-color: var(--cs-accent);
}

.cs-color-popover {
    position: absolute;
    z-index: 50;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 220px;
    padding: 0.85rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-md);
}

.cs-color-popover[hidden] {
    display: none;
}

.cs-color-wheel-wrap {
    position: relative;
    margin: 0 auto 0.6rem;
    /* width/height are set inline by color-wheel.js to fit exactly the
       generated hex grid — this only centres that box within the popover. */
}

.cs-color-hex-swatch {
    position: absolute;
    padding: 0;
    border: none;
    cursor: pointer;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transition: transform 0.1s ease, filter 0.1s ease;
}

.cs-color-hex-swatch:hover {
    filter: brightness(1.08);
    transform: scale(1.15);
    z-index: 2;
}

.cs-color-hex-swatch.is-selected {
    filter: brightness(1.08);
    transform: scale(1.2);
    z-index: 3;
}

.cs-color-tones-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--cs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.3rem;
}

.cs-color-tones {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.7rem;
}

.cs-color-tone {
    flex: 1;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 1px solid var(--cs-border-strong);
    border-radius: var(--cs-radius-sm);
    cursor: pointer;
}

.cs-color-tone:hover {
    border-color: var(--cs-accent);
    box-shadow: 0 0 0 2px var(--cs-accent-soft);
}

.cs-color-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cs-color-fields > label,
.cs-color-rgb label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--cs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cs-color-rgb label {
    text-align: center;
}

.cs-color-fields input[type="text"] {
    width: 100%;
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--cs-border-strong);
    border-radius: var(--cs-radius-sm);
    font-size: 0.82rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-align: center;
}

.cs-color-rgb {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
}

.cs-color-rgb input[type="number"] {
    width: 100%;
    padding: 0.2rem 0.2rem;
    border: 1px solid var(--cs-border-strong);
    border-radius: var(--cs-radius-sm);
    font-size: 0.8rem;
    text-align: center;
}

.cs-color-fields input:focus-visible {
    outline: 2px solid var(--cs-accent);
    outline-offset: 1px;
}
