:root {
    --primary: #75b7a1;
    --dark: #111323;
    --light: #f4f2ee;
    --success: #00ff88;
    --error: #ff6b6b;
    --warning: #ffa726;
    --navy: #111323; /* Added for clarity */
    --mint: #75b7a1; /* Added for clarity */
    --white: #ffffff; /* Added for clarity */
    --blue: #7aa2ff; /* Added for clarity */
    --bg: #0c1330; /* Added for clarity */
    --text: #e9eefb; /* Added for clarity */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--dark);
    color: var(--light);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(117, 183, 161, 0.3);
    margin-bottom: 20px;
}

.nav-brand {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary);
}

.nav-controls label {
    font-size: 0.9rem;
    cursor: pointer;
}

.nav-controls input[type="checkbox"] {
    margin-right: 8px;
}

.card {
    background: rgba(17, 19, 35, 0.8);
    border: 1px solid rgba(117, 183, 161, 0.3);
    border-radius: 12px;
    padding: 25px 25px 20px 25px;
    margin-bottom: 20px;
}

.judge-panel {
    background: rgba(117, 183, 161, 0.1);
    border-color: var(--primary);
    display: none;
}

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

.criteria-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.run-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.run-btn:hover {
    background: #5a9d87;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid;
}

.badge.todo {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
}

.badge.pass {
    background: rgba(0, 255, 136, 0.2);
    color: var(--success);
    border-color: rgba(0, 255, 136, 0.3);
}

.section-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    background: rgba(117, 183, 161, 0.1);
    border: 1px solid rgba(117, 183, 161, 0.3);
    color: var(--light);
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    white-space: nowrap;
}

.tab:hover, .tab.active {
    background: var(--primary);
    color: white;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.form-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.form-group input, .form-group select {
    flex: 1;
    min-width: 150px;
    padding: 10px;
    border: 1px solid rgba(117, 183, 161, 0.3);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--light);
}

/* Session Summary */
.session-summary {
    background: rgba(17, 19, 35, 0.5);
    border: 1px solid rgba(74, 158, 255, 0.3);
}

.session-summary h3 {
    margin: 0;
    font-size: 1rem;
}

.summary-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(244, 242, 238, 0.1);
    font-size: 0.875rem;
    align-items: center;
}

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

.summary-label {
    color: rgba(244, 242, 238, 0.6);
    font-weight: 500;
}

.session-summary .summary-value {
    color: rgba(244, 242, 238, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-value.monospace {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Courier New', monospace;
    font-size: 0.8rem;
}

.summary-value[data-full]:hover::after {
    content: attr(data-full);
    position: absolute;
    left: 0;
    top: 100%;
    background: var(--dark);
    border: 1px solid var(--blue);
    padding: 8px 12px;
    border-radius: 6px;
    white-space: normal;
    word-break: break-all;
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.scope-pill {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(117, 183, 161, 0.15);
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 4px;
    white-space: nowrap;
}

/* Screen reader only class for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Monospace font for technical strings */
.tech-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Verified chip for counterparty */
.verified-chip {
    background: rgba(117, 183, 161, 0.15);
    border: 1px solid var(--mint);
    border-radius: 8px;
    padding: 10px 15px;
    color: rgba(244, 242, 238, 0.9);
    font-size: 0.875rem;
}

/* Policy banner */
.policy-banner {
    background: rgba(74, 158, 255, 0.1);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: rgba(244, 242, 238, 0.9);
}

.policy-banner.policy-verified {
    background: rgba(117, 183, 161, 0.1);
    border-color: var(--mint);
}

/* Success block */
.success-block {
    background: rgba(117, 183, 161, 0.1);
    border: 1px solid var(--mint);
    border-radius: 8px;
    padding: 15px;
}

.success-badge {
    display: inline-block;
    background: rgba(117, 183, 161, 0.2);
    border: 1px solid var(--mint);
    color: var(--mint);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Onboarding completion banner */
.onboard-complete-banner {
    background: rgba(117, 183, 161, 0.15);
    border: 1px solid var(--mint);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--mint);
}

.banner-close {
    background: none;
    border: none;
    color: var(--mint);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    margin-left: 10px;
}

.banner-close:hover {
    opacity: 0.8;
}

.banner-close:focus-visible {
    outline: 2px solid var(--mint);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Primary button style for receipt download */
.primary-btn {
    background: var(--blue);
    color: var(--bg);
    border: 2px solid var(--blue);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    font-weight: 600;
    margin-left: 10px;
}

.primary-btn:hover {
    background: rgba(74, 158, 255, 0.9);
}

.primary-btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* Onboarding checklist */
.onboarding-checklist {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(117, 183, 161, 0.2);
    flex-wrap: wrap;
}

.checklist-item.policy-item {
    background: rgba(74, 158, 255, 0.1);
    border-color: rgba(74, 158, 255, 0.3);
}

.checkbox {
    font-size: 1.2rem;
    color: rgba(244, 242, 238, 0.6);
    min-width: 20px;
}

.checklist-item.checked .checkbox {
    color: var(--mint);
}

.checklist-item.checked .checkbox::before {
    content: '☑';
}

.checklist-item:focus-within {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.edit-roles-btn {
    background: rgba(74, 158, 255, 0.2);
    border: 1px solid var(--blue);
    color: var(--blue);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: auto;
}

.edit-roles-btn:hover {
    background: rgba(74, 158, 255, 0.3);
}

.edit-roles-btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.info-tooltip {
    cursor: help;
    color: rgba(244, 242, 238, 0.6);
    font-size: 0.9rem;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(244, 242, 238, 0.3);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--mint);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* Prefilled block */
.prefilled-block {
    background: rgba(117, 183, 161, 0.05);
    border: 1px solid rgba(117, 183, 161, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.prefilled-block h4 {
    margin: 0 0 10px 0;
    color: var(--mint);
    font-size: 0.9rem;
}

.prefilled-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-size: 0.875rem;
}

.prefilled-grid .label {
    color: rgba(244, 242, 238, 0.6);
    font-weight: 500;
}

.onboarding-actions {
    margin-top: 20px;
}

.onboarding-actions .btn {
    width: 100%;
}

.attestation-line {
    font-size: 0.875rem;
    color: var(--mint);
    display: flex;
    align-items: center;
    gap: 8px;
}

.attestation-line .tech-mono {
    font-size: 0.8rem;
}

.copy-hash-btn {
    background: none;
    border: none;
    color: var(--blue);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.copy-hash-btn:hover {
    background: rgba(74, 158, 255, 0.2);
}

.copy-hash-btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.helper-text {
    font-size: 0.875rem;
    color: rgba(244, 242, 238, 0.6);
}

/* Refresh toast styling */
.refresh-toast {
    background: rgba(117, 183, 161, 0.9);
    color: var(--navy);
    font-weight: 600;
}

.role-pill {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(117, 183, 161, 0.2);
    border: 1px solid var(--mint);
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--mint);
}

.copy-link {
    background: none;
    border: none;
    color: var(--blue);
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.copy-link:hover {
    color: var(--mint);
}

.btn {
    padding: 10px 20px;
    background: rgba(74, 158, 255, 0.2);
    border: 2px solid var(--blue);
    border-radius: 6px;
    color: var(--blue);
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover:not(:disabled) {
    background: var(--blue);
    color: var(--bg);
}

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

.btn:focus-visible,
.copy-link:focus-visible,
.action-btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

input:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.demo-btn {
    background: rgba(117, 183, 161, 0.2);
    border-color: var(--mint);
    color: var(--mint);
}

.demo-btn:hover {
    background: var(--mint);
    color: var(--bg);
}

.copy-log-btn {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Action Buttons */
.action-btn {
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    border: 2px solid transparent;
}

.action-btn.primary {
    background: var(--blue);
    color: var(--bg);
    border-color: var(--blue);
}

.action-btn.primary:hover {
    background: rgba(74, 158, 255, 0.9);
}

.action-btn.secondary {
    background: rgba(74, 158, 255, 0.2);
    border-color: var(--blue);
    color: var(--blue);
}

.action-btn.secondary:hover {
    background: rgba(74, 158, 255, 0.3);
}

.action-btn.tertiary {
    background: rgba(244, 242, 238, 0.1);
    border-color: rgba(244, 242, 238, 0.3);
    color: rgba(244, 242, 238, 0.8);
}

.action-btn.tertiary:hover {
    background: rgba(244, 242, 238, 0.15);
}

.action-btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.result {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid;
}

.result.success {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.result.error {
    background: rgba(255, 107, 107, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.message {
    background: var(--dark);
    color: var(--light);
    padding: 12px 16px;
    margin-bottom: 10px;
    border-radius: 6px;
    border-left: 4px solid;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 300px;
}

.message.success { border-color: var(--success); }
.message.error { border-color: var(--error); }
.message.info { border-color: var(--primary); }

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--dark);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--primary);
}

.close:hover {
    color: var(--light);
}

.audit-entry {
    padding: 10px;
    border-bottom: 1px solid rgba(117, 183, 161, 0.2);
    margin-bottom: 10px;
}

.audit-time {
    font-size: 0.8rem;
    color: rgba(244, 242, 238, 0.6);
}

.audit-text {
    font-weight: 500;
}

#session-status.success {
    color: var(--success);
    font-weight: 600;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--dark);
    color: var(--success);
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--success);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Ledger styles */
.ledger {
    max-height: 400px;
    overflow-y: auto;
}

.ledger ul {
    list-style: none;
    padding: 0;
}

.ledger li {
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.ledger-time {
    font-size: 0.8rem;
    color: rgba(244, 242, 238, 0.6);
    display: block;
}

.ledger-label {
    font-weight: 600;
    color: var(--success);
}

/* Hash display with copy functionality */
.hash {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    font-size: 0.9rem;
}

.hash:hover {
    background: rgba(117, 183, 161, 0.2);
}

.hash::after {
    content: '📋';
    margin-left: 5px;
    opacity: 0.6;
}

.hash:hover::after {
    opacity: 1;
}

/* Chain flow animation */
.chainflow {
    background: linear-gradient(90deg, var(--primary), rgba(117, 183, 161, 0.3));
    height: 4px;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    margin: 15px 0;
}

.chainflow::before {
    content: '';
    position: absolute;
    top: 0;
    left: -20px;
    width: 20px;
    height: 100%;
    background: var(--success);
    border-radius: 2px;
}

.chainflow.animate::before {
    animation: flowArrow 1.5s ease-in-out;
}

@keyframes flowArrow {
    0% { left: -20px; }
    100% { left: 100%; }
}

/* Confetti animation */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4000;
}

.confetti.show {
    animation: confettiFade 1s ease-out;
}

.confetti::before,
.confetti::after {
    content: '🎉🎊✨🌟';
    position: absolute;
    font-size: 2rem;
    animation: confettiDrop 1s ease-out infinite;
}

.confetti::before {
    left: 20%;
    animation-delay: 0.2s;
}

.confetti::after {
    right: 20%;
    animation-delay: 0.5s;
}

@keyframes confettiDrop {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

@keyframes confettiFade {
    0%, 80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Badge pulse animation */
.badge.ok {
    animation: badgePulse 0.6s ease-out;
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px var(--success); }
    100% { transform: scale(1); }
}

/* Two column layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.main-content {
    min-width: 0;
}

/* Audit table toggle */
.audit-toggle {
    margin-bottom: 15px;
}

/* Audit filters */
.audit-filters {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

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

.filter-select,
.filter-date,
.filter-search {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(244, 242, 238, 0.2);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.875rem;
}

.filter-select {
    min-width: 150px;
}

.filter-date {
    min-width: 140px;
}

.filter-search {
    flex: 1;
    min-width: 200px;
}

.filter-btn {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Audit totals */
.audit-totals {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    flex-wrap: wrap;
}

.total-badge {
    padding: 6px 12px;
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.total-badge:hover {
    background: rgba(74, 158, 255, 0.25);
    border-color: rgba(74, 158, 255, 0.5);
}

.total-badge.active {
    background: rgba(74, 158, 255, 0.3);
    border-color: var(--primary);
}

.last-updated {
    margin-left: auto;
    font-size: 0.8rem;
    color: rgba(244, 242, 238, 0.6);
}

.audit-table {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

.audit-table table {
    width: 100%;
    border-collapse: collapse;
}

.audit-table th,
.audit-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(117, 183, 161, 0.2);
}

.audit-table th {
    background: rgba(117, 183, 161, 0.2);
    font-weight: 600;
}

/* 2-column grid layout */
.grid2 {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
}

@media (max-width: 1000px) {
    .grid2 {
        grid-template-columns: 1fr;
    }
}

/* Ledger styles */
.ledger ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ledger li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    background: #0f1836;
    border: 1px solid #263464;
    border-radius: 8px;
    padding: 8px;
}

.hash {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    cursor: pointer;
}

.hash::after {
    content: "📋";
    margin-left: 6px;
    opacity: 0.75;
}

/* Toast notifications */
.toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    background: #1b274d;
    color: #e9eefb;
    border: 1px solid #2a3b74;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.toast.show {
    animation: fade 2.6s forwards;
}

@keyframes fade {
    0% { opacity: 0; transform: translateY(10px); }
    10% { opacity: 1; transform: none; }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

/* Chain flow animation */
.chainflow {
    margin-top: 10px;
    border: 1px dashed #32457f;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chain {
    font-weight: 600;
}

.flow {
    position: relative;
    flex: 1;
    height: 6px;
    background: #0c1330;
    border-radius: 6px;
    border: 1px solid #1b2550;
    overflow: hidden;
}

#dot {
    position: absolute;
    top: -5px;
    left: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #7aa2ff;
    box-shadow: 0 0 8px #7aa2ff;
}

.flow.run #dot {
    animation: travel 1.5s linear 1;
}

@keyframes travel {
    0% {
        left: 0;
        opacity: 1;
    }
    100% {
        left: calc(100% - 16px);
        opacity: 1;
    }
}

.progress #bar.pulse {
    box-shadow: 0 0 16px #6effb180;
}

/* Confetti animation */
.confetti {
    pointer-events: none;
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
}

.confetti.show {
    display: block;
}

.confetti::before,
.confetti::after {
    content: "🎉🎊✨🌟💫⭐";
    position: absolute;
    top: -10px;
    font-size: 2rem;
    white-space: nowrap;
    animation: confettiDrop 2s ease-out;
}

.confetti::before {
    left: 20%;
    animation-delay: 0s;
}

.confetti::after {
    right: 20%;
    animation-delay: 0.3s;
}

@keyframes confettiDrop {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.grid2{display:grid;grid-template-columns:1fr 340px;gap:16px}
@media(max-width:1000px){.grid2{grid-template-columns:1fr}}
.panel{background:#0f1836;border:1px solid #263464;border-radius:10px;padding:12px;margin-top:10px}
.balances{display:flex;justify-content:space-between;margin-bottom:8px}
.roles{margin-top:6px;display:flex;gap:6px;flex-wrap:wrap}
.roles .badge{border-color:#345295}
.stages{margin-top:10px}
.stage-header{display:flex;align-items:center;gap:10px;margin-bottom:6px}
.stage-title{font-weight:600}
.stage-progress{flex:1;height:6px;background:#0c1330;border:1px solid #1b2550;border-radius:6px;overflow:hidden}
#stageBar{height:100%;width:0%;background:linear-gradient(90deg,#7aa2ff,#8ff0c7)}
.stage-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.stage-list li{display:flex;justify-content:space-between;background:#0d1530;border:1px solid #233362;border-radius:8px;padding:6px 8px}
.li-ok{border-color:#1a6f4b}
.li-fail{border-color:#7d2b2b}
.toast{position:fixed;right:16px;bottom:16px;background:#1b274d;color:#e9eefb;border:1px solid #2a3b74;padding:10px 12px;border-radius:8px;box-shadow:0 6px 20px rgba(0,0,0,.35)}
.toast.show{animation:fade 2.6s forwards}
@keyframes fade{0%{opacity:0;transform:translateY(10px)}10%{opacity:1;transform:none}85%{opacity:1}100%{opacity:0}}
.ledger ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.ledger li{display:flex;justify-content:space-between;gap:8px;background:#0f1836;border:1px solid #263464;border-radius:10px;padding:8px}
.hash{font-family:ui-monospace, SFMono-Regular, Menlo, monospace;cursor:pointer}
.hash::after{content:" 📋";opacity:.75}
.chainflow{display:none !important}
.chain{font-weight:600}
.flow{display:none !important}
#dot{display:none !important}
.ob{width:100%;border-collapse:collapse}
.ob th,.ob td{border:1px solid #22325f;padding:6px 8px}
.ask{color:#ff7b7b}
.bid{color:#8ff0c7}
.muted{opacity:0.6;font-size:0.9em}

/* Added styles for input validation */
.lei-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(17, 19, 35, 0.8);
    border: 1px solid rgba(117, 183, 161, 0.3);
    border-radius: 8px;
    color: var(--white);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.lei-input.invalid {
    border-color: #ff4d4d;
}

.input-error {
    color: #ff6b6b;
    font-size: 0.875rem;
    margin-top: 5px;
}

input[data-error] {
    border-color: #ff6b6b !important;
}

input[data-error]::after {
    content: attr(data-error);
    display: block;
    color: #ff6b6b;
    font-size: 0.875rem;
    margin-top: 5px;
}

.helper-text {
    color: rgba(244, 242, 238, 0.6);
    font-size: 0.875rem;
}

/* Added styles for role badge, action buttons, credential modal, and spinner */
.verified {
    background: rgba(117, 183, 161, 0.1);
    border: 1px solid var(--mint);
    border-radius: 8px;
    padding: 20px;
}

.role-badge {
    background: var(--mint);
    color: var(--navy);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.action-btn {
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.primary {
    background: var(--mint);
    color: var(--navy);
}

.action-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(117, 183, 161, 0.3);
}

.action-btn.secondary {
    background: rgba(117, 183, 161, 0.2);
    color: var(--mint);
    border: 1px solid rgba(117, 183, 161, 0.5);
}

.action-btn.secondary:hover {
    background: rgba(117, 183, 161, 0.3);
}

.info-tooltip {
    cursor: help;
    margin-left: 6px;
    color: var(--mint);
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.credential-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.credential-modal-content {
    background: var(--navy);
    border: 2px solid var(--mint);
    border-radius: 12px;
    padding: 30px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
}

.credential-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.credential-modal-header h3 {
    color: var(--mint);
    margin: 0;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.credential-json {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(117, 183, 161, 0.3);
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    color: var(--white);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.copy-credential-btn {
    background: var(--mint);
    color: var(--navy);
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.copy-credential-btn:hover {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .criteria-grid {
        grid-template-columns: 1fr;
    }

    .form-group {
        flex-direction: column;
    }

    .form-group input, .form-group select {
        min-width: unset;
    }
}

input, select {
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 4px;
    color: var(--text);
    flex: 1;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

input.invalid {
    border-color: #ff4444;
}

/* Audit table styling */
.audit-table {
    width: 100%;
    margin-top: 15px;
    border-collapse: collapse;
}

.audit-table thead {
    background: rgba(0, 0, 0, 0.3);
}

.audit-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 2px solid rgba(244, 242, 238, 0.1);
}

.audit-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(244, 242, 238, 0.05);
    font-size: 0.875rem;
}

.audit-table tbody tr:hover {
    background: rgba(74, 158, 255, 0.05);
}

.artifact-id {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: rgba(244, 242, 238, 0.8);
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    background: rgba(74, 158, 255, 0.2);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 3px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(74, 158, 255, 0.3);
}

.verify-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

.verify-badge.valid {
    background: rgba(117, 183, 161, 0.2);
    color: var(--mint);
    border: 1px solid rgba(117, 183, 161, 0.3);
}

.verify-badge.invalid {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.verify-badge.local {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.audit-empty {
    padding: 40px;
    text-align: center;
    color: rgba(244, 242, 238, 0.6);
    font-size: 0.9rem;
}

/* Monospace font for technical IDs */
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Empty state for audit table */
.audit-empty {
    text-align: center;
    padding: 12px 0;
    color: #9bb;
}

/* Audit pagination */
.audit-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
}

.pagination-btn {
    padding: 8px 16px;
    font-size: 0.875rem;
}

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

#audit-page-info {
    font-size: 0.875rem;
    color: rgba(244, 242, 238, 0.8);
}

/* Audit modal */
.audit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.audit-modal-content {
    background: var(--dark);
    border: 2px solid rgba(74, 158, 255, 0.3);
    border-radius: 8px;
    padding: 25px;
    max-width: 700px;
    max-height: 80vh;
    width: 90%;
    overflow-y: auto;
}

.audit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.audit-modal-header h3 {
    margin: 0;
    color: var(--mint);
}

.audit-json {
    background: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 6px;
    max-height: 60vh;
    overflow: auto;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.audit-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Audit action buttons and badges */
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.badge-valid {
    background: #1e6f46;
    color: #dff7ea;
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 12px;
    display: inline-block;
    margin-left: 8px;
}

.badge-invalid {
    background: #7a2832;
    color: #ffe7ea;
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 12px;
    display: inline-block;
    margin-left: 8px;
}

.audit-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tooltip {
    cursor: help;
}

.modal pre {
    max-height: 60vh;
    overflow: auto;
}