/*
 * Spotlight interior component theme.
 * Loaded after style_new.css and spotlight.css so legacy classes inherit
 * the Spotlight visual language without requiring wholesale Twig rewrites.
 */

:root {
    --spot-success: #15803d;
    --spot-warning: #b45309;
    --spot-info: #0369a1;
    --spot-surface-alt: #faf6ec;
    --spot-surface-hover: rgba(15, 23, 42, 0.04);
    --spot-focus: #0ea5e9;
    --spot-radius-sm: 8px;
    --spot-radius-md: 12px;
    --spot-radius-lg: 18px;
    --spot-shadow-sm: 0 4px 10px rgba(15, 23, 42, 0.04);
    --spot-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --spot-shadow-lg: 0 14px 30px rgba(15, 23, 42, 0.1);
    --spot-font-sans: 'Space Grotesk', 'Segoe UI', sans-serif;
    --spot-font-display: 'Fraunces', serif;
    --spot-font-mono: 'IBM Plex Mono', monospace;

    /* Legacy color aliases used by older templates/scripts */
    --primary-blue: var(--spot-accent);
    --dark-blue: var(--spot-ink);
    --text-light: var(--spot-muted);
    --warning-color: var(--spot-warning);
    --success-color: var(--spot-success);
    --danger-color: var(--spot-danger);
}

body,
input,
select,
textarea,
button {
    font-family: var(--spot-font-sans);
}

.app-main .content,
.app-main .content_text,
.report-page,
.report-container,
.spotlight-page {
    color: var(--spot-ink);
}

/* Override legacy report shell visuals so page headers stay consistent in Spotlight. */
.app-main .report-page {
    min-height: auto;
    padding: 0;
    background: transparent;
}

.app-main .report-container {
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.app-main .report-container .page-header h1 {
    text-align: left;
    font-size: 1.75rem;
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--spot-ink);
}

.app-main .report-container .page-description {
    text-align: left;
    margin-bottom: 0;
    color: var(--spot-muted);
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--spot-line);
}

.page-header h1 {
    margin: 0;
    font-family: var(--spot-font-display);
    font-size: 1.75rem;
    line-height: 1.1;
    color: var(--spot-ink);
}

.page-description {
    margin: 6px 0 0;
    max-width: 72ch;
    color: var(--spot-muted);
    font-size: 0.9rem;
}

.section-actions,
.form-actions,
.filter-actions,
.button-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.section-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--spot-line);
}

.section-actions.no-divider,
.section-actions.compact {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.form-actions {
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--spot-line);
}

/* Buttons */
.btn,
.submit-button,
.update-button,
.edit-ai-btn,
.download-action-btn,
.practice-action-btn,
.generate-key-btn,
.change-owner-btn,
.btn-small,
.btn-extend,
.edit-link,
.edit-profile-btn,
a.edit-ai-btn,
a.edit-link,
a.edit-profile-btn,
a.btn,
button.btn,
input[type='submit'].btn,
input[type='button'].btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--spot-radius-md);
    border: 1px solid var(--spot-accent);
    background: var(--spot-accent);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.84rem;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: var(--spot-shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover,
.submit-button:hover,
.update-button:hover,
.edit-ai-btn:hover,
.download-action-btn:hover,
.practice-action-btn:hover,
.generate-key-btn:hover,
.change-owner-btn:hover,
.btn-small:hover,
.btn-extend:hover,
.edit-link:hover,
.edit-profile-btn:hover,
a.edit-ai-btn:hover,
a.edit-link:hover,
a.edit-profile-btn:hover,
a.btn:hover,
button.btn:hover,
input[type='submit'].btn:hover,
input[type='button'].btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--spot-shadow-md);
    color: #fff;
}

.btn-secondary,
.cancel-button,
.btn-outline,
a.cancel-button,
a.btn-secondary,
a.btn-outline,
.job-modal-close {
    border-color: var(--spot-line);
    background: #fff;
    color: var(--spot-ink);
    box-shadow: none;
}

.btn-secondary:hover,
.cancel-button:hover,
.btn-outline:hover,
a.cancel-button:hover,
a.btn-secondary:hover,
a.btn-outline:hover,
.job-modal-close:hover {
    border-color: var(--spot-accent);
    color: var(--spot-ink);
    box-shadow: var(--spot-shadow-sm);
}

.btn-warning,
.btn-warning:hover,
a.btn-warning,
a.btn-warning:hover {
    border-color: #f59e0b;
    background: #fff7ed;
    color: var(--spot-warning);
}

.btn-danger,
.cancel-button.danger,
a.btn-danger,
button.btn-danger,
#confirm-delete {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--spot-danger);
}

.btn-danger:hover,
.cancel-button.danger:hover,
a.btn-danger:hover,
button.btn-danger:hover,
#confirm-delete:hover {
    border-color: var(--spot-danger);
    background: var(--spot-danger);
    color: #fff;
}

.btn-success,
a.btn-success,
button.btn-success {
    border-color: #86efac;
    background: #ecfdf5;
    color: #166534;
}

.btn-success:hover,
a.btn-success:hover,
button.btn-success:hover {
    border-color: #15803d;
    background: #15803d;
    color: #fff;
}

.btn-sm,
.btn-small,
.btn-extend,
.quick-date-btn {
    padding: 5px 10px;
    border-radius: var(--spot-radius-sm);
    font-size: 0.78rem;
}

.btn-primary,
a.btn-primary,
button.btn-primary,
input.btn-primary {
    border-color: var(--spot-accent);
    background: var(--spot-accent);
    color: #fff;
}

.btn-outline,
a.btn-outline,
button.btn-outline {
    border-color: var(--spot-line);
    background: #fff;
    color: var(--spot-ink);
}

.btn-outline:hover,
a.btn-outline:hover,
button.btn-outline:hover {
    border-color: var(--spot-accent);
    color: var(--spot-ink);
}

.download-action-btn,
.practice-action-btn {
    min-height: 32px;
}

button[disabled],
a[aria-disabled='true'],
input[disabled],
.btn[disabled],
.cancel-button[disabled],
.edit-ai-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

/* Links */
a {
    color: var(--spot-accent);
}

a:hover {
    color: #075985;
}

.table-link {
    color: var(--spot-accent);
    text-decoration: none;
    font-weight: 600;
}

.table-link:hover {
    text-decoration: underline;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--spot-line);
    border-radius: 999px;
    background: #fff;
    color: var(--spot-ink);
    text-decoration: none;
    padding: 5px 12px;
    font-size: 0.82rem;
    margin-bottom: 10px;
}

.back-link:hover {
    border-color: var(--spot-accent);
}

/* Form fields */
.form-control,
input.form-control,
select.form-control,
textarea.form-control,
.form-group input[type='text'],
.form-group input[type='password'],
.form-group input[type='number'],
.form-group input[type='email'],
.form-group input[type='date'],
.form-group input[type='datetime-local'],
.form-group input[type='search'],
.form-group input[type='url'],
.form-group textarea,
.form-group select,
.form-table input,
.form-table textarea,
.form-table select,
.modern-form input,
.modern-form textarea,
.modern-form select,
.filter-form input,
.filter-form select,
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--spot-line);
    border-radius: var(--spot-radius-sm);
    background: #fff;
    color: var(--spot-ink);
    padding: 8px 11px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.form-group input[type='checkbox'],
.form-group input[type='radio'],
input[type='checkbox'],
input[type='radio'] {
    accent-color: var(--spot-accent);
}

.form-group label,
.filter-group label,
.checkbox-label {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--spot-ink);
}

.form-text,
.help-text,
.field-help,
.field-description,
.text-muted,
.small {
    color: var(--spot-muted);
    font-size: 0.82rem;
}

.password-requirements {
    background: var(--spot-panel);
    border: 1px solid var(--spot-line);
    border-radius: var(--spot-radius-md);
}

.password-requirements h4 {
    color: var(--spot-ink);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus,
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--spot-accent);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.17);
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--spot-focus);
    outline-offset: 2px;
    border-radius: var(--spot-radius-sm);
}

/* Surfaces */
.form-section,
.data-section,
.info-section,
.table-section,
.card,
.status-card,
.stat-card,
.stat-card-large,
.analysis-card,
.detail-group,
.modal-content,
.table-container,
.table-responsive,
.spotlight-recent .surface,
.no-data,
.empty-state {
    background: var(--spot-panel);
    border: 1px solid var(--spot-line);
    border-radius: var(--spot-radius-lg);
    box-shadow: var(--spot-shadow-sm);
}

.form-section,
.data-section,
.info-section,
.table-section,
.card,
.analysis-card,
.detail-group {
    padding: 16px 18px;
    margin-bottom: 16px;
}

.form-section h3,
.form-section h4,
.data-section h3,
.data-section h4,
.info-section h3,
.info-section h4,
.card-header h5,
.analysis-card h4,
.table-section h3,
.detail-group h4,
.result-section h3,
.result-section h4 {
    margin: 0 0 10px;
    color: var(--spot-ink);
    font-family: var(--spot-font-display);
    font-size: 1.05rem;
    font-weight: 600;
}

.card-header,
.modal-header {
    margin: -16px -18px 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--spot-line);
    background: transparent;
}

.card-header.bg-primary,
.card-header.bg-primary h5 {
    background: transparent;
    color: var(--spot-ink);
}

/* Grid layouts */
.form-grid,
.info-grid,
.stats-grid,
.status-overview,
.overall-stats,
.two-column-grid,
.row {
    display: grid;
    gap: 12px;
}

.form-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.info-grid,
.status-overview,
.stats-grid,
.overall-stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.two-column-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.form-row .form-group {
    flex: 1 1 240px;
}

.form-group.full-width,
.full-width,
.u-grid-span-2 {
    grid-column: 1 / -1;
}

.info-row {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(217, 210, 198, 0.7);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label,
.meta-label,
.status-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--spot-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.info-value,
.meta-value,
.status-value {
    color: var(--spot-ink);
    font-weight: 500;
}

.status-value.status-online {
    color: #15803d;
}

.status-value.status-offline {
    color: var(--spot-muted);
}

.status-value strong,
.stat-value,
.stat-number {
    font-family: var(--spot-font-mono);
    font-size: 1.4rem;
    color: var(--spot-ink);
}

.stat-label {
    color: var(--spot-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Alerts and badges */
.alert {
    border-radius: var(--spot-radius-md);
    border: 1px solid;
    padding: 11px 14px;
    margin-bottom: 14px;
    font-size: 0.88rem;
}

.alert-success {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
}

.alert-danger,
.alert-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--spot-danger);
}

.alert-warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: var(--spot-warning);
}

.alert-info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

.badge,
.status-badge,
.action-badge,
.badge-info,
.badge-stable,
.badge-alpha {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge,
.status-badge,
.action-badge {
    background: #eef2f7;
    color: #334155;
}

.status-badge.status-success,
.badge-stable,
.status-indicator.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-warning,
.badge-alpha {
    background: #ffedd5;
    color: #9a3412;
}

.badge-beta {
    background: #ede9fe;
    color: #5b21b6;
}

.status-badge.status-error,
.text-danger,
.status-error {
    background: #fee2e2;
    color: #991b1b;
}

.status-indicator.inactive {
    background: #f3f4f6;
    color: #6b7280;
}

.status-indicator {
    border-radius: 999px;
    padding: 5px 10px;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.78rem;
}

.status-text {
    color: inherit;
}

.text-warning {
    color: var(--spot-warning);
}

.text-center {
    text-align: center;
}

/* Tables */
.table-container,
.table-responsive {
    overflow: auto;
}

.medical-data-table,
.table,
table.dataTable,
table.display {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

.medical-data-table thead th,
.table thead th,
table.dataTable thead th,
table.display thead th {
    background: var(--spot-surface-alt);
    color: var(--spot-muted);
    font-size: 0.77rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    padding: 11px 12px;
    border-bottom: 1px solid var(--spot-line);
}

.medical-data-table td,
.table td,
table.dataTable td,
table.display td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(217, 210, 198, 0.7);
    color: var(--spot-ink);
    vertical-align: top;
}

.medical-data-table tbody tr:hover,
.table tbody tr:hover,
table.dataTable tbody tr:hover,
table.display tbody tr:hover,
.clickable-row:hover {
    background: var(--spot-surface-hover);
}

.medical-data-table tbody tr:last-child td,
.table tbody tr:last-child td,
table.dataTable tbody tr:last-child td,
table.display tbody tr:last-child td {
    border-bottom: none;
}

.medical-data-table.compact th,
.medical-data-table.compact td,
.table-sm th,
.table-sm td {
    padding: 8px 10px;
}

/* DataTables internals */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin: 10px 2px;
    color: var(--spot-muted);
    font-size: 0.82rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    margin-left: 6px;
    width: auto;
    min-width: 90px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid var(--spot-line) !important;
    background: #fff !important;
    color: var(--spot-ink) !important;
    border-radius: 999px;
    margin-left: 5px;
    padding: 4px 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: var(--spot-accent) !important;
    background: #f0f9ff !important;
    color: var(--spot-ink) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--spot-accent) !important;
    border-color: var(--spot-accent) !important;
    color: #fff !important;
}

/* Filters and tabs */
.filter-form {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: var(--spot-radius-lg);
    border: 1px solid var(--spot-line);
    background: var(--spot-panel);
    box-shadow: var(--spot-shadow-sm);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 160px;
    min-width: 140px;
}

.quick-date-buttons,
.quick-date-btn {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nav-item {
    margin-right: 6px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--spot-line);
    color: var(--spot-muted);
    text-decoration: none;
    background: #fff;
    font-size: 0.82rem;
}

.nav-link.active,
.nav-link:hover {
    border-color: var(--spot-accent);
    color: var(--spot-ink);
}

.tab-content-wrapper,
.tab-content,
.tab-pane {
    margin-top: 10px;
}

/* Progress and charts */
.progress-bar {
    width: 100%;
    height: 10px;
    background: #e9e5dc;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--spot-accent), var(--spot-accent-2));
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 9999;
    padding: 30px 14px;
    overflow: auto;
}

.modal-content {
    max-width: 680px;
    margin: 0 auto;
    box-shadow: var(--spot-shadow-lg);
}

.modal-content.modal-lg {
    max-width: 820px;
}

.modal-content.modal-xl {
    max-width: 940px;
}

.modal-close,
.job-modal-close {
    line-height: 1;
}

.modal-body,
#job-details-body {
    font-size: 0.88rem;
    color: var(--spot-ink);
}

/* JSON/code */
.mono,
code,
.json-data,
.json-values,
.tokens-used,
pre {
    font-family: var(--spot-font-mono);
}

code,
.json-data,
.json-values,
pre {
    background: var(--spot-surface-alt);
    border: 1px solid var(--spot-line);
    border-radius: var(--spot-radius-sm);
    padding: 8px 10px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    color: var(--spot-ink);
    font-size: 0.81rem;
}

.json-data.notice-warning,
pre.notice-warning {
    background: #fffbea;
    border-left: 4px solid #f59e0b;
}

.json-data.notice-info,
pre.notice-info {
    background: #eff6ff;
    border-left: 4px solid #0369a1;
}

.json-data.notice-orange,
pre.notice-orange {
    background: #fff8f0;
    border-left: 4px solid #ea580c;
}

.json-data.notice-success,
pre.notice-success {
    background: #f0fff4;
    border-left: 4px solid #15803d;
}

.error-message {
    border-left: 4px solid var(--spot-danger);
    background: #fef2f2;
    color: var(--spot-danger);
}

/* Empty states */
.empty-state,
.no-data,
.no-downloads {
    text-align: center;
    font-style: italic;
    color: var(--spot-muted);
    padding: 28px 14px;
}

/* Help page */
.help-page .help-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 14px;
}

.help-page .help-nav,
.help-page .help-content {
    background: var(--spot-panel);
    border: 1px solid var(--spot-line);
    border-radius: var(--spot-radius-lg);
    box-shadow: var(--spot-shadow-sm);
}

.help-page .help-nav {
    padding: 14px;
}

.help-page .help-nav h3 {
    margin: 0 0 10px;
    font-family: var(--spot-font-display);
}

.help-page .help-menu,
.help-page .help-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.help-page .help-menu > li {
    margin-bottom: 8px;
}

.help-page .help-menu a {
    display: block;
    padding: 6px 8px;
    border-radius: var(--spot-radius-sm);
    text-decoration: none;
    color: var(--spot-ink);
}

.help-page .help-menu a:hover,
.help-page .help-menu a.active {
    background: color-mix(in srgb, var(--spot-accent) 12%, #fff);
    color: var(--spot-ink);
}

.help-page .help-nav .help-section > strong {
    display: block;
    margin: 8px 8px 4px;
    font-size: 0.76rem;
    color: var(--spot-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.help-page .help-content {
    padding: 18px;
}

.help-page .help-intro,
.help-page .help-callout,
.help-page .help-card,
.help-page .help-grid {
    margin-bottom: 14px;
}

.help-page .help-callout {
    border-left: 4px solid var(--spot-accent);
    padding: 10px 12px;
    background: #eff6ff;
    border-radius: var(--spot-radius-sm);
}

.help-page .help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.help-page .help-card {
    border: 1px solid var(--spot-line);
    border-radius: var(--spot-radius-md);
    padding: 12px;
    background: #fff;
}

/* Keep help article bullet content in normal text flow; legacy flex layout causes
   inline phrases/code spans to split into cramped columns. */
.help-page .help-content .help-list li {
    display: block;
    position: relative;
    padding: 10px 0 10px 26px;
    line-height: 1.55;
}

.help-page .help-content .help-list li::before {
    position: absolute;
    left: 0;
    top: 12px;
    margin: 0;
}

.help-page .help-content .help-list li strong {
    display: inline;
    margin-right: 6px;
}

/* Utility classes used for inline style cleanup */
.u-hidden { display: none !important; }
.u-inline { display: inline !important; }
.u-inline-block { display: inline-block !important; }
.u-inline-flex { display: inline-flex !important; }
.u-block { display: block !important; }
.u-flex { display: flex !important; }
.u-flex-wrap { flex-wrap: wrap !important; }
.u-items-center { align-items: center !important; }
.u-items-start { align-items: flex-start !important; }
.u-justify-between { justify-content: space-between !important; }
.u-gap-8 { gap: 8px !important; }
.u-gap-10 { gap: 10px !important; }
.u-gap-12 { gap: 12px !important; }
.u-gap-16 { gap: 16px !important; }
.u-m-0 { margin: 0 !important; }
.u-mt-0 { margin-top: 0 !important; }
.u-mt-8 { margin-top: 8px !important; }
.u-mt-10 { margin-top: 10px !important; }
.u-mt-12 { margin-top: 12px !important; }
.u-mt-14 { margin-top: 14px !important; }
.u-mt-16 { margin-top: 16px !important; }
.u-mt-20 { margin-top: 20px !important; }
.u-mt-24 { margin-top: 24px !important; }
.u-mt-40 { margin-top: 40px !important; }
.u-mb-0 { margin-bottom: 0 !important; }
.u-mb-4 { margin-bottom: 4px !important; }
.u-mb-8 { margin-bottom: 8px !important; }
.u-mb-10 { margin-bottom: 10px !important; }
.u-mb-12 { margin-bottom: 12px !important; }
.u-mb-15 { margin-bottom: 15px !important; }
.u-mb-16 { margin-bottom: 16px !important; }
.u-mb-20 { margin-bottom: 20px !important; }
.u-mb-18 { margin-bottom: 18px !important; }
.u-ml-8 { margin-left: 8px !important; }
.u-ml-10 { margin-left: 10px !important; }
.u-ml-12 { margin-left: 12px !important; }
.u-ml-16 { margin-left: 16px !important; }
.u-mr-8 { margin-right: 8px !important; }
.u-mr-10 { margin-right: 10px !important; }
.u-mr-15 { margin-right: 15px !important; }
.u-pt-0 { padding-top: 0 !important; }
.u-pt-6 { padding-top: 6px !important; }
.u-p-8 { padding: 8px !important; }
.u-p-15 { padding: 15px !important; }
.u-px-6-8 { padding: 6px 8px !important; }
.u-border-top-0 { border-top: none !important; }
.u-border-none { border: none !important; }
.u-w-100 { width: 100% !important; }
.u-w-auto { width: auto !important; }
.u-max-w-400 { max-width: 400px !important; }
.u-word-break { word-break: break-all !important; }
.u-nowrap { white-space: nowrap !important; }
.u-no-underline { text-decoration: none !important; }
.u-text-muted { color: var(--spot-muted) !important; }
.u-text-danger { color: var(--spot-danger) !important; }
.u-text-warning { color: var(--spot-warning) !important; }
.u-cursor-pointer { cursor: pointer !important; }
.u-opacity-70 { opacity: 0.7 !important; }
.u-max-w-600 { max-width: 600px !important; }
.u-max-w-800 { max-width: 800px !important; }
.u-max-w-900 { max-width: 900px !important; }
.u-max-h-80vh { max-height: 80vh !important; }
.u-overflow-y-auto { overflow-y: auto !important; }
.u-overflow-auto { overflow: auto !important; }
.u-pre-wrap { white-space: pre-wrap !important; }
.u-font-13 { font-size: 13px !important; }
.u-font-12 { font-size: 12px !important; }
.u-color-666 { color: #666 !important; }
.u-color-999 { color: #999 !important; }
.u-color-721c24 { color: #721c24 !important; }
.u-bg-f5 { background: #f5f5f5 !important; }
.u-bg-warn-soft { background: #fff3cd !important; }
.u-border-warn-soft { border: 1px solid #ffc107 !important; }
.u-radius-4 { border-radius: 4px !important; }
.u-radius-6 { border-radius: 6px !important; }
.u-p-10 { padding: 10px !important; }
.u-p-12-24 { padding: 12px 24px !important; }
.u-p-15 { padding: 15px !important; }
.u-p-20 { padding: 20px !important; }
.u-inline-flex-gap-8 { display: inline-flex !important; gap: 8px !important; flex-wrap: wrap !important; }
.u-inline-actions { display: inline-flex !important; align-items: center !important; gap: 8px !important; }
.u-display-none { display: none !important; }
.u-display-table-row { display: table-row !important; }
.u-nowrap { white-space: nowrap !important; }
.u-width-60 { width: 60px !important; }
.u-width-60pct { width: 60% !important; }
.u-height-14 { height: 14px !important; }
.u-bar-bg { background: #e8f0fe !important; }
.u-border-light { border: 1px solid var(--spot-line) !important; }

.section-actions.no-divider {
    margin-bottom: 16px;
}

.inline-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.inline-filter-form label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.inline-filter-form .filter-note {
    margin-left: 16px;
    color: #666;
    font-size: 0.9em;
}

.status-overview.section-spaced,
.data-section.section-spaced,
.info-section.section-spaced,
.table-section.section-spaced {
    margin-top: 24px;
}

.inline-title-row h3 {
    margin: 0;
}

.inline-title-row .right-action {
    margin-left: auto;
}

.inline-actions-stack {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.summary-link-btn {
    padding: 12px 24px;
    border-radius: 8px;
    background: var(--spot-accent);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
}

.summary-link-btn:hover {
    color: #fff;
}

.modal.is-hidden,
#audit-modal.is-hidden,
#job-details-modal.is-hidden {
    display: none;
}

.modal.is-visible,
#audit-modal.is-visible,
#job-details-modal.is-visible {
    display: block;
}

.audit-modal-content {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.job-details-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.job-details-content {
    max-width: 900px;
    margin: 60px auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    position: relative;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.job-details-body {
    flex: 1;
    overflow: auto;
    white-space: pre-wrap;
    font-size: 13px;
}

.job-modal-close {
    position: absolute;
    right: 12px;
    top: 8px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
}

.expiry-actions {
    white-space: nowrap;
}

.expiry-updated {
    animation: spot-highlight-fade 2s ease-out;
}

@keyframes spot-highlight-fade {
    from { background-color: #dcfce7; }
    to { background-color: transparent; }
}

.package-details {
    margin-top: 8px;
}

.manifest-toggle-link {
    font-size: 12px;
}

.manifest-json {
    display: none;
    max-height: 300px;
    overflow: auto;
    background: #f5f5f5;
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.manifest-json.is-visible {
    display: block;
}

.questionnaire-url-value {
    display: block;
    width: 100%;
    word-break: break-all;
}

.questionnaire-url-actions {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.questionnaire-inline-note {
    margin-top: 14px;
    color: #7a1f1f;
}

.theme-upload-panel {
    margin-top: 16px;
    border-top: 1px solid var(--spot-line);
    padding-top: 16px;
}

.theme-upload-panel h3,
.theme-upload-panel p {
    margin-top: 0;
}

.theme-upload-panel p {
    color: var(--spot-muted);
}

.theme-file-row {
    margin-bottom: 10px;
}

.theme-file-row label {
    margin-left: 12px;
}

.theme-counter {
    font-size: 12px;
    color: var(--spot-muted);
    text-align: right;
}

.theme-logo-preview-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.theme-logo-preview-title {
    font-size: 12px;
    color: var(--spot-muted);
    margin-bottom: 4px;
}

.theme-logo-canvas {
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--spot-line);
    border-radius: 6px;
    background: #fff;
}

.theme-current-logo {
    margin-top: 14px;
}

.inline-alert-action {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.logo-preview-img {
    display: none;
}

.audit-json-pre {
    margin-top: 8px;
}

.audit-rating-note {
    color: var(--spot-muted);
    font-style: italic;
}

.analysis-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.analysis-card {
    flex: 1;
    min-width: 300px;
}

.analysis-card h4 {
    color: var(--spot-ink);
    margin-bottom: 15px;
}

.analysis-title {
    color: var(--spot-accent);
    margin-bottom: 20px;
}

.hint-text {
    display: block;
    margin-top: 6px;
    color: var(--spot-muted);
}

.warning-note {
    margin-top: 0;
    color: var(--spot-warning);
}

.muted-note {
    margin-top: 0;
    color: var(--spot-muted);
}

.muted-note-tight {
    margin: 10px 0 0;
    color: var(--spot-muted);
}

.form-grid-role-assign {
    grid-template-columns: 2fr auto;
    align-items: end;
}

.permissions-bucket {
    margin-bottom: 18px;
    border: 1px solid var(--spot-line);
    border-radius: 8px;
    padding: 12px;
}

.permissions-bucket h4 {
    margin: 0 0 10px;
}

.permissions-grid-two {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 0;
}

.checkbox-inline-start {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
}

.role-permissions-page .permissions-bucket {
    padding: 14px;
}

.role-permissions-page .permissions-grid-two {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 10px;
}

.role-permissions-page .permission-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--spot-line);
    border-radius: 8px;
    background: #fff;
}

.role-permissions-page .permission-item input[type='checkbox'] {
    margin: 2px 0 0;
}

.role-permissions-page .permission-item-content {
    min-width: 0;
}

.role-permissions-page .permission-item-title {
    display: block;
    font-weight: 600;
    line-height: 1.3;
}

.role-permissions-page .permission-item-meta {
    display: block;
    margin-top: 2px;
    font-size: 0.82rem;
    color: var(--spot-muted);
    overflow-wrap: anywhere;
}

.telemetry-range-note {
    margin-left: 16px;
    color: #666;
    font-size: 0.9em;
}

.month-bar-cell {
    width: 60%;
}

.month-bar-fill {
    background: #e8f0fe;
    height: 14px;
}

.grid-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.questionnaire-url-inline-actions {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.api-key-once {
    padding: 6px 8px;
    background: #f4f7fb;
    border: 1px solid var(--spot-line);
    border-radius: 6px;
}

.api-key-once-wrap {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.audit-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.audit-summary-link {
    padding: 12px 24px;
    background: var(--primary-blue);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    display: inline-block;
    margin-top: 10px;
}

.audit-summary-link:hover {
    color: #fff;
}

.audit-row-error {
    color: #721c24;
}

.audit-feedback-warning {
    color: var(--warning-color);
}

.audit-feedback-success {
    color: var(--success-color);
}

.audit-feedback-danger {
    color: var(--danger-color);
}

.audit-feedback-muted {
    color: var(--text-light);
}

.audit-fine-tune-empty {
    color: var(--text-light);
}

.audit-detail-link-btn {
    display: inline-block;
    padding: 10px 16px;
    background: var(--primary-blue);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
}

.audit-detail-link-btn:hover {
    color: #fff;
}

.audit-table-row-clickable {
    cursor: pointer;
}

.audit-empty-cell {
    text-align: center;
    padding: 40px;
    color: #999;
}

.manifest-table {
    border-collapse: collapse;
    font-size: 12px;
    width: auto;
}

.manifest-table td {
    padding: 2px 0;
}

.manifest-table td:first-child {
    padding-right: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.max-w-600 {
    max-width: 600px;
}

.inline-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-preview {
    max-height: 400px;
    overflow-y: auto;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
}

.conversation-header {
    background: linear-gradient(135deg, #0d9488, #0369a1);
    color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.conversation-header p {
    margin: 5px 0;
    opacity: 0.9;
}

.conversation-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.meta-item {
    background: rgba(255, 255, 255, 0.12);
    padding: 12px;
    border-radius: 6px;
}

.conversation-id-row {
    margin-top: 20px;
}

.conversation-id-display {
    background: rgba(0, 0, 0, 0.12);
    padding: 8px 12px;
    border-radius: 4px;
    font-family: var(--spot-font-mono);
    font-size: 12px;
    word-break: break-all;
}

.messages-container {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--spot-line);
}

.messages-heading {
    margin-top: 0;
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
    padding-bottom: 10px;
}

.message-group {
    margin-bottom: 25px;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid var(--primary-blue);
}

.message-group.user {
    background: #e3f2fd;
    border-left-color: #1976d2;
}

.message-group.assistant {
    background: #f5f5f5;
    border-left-color: #666;
}

.message-group.system {
    background: #fff3e0;
    border-left-color: #f57c00;
}

.message-role {
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-group.assistant .message-role {
    color: #666;
}

.message-group.system .message-role {
    color: #f57c00;
}

.message-order {
    margin-left: 10px;
    font-weight: 400;
    color: #666;
}

.message-content {
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #333;
}

.message-meta {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 12px;
    color: #666;
}

.message-meta span {
    margin-right: 20px;
}

.tokens-badge {
    display: inline-block;
    background: var(--primary-blue);
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.api-calls-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--spot-line);
}

.api-calls-section h3 {
    margin: 0 0 15px;
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
    padding-bottom: 10px;
}

.api-call-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
    border-left: 3px solid var(--primary-blue);
}

.api-call-item p {
    margin: 5px 0;
    font-size: 13px;
}

.api-call-error {
    color: #721c24;
}

.back-button {
    display: inline-block;
    padding: 10px 16px;
    background: var(--text-light);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    margin-bottom: 20px;
}

.back-button:hover {
    background: #555;
    color: #fff;
}

.page-header.page-header-between {
    justify-content: space-between;
    align-items: center;
}

.copy-button {
    background: #666;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.copy-button:hover {
    background: #444;
}

.qr-print-page {
    font-family: var(--spot-font-sans);
    text-align: center;
    padding: 24px;
}

.qr-print-image {
    width: 360px;
    height: 360px;
    border: 1px solid var(--spot-line);
    padding: 12px;
    background: #fff;
}

.qr-print-url {
    display: block;
    margin-top: 16px;
    word-break: break-all;
    font-size: 12px;
}

.qr-print-action {
    margin-top: 12px;
}

@media print {
    .qr-print-page {
        padding: 0;
    }

    .qr-print-action {
        display: none !important;
    }
}

.page-description.subtle-note {
    margin-top: 0.5em;
}

/* Page-specific helpers used by cleanup pass */
.page-header.page-header-tight {
    margin-bottom: 12px;
}

.inline-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.audit-header-actions {
    margin-left: auto;
}

.audit-row {
    cursor: pointer;
}

.audit-feedback {
    color: var(--spot-muted);
}

.audit-feedback.helpful,
.audit-stored {
    color: #166534;
}

.audit-feedback.not-helpful,
.audit-error {
    color: #991b1b;
}

.audit-feedback.comment {
    color: #9a3412;
}

.audit-code-inline {
    background: var(--spot-surface-alt);
    border: 1px solid var(--spot-line);
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 12px;
}

.audit-finish-reason {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.audit-finish-reason.stop {
    background: #dcfce7;
    color: #166534;
}

.audit-finish-reason.other {
    background: #ffedd5;
    color: #9a3412;
}

.audit-feedback-toggle {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--spot-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.audit-feedback-toggle.helpful {
    background: #dcfce7;
    color: #166534;
}

.audit-feedback-toggle.not-helpful {
    background: #fee2e2;
    color: #991b1b;
}

.audit-history-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.qr-thumb {
    width: 120px;
    height: 120px;
    border: 1px solid var(--spot-line);
    background: #fff;
    border-radius: var(--spot-radius-sm);
    padding: 6px;
    cursor: pointer;
}

.logo-preview-desktop {
    width: 320px;
    height: 96px;
}

.logo-preview-mobile {
    width: 200px;
    height: 60px;
}

.logo-preview-img,
.logo-preview-desktop,
.logo-preview-mobile {
    border: 1px solid var(--spot-line);
    border-radius: var(--spot-radius-sm);
    object-fit: contain;
    background: #fff;
}

.manifest-summary {
    background: #f8fafc;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    margin: 4px 0;
    border: 1px solid var(--spot-line);
}

.manifest-summary table {
    border-collapse: collapse;
    font-size: 12px;
    width: auto;
}

.manifest-summary td {
    padding: 2px 10px 2px 0;
    border: none;
}

.manifest-summary td:first-child {
    font-weight: 700;
    white-space: nowrap;
}

.manifest-json {
    max-height: 300px;
}

#custom_dates {
    display: flex;
    gap: 10px;
    align-items: center;
}

#custom_dates.is-hidden {
    display: none;
}

.floating-page-help {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: 1px solid rgba(2, 132, 199, 0.4);
    background: var(--spot-accent);
    color: #fff;
    text-decoration: none;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(2, 132, 199, 0.32);
    z-index: 1200;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.floating-page-help:hover,
.floating-page-help:focus-visible {
    color: #fff;
    background: #0369a1;
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(3, 105, 161, 0.35);
}

.floating-page-help.is-hidden {
    display: none;
}

@media (max-width: 920px) {
    .floating-page-help {
        right: 14px;
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

@media (max-width: 920px) {
    .info-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .help-page .help-layout {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 18px 10px;
    }

    .modal-content,
    .modal-content.modal-lg,
    .modal-content.modal-xl {
        max-width: 100%;
    }
}

@media print {
    body {
        background: #fff !important;
    }

    .app-topbar,
    .mode-switch,
    .spotlight-secondary,
    .page-help-link,
    .floating-page-help,
    .section-actions,
    .form-actions,
    .btn,
    .submit-button,
    .cancel-button,
    .edit-ai-btn,
    .download-action-btn,
    .practice-action-btn {
        display: none !important;
    }

    .form-section,
    .data-section,
    .info-section,
    .table-section,
    .card,
    .table-container,
    .table-responsive {
        box-shadow: none !important;
        border-color: #ddd !important;
        background: #fff !important;
    }
}
