/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #FFFFFF;
    --surface: #F5F5F5;
    --surface-hover: #EBEBEB;
    --border: #E0E0E0;
    --text: #1A1A1E;
    --text-muted: #757575;
    --text-dim: #9E9E9E;
    --primary: #E63946;
    --primary-light: #EF6B77;
    --primary-dark: #C4202E;
    --accent: #E63946;
    --accent-hover: #EF6B77;
    --cta: #00E676;
    --cta-hover: #00C853;
    --cta-glow: rgba(230, 57, 70, 0.2);
    --cta-glow-strong: rgba(230, 57, 70, 0.3);
    --glow: rgba(230, 57, 70, 0.08);
    --glow-strong: rgba(230, 57, 70, 0.15);
    --success: #00E676;
    --warning: #FFAB00;
    --danger: #FF5252;
    --info: #448AFF;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-elevation: 0 4px 24px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, nav .logo {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

/* Nav */
nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 56px;
}

nav .logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    text-decoration: none;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s;
}

nav a:hover, nav a.active { color: var(--primary); }

/* Main */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--text);
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* Cards grid (index page) */
.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.demo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, transform 0.15s;
}

.demo-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevation);
}

.demo-card h3 { color: var(--accent); }

.demo-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.demo-card .tag {
    display: inline-block;
    background: rgba(230, 57, 70, 0.08);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ─── Kanban ─── */
.kanban {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.column {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    min-height: 300px;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.column-header h3 { margin: 0; }

.column-header .count {
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
}

.column[data-column="todo"] .column-header { border-bottom-color: var(--primary); }
.column[data-column="in-progress"] .column-header { border-bottom-color: var(--warning); }
.column[data-column="done"] .column-header { border-bottom-color: var(--success); }

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    touch-action: none;
}

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

.card.dragging {
    opacity: 0.5;
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--glow-strong);
}

.card .card-title { font-weight: 600; font-size: 0.9rem; }
.card .card-desc { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.25rem; }

.column.drag-over {
    background: var(--glow);
    border-color: var(--accent);
}

.drop-zone {
    min-height: 60px;
    border: 2px dashed transparent;
    border-radius: 6px;
    transition: border-color 0.15s;
}

.column.drag-over .drop-zone { border-color: var(--accent); }

/* Status log */
.status-log {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1.5rem;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.8rem;
}

.status-log .entry {
    padding: 0.25rem 0;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.status-log .entry:last-child { border-bottom: none; }
.status-log .entry .time { color: var(--accent); margin-right: 0.5rem; }

/* ─── Non-deterministic challenges ─── */
.challenges {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 1.5rem;
}

.challenge {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

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

.challenge-header .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: var(--border);
    color: var(--text-muted);
}

.challenge-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Delayed content panels */
.panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel.loaded {
    border-color: var(--success);
}

/* Greek sort list */
.random-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.random-list li {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    cursor: grab;
    user-select: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.random-list li:hover {
    border-color: var(--primary);
}

.random-list li.dragging {
    opacity: 0.4;
    border-color: var(--primary);
}

.random-list li.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.15);
}

.greek-symbol {
    display: inline-block;
    width: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.sort-controls button {
    background: var(--cta);
    color: #FFFFFF;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 24px var(--cta-glow);
}

.sort-controls button:hover {
    background: var(--cta-hover);
    box-shadow: 0 0 40px var(--cta-glow-strong);
}

.error-inline {
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Moving button */
.moving-button-area {
    position: relative;
    height: 200px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.moving-button-area button {
    position: absolute;
    background: var(--cta);
    color: #FFFFFF;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: left 0.3s, top 0.3s;
    box-shadow: 0 0 24px var(--cta-glow);
}

.moving-button-area button:hover { background: var(--cta-hover); }

/* Toast */
.toast-area {
    position: relative;
    min-height: 100px;
}

.toast {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning);
    color: #1A1A1E;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.toast button {
    background: rgba(0, 0, 0, 0.15);
    border: none;
    color: #1A1A1E;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.toast-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

.toast-form label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.toast-form input, .toast-form select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
}

.toast-form button[type="submit"] {
    background: var(--cta);
    color: #FFFFFF;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    align-self: flex-start;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 24px var(--cta-glow);
}

.toast-form button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dynamic form */
.dynamic-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

.dynamic-form label {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dynamic-form input[type="text"],
.dynamic-form input[type="email"],
.dynamic-form input[type="tel"] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
    width: 100%;
}

.dynamic-form .field-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dynamic-form .field-group.hidden { display: none; }

.dynamic-form .required-marker { color: var(--danger); font-weight: 700; }

.dynamic-form button[type="submit"] {
    background: var(--cta);
    color: #FFFFFF;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    align-self: flex-start;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 24px var(--cta-glow);
}

.dynamic-form .validation-msg {
    color: var(--danger);
    font-size: 0.8rem;
}

/* Data table */
.data-table-area {
    min-height: 120px;
}

.spinner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    padding: 1rem;
}

.spinner::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Success state */
.success-msg {
    color: #00C853;
    font-weight: 600;
    padding: 0.75rem;
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid var(--success);
    border-radius: 6px;
    text-align: center;
}

/* ─── Nav user ─── */
.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-username {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.nav-logout button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: color 0.15s, border-color 0.15s;
}

.nav-logout button:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

/* ─── Login ─── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 56px - 100px);
}

.login-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-elevation);
}

.login-card h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.login-card .subtitle {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-error {
    background: rgba(255, 82, 82, 0.08);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form .field-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.login-form label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.login-form input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

.login-form button[type="submit"] {
    background: var(--cta);
    color: #FFFFFF;
    border: none;
    padding: 0.65rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 0.5rem;
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
    box-shadow: 0 0 24px var(--cta-glow);
}

.login-form button[type="submit"]:hover {
    background: var(--cta-hover);
    box-shadow: 0 0 40px var(--cta-glow-strong);
    transform: translateY(-1px);
}

.login-link {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.login-link a:hover {
    color: var(--accent-hover);
}

/* ─── Section headings on dashboard ─── */
.section-heading-buggy {
    margin-top: 2.5rem;
}

/* ─── Nav buggy link ─── */
.nav-buggy {
    color: var(--warning) !important;
    font-weight: 600;
}

/* ─── Buggy banner ─── */
.buggy-banner {
    background: rgba(255, 171, 0, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ─── Buggy card styling ─── */
.buggy-card {
    border-color: rgba(255, 171, 0, 0.3);
}

.buggy-card:hover {
    border-color: var(--warning);
}

.buggy-card h3 {
    color: var(--warning) !important;
}

.tag-bug {
    background: rgba(255, 171, 0, 0.12) !important;
    color: var(--warning) !important;
}

/* ─── Wizard ─── */
.wizard {
    max-width: 640px;
}

.wizard-progress {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.wizard-progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.wizard-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.wizard-step {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    background: var(--surface);
    transition: color 0.15s, background 0.15s;
}

.wizard-step.active {
    color: var(--primary);
    background: rgba(230, 57, 70, 0.08);
}

.wizard-panel {
    display: none;
}

.wizard-panel.active {
    display: block;
}

.wizard-panel h2 {
    margin-bottom: 1.25rem;
}

.wizard-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wizard-form .field-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.wizard-form label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.wizard-form input[type="text"],
.wizard-form input[type="email"],
.wizard-form input[type="tel"],
.wizard-form select,
.wizard-form textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.wizard-form input:focus,
.wizard-form select:focus,
.wizard-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

.radio-group, .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.radio-label, .checkbox-label {
    font-size: 0.9rem !important;
    font-weight: 400 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: var(--text) !important;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.wizard-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.wizard-btn-next {
    background: var(--cta);
    color: #FFFFFF;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 24px var(--cta-glow);
}

.wizard-btn-next:hover {
    background: var(--cta-hover);
    box-shadow: 0 0 40px var(--cta-glow-strong);
}

.wizard-btn-back {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.15s, border-color 0.15s;
}

.wizard-btn-back:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.wizard-validation {
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
    min-height: 1.2rem;
}

.wizard-review {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.review-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.review-section h3 {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.review-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

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

.review-label {
    color: var(--text-muted);
    font-weight: 500;
}

.review-value {
    color: var(--text);
    font-weight: 600;
    text-align: right;
}

.wizard-success {
    margin-top: 1rem;
}

/* ─── File Upload ─── */
.upload-container {
    max-width: 640px;
}

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-dropzone:hover,
.upload-dropzone.drag-active {
    border-color: var(--primary);
    background: var(--glow);
}

.dropzone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.dropzone-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.dropzone-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.upload-input-hidden {
    display: none;
}

.upload-browse-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

.upload-browse-btn:hover {
    border-color: var(--primary);
}

.upload-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.upload-file-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.upload-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upload-preview-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.upload-file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.upload-file-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.upload-file-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-check {
    color: var(--success);
    font-size: 1.2rem;
    font-weight: 700;
}

.upload-fail {
    color: var(--danger);
    font-size: 1.2rem;
    font-weight: 700;
}

.upload-progress {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.15s;
    border-radius: 2px;
}

.upload-submit-btn {
    background: var(--cta);
    color: #FFFFFF;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 1.5rem;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 24px var(--cta-glow);
}

.upload-submit-btn:hover {
    background: var(--cta-hover);
    box-shadow: 0 0 40px var(--cta-glow-strong);
}

.upload-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upload-error {
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.upload-error-hidden {
    display: none;
}

.upload-retry-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* ─── Data Table (full page) ─── */
.dt-container {
    width: 100%;
}

.dt-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.dt-search {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
    width: 300px;
    transition: border-color 0.15s;
}

.dt-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

.dt-selected-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dt-full {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.dt-full th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.dt-full td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.dt-th-check {
    width: 40px;
}

.dt-sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.dt-sortable:hover {
    color: var(--primary);
}

.dt-sort-arrow {
    font-size: 0.75rem;
}

.dt-row-selected {
    background: rgba(230, 57, 70, 0.04);
}

.dt-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.75rem 0;
}

.dt-pagination button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: border-color 0.15s;
}

.dt-pagination button:hover:not(:disabled) {
    border-color: var(--primary);
}

.dt-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#dt-page-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dt-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ─── Iframe ─── */
.iframe-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.iframe-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.iframe-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.iframe-label-ok { color: var(--success); }
.iframe-label-blocked { color: var(--danger); }

.iframe-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.iframe-desc code {
    background: var(--border);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
}

.iframe-wrapper {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.iframe-box {
    width: 100%;
    height: 300px;
    border: none;
    display: block;
}

.iframe-status {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.iframe-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.iframe-badge-ok {
    background: rgba(0, 230, 118, 0.12);
    color: var(--success);
}

.iframe-badge-blocked {
    background: rgba(255, 82, 82, 0.1);
    color: var(--danger);
}

/* ─── Iframe content page (served inside iframe) ─── */
.iframe-content-page {
    max-width: 400px;
    padding: 1rem;
}

.iframe-content-page h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.iframe-content-page p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.iframe-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.iframe-form .field-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.iframe-form label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.iframe-form input,
.iframe-form textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}

.iframe-form input:focus,
.iframe-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.iframe-form button[type="submit"] {
    background: var(--cta);
    color: #FFFFFF;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    align-self: flex-start;
}

/* ─── Workspace ─── */
.ws-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem 1.5rem; padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1.25rem; }
.ws-subnav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.ws-subnav a { color: var(--text); text-decoration: none; font-weight: 500; padding: 0.25rem 0.1rem; border-bottom: 2px solid transparent; }
.ws-subnav a:hover { border-bottom-color: var(--primary); }
.ws-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
.ws-inline-form { display: inline-flex; align-items: center; gap: 0.5rem; }
.ws-inline-form label, .ws-filters label { color: var(--text-muted); font-size: 0.85rem; }
.ws-search { position: relative; }
.ws-search input { width: 240px; }
.ws-search-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin: 0.25rem 0 0; padding: 0; list-style: none; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); max-height: 320px; overflow: auto; }
.ws-search-results li a { display: block; padding: 0.5rem 0.75rem; color: var(--text); text-decoration: none; font-size: 0.9rem; }
.ws-search-results li a:hover { background: var(--surface-hover); }
.ws-search-results li a::before { content: attr(data-kind); display: inline-block; min-width: 4.5rem; color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.ws-flash { margin: 0 0 1rem; }
.ws-flash-err { padding: 0.75rem; background: rgba(230, 57, 70, 0.08); border: 1px solid var(--danger); border-radius: 6px; }
.ws-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
.ws-tile { display: grid; gap: 0.2rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text-muted); font-size: 0.85rem; }
.ws-tile:hover { border-color: var(--primary); }
.ws-tile-num { font-family: 'JetBrains Mono', monospace; font-size: 1.8rem; font-weight: 700; color: var(--text); }
.ws-rules { color: var(--text-muted); line-height: 1.6; max-width: 70ch; }
.ws-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.ws-filters input, .ws-filters select, .ws-form input, .ws-form select, .ws-form textarea, .ws-inline-form select, .ws-search input { font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
.ws-filters button, .ws-actions button, .ws-form button, .ws-btn-primary, .ws-btn-secondary { font: inherit; font-weight: 600; padding: 0.45rem 0.9rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
.ws-btn-primary { background: var(--cta); border-color: var(--cta); color: #fff; }
.ws-btn-secondary { background: var(--bg); }
.ws-btn-danger { color: var(--danger); border-color: var(--danger); }
.ws-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1.25rem; }
.ws-actions form { margin: 0; }
.ws-two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.ws-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0 0 1.25rem; }
.ws-facts dt { color: var(--text-muted); }
.ws-facts dd { margin: 0; }
.ws-status { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-hover); color: var(--text-muted); }
.ws-status-verified, .ws-status-sent { background: rgba(33, 150, 243, 0.12); color: #1565C0; }
.ws-status-approved, .ws-status-paid, .ws-status-signed { background: rgba(0, 230, 118, 0.15); color: #00875A; }
.ws-status-rejected { background: rgba(230, 57, 70, 0.12); color: var(--danger); }
.ws-num { font-family: 'JetBrains Mono', monospace; text-align: right; }
.ws-trail { padding-left: 1.2rem; line-height: 1.7; }
.ws-trail-when { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--text-muted); }
.ws-trail-actor { color: var(--text-muted); }
.ws-trail-detail { color: var(--text-muted); }
.ws-form { display: grid; gap: 0.35rem; max-width: 560px; margin-bottom: 1.25rem; }
.ws-form label { margin-top: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }
.ws-split { display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: 0.5rem; align-items: center; }
.ws-signature-pad { border: 1px dashed var(--border); border-radius: 6px; background: #fff; touch-action: none; display: block; margin-bottom: 0.75rem; }
.ws-signature-img { border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.ws-preview { max-width: 70ch; }
.ws-preview-body { white-space: pre-wrap; padding: 1rem; background: var(--surface); border-radius: var(--radius); }
.ws-row-deleted td { opacity: 0.55; }
.ws-muted { color: var(--text-dim); }
.ws-disabled { color: var(--text-dim); }
.ws-mail { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem; background: var(--surface); }
.ws-code { font-family: 'JetBrains Mono', monospace; font-size: 1.3rem; letter-spacing: 0.2em; }
