@charset "UTF-8";

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    grid-column: 1/-1;
    background-color: transparent;
    border-bottom: solid 1px var(--border);
    cursor: default;
    background: radial-gradient(circle, var(--bg-tertiary) 0%, var(--bg-dark) 100%);
}

.brand {
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-main);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.brand:hover {
    opacity: 0.8;
}

.brand span {
    color: var(--accent)
}

.hidden {
    display: none
}

.session-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    align-content: center;
}

.session-bar .vault-subtitle {
    font-weight: 500;
    color: var(--text-main);
    font-size: 12px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.toolbar.hidden {
    display: none
}

.toolbar.no-session .left {
    display: none
}

.toolbar.no-session .right #login_btn {
    display: inline-flex
}

.toolbar.no-session .right #logout_btn {
    display: none
}

.toolbar:not(.no-session) .right #login_btn {
    display: none
}

.toolbar .left {
    display: flex;
    align-items: center;
    gap: 8px
}

.toolbar .right {
    display: flex;
    align-items: center
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 16px;
    /* background: var(--bg-lighter); */
    color: var(--accent);
    border: 1px solid var(--border);
    font-size: 12px;
    cursor: default;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #b00;
    box-shadow: 0 0 0 1px var(--border)
}

.status-dot.green{
        background: rgb(0, 170, 102);
}

.log-cat {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 14px;
    margin-left: 8px;
    font-size: 11px;
    font-weight: 700
}

.log-cat.cat-session {
    background: #0d6efd;
    color: #fff
}

.log-cat.cat-users {
    background: #20c997;
    color: #fff
}

.log-cat.cat-rbac {
    background: #6f42c1;
    color: #fff
}

.log-cat.cat-other {
    background: #6c757d;
    color: #fff
}

#key_gate {
    padding: 20px;
    max-width: 560px;
    margin: 40px auto;
}

#key_gate h1 {
    margin-bottom: 8px;
}

#key_gate .option label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-main)
}

#auth_drop {
    border: 2px dashed var(--border);
    border-radius: 16px;
    background: var(--bg-panel)
}

#auth_drop:focus-within {
    border-color: var(--accent)
}

#auth_drop.drag-active {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb, 79, 70, 229), 0.05);
}

.gate-textarea {
    width: 100%;
    padding: 12px;
    border: none;
    background: var(--bg-lighter);
    color: var(--text-muted);
    border-radius: 16px;
    font-size: 16px;
    font-family: monospace;
    resize: vertical;
}

.gate .action-row {
    margin-top: 12px
}

.gate-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.gate-btn-import {
    padding: 10px 18px;
    border-radius: 26px;
    border: 1px solid var(--border);
    background: var(--bg-lighter);
    color: var(--text-main);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.gate-btn-import:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.gate-btn-unlock {
    padding: 10px 24px;
    border-radius: 26px;
    border: none;
    background: var(--accent);
    color: var(--bg-panel);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-left: auto;
    font-family: inherit;
}

.gate-btn-unlock:hover {
    filter: brightness(1.1);
}

.gate-help {
    margin-bottom: 16px;
    line-height: 1.5;
}

.card-box {
    margin-top: 12px
}

.card-box .small.mono {
    color: var(--accent);
    font-weight: 500;
}

#auth_status {
    margin-top: 10px;
}

.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.dna-canvas {
    background-size: 20px 20px;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px
}

.node {
    border-radius: 8px
}

.node-header {
    font-weight: 700
}

.node-field {
    font-family: var(--font-mono);
    font-size: 12px
}

.type-badge {
    color: var(--accent)
}

.km-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 12px
}

.vault-status {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: space-between;
}

.vault-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: #6c757d
}

.vault-status-dot.ready {
    background: #28a745
}

.vault-status-dot.busy {
    background: #ffc107
}

.vault-status-text {
    color: #6c757d
}

.push-right {
    margin-left: auto
}

.w-160 {
    max-width: 160px
}

.w-140 {
    max-width: 140px
}

.flex-1 {
    flex: 1
}

.audit-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 8px
}

.grid-info-compact {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px
}

.field-row-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 10px
}

.cols-compact {
    grid-template-columns: minmax(200px, 1.2fr) minmax(180px, 1fr) minmax(180px, 1fr) auto auto
}

.dna-toolbar {
    position: fixed;
    top: 60px;
    right: 10px;
    display: flex;
    gap: 10px;
    padding: 8px 10px;
    /* background:var(--bg-lighter); */
    /* border:1px solid var(--border); */
    border-radius: 100px;
    z-index: 1000;
    align-items: center;
    justify-content: space-around;
}

.gate-overlay {
    padding: 20px;
    color: var(--text-muted);
    background: rgb(26 29 35);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    margin-bottom: 12px;
    position: absolute;
    top: 0;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    scroll-behavior: revert;
    z-index: 10;
}

.btn-keymaster {
    width: 100%;
    padding: 12px;
    background: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: 28px;
    cursor: pointer;
    font-weight: 600;
    transition: background .2s ease;
    display: flex;
    justify-content: space-between;
    border: solid 1px var(--border);
}

.btn-keymaster[disabled] {
    opacity: 0.5;
    pointer-events: none;
}

.btn-keymaster:hover {
    background: var(--accent);
    color: var(--text-secondary);
}

.nc-wrap {
    position: fixed;
    right: 12px;
    bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999
}

.nc-item {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0 10px;
    border-radius: 8px;
    min-width: 240px;
    font-size: 12px;
    text-shadow: var(--shadow-sm);
    text-align: right;
    cursor: default;
}

.nc-item.success {
    border-color: #00aa66;
    color: #00aa66;
}

.nc-item.error {
    border-color: #ff4757
}

.nc-item.warn {
    border-color: #ffa502
}

.keymaster-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    animation: fade 1s ease;
    box-sizing: border-box;
}

.keymaster-header {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 20px;
    color: var(--text-primary)
}

.keymaster-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--text-main);
    gap: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.keymaster-header p {
    font-size: 1.2em;
    color: var(--text-muted)
}

.keymaster-header p span {
    color: var(--text-main);
}

.keymaster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px
}

.keymaster-panel {
    background: radial-gradient(circle, var(--bg-panel) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
#hydra-key-panel{margin-bottom: 40px;}

.keymaster-panel h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 14px;
}

/* ===========================================
   HYDRA COPILOT KEY PANEL
   =========================================== */

.hydra-key-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 18px;
    margin-top: -4px;
}

.hydra-key-desc small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    opacity: 0.75;
}

/* Main generate button: centered content instead of space-between */
#btn-generate-hydra-key {
    justify-content: center;
    gap: 8px;
    font-size: 13px;
}

/* Key display block spacing */
#hydra-key-display {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.hydra-key-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 9px;
}

/* Input + copy button row — pill-shaped container */
.hydra-key-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 5px 5px 5px 13px;
    transition: border-color 0.15s;
}

.hydra-key-input-row:focus-within {
    border-color: var(--accent-secondary, var(--accent));
    box-shadow: 0 0 0 3px var(--accent-dim, rgba(0, 81, 255, 0.08));
}

/* Monospace key value input */
.hydra-key-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 12px;
    color: var(--text-main);
    letter-spacing: 0.05em;
    padding: 5px 0;
    cursor: text;
    user-select: all;
}

/* Copy button — override btn-keymaster full-width/space-between */
#btn-copy-hydra-key {
    width: auto !important;
    flex-shrink: 0;
    justify-content: center;
    padding: 7px 11px;
    border-radius: 9px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}

#btn-copy-hydra-key:hover {
    background: var(--accent-dim, rgba(0, 81, 255, 0.08));
    color: var(--accent-secondary, var(--accent));
    border-color: var(--accent-secondary, var(--accent));
}

.roles-list {
    margin-bottom: 15px
}

.role-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all .2s ease;
    display: flex;
    gap: 10px;
    align-items: center;
    line-height: 1;
}

.role-item:hover {
    background: transparent;
    border-color: var(--accent-primary)
}

.role-item.active {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

.role-item i {
    margin-right: 5px;
    font-size: 1.1em
}

.role-item span {
    font-weight: 600
}

.role-item small {
    display: block;
    margin-top: 4px;
    margin-bottom: 8px;
    font-size: .85em;
    opacity: .8
}

/* Search Select Styles */
.search-select-wrapper {
    position: relative;
    width: 100%;
}

.search-select-display {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 16px; /* Matched to dna-modal.css */
    color: var(--text-main);
    font-size: 14px;
}

.search-select-display:focus {
    border-color: var(--accent);
    outline: none;
}

.search-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px); /* Slight spacing */
    left: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--bg-lighter); /* Matched to modal background */
    border: 1px solid var(--border);
    z-index: 9999;
    border-radius: 16px; /* Rounded corners */
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    padding: 8px 0; /* Padding inside dropdown */
}

.search-select-option {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--text-main);
    font-family: 'Roboto', sans-serif; /* Standard font */
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-select-option:last-child {
    border-bottom: none;
}

.search-select-option:hover {
    background-color: var(--bg-panel);
    color: var(--accent);
}

.permissions-grid {
    display: grid;
    gap: 3px;
    margin-bottom: 15px;
}

.permission-category h4 {
    margin-bottom: 10px;
    color: var(--text-muted);
    padding-bottom: 5px
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0
}

.permission-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary)
}

.permission-item label {
    cursor: pointer;
    font-size: .95em;
    color: var(--text-primary)
}

.perm-count-badge {
    background: var(--accent);
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    margin-left: 8px;
    font-weight: 700
}

details.permission-section {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 8px 0;
    overflow: hidden
}

details.permission-section summary {
    padding: 8px 12px;
    background: var(--bg-lighter);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
    list-style: none;
    position: relative;
    padding-left: 30px;
    transition: background 0.3s ease;
    display: flex;
    justify-content: space-between;
    gap: 5px;
    align-items: center;
}

details.permission-section summary i {
    transform: scale(0.8)
}

details.permission-section summary::-webkit-details-marker {
    display: none;
}

details.permission-section.active i {
    color: var(--accent)
}

details.permission-section.active summary {
    color: var(--accent)
}

/* Custom CSS Arrow */
details.permission-section summary::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    width: 6px;
    height: 6px;
    border: solid var(--text-main);
    /* Default color */
    border-width: 0 2px 2px 0;
    transform: translateY(-50%) rotate(-45deg);
    /* Pointing right */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
}

/* Open State Animation */
details.permission-section[open] summary::before {
    transform: translateY(-65%) rotate(45deg);
    /* Pointing down */
    border-color: var(--accent);
    /* Highlight on open */
    opacity: 1;
}

details.permission-section[open] summary {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
}

/* Hover effect */
details.permission-section summary:hover::before {
    opacity: 1;
    border-color: var(--accent);
}

details.permission-section .permission-item {
    padding: 6px 12px
}
details.permission-section .permission-item select{
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 16px;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    text-transform: lowercase;
    padding-right: 30px;
    font-weight: 600;
}
.view-section.loading {
    position: relative
}

.view-loader-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(2px);
    z-index: 10
}

.view-loader-overlay.hidden {
    display: none
}

.loader-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-panel)
}

.loader-spinner .ring {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    animation: spin .8s linear infinite
}

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

.users-assignment {
    margin-bottom: 15px
}

.user-search {
    display: flex;
    gap: 10px;
    margin-bottom: 15px
}

.user-search input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 28px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
}

.user-search button {
    padding: 10px 15px;
    background: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: 28px;
    cursor: pointer;
    width: 42px;
    height: 42px;
    text-align: center;
}

.users-list {
    max-height: fit-content;
    overflow-y: auto
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    padding-left: 15px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: 28px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all ease .3s;
    line-height: 1.5;
}

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

.user-item.active {
    border-color: var(--accent);
    background: transparent;
}

.user-item .user-email {
    font-size: 12px;
}

.user-item.active i {
    color: var(--accent);
}

.user-item i {
    color: var(--accent-primary)
}

.user-item span {
    flex: 1;
    font-weight: 500;
    cursor: default;
}

.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: .75em;
    font-weight: 600;
    background-color: var(--accent-primary);
    margin: 5px;
    color: var(--text-main);
}

.role-badge.admin {
    background: #dc3545;
    color: #fff
}

.role-badge.manager {
    background: #fd7e14;
    color: #fff
}

.role-badge.agent {
    background: #20c997;
    color: #fff
}

.role-badge.auditor {
    background: #6f42c1;
    color: #fff
}

.security-status {
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 26px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color)
}

.security-status h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 28px;
    border: 1px solid var(--border-color);
    font-size: 12px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6c757d
}

.status-indicator.active {
    background: var(--accent);
}

/* Sympathetic Loader */
#sympathetic_loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-panel);
    /* Use theme background */
    z-index: 10000;
    /* High z-index to cover everything */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#sympathetic_loader.hidden {
    display: none !important;
}

.sl-container {
    width: 80%;
    max-width: 600px;
    font-family: 'Courier New', Courier, monospace;
    /* Hacker/Terminal font */
}

.sl-terminal {
    padding: 0;
    border-radius: 8px;
    /* Subtle glow */
    margin-bottom: 20px;
    min-height: fit-content;
    color: var(--accent);
    font-size: 1.2em;
    position: relative;
    overflow: hidden;
    text-align: left;
}

.sl-prompt {
    margin-right: 10px;
    color: var(--accent-dim);
}

#sl_text {
    font-size: 15px;
}

.sl-cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--accent);
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.sl-progress-track {
    width: 100%;
    height: 4px;
    background-color: var(--bg-lighter);
    border-radius: 2px;
    overflow: hidden;
}

.sl-progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--accent);
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px var(--accent);
}

.audit-log {
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 26px;
    border: 1px solid var(--border-color)
}

.audit-log h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.log-entries {
    max-height: 200px;
    overflow-y: auto
}

.log-entry {
    display: grid;
    grid-template-columns: 80px 1fr 2fr;
    gap: 15px;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 28px;
    border: 1px solid var(--border-color);
    font-size: .9em
}

.log-time {
    color: var(--text-muted);
    font-weight: 600
}

.log-user {
    color: var(--text-main);
    font-weight: 500
}

.log-action {
    color: var(--text-primary);
    text-align: right;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background: radial-gradient(circle, var(--bg-tertiary) 0%, var(--bg-dark) 100%);
    color: var(--text-main);
    font-family: var(--font-ui);
    height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 60px 1fr;
    overflow: hidden
}

aside {
    background-color: transparent;
    border-right: 1px solid var(--border);
    padding: 20px 0;
    grid-row: 2;
    overflow-y: auto;
    background: radial-gradient(circle, var(--bg-tertiary) 0%, var(--bg-dark) 100%);
}

.nav-group {
    margin-bottom: 20px
}

.nav-title {
    padding: 0 20px 10px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 700
}

.nav-item {
    padding: 10px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--text-muted);
    transition: .2s;
    font-size: 16px;
    border-left: 3px solid transparent;
    font-weight: 600;
    position: relative;
}

.nav-item:hover {
    color: var(--text-main);
    background: var(--bg-lighter)
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-dim);
    border-left-color: var(--accent)
}

.nav-item i {
    width: 16px;
    text-align: center
}

/* Pending richieste badge */
.nav-item .nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: var(--danger, #e74c3c);
    border-radius: 9px;
    line-height: 1;
    animation: badge-pulse 2s ease-in-out infinite;
}

.nav-item .nav-badge.nav-badge--top {
    position: absolute;
    top: 6px;
    right: 16px;
    margin-left: 0;
}

.nav-item .nav-badge.hidden {
    display: none;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 4px rgba(231, 76, 60, 0);
    }
}

main {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.views-container {
    flex: 1;
    position: relative;
    min-height: -webkit-fill-available;
    height: -webkit-fill-available;
}

.view-section {
    display: none;
    flex: 1;
    height: 100%;
    overflow: auto;
    padding: 0;
    background: radial-gradient(circle, var(--bg-tertiary) 0%, var(--bg-dark) 100%);
    min-height: calc(100svh - 60px);
}

.view-section.active {
    display: block
}

.view-section#view-dashboard{
    background: radial-gradient(circle, var(--bg-tertiary) 0%, var(--bg-dark) 100%);
}

#view-dna {
    position: relative
}

.dna-canvas {
    width: 100%;
    height: 100%;
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 20px 20px;
    position: relative;
    overflow: hidden;
    animation: fade 1s ease;
    min-height: calc(100vh - 60px);
}

.dna-canvas-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1
}

.dna-links path.active {
    stroke-opacity: .85;
    stroke-width: 2.5
}

.node {
    position: absolute;
    width: 280px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    z-index: 0
}

.node.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent)
}

.node-header {
    padding: 10px;
    /* background:var(--bg-lighter); */
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    cursor: move;
    touch-action: none;
    border-radius: 26px;
    padding: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

.node-body {
    padding: 20px;
}

.relation-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    display: inline-block
}

.dna-modal {
    position: absolute;
    top: 80px;
    right: 12px;
    width: 380px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    z-index: 6
}

.dna-modal .modal-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700
}

.dna-modal .modal-body {
    padding: 12px;
    max-height: 60vh;
    overflow: auto
}

.dna-modal .modal-row {
    display: grid;
    grid-template-columns: 1fr 120px 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px
}

.dna-modal input,
.dna-modal select {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-dark);
    color: var(--text-main)
}

.dna-modal .modal-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px
}

.dna-modal .lock {
    color: var(--warning);
    font-size: 12px
}

.oracle-bar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    background: rgba(26, 29, 35, .9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    border-radius: 50px;
    padding: 5px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 0 20px rgba(0, 240, 255, .1)
}

.oracle-input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    padding: 15px;
    font-size: 14px
}

.oracle-btn {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    font-size: 12px
}

.grid-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center
}

.btn {
    padding: 8px 16px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px
}

.btn-primary {
    background: var(--accent);
    color: #000;
    border: none;
    font-weight: 600
}

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

.data-table th {
    text-align: left;
    padding: 15px 20px;
    color: var(--text-muted);
    font-size: 12px;
    border-bottom: 1px solid var(--border)
}

.data-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px
}

.tag {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600
}

.tag.green {
    background: rgba(46, 213, 115, .2);
    color: #00aa66
}

.tag.blue {
    background: rgba(0, 240, 255, .1);
    color: var(--accent)
}

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

.dna-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px
}

.dna-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px
}

.dna-card {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
    border: 1px solid var(--border)
}

.dna-card h3 {
    margin-top: 0;
    color: var(--text-main);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 10px
}

.rule-item {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin: 17px 0;
    flex-direction: column;
}

.justify-content-between {
    display: flex;
    justify-content: space-between;
}

.entity-list {
    list-style: none;
    padding: 0
}

.entity-item {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center
}

.entity-item:last-child {
    border-bottom: none
}

.btn-dna {
    background: var(--accent);
    color: var(--text-secondary);
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    margin: 5px;
    font-weight: 600;
    transition: all ease .5s;
}

.btn-dna.secondary {
    background: var(--bg-lighter);
    color: var(--text-main)
}

.btn-dna.secondary:hover {
    background: var(--border)
}

.sample-generator {
    background: var(--bg-lighter);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--border)
}

.field-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px
}

.field-row input,
.field-row select {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: var(--bg-dark);
    color: var(--text-main)
}

.gate-help {
    color: var(--text-muted);
    margin-bottom: 10px;
}

.hidden-file-input {
    display: none
}

.node-immobili {
    top: 100px;
    left: 100px
}

.node-agenti {
    top: 300px;
    left: 500px
}

.oracle-icon {
    color: var(--warning);
    margin-right: 10px
}

.sample-status {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted)
}

.flex-col-10 {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px;
    animation: fade 1s ease;
}

.widget {
    background: radial-gradient(circle, var(--bg-panel) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    padding: 20px
}

.widget h3 {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase
}

.widget .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main)
}

.widget .trend {
    font-size: 12px;
    color: var(--accent);
    margin-top: 5px
}

trademark{
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 50%;
    right: 0;
    left: 0;
    flex-direction: column-reverse;
    font-family: 'Whisper';
    opacity: 1;
    pointer-events: none;
    z-index: 0;
    text-align: center;
    width: 100%;
    opacity: 1;
    animation: fadeIn 3s ease infinite alternate;
}
trademark mc-ico:before, trademark mc-ico:after, trademark mc-ico-parallel:after, trademark mc-ico-parallel:before{
    background: var(--text-muted);
}

trademark span{
     font-family: var(--font-cursive);
     font-size: 28px;
     color: var(--text-muted);
     letter-spacing: 7px;
}

trademark span span:before{
    content:'';
    display:block;
    padding:30px;
    position:absolute;
    background: var(--text-muted);
    margin:0 auto;
    transform:translate(-50%, 0);
    left:50%;
    z-index:-1;
    opacity: 0.3;
    filter: blur(30px);
    -webkit-filter: blur(30px);
    top:0;
    will-change: blur;
}

trademark span span{
     display:block;
     font-family: var(--font-sans);
     font-size: 15px;
     letter-spacing: 0px;
     color: var(--accent);
}


* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary)
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px
}

*::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 8px
}

.module-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px
}

.module-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px
}

.module-header p {
    color: var(--text-muted);
    margin: 0
}

.module-toolbar {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    position: sticky;
    top: 0;
    z-index: 4
}

.btn-module {
    padding: 8px 14px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-module.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
}

.btn-module i {
    margin-right: 6px
}

.btn-module.btn-icon i {
    margin-right: 0;
}

.btn-module[disabled] {
    opacity: .5;
    cursor: not-allowed
}

.module-content {
    padding: 20px
}

.module-grid {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden
}

.contact-card-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    margin-top: 10px;
}

.contact-card-summary-list {
    display: grid;
    gap: 8px
}

.contact-card-summary-row {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-main)
}

.contact-card-summary-empty {
    color: var(--text-muted)
}

.contact-card-editor-wrap {
    display: grid;
    gap: 16px
}

.contact-card-editor {
    padding: 16px
}

.about-gallery-wrap {
    display: grid;
    gap: 0;
}

.about-gallery-card {
    padding: 12px
}

.about-gallery-card .mc-row {
    margin-bottom: 8px
}

.about-gallery-card .action-row {
    gap: 6px;
    flex-wrap: wrap
}

.about-gallery-card img {
    max-width: 160px !important;
    max-height: 110px !important;
    margin-top: 20px;
}

.legal-page-card {
    padding: 18px
}

.legal-chapters-wrap {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.legal-chapter-card {
}

.legal-chapter-card .mc-row textarea{
    min-height: 280px;
}

.alert {
    border: 1px solid var(--danger) !important;
    box-shadow: 0 0 0 1px var(--danger) !important;
}

.required-mark {
    color: var(--danger);
    margin-left: 4px;
    font-weight: bold;
}

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

.grid-table thead th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 12px;
    border-bottom: 1px solid var(--border)
}

.grid-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-main)
}

.grid-table .grid-empty td {
    text-align: center;
    color: var(--text-muted)
}

.module-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 14px
}

.module-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-lighter);
    color: var(--accent)
}

.module-actions {
    margin-left: auto
}

.nav-item.disabled {
    opacity: .6;
    pointer-events: none
}

/* Removed row-actions to avoid conflict with dna-modal.css */
/* .row-actions{display:flex;gap:8px;align-items:center;justify-content:flex-start} */
/* .row-action-btn{padding:6px 10px;border:1px solid var(--border);background:var(--bg-lighter);color:var(--text-main);border-radius:12px;cursor:pointer;font-size:12px} */
/* .row-action-btn i{pointer-events:none} */
*::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
    border: 2px solid var(--bg-tertiary)
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary)
}

*::-webkit-scrollbar-corner {
    background: var(--bg-tertiary)
}

@media (max-width: 520px) {
    #toolbar {
        border: none;
        border-radius: 16px;
        padding: 12px;
        background: transparent;
    }

}

@keyframes fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* DNA Center - SVG Connections */
.dna-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 2000px;
    height: 2000px;
    pointer-events: none;
    z-index: 0;
}

.connection-line {
    stroke-width: 2;
    fill: none;
    opacity: 0.7;
    transition: stroke-opacity 0.2s ease, stroke-width 0.2s ease;
}

/* Hover effects for connections */
path.active {
    stroke-opacity: 1 !important;
    stroke-width: 2.5 !important;
}

.node.active {
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.5);
    transform: scale(1.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* AUDIT LOG STYLES */
#audit-log-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    max-height: 600px;
    overflow-y: auto;
}

.audit-entry {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    transition: all 0.2s ease;
}

.audit-entry:hover {
    background: var(--bg-primary);
}

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

/* Audit Log Styles */
.audit-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.audit-filters {
    display: flex;
    gap: 8px;
}

.audit-input {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 16px;
    /* User requested 16px */
    transition: border-color 0.2s;
}

select.audit-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 30px;
}

.audit-input:focus {
    border-color: var(--accent);
    outline: none;
}

.audit-search {
    width: 140px;
}

/* Geo Card Styles */
.geo-card-small {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border-radius: 8px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
}

.geo-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 158, 255, 0.1);
    color: var(--accent);
    border-radius: 6px;
    flex-shrink: 0;
}

.geo-info {
    overflow: hidden;
}

.geo-address {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.geo-city {
    font-size: 11px;
    color: var(--text-muted);
}

.geo-detail-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

.geo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-main);
}

.geo-coords {
    margin-top: 8px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* HYDRA: Geo Detail Card Compact */
.geo-detail-card.compact {
    padding: 10px 14px;
}

.geo-detail-card.compact .geo-header {
    font-size: 14px;
}

.geo-detail-card .geo-locality {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

/* HYDRA: JSON Viewer Detail Styles */
.json-viewer-detail {
    width: 100%;
}

.json-kv-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.json-kv-item {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-light);
}

.json-kv-item:last-child {
    border-bottom: none;
}

.json-kv-key {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 120px;
}

.json-kv-value {
    color: var(--text-main);
    font-size: 13px;
    word-break: break-word;
}

/* HYDRA: Toggle Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(40, 167, 69, 0.15);
    color: var(--success-text);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.badge-secondary {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.badge-primary {
    background: rgba(0, 123, 255, 0.15);
    color: #007bff;
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.badge-warning {
    background: rgba(255, 193, 7, 0.15);
    color: #d39e00;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.badge-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.badge-info {
    background: rgba(23, 162, 184, 0.15);
    color: #17a2b8;
    border: 1px solid rgba(23, 162, 184, 0.3);
}

.audit-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.audit-badge.users {
    background: rgba(0, 188, 212, 0.15);
    color: #00bcd4;
    border: 1px solid #00bcd4;
}

.audit-badge.rbac {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1px solid #4caf50;
}

.audit-badge.security {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
    border: 1px solid #f44336;
}

.audit-badge.vault {
    background: rgba(156, 39, 176, 0.15);
    color: #9c27b0;
    border: 1px solid #9c27b0;
}

.audit-badge.system {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
    border: 1px solid #ff9800;
}

.audit-badge.general {
    background: rgba(158, 158, 158, 0.15);
    color: #9e9e9e;
    border: 1px solid #9e9e9e;
}

.audit-badge i {
    font-size: 12px;
}

/* ==========================================================================
   SEMANTIC BADGE CLASSES - Domain-specific badges for LANA/SAMI
   ========================================================================== */

/* --- Contract Types --- */
.badge-contratto-acquisto {
    background: rgba(0, 170, 102, 0.15);
    color: #00aa66;
    border: 1px solid rgba(0, 170, 102, 0.3);
}

.badge-contratto-vendita {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.badge-contratto-affitto {
    background: rgba(111, 66, 193, 0.15);
    color: #6f42c1;
    border: 1px solid rgba(111, 66, 193, 0.3);
}

/* --- Urgency Levels --- */
.badge-urgenza-alta {
    background: rgba(231, 74, 59, 0.15);
    color: #e74a3b;
    border: 1px solid rgba(231, 74, 59, 0.3);
}

.badge-urgenza-media {
    background: rgba(246, 194, 62, 0.15);
    color: #d39e00;
    border: 1px solid rgba(246, 194, 62, 0.3);
}

.badge-urgenza-bassa {
    background: rgba(54, 185, 204, 0.15);
    color: #36b9cc;
    border: 1px solid rgba(54, 185, 204, 0.3);
}

/* --- Financing Types --- */
.badge-finanz-cash {
    background: rgba(0, 170, 102, 0.15);
    color: #00aa66;
    border: 1px solid rgba(0, 170, 102, 0.3);
}

.badge-finanz-mutuo-ok {
    background: rgba(54, 185, 204, 0.15);
    color: #36b9cc;
    border: 1px solid rgba(54, 185, 204, 0.3);
}

.badge-finanz-mutuo-pending {
    background: rgba(246, 194, 62, 0.15);
    color: #d39e00;
    border: 1px solid rgba(246, 194, 62, 0.3);
}

.badge-finanz-vendita-prima {
    background: rgba(231, 74, 59, 0.15);
    color: #e74a3b;
    border: 1px solid rgba(231, 74, 59, 0.3);
}

/* --- Request/Demand States --- */
.badge-stato-attiva {
    background: rgba(0, 170, 102, 0.15);
    color: #00aa66;
    border: 1px solid rgba(0, 170, 102, 0.3);
}

.badge-stato-sospesa {
    background: rgba(255, 215, 0, 0.15);
    color: #b8860b;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.badge-stato-evasa {
    background: rgba(65, 105, 225, 0.15);
    color: #4169e1;
    border: 1px solid rgba(65, 105, 225, 0.3);
}

.badge-stato-annullata {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* --- Appointment States --- */
.badge-app-da-confermare {
    background: rgba(255, 215, 0, 0.15);
    color: #b8860b;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.badge-app-confermato {
    background: rgba(0, 170, 102, 0.15);
    color: #00aa66;
    border: 1px solid rgba(0, 170, 102, 0.3);
}

.badge-app-completato {
    background: rgba(54, 185, 204, 0.15);
    color: #36b9cc;
    border: 1px solid rgba(54, 185, 204, 0.3);
}

.badge-app-annullato {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* --- Request Types (SAMI) --- */
.badge-tipo-acquisto {
    background: rgba(23, 162, 184, 0.15);
    color: #17a2b8;
    border: 1px solid rgba(23, 162, 184, 0.3);
}

.badge-tipo-vendita {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.badge-tipo-valutazione {
    background: rgba(111, 66, 193, 0.15);
    color: #6f42c1;
    border: 1px solid rgba(111, 66, 193, 0.3);
}

.badge-tipo-affitto-cerca {
    background: rgba(253, 126, 20, 0.15);
    color: #fd7e14;
    border: 1px solid rgba(253, 126, 20, 0.3);
}

.badge-tipo-affitto-propone {
    background: rgba(32, 201, 151, 0.15);
    color: #20c997;
    border: 1px solid rgba(32, 201, 151, 0.3);
}

/* --- Quiz Paths --- */
.badge-percorso-immobile {
    background: rgba(54, 185, 204, 0.15);
    color: #36b9cc;
    border: 1px solid rgba(54, 185, 204, 0.3);
}

.badge-percorso-caratteristiche {
    background: rgba(246, 194, 62, 0.15);
    color: #d39e00;
    border: 1px solid rgba(246, 194, 62, 0.3);
}

.badge-percorso-valutazione {
    background: rgba(28, 200, 138, 0.15);
    color: #1cc88a;
    border: 1px solid rgba(28, 200, 138, 0.3);
}

.badge-percorso-vendita {
    background: rgba(231, 74, 59, 0.15);
    color: #e74a3b;
    border: 1px solid rgba(231, 74, 59, 0.3);
}

.badge-percorso-affitto {
    background: rgba(111, 66, 193, 0.15);
    color: #6f42c1;
    border: 1px solid rgba(111, 66, 193, 0.3);
}

/* --- Property Contract Types --- */
.badge-contratto-prop-vendita {
    background: rgba(0, 170, 102, 0.15);
    color: #00aa66;
    border: 1px solid rgba(0, 170, 102, 0.3);
}

.badge-contratto-prop-affitto {
    background: rgba(111, 66, 193, 0.15);
    color: #6f42c1;
    border: 1px solid rgba(111, 66, 193, 0.3);
}

.badge-contratto-prop-gestione {
    background: rgba(54, 185, 204, 0.15);
    color: #36b9cc;
    border: 1px solid rgba(54, 185, 204, 0.3);
}

/* --- Property Workflow States --- */
.badge-workflow-valutazione {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.badge-workflow-incarico-attivo {
    background: rgba(0, 170, 102, 0.15);
    color: #00aa66;
    border: 1px solid rgba(0, 170, 102, 0.3);
}

.badge-workflow-proposta {
    background: rgba(255, 215, 0, 0.15);
    color: #b8860b;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.badge-workflow-venduto {
    background: rgba(65, 105, 225, 0.15);
    color: #4169e1;
    border: 1px solid rgba(65, 105, 225, 0.3);
}

.badge-workflow-affittato {
    background: rgba(54, 185, 204, 0.15);
    color: #36b9cc;
    border: 1px solid rgba(54, 185, 204, 0.3);
}

.badge-workflow-sospeso {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* --- Activity Types (Agenda) --- */
.badge-attivita-appuntamento {
    background: rgba(0, 128, 128, 0.15);
    color: teal;
    border: 1px solid rgba(0, 128, 128, 0.3);
}

.badge-attivita-visita {
    background: rgba(65, 105, 225, 0.15);
    color: #4169e1;
    border: 1px solid rgba(65, 105, 225, 0.3);
}

.badge-attivita-acquisizione {
    background: rgba(255, 215, 0, 0.15);
    color: #b8860b;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.badge-attivita-stipula {
    background: rgba(0, 170, 102, 0.15);
    color: #00aa66;
    border: 1px solid rgba(0, 170, 102, 0.3);
}

.badge-attivita-followup {
    background: rgba(128, 0, 128, 0.15);
    color: purple;
    border: 1px solid rgba(128, 0, 128, 0.3);
}

.badge-attivita-notaio {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.badge-attivita-consegna {
    background: rgba(52, 58, 64, 0.15);
    color: #343a40;
    border: 1px solid rgba(52, 58, 64, 0.3);
}

.badge-attivita-informazioni {
    background: rgba(23, 162, 184, 0.15);
    color: #17a2b8;
    border: 1px solid rgba(23, 162, 184, 0.3);
}

/* --- Context Types (Agenda) --- */
.badge-contesto-generale {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.badge-contesto-immobile {
    background: rgba(65, 105, 225, 0.15);
    color: #4169e1;
    border: 1px solid rgba(65, 105, 225, 0.3);
}

.badge-contesto-cliente {
    background: rgba(128, 0, 128, 0.15);
    color: purple;
    border: 1px solid rgba(128, 0, 128, 0.3);
}

.badge-contesto-trattativa {
    background: rgba(0, 170, 102, 0.15);
    color: #00aa66;
    border: 1px solid rgba(0, 170, 102, 0.3);
}

/* --- SAMI Request States --- */
.badge-sami-nuova {
    background: rgba(23, 162, 184, 0.15);
    color: #17a2b8;
    border: 1px solid rgba(23, 162, 184, 0.3);
}

.badge-sami-lavorazione {
    background: rgba(255, 193, 7, 0.15);
    color: #d39e00;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.badge-sami-trasferita {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.badge-sami-archiviata {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.audit-time {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.audit-message {
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    padding: 4px 0;
}

.audit-meta {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.audit-user {
    color: var(--accent);
    font-weight: 600;
}

/* UNIT-734: Standard Badge Style */
.dna-badge {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    display: flex;
}

/* Badge with icon */
.dna-badge i {
    margin-right: 4px;
}

/* Badge color variants - use CSS custom properties for dynamic colors */
.dna-badge[data-color] {
    background-color: var(--badge-bg);
    color: var(--badge-text, #fff);
    border-color: var(--badge-bg);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--badge-bg) 30%, transparent);
}

/* Predefined badge colors */
.dna-badge--success { background-color: #00aa66; color: #fff; border-color: #00aa66; }
.dna-badge--warning { background-color: #ffd700; color: #000; border-color: #ffd700; }
.dna-badge--danger { background-color: #dc3545; color: #fff; border-color: #dc3545; }
.dna-badge--info { background-color: #36b9cc; color: #fff; border-color: #36b9cc; }
.dna-badge--primary { background-color: #4e73df; color: #fff; border-color: #4e73df; }
.dna-badge--secondary { background-color: #6c757d; color: #fff; border-color: #6c757d; }
.dna-badge--purple { background-color: #6f42c1; color: #fff; border-color: #6f42c1; }
.dna-badge--orange { background-color: #f6c23e; color: #000; border-color: #f6c23e; }
.dna-badge--red { background-color: #e74a3b; color: #fff; border-color: #e74a3b; }

/* UNIT-734: Money Format */
.dna-money {
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: .66px;
}

.detail-view .dna-money {
    color: var(--accent);
    font-weight: 700;
}


/* ===========================================
   UNIT-734: MOBILE SHELL TRANSFORM
   =========================================== */
@media (max-width: 768px) {

    /* Layout Reset */
    .app-container {
        display: flex;
        flex-direction: column;
        height: 100vh;
    }

    /* Compact Header */
    header {
        position: sticky;
        top: 0;
        z-index: 1100;
        height: 60px;
        padding: 0 15px;
        backdrop-filter: blur(33px);
        -webkit-backdrop-filter: blur(33px);
        will-change: blur;
    }

    header .brand {
        font-size: 16px;
        position: absolute;
        left: 70px;
    }

    header .session-bar {
        gap: 8px;
    }

    /* Burger Menu Toggle */
    #burger_btn {
        display: flex !important;
        /* Force show */
        background: transparent;
        border: none;
        color: var(--text-main);
        font-size: 20px;
        cursor: pointer;
        padding: 10px;
        margin-right: 10px;
    }

    /* Aside (Sidebar) as Overlay */
    aside {
        position: fixed;
        top: 60px;
        /* Below header */
        left: -100%;
        /* Hidden by default */
        width: 80%;
        height: calc(100vh - 60px);
        border-right: 1px solid var(--border);
        transition: left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        z-index: 1050;
        box-shadow: 10px 0 30px rgb(0 0 0 / 9%);
        background: radial-gradient(circle, var(--bg-tertiary) 0%, var(--bg-dark) 100%);
        will-change: blur;
    }

    aside.active {
        left: 0;
        overflow-y: auto;
    }

    /* Overlay Backdrop */
    .aside-backdrop {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgb(0 0 0 / 11%);
        backdrop-filter: blur(2px);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .aside-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Main Content Adjustments */
    main {
        padding: 0;
        overflow-x: hidden;
    }

    /* Full Screen Modals */
    .modal-content,
    .dna-modal-content {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        padding: 0;
        flex: 1;
        overflow-y: auto;
    }

    .modal-body .module-form {
        padding: 20px;
    }

    /* Modal Close Button - Make it HUGE */
    .close-modal,
    .dna-modal-close {
        position: absolute;
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        background: rgba(255, 0, 0, 0.1);
        border-radius: 50%;
        color: var(--danger-text);
        z-index: 10;
    }

    /* Keymaster Grid on Mobile */
    .keymaster-grid {
        display: flex;
        flex-direction: column;
    }
    

    .audit-header-container{
        display:flex;
        flex-direction: column;
        padding-top:20px;
    }

    .audit-log{
        padding:0
    }
    
    .km-actions{
        display: flex;
        flex-direction: column;
    }

    /* Hide less important elements in header */
    .toolbar .left {
        display: none;
        /* Hide status pills to save space */
    }
}

/* UNIT-734: Virtual Engine Node Style */
.node-virtual {
    border-color: var(--accent);
    background: radial-gradient(circle at top left, var(--bg-panel), rgba(74, 158, 255, 0.1));
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.2);
}

.node-virtual .node-header {
    background: linear-gradient(90deg, rgba(74, 158, 255, 0.1), transparent);
    color: var(--accent);
    border-bottom-color: rgba(74, 158, 255, 0.3);
}

/* UNIT-734: UI Type Visualizations (Form Context) */
.match-score-wrapper,
.status-dot-wrapper,
.pipeline-step-wrapper {
    font-size: 14px;
}

/* ===========================================
   GALLERY DETAIL VIEW (ui_type: gallery)
   =========================================== */

.gallery-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.gallery-detail-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    background: var(--bg-dark);
}

.gallery-detail-item:hover {
    border-color: var(--accent);
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-detail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-detail-more {
    aspect-ratio: 1;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-detail-more:hover {
    border-color: var(--accent);
    background: var(--bg-panel);
}

.gallery-detail-more span {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
}

.gallery-detail-footer {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.gallery-detail-footer i {
    color: var(--accent);
}

/* ===========================================
   GALLERY LIGHTBOX OVERLAY
   =========================================== */

.gallery-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    animation: lightboxFadeIn 0.2s ease;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gallery-lightbox-overlay .lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.gallery-lightbox-overlay .lightbox-counter {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    font-family: var(--font-mono, monospace);
}

.gallery-lightbox-overlay .lightbox-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.gallery-lightbox-overlay .lightbox-close:hover {
    background: white;
    color: black;
}

.gallery-lightbox-overlay .lightbox-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.gallery-lightbox-overlay .lightbox-image-wrapper {
    max-width: 85%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox-overlay .lightbox-main-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.gallery-lightbox-overlay .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.gallery-lightbox-overlay .lightbox-nav:hover {
    background: var(--accent);
    color: black;
    border-color: var(--accent);
}

.gallery-lightbox-overlay .lightbox-nav.prev {
    left: 20px;
}

.gallery-lightbox-overlay .lightbox-nav.next {
    right: 20px;
}

.gallery-lightbox-overlay .lightbox-thumbnails {
    display: flex;
    gap: 8px;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.6);
    overflow-x: auto;
    justify-content: center;
}

.gallery-lightbox-overlay .lightbox-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.gallery-lightbox-overlay .lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-lightbox-overlay .lightbox-thumb:hover {
    border-color: rgba(255,255,255,0.5);
}

.gallery-lightbox-overlay .lightbox-thumb.active {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.5);
}
