/* View-specific styles */

/* Dashboard */
.dashboard-hero { margin-bottom: 1rem; }
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    text-align: center;
}
.stat-value { font-size: 1.1rem; font-weight: 700; }
.stat-label { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }

/* Key Vault */
.vault-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.vault-section-sub { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.75rem; }

/* Wallet */
.portfolio-section { margin-bottom: 1rem; }
.portfolio-token {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-gold);
}
.portfolio-token:last-child { border-bottom: none; }
.token-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
}
.token-info { flex: 1; }
.token-name { font-size: 0.85rem; font-weight: 600; }
.token-amount { font-size: 0.65rem; color: var(--text-muted); font-family: 'SF Mono', monospace; }
.token-value { font-size: 0.85rem; font-weight: 600; text-align: right; font-family: 'SF Mono', monospace; }

/* Exchange section */
.exchange-card {
    background: linear-gradient(135deg, rgba(201, 149, 108, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}
.exchange-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}
.exchange-swap-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--grad-gold-deep);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Documents */
.doc-section { margin-bottom: 1rem; }
.doc-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.doc-section-title { font-size: 0.9rem; font-weight: 600; }
.doc-count { font-size: 0.7rem; color: var(--text-muted); }

/* Requests */
.request-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.request-tabs::-webkit-scrollbar { display: none; }
.request-tab {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.request-tab:hover { border-color: var(--gold); }
.request-tab.active { background: var(--gold); color: white; border-color: var(--gold); }

/* Estates */
.estate-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-gold);
    margin-bottom: 1rem;
}
.estate-tab {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.estate-tab:hover { color: var(--text-secondary); }
.estate-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.beneficiary-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    cursor: pointer;
}
.beneficiary-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.beneficiary-info { flex: 1; }
.beneficiary-name { font-size: 0.85rem; font-weight: 600; }
.beneficiary-role { font-size: 0.65rem; color: var(--text-muted); }
.beneficiary-docs {
    font-size: 0.7rem;
    color: var(--gold-light);
    font-weight: 600;
}

/* Auth Management */
.auth-search {
    position: relative;
    margin-bottom: 0.75rem;
}
.auth-search input {
    padding-left: 2.5rem;
}
.auth-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

/* WiFi */
.wifi-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
}
.wifi-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--grad-cyan-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.wifi-info { flex: 1; }
.wifi-name { font-size: 0.85rem; font-weight: 600; }
.wifi-security { font-size: 0.65rem; color: var(--text-muted); }
.wifi-password {
    font-family: 'SF Mono', monospace;
    font-size: 0.8rem;
    color: var(--gold-light);
    letter-spacing: 1px;
}
.wifi-actions { display: flex; gap: 0.4rem; }

/* Contract validation */
.cv-field {
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
}
.cv-field-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.cv-field-name { font-size: 0.8rem; font-weight: 600; }
.cv-confidence { font-size: 0.7rem; font-family: 'SF Mono', monospace; }
.cv-field-value { font-size: 0.85rem; padding: 0.5rem; background: rgba(0,0,0,0.3); border-radius: var(--radius-sm); margin-top: 0.4rem; font-family: 'SF Mono', monospace; }
.cv-sensitivity { font-size: 0.6rem; padding: 0.15rem 0.4rem; border-radius: 8px; }
.cv-sensitivity.critical { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.cv-sensitivity.high { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.cv-sensitivity.medium { background: rgba(201, 149, 108, 0.15); color: var(--gold); }

/* Chat view */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.5;
}
.chat-bubble.sent {
    align-self: flex-end;
    background: var(--grad-gold-deep);
    border-bottom-right-radius: 4px;
}
.chat-bubble.received {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-bottom-left-radius: 4px;
}
.chat-input-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-gold);
    background: var(--bg-header);
}
.chat-input-bar input { flex: 1; }
.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--grad-gold-deep);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* ── Security Stack ── */

.stack-layer {
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.stack-layer.active {
    border-left-color: var(--green);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.15);
    background: rgba(74, 222, 128, 0.04);
}
.stack-layer.checking {
    border-left-color: var(--amber);
    animation: layerPulse 1.2s ease infinite;
}
.stack-layer.error {
    border-left-color: var(--red);
    background: rgba(239, 68, 68, 0.04);
}
@keyframes layerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.stack-layer-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}
.stack-layer-info { flex: 1; min-width: 0; }
.stack-layer-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}
.stack-layer-detail {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'SF Mono', monospace;
}
.stack-layer-status {
    text-align: right;
    flex-shrink: 0;
}
.stack-layer-latency {
    font-size: 0.75rem;
    color: var(--green);
    font-weight: 700;
    font-family: 'SF Mono', monospace;
}
.stack-layer-state {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stack-layer.active .stack-layer-state { color: var(--green); }
.stack-layer.checking .stack-layer-state { color: var(--amber); }
.stack-layer.error .stack-layer-state { color: var(--red); }

/* Security Stack — Mini (condensed 7 dots) */
.stack-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: 20px;
    font-size: 0.65rem;
    color: var(--text-muted);
}
.stack-mini-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    transition: background 0.3s;
}
.stack-mini-dot.active { background: var(--green); box-shadow: 0 0 4px rgba(74, 222, 128, 0.5); }
.stack-mini-dot.checking { background: var(--amber); animation: dotPulse 1s infinite; }
.stack-mini-dot.error { background: var(--red); }
@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* Security Stack — Interactive Crypto Demo */
.crypto-demo {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-top: 1rem;
}
.crypto-demo-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-gold);
}
.crypto-demo-title { font-size: 0.9rem; font-weight: 600; }
.crypto-demo-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.crypto-output {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-family: 'SF Mono', monospace;
    font-size: 0.7rem;
    color: var(--green);
    word-break: break-all;
    margin-top: 0.5rem;
    min-height: 2rem;
    line-height: 1.5;
}
.crypto-output.empty { color: var(--text-muted); }
.crypto-output.error-output { color: var(--red); }
.crypto-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.crypto-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 0.5rem;
}
.crypto-verified.valid { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.crypto-verified.invalid { background: rgba(239, 68, 68, 0.15); color: var(--red); }

/* Pipeline run button */
.pipeline-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--gold) 0%, var(--green) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
    letter-spacing: 0.3px;
}
.pipeline-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(201, 149, 108, 0.3); }
.pipeline-btn:active { transform: translateY(0); }
.pipeline-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Document Re-Execution (Contract Validation) ── */

.reexec-section {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.reexec-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.reexec-header:hover { background: var(--bg-card-hover); }
.reexec-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--grad-gold-deep);
    color: white;
    flex-shrink: 0;
}
.reexec-number.done { background: var(--green); }
.reexec-title { font-size: 0.85rem; font-weight: 600; flex: 1; }
.reexec-chevron {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.2s;
}
.reexec-chevron.open { transform: rotate(90deg); }
.reexec-body {
    padding: 0 1rem 1rem;
    display: none;
}
.reexec-body.open { display: block; }

/* Merkle Tree */
.merkle-tree { margin-top: 0.5rem; }
.merkle-node {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    margin-left: var(--merkle-indent, 0);
}
.merkle-node.root {
    border: 1px solid var(--gold);
    background: rgba(201, 149, 108, 0.08);
    color: var(--gold);
    font-weight: 600;
}

/* Signature Cards */
.sig-card {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
}
.sig-card.verified { border-color: var(--green); background: rgba(74, 222, 128, 0.04); }
.sig-card.invalid { border-color: var(--red); background: rgba(239, 68, 68, 0.04); }
.sig-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.sig-card-algo { font-size: 0.8rem; font-weight: 700; }
.sig-card-status {
    font-size: 0.6rem;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sig-card-status.verified { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.sig-card-status.pending { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.sig-card-status.failed { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.sig-card-hash {
    font-family: 'SF Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
    word-break: break-all;
}

/* Biometric Gate */
.bio-gate {
    text-align: center;
    padding: 1.5rem 1rem;
}
.bio-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
    transition: all 0.3s;
}
.bio-circle.scanning {
    border-color: var(--amber);
    animation: bioScan 1.5s ease infinite;
}
.bio-circle.verified {
    border-color: var(--green);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}
@keyframes bioScan {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 0 0 12px rgba(245, 158, 11, 0); }
}
.bio-label { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; }
.bio-sublabel { font-size: 0.7rem; color: var(--text-muted); }
.bio-timer {
    font-family: 'SF Mono', monospace;
    font-size: 0.75rem;
    color: var(--amber);
    margin-top: 0.75rem;
}

/* Signer cards */
.signer-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    margin-bottom: 0.4rem;
}
.signer-card.active-signer { border-color: var(--gold); background: rgba(201, 149, 108, 0.06); }
.signer-card.signed { border-color: var(--green); }
.signer-card.waiting { opacity: 0.5; }
.signer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--grad-gold-deep);
    color: white;
    flex-shrink: 0;
}
.signer-info { flex: 1; }
.signer-name { font-size: 0.8rem; font-weight: 600; }
.signer-role { font-size: 0.6rem; color: var(--text-muted); }
.signer-status { font-size: 0.75rem; flex-shrink: 0; }

/* Document Detail tabs */
.doc-detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-gold);
    margin-bottom: 1rem;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.doc-detail-tabs::-webkit-scrollbar { display: none; }
.doc-detail-tab {
    padding: 0.6rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    transition: all 0.2s;
}
.doc-detail-tab:hover { color: var(--text-secondary); }
.doc-detail-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Sensitivity badge (low variant) */
.cv-sensitivity.low { background: rgba(74, 222, 128, 0.15); color: var(--green); }

/* Version badge */
.version-badge {
    font-size: 0.6rem;
    font-family: 'SF Mono', monospace;
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    background: rgba(201, 149, 108, 0.15);
    color: var(--gold);
}
.version-badge.stale { background: rgba(245, 158, 11, 0.15); color: var(--amber); }

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border-gold);
    border-radius: var(--radius-lg);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.upload-zone:hover {
    border-color: var(--gold);
    background: rgba(201, 149, 108, 0.04);
}
.upload-zone-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.upload-zone-text { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; }
.upload-zone-sub { font-size: 0.7rem; color: var(--text-muted); }

/* Progress bar */
.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    transition: width 0.3s ease;
}
