:root {
    --bg-dark: #0f0f1a;
    --bg-card: #1a1f35;
    --bg-elevated: #222845;
    --accent: #eb1700;
    --accent-hover: #c41400;
    --accent-soft: rgba(235, 23, 0, 0.12);
    --text-primary: #ffffff;
    --text-secondary: #a8b0c8;
    --text-muted: #6b7289;
    --border: #2e3654;
    --success: #00c853;
    --error: #ff5252;
    --warning: #ffc107;
    --radius: 12px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

body.app-body {
    background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(235, 23, 0, 0.08), transparent 50%),
                var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

/* App shell */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.app-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-brand-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.app-nav {
    display: flex;
    gap: 0.25rem;
}

.app-nav-link {
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}

.app-nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.app-nav-link.active {
    color: var(--text-primary);
    background: var(--accent-soft);
}

.app-main {
    min-height: calc(100vh - 120px);
}

.app-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
    cursor: pointer;
    max-width: 320px;
}

.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { border-color: rgba(0, 200, 83, 0.4); color: #69f0ae; }
.toast-error { border-color: rgba(255, 82, 82, 0.4); color: #ff8a80; }
.toast-info { border-color: rgba(100, 181, 246, 0.4); color: #90caf9; }

/* Button loading */
.btn-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 0.5em;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -0.15em;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Callouts */
.callout {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.callout-info {
    background: rgba(100, 181, 246, 0.08);
    border: 1px solid rgba(100, 181, 246, 0.25);
    color: var(--text-secondary);
}

.callout-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    opacity: 0.9;
}

.verification-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 120px);
    padding: 1.5rem 1rem 3rem;
}

.verification-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow);
    transition: max-width 0.25s ease;
}

@media (min-width: 640px) {
    .verification-card { padding: 2rem 2.25rem; }
}

.verification-card-wide {
    max-width: 560px;
}

.verification-card-xl {
    max-width: 720px;
}

.page-hero {
    text-align: center;
    margin-bottom: 1.5rem;
}

.page-hero-compact {
    margin-bottom: 1.25rem;
}

.verification-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    letter-spacing: -0.02em;
}

.verification-subtitle {
    color: var(--text-secondary);
    margin: 0 0 1.25rem;
    line-height: 1.55;
    font-size: 0.9rem;
}

.tab-panel .verification-subtitle {
    text-align: left;
    margin-bottom: 1rem;
}

.verification-form .form-group {
    margin-bottom: 1rem;
}

.verification-form label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.verification-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.verification-form input:focus,
.verification-form select:focus,
.verification-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.verification-form select,
.verification-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

.verification-form textarea {
    resize: vertical;
    min-height: 80px;
}

.verification-form code {
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-all;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem;
    background: var(--bg-dark);
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    flex: 1 0 auto;
    min-width: 0;
    padding: 0.625rem 0.875rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

.tab:hover { color: var(--text-primary); }

.tab.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tab-panel { display: none; animation: fadeIn 0.2s ease; }
.tab-panel.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

.admin-link a { color: var(--text-secondary); }
.admin-link a:hover { color: var(--accent); }

/* Templates admin */
.section-title { font-size: 1.25rem; margin: 0; }
.section-subtitle { font-size: 1rem; color: var(--text-secondary); margin: 1rem 0 0.5rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

.templates-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.templates-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.templates-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
}

.templates-page-subtitle {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.templates-back-link {
    text-decoration: none;
    white-space: nowrap;
}

.templates-list-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.template-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.template-modal[hidden] {
    display: none;
}

.template-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
}

.template-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: calc(100vh - 2.5rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.template-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.template-modal-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.template-modal-actions {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding-top: 0.75rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
}

body.template-modal-open {
    overflow: hidden;
}

.templates-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.templates-search-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.templates-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.templates-search {
    width: 100%;
    padding: 0.65rem 0.75rem 0.65rem 2.25rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.templates-search:focus {
    outline: none;
    border-color: var(--accent);
}

.templates-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
}

.templates-loading,
.templates-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
    text-align: center;
}

.templates-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.templates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.templates-table thead {
    background: var(--bg-dark);
}

.templates-table th {
    text-align: left;
    padding: 0.65rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.templates-table td {
    padding: 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.templates-table tbody tr:last-child td {
    border-bottom: none;
}

.templates-row {
    cursor: pointer;
    transition: background 0.15s;
}

.templates-row:hover {
    background: rgba(235, 23, 0, 0.04);
}

.templates-row.selected {
    background: rgba(235, 23, 0, 0.08);
    box-shadow: inset 3px 0 0 var(--accent);
}

.templates-row-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.templates-row-updated {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.templates-code {
    font-size: 0.78rem;
    word-break: break-all;
}

.template-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    text-transform: lowercase;
}

.badge-production {
    background: rgba(0, 200, 83, 0.15);
    color: #69f0ae;
}

.badge-sandbox {
    background: rgba(255, 193, 7, 0.15);
    color: #ffd54f;
}

.badge-pending {
    background: rgba(33, 150, 243, 0.15);
    color: #64b5f6;
}

.badge-completed {
    background: rgba(0, 200, 83, 0.2);
    color: #b9f6ca;
}

.sessions-toolbar {
    margin-bottom: 1rem;
}

.sessions-ref {
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
    max-width: 220px;
}

/* Session cards */
.session-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.session-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    transition: border-color 0.15s;
}

.session-card:hover {
    border-color: rgba(235, 23, 0, 0.35);
}

.session-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.session-card-ref {
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
    word-break: break-all;
    color: var(--text-primary);
    flex: 1;
}

.session-card-copy {
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
}

.session-card-copy:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.session-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.session-card-meta code {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.session-card-actions {
    display: flex;
    gap: 0.5rem;
}

.session-card-actions .btn-primary {
    margin-top: 0;
    flex: 1;
}

.session-card-waiting {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

.sessions-toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    margin-bottom: 1rem;
}

.sessions-toolbar .templates-search-wrap {
    flex: 1;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    padding: 0;
    flex-shrink: 0;
    margin-top: 0;
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.templates-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.templates-empty p {
    margin: 0 0 0.5rem;
    max-width: 36ch;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.page-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}

.page-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.page-links a:hover {
    color: var(--accent);
}

.no-session-panel {
    text-align: center;
}

.no-session-panel .verification-title {
    margin-bottom: 0.75rem;
}

.no-session-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.no-session-actions .btn-secondary {
    width: 100%;
    text-align: center;
    text-decoration: none;
    display: block;
}

.templates-field-count {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.templates-field-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.field-tag {
    font-size: 0.7rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
}

.field-tag-more {
    color: var(--text-secondary);
    font-family: inherit;
}

.templates-th-actions,
.templates-td-actions {
    text-align: right;
    white-space: nowrap;
}

.templates-td-actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

.templates-form {
    overflow-y: auto;
    padding: 1rem 1.25rem 1.25rem;
    flex: 1;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-icon:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

@media (max-width: 900px) {
    .templates-th-actions,
    .templates-td-actions {
        position: sticky;
        right: 0;
        background: inherit;
    }

    .template-modal {
        padding: 0;
        align-items: flex-end;
    }

    .template-modal-dialog {
        width: 100%;
        max-height: 92vh;
        border-radius: 14px 14px 0 0;
    }
}

@media (max-width: 640px) {
    .field-row {
        grid-template-columns: 1fr 1fr;
    }

    .field-row input[data-prop="key"],
    .field-row input[data-prop="label"] {
        grid-column: 1 / -1;
    }
}

.field-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 0.8fr 0.8fr auto auto auto;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.field-row input,
.field-row select {
    padding: 0.5rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.order-input { width: 50px !important; }

.checkbox-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.btn-sm { padding: 0.375rem 0.75rem !important; font-size: 0.8rem !important; width: auto !important; }

.btn-danger {
    padding: 0.375rem 0.75rem;
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-danger:hover { background: rgba(255, 82, 82, 0.1); }

.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.empty-state { color: var(--text-secondary); text-align: center; padding: 1rem; }

@media (max-width: 600px) {
    .field-row { grid-template-columns: 1fr 1fr; }
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-advanced {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
}

.form-advanced summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    user-select: none;
}

.form-advanced summary:hover {
    color: var(--text-primary);
}

.form-advanced[open] summary {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

@media (max-width: 480px) {
    .form-row { grid-template-columns: 1fr; }
    .app-nav-link { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
}

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
}

.error-message {
    background: rgba(255, 82, 82, 0.15);
    color: var(--error);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Dynamic flow */
.dynamic-flow {
    max-width: 520px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

.dynamic-flow-wide {
    max-width: 760px;
}

.selfie-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
    text-align: left;
}

.selfie-slot-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.selfie-slot .drop-zone-round {
    max-width: none;
    margin: 0;
    aspect-ratio: 1;
}

.selfie-slot .file-name {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 0.35rem;
    word-break: break-all;
}

@media (max-width: 640px) {
    .selfie-grid {
        grid-template-columns: 1fr;
    }
}

.dynamic-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.dynamic-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dynamic-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.dynamic-progress {
    margin-bottom: 1.5rem;
}

.progress-track {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 0;
}

.progress-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    display: block;
}

.dynamic-panel {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dynamic-card {
    width: 100%;
    text-align: center;
}

.dynamic-desc {
    color: var(--text-secondary);
    margin: 1rem 0 1.5rem;
    line-height: 1.5;
}

.dynamic-card .drop-zone {
    aspect-ratio: 4/3;
    border: 2px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    background: var(--bg-card);
    margin-bottom: 1rem;
    transition: border-color 0.2s, background 0.2s;
}

.dynamic-card .drop-zone-round {
    aspect-ratio: 1;
    border-radius: 50%;
    max-width: 220px;
    margin: 0 auto 1rem;
}

.dynamic-card .drop-zone:hover,
.dynamic-card .drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(235, 23, 0, 0.05);
}

.dynamic-card .btn-primary {
    max-width: 280px;
    margin: 0 auto;
}

.dynamic-card .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ocr-section {
    text-align: left;
    margin: 1rem 0;
}

.ocr-section label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.ocr-section textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: monospace;
    resize: vertical;
    min-height: 100px;
}

.ocr-hint, .barcode-status {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
}

#error-message,
#flowError {
    max-width: 100%;
    margin-top: 1rem;
}

/* Upload page */
.upload-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

.upload-header {
    text-align: center;
    margin-bottom: 2rem;
}

.upload-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.upload-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2.5rem;
    padding: 0 1rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.progress-step.active,
.progress-step.done {
    opacity: 1;
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.progress-step.active .step-num {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.progress-step.done .step-num {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-line {
    width: 60px;
    height: 2px;
    background: var(--border);
    margin: 0 0.5rem;
    margin-bottom: 1.5rem;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.upload-card.filled {
    border-color: var(--success);
    box-shadow: 0 0 0 1px rgba(0, 200, 83, 0.2);
}

.upload-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.75rem 0 0.25rem;
}

.upload-card > p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
    min-height: 2.2em;
}

.upload-card-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    color: var(--accent);
}

.upload-card-icon svg {
    width: 100%;
    height: 100%;
}

.upload-card-icon-round {
    border-radius: 50%;
    background: rgba(235, 23, 0, 0.12);
    padding: 10px;
}

.drop-zone {
    position: relative;
    aspect-ratio: 4/3;
    border: 2px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    background: var(--bg-dark);
}

.drop-zone-round {
    aspect-ratio: 1;
    border-radius: 50%;
    max-width: 180px;
    margin: 0 auto;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(235, 23, 0, 0.05);
}

.drop-zone.has-file {
    border-style: solid;
    border-color: var(--success);
}

.drop-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-secondary);
}

.drop-placeholder svg {
    width: 32px;
    height: 32px;
    opacity: 0.6;
}

.drop-placeholder span {
    font-size: 0.8rem;
}

.drop-placeholder small {
    font-size: 0.7rem;
    opacity: 0.7;
}

.drop-zone .preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.drop-zone-round .preview {
    border-radius: 50%;
}

.btn-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: var(--error);
}

.file-name {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-error {
    max-width: 480px;
    margin: 0 auto 1rem;
}

.btn-submit {
    display: block;
    max-width: 320px;
    margin: 0 auto 1.5rem;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.overlay-content {
    text-align: center;
    color: var(--text-primary);
}

.overlay-content p {
    margin-top: 1rem;
    color: var(--text-secondary);
}

.result-panel {
    max-width: 480px;
    margin: 4rem auto;
    text-align: center;
    padding: 2rem;
}

.result-panel h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.result-panel p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.inquiry-id {
    font-size: 0.8rem;
    font-family: monospace;
    margin-bottom: 1.5rem !important;
}

.result-panel .btn-primary {
    display: inline-block;
    max-width: 280px;
    text-decoration: none;
}

@media (max-width: 768px) {
    .upload-grid {
        grid-template-columns: 1fr;
        max-width: 360px;
        margin-left: auto;
        margin-right: auto;
    }

    .progress-line {
        width: 32px;
    }
}

/* Verification flow (legacy) */
.verification-flow {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.step-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
}

.step-image {
    width: 200px;
    height: 200px;
    object-fit: contain;
    margin-bottom: 1.5rem;
}

.step-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.step-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 400px;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    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); }
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

/* Camera */
.camera-panel {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    margin-bottom: 1rem;
}

#cameraVideo {
    width: 100%;
    display: block;
    max-height: 400px;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.camera-frame {
    width: 85%;
    height: 55%;
    border: 2px dashed rgba(255, 255, 255, 0.6);
    border-radius: 12px;
}

.camera-frame.selfie {
    width: 60%;
    height: 60%;
    border-radius: 50%;
}

.camera-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-card);
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.5s ease infinite;
}

.status-dot.complete {
    background: var(--success);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.navbar, .footer {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
}

.navbar-brand, .nav-link, .footer {
    color: var(--text-primary) !important;
}

.container {
    max-width: 100%;
}
