:root {
    --bg-main: #060911;
    --bg-card: #0c1222;
    --bg-card-hover: #131c35;
    --bg-elevated: #16203c;
    --border-color: rgba(99, 102, 241, 0.2);
    --border-glow: rgba(6, 182, 212, 0.4);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --primary: #06b6d4;
    --primary-glow: rgba(6, 182, 212, 0.3);
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --emerald: #10b981;
    --emerald-glow: rgba(16, 185, 129, 0.3);
    --amber: #f59e0b;
    --rose: #ef4444;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 40%);
}

/* Header */
.vault-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: rgba(12, 18, 34, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-orb {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #06b6d4, #6366f1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 0 20px var(--primary-glow);
}

.vault-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-tag {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.4);
    color: var(--primary);
    border-radius: 999px;
    font-weight: 600;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.root-chip {
    display: flex;
    flex-direction: column;
    background: rgba(6, 9, 17, 0.7);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
}

.chip-label {
    font-size: 0.65rem;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 0.05em;
}

.mono-hash {
    font-family: var(--font-mono);
    color: #38bdf8;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-link {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.gh-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

/* Layout */
.vault-layout {
    display: grid;
    grid-template-columns: 340px 1.4fr 400px;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    flex: 1;
}

@media (max-width: 1400px) {
    .vault-layout {
        grid-template-columns: 1fr;
    }
}

.panel-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

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

.panel-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #e2e8f0;
}

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

.status-indicator {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.status-indicator.live {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-zk {
    font-size: 0.7rem;
    font-weight: 700;
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
}

/* Forms & Inputs */
.issue-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: rgba(6, 9, 17, 0.5);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input, .custom-select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: #f8fafc;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus, .custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.clearance-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}

.clearance-pill {
    cursor: pointer;
    font-size: 0.75rem;
}

.clearance-pill input {
    display: none;
}

.clearance-pill span {
    display: block;
    padding: 0.35rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    text-align: center;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.clearance-pill input:checked + span {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--primary);
    color: #38bdf8;
    font-weight: 600;
}

/* Buttons */
.btn-primary, .btn-accent, .btn-warning, .btn-ghost, .btn-mini {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary {
    background: linear-gradient(135deg, #06b6d4, #0284c7);
    color: #fff;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
}

.btn-primary:hover {
    box-shadow: 0 0 16px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-accent {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    width: 100%;
}

.btn-accent:hover:not(:disabled) {
    box-shadow: 0 0 20px var(--accent-glow);
    filter: brightness(1.1);
}

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

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--amber);
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

.btn-ghost:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* Registry Cards */
.registry-header {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.registry-header h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.credential-cards {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.cred-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cred-card:hover {
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(15, 23, 42, 0.9);
}

.cred-card.selected {
    border-color: var(--primary);
    background: rgba(6, 182, 212, 0.08);
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.2);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.cred-id {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #38bdf8;
    font-weight: 600;
}

.cred-level {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.card-alias {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f1f5f9;
}

.card-dept {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.card-commitment {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Merkle Tree SVG Canvas */
.tree-canvas-container {
    flex: 1;
    background: #04060c;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#merkle-svg {
    width: 100%;
    height: 100%;
}

.tree-line {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1.5;
    transition: stroke 0.3s, stroke-width 0.3s;
}

.tree-line.active {
    stroke: var(--primary);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 6px var(--primary));
}

.tree-node-circle {
    fill: #0c1222;
    stroke: #334155;
    stroke-width: 2;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tree-node-circle:hover {
    fill: #1e293b;
    stroke: #64748b;
}

.tree-node-circle.root {
    stroke: #10b981;
    fill: rgba(16, 185, 129, 0.15);
}

.tree-node-circle.target {
    stroke: #06b6d4;
    fill: rgba(6, 182, 212, 0.25);
    filter: drop-shadow(0 0 8px var(--primary));
}

.tree-node-circle.sibling {
    stroke: #f59e0b;
    fill: rgba(245, 158, 11, 0.2);
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.5));
}

.tree-node-label {
    fill: #94a3b8;
    font-size: 9px;
    font-family: var(--font-mono);
    text-anchor: middle;
    pointer-events: none;
}

.auth-path-drawer {
    margin-top: 0.75rem;
    background: rgba(6, 9, 17, 0.6);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.path-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--amber);
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.path-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.path-pill {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

/* ZK Verifier Panel */
.gate-selector-box {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.gate-selector-box label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.selected-cred-preview {
    background: rgba(6, 9, 17, 0.6);
    border-radius: 8px;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
}

.cred-preview-placeholder {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    padding: 0.5rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
    font-size: 0.75rem;
}

.preview-row {
    display: flex;
    flex-direction: column;
}

.preview-label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.preview-val {
    font-family: var(--font-mono);
    color: #38bdf8;
    font-size: 0.75rem;
    word-break: break-all;
}

/* ZK Results */
.zk-results-card {
    margin-top: 1rem;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 10px;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.zk-status-banner {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--emerald);
    text-align: center;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.zk-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.check-icon {
    width: 20px;
    height: 20px;
    background: rgba(16, 185, 129, 0.2);
    color: var(--emerald);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.check-info {
    display: flex;
    flex-direction: column;
}

.check-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
}

.check-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Audit Log */
.audit-log-container {
    margin-top: 1rem;
    background: #04060c;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.audit-log-header {
    background: rgba(15, 23, 42, 0.6);
    padding: 0.4rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.audit-log {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 0.6rem;
    height: 140px;
    overflow-y: auto;
    color: #38bdf8;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Footer */
.vault-footer {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(12, 18, 34, 0.6);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-dim);
}

.vault-footer a {
    color: var(--primary);
    text-decoration: none;
}
