/* ==========================================================================
   EcoGrid AI: Federated Consensus - Stylesheet
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #ca8a04;
    --warning-hover: #a16207;
    --warning-light: #fffbeb;
    --error: #dc2626;
    --error-light: #fee2e2;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --node-bg: #f1f5f9;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.5;
}

/* --- Header --- */
header {
    text-align: center;
    margin-bottom: 25px;
    width: 100%;
    max-width: 1400px;
}

h1 {
    margin: 0;
    color: var(--primary);
    font-size: 2.2rem;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 6px;
    font-size: 1rem;
}

.badge {
    background: #dbeafe;
    color: var(--primary);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    margin-top: 10px;
}

/* --- Sync Status Indicator --- */
.sync-indicator {
    background: var(--card);
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.sync-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: background-color 0.3s;
}

.sync-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.sync-dot.offline {
    background: var(--error);
    box-shadow: 0 0 8px var(--error);
}

/* --- Flow Diagram --- */
.flow-diagram-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin-bottom: 25px;
    padding: 20px;
    background: var(--card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.flow-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.flow-node {
    width: 110px;
    height: 65px;
    background: var(--node-bg);
    border: 2px solid var(--border-dark);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    transition: all 0.3s;
    position: relative;
    z-index: 2;
}

.flow-node.user-input {
    border-color: var(--primary);
    background: var(--primary-light);
}

.flow-node.db-check {
    border-color: var(--text-muted);
    background: var(--bg);
}

.flow-node.ai-agent {
    border-color: var(--warning);
    background: var(--warning-light);
}

.flow-node.active {
    box-shadow: 0 0 16px currentColor;
    transform: scale(1.05);
    z-index: 3;
}

.status-indicator {
    font-size: 0.7rem;
    margin-top: 4px;
    color: var(--text-muted);
    font-weight: 500;
}

.flow-line {
    height: 6px;
    background: var(--border);
    width: 100%;
    margin: 25px 0;
    position: relative;
    border-radius: 3px;
    overflow: hidden;
    display: none;
}

.data-packet {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    box-shadow: 0 0 10px currentColor;
    z-index: 10;
    animation: movePacket 2s linear infinite;
}

.data-packet.default {
    background: var(--primary);
    color: var(--primary);
}

.data-packet.processing {
    background: var(--warning);
    color: var(--warning);
}

.data-packet.success {
    background: var(--success);
    color: var(--success);
}

@keyframes movePacket {
    0% {
        left: 0;
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }
    10% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    90% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    100% {
        left: 100%;
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }
}

.flow-nodes-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

.mini-node {
    width: 44px;
    height: 32px;
    background: var(--node-bg);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.3s;
}

.mini-node.received {
    background: #dcfce7;
    border-color: var(--success);
    color: var(--success);
    transform: scale(1.15);
    box-shadow: 0 0 10px var(--success);
}

/* --- Network Grid Layout --- */
.network-container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin-bottom: 25px;
    gap: 20px;
    align-items: flex-start;
}

#node-1 {
    flex: 1;
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    border-left: 5px solid var(--primary);
}

#node-1 .chat-wrapper {
    max-height: 520px;
    opacity: 1;
    display: block;
}

#node-1 .chat-history {
    height: 460px;
}

.right-sidebar {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.node-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-left: 5px solid var(--primary);
    transition: all 0.3s ease;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.node-id {
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.node-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--border);
    font-weight: 600;
}

.node-status.active {
    background: #dcfce7;
    color: var(--success);
}

.node-status.sleeping {
    background: var(--error-light);
    color: var(--error);
}

.expand-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.chat-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease;
    opacity: 0;
    margin-top: 0;
}

.node-card.expanded .chat-wrapper {
    max-height: 380px;
    opacity: 1;
    margin-top: 12px;
}

.node-card.expanded .expand-icon {
    transform: rotate(90deg);
}

.node-card.expanded {
    border-left-color: var(--success);
    box-shadow: var(--shadow-md);
}

/* --- Chat Messages --- */
.chat-history {
    height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    font-size: 0.85rem;
    padding-right: 5px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dark) var(--node-bg);
}

.msg {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    line-height: 1.4;
    word-break: break-word;
    align-self: flex-start;
    animation: fadeIn 0.3s ease;
}

.msg.user {
    align-self: flex-end;
    background: var(--node-bg);
    color: var(--text);
    text-align: right;
    border-bottom-right-radius: 2px;
}

.msg.ai {
    align-self: flex-start;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 2px;
}

.msg.ai.learning {
    border-color: var(--warning);
    background: var(--warning-light);
}

.msg.ai.consensus-card {
    border: 2px solid var(--success);
    background: var(--success-light);
    padding: 14px;
    border-radius: var(--radius-lg);
    width: 100%;
}

.msg.ai.error-msg {
    border-color: var(--error);
    background: var(--error-light);
    color: var(--error);
    font-weight: 500;
}

/* --- Consensus Best Answer Card Components --- */
.consensus-question-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.best-answer-box {
    position: relative;
    background: var(--card);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 2px solid var(--success);
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.08);
}

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

.best-answer-badge {
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--success);
}

.model-tag {
    font-size: 0.75rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.best-answer-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.votes-summary {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.vote-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
}

/* --- Accordion Alternatives --- */
.accordion {
    background-color: var(--node-bg);
    color: var(--text);
    cursor: pointer;
    padding: 10px 14px;
    width: 100%;
    border: 1px solid var(--border);
    text-align: left;
    outline: none;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

.accordion:hover {
    background-color: var(--border);
}

.accordion::after {
    content: '+';
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-muted);
}

.accordion.active::after {
    content: '−';
}

.accordion-container {
    display: none;
    padding: 10px;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: fadeIn 0.2s ease;
}

.accordion-container.show {
    display: block;
}

.alt-option {
    background: var(--card);
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alt-option:last-child {
    margin-bottom: 0;
}

.alt-option-text {
    font-weight: 600;
    color: var(--text);
}

.alt-option .votes-row {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.votes-yes {
    color: var(--success);
    font-weight: bold;
}

.votes-no {
    color: var(--error);
    font-weight: bold;
}

/* --- Buttons --- */
button {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: var(--text-subtle);
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

.vote-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
}

.vote-btn.yes {
    background: var(--success);
}
.vote-btn.yes:hover {
    background: #15803d;
}

.vote-btn.no {
    background: var(--error);
}
.vote-btn.no:hover {
    background: #b91c1c;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border-dark);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    transition: all 0.2s;
}

.icon-btn.yes {
    border-color: var(--success);
    color: var(--success);
}
.icon-btn.yes:hover {
    background: var(--success);
    color: white;
}

.icon-btn.no {
    border-color: var(--error);
    color: var(--error);
}
.icon-btn.no:hover {
    background: var(--error);
    color: white;
}

.btn-secondary {
    background: var(--text-muted);
}
.btn-secondary:hover {
    background: #475569;
}

.btn-warning {
    background: var(--warning);
}
.btn-warning:hover {
    background: var(--warning-hover);
}

/* --- Control Panel --- */
.control-panel {
    background: var(--card);
    padding: 24px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 1400px;
    text-align: center;
    border: 1px solid var(--border);
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--primary);
}

.energy-meter {
    margin-top: 15px;
    background: #e0f2fe;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.energy-bar {
    flex: 1;
    height: 12px;
    background: #bae6fd;
    border-radius: 6px;
    overflow: hidden;
}

.energy-fill {
    height: 100%;
    background: var(--success);
    width: 100%;
    transition: width 0.5s ease-out, background-color 0.3s;
}

.network-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

/* --- Rejection / Prompt Menus --- */
.action-box {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.action-box-title {
    font-weight: 700;
    text-align: center;
    color: var(--text);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Spinners & Loaders --- */
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-loader {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: fit-content;
    margin-bottom: 10px;
    animation: fadeIn 0.4s ease;
}

.loader-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulseDot 1.4s infinite ease-in-out;
}

.loader-dot:nth-child(2) { animation-delay: 0.2s; }
.loader-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulseDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

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

/* --- Info Button & Tooltip --- */
.info-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s, color 0.2s;
}

.info-btn:hover {
    background: var(--node-bg);
    color: var(--primary);
    transform: none;
}

.info-tooltip {
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    width: 290px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 12px;
    z-index: 100;
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.4;
    display: none;
    flex-direction: column;
    gap: 6px;
}

.info-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent var(--border) transparent;
}

.info-tooltip.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.info-tooltip strong {
    color: var(--primary);
    font-size: 0.85rem;
}

/* --- Responsive Adjustments --- */
@media (max-width: 992px) {
    .network-container {
        flex-direction: column;
    }
    .right-sidebar {
        width: 100%;
        flex: none;
    }
    #node-1 .chat-history {
        height: 350px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    h1 {
        font-size: 1.6rem;
    }
    .input-group {
        flex-direction: column;
    }
    .flow-diagram-container {
        padding: 12px;
        flex-direction: column;
        gap: 15px;
    }
}

/* ==========================================================================
   Multi-View System & Authentication Styles
   ========================================================================== */

.view-section {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.3s ease;
}

.view-hidden,
.view-section.view-hidden,
.blocked-overlay.view-hidden,
.admin-modal-overlay.view-hidden,
.session-saving-overlay.view-hidden {
    display: none !important;
}

/* --- Top Navigation & Auth Bar --- */
.top-nav-bar {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
}

.user-badge {
    background: var(--card);
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-nav {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    transition: all 0.2s;
}

.btn-nav:hover {
    background: var(--node-bg);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-nav.btn-logout {
    color: var(--error);
    border-color: #fca5a5;
    background: #fef2f2;
}

.btn-nav.btn-logout:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* --- User Session Toolbar inside Workspace --- */
.user-session-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    background: var(--card);
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.user-session-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text);
}

.user-session-info strong {
    color: var(--primary);
    font-weight: 800;
}

.btn-logout-main {
    padding: 8px 18px;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-logout-main:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-logout-main:active {
    transform: translateY(0);
}

/* --- Landing Page (For Unauthenticated Users) --- */
.landing-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding-bottom: 40px;
}

.hero-box {
    background: var(--card);
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    text-align: center;
    max-width: 900px;
    width: 100%;
}

.hero-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 800;
    display: inline-block;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: 2.2rem;
    color: var(--text);
    margin: 0 0 16px 0;
    font-weight: 850;
    line-height: 1.25;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 auto 24px auto;
    max-width: 760px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1100px;
}

.feature-card {
    background: var(--card);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.feature-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}

.feature-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* --- Authentication Card on Landing --- */
.auth-box {
    background: var(--card);
    padding: 32px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 460px;
    margin-top: 10px;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    gap: 10px;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.form-input {
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--primary);
}

.auth-submit-btn {
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 8px;
}

.auth-submit-btn:hover {
    background: var(--primary-hover);
}

.auth-hint {
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    background: var(--node-bg);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* --- Registration Form Enhanced Styles --- */
.auth-box.reg-mode {
    max-width: 580px;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 560px) {
    .form-row-2col {
        grid-template-columns: 1fr;
    }
}

.reg-type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

.reg-type-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--node-bg);
    transition: all 0.2s ease;
}

.reg-type-card input[type="radio"] {
    display: none;
}

.reg-type-card.active {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.08);
}

.reg-type-icon {
    font-size: 1.4rem;
}

.reg-type-info {
    display: flex;
    flex-direction: column;
}

.reg-type-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.reg-type-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.reg-legal-block {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reg-legal-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.password-match-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.password-match-status.match {
    color: #059669;
    background: rgba(16, 185, 129, 0.1);
}

.password-match-status.mismatch {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.1);
}

.auth-alert-message {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-alert-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.2);
}

.admin-user-profile-details {
    background: rgba(241, 245, 249, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
}

.user-profile-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile-label {
    color: var(--text-muted);
    font-weight: 600;
    min-width: 130px;
}

.user-profile-val {
    color: var(--text);
    font-weight: 500;
}

.user-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-type-badge.individual {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.user-type-badge.legal {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

/* --- Auth Error Page --- */
.auth-error-container {
    width: 100%;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.auth-error-card {
    background: var(--card);
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--error);
    text-align: center;
    max-width: 520px;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.error-icon-large {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.error-title-large {
    font-size: 1.8rem;
    font-weight: 850;
    color: var(--error);
    margin: 0 0 12px 0;
}

.error-desc {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 28px 0;
}

.error-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-retry {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-retry:hover {
    background: var(--primary-hover);
}

.btn-back-landing {
    padding: 12px 20px;
    background: var(--node-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back-landing:hover {
    background: var(--border);
}

/* ==========================================================================
   ROLE BADGES & STATUS BADGES
   ========================================================================== */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}
.role-badge.role-admin {
    background: #f3e8ff;
    color: #7e22ce;
    border-color: #d8b4fe;
}
.role-badge.role-moderator {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}
.role-badge.role-user {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}
.status-badge.status-active {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.status-badge.status-blocked {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

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

.btn-admin-panel {
    padding: 8px 16px;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(124, 58, 237, 0.25);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-admin-panel:hover {
    background: linear-gradient(135deg, #6d28d9, #4338ca);
    box-shadow: 0 4px 8px rgba(124, 58, 237, 0.35);
    transform: translateY(-1px);
}

/* ==========================================================================
   BLOCKED STATE & OVERLAY
   ========================================================================== */
.interface-blocked {
    pointer-events: none !important;
    user-select: none !important;
    filter: grayscale(40%) blur(1.5px) !important;
    opacity: 0.6 !important;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.blocked-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}

.blocked-card {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    max-width: 540px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    border: 2px solid var(--error);
    pointer-events: auto !important;
    animation: scaleUp 0.25s ease;
}

.blocked-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.blocked-title {
    font-size: 1.6rem;
    font-weight: 850;
    color: var(--error);
    margin: 0 0 10px 0;
}

.blocked-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 18px 0;
    line-height: 1.4;
}

.blocked-reason-box {
    background: #fef2f2;
    border: 1px dashed #f87171;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    text-align: left;
    margin-bottom: 18px;
}

.blocked-reason-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #991b1b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.blocked-reason-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: #7f1d1d;
    word-break: break-word;
}

.blocked-notice {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 24px 0;
    line-height: 1.4;
}

.btn-blocked-logout {
    padding: 12px 28px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto !important;
    transition: background-color 0.2s;
}

.btn-blocked-logout:hover {
    background: #b91c1c;
}

/* ==========================================================================
   ADMIN MODAL & TABLE
   ========================================================================== */
.admin-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9500;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.admin-modal-content {
    background: var(--card);
    border-radius: var(--radius-xl);
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    animation: scaleUp 0.2s ease;
    overflow: hidden;
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: #faf5ff;
}

.admin-modal-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-modal-icon {
    font-size: 2rem;
}

.admin-modal-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: #581c87;
}

.admin-modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.admin-modal-close {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.admin-modal-close:hover {
    color: var(--error);
    background: var(--error-light);
}

.admin-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-stats-badge {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--node-bg);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.btn-admin-refresh {
    padding: 6px 14px;
    background: var(--card);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-admin-refresh:hover {
    background: var(--node-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.admin-table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.admin-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

.admin-table .user-col-name {
    font-weight: 700;
    color: var(--text);
}

.admin-table .user-col-desc {
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-table .user-col-reason {
    color: #991b1b;
    font-size: 0.82rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-actions-cell {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.btn-table-action {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-table-edit {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}
.btn-table-edit:hover {
    background: #dbeafe;
}

.btn-table-block {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}
.btn-table-block:hover {
    background: #fee2e2;
}

.btn-table-unblock {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}
.btn-table-unblock:hover {
    background: #dcfce7;
}

/* Edit User Panel */
.admin-edit-card {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    animation: fadeIn 0.2s ease;
}

.admin-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.admin-edit-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 750;
    color: var(--text);
}

.admin-edit-close {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
}

.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}

.admin-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.admin-form-group label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

.admin-select, .admin-input, .admin-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
}

.admin-select:focus, .admin-input:focus, .admin-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.admin-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.btn-admin-cancel {
    padding: 8px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.btn-admin-save {
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-admin-save:hover {
    background: var(--primary-hover);
}

.admin-alert {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    margin-bottom: 12px;
}

.admin-alert.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.admin-alert.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}



/* --- Admin Tabs --- */
.admin-tabs {
    display: flex;
    gap: 2px;
    background: var(--node-bg);
    padding: 4px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin-bottom: 15px;
}

.admin-tab {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-tab:hover {
    background: #e2e8f0;
}

.admin-tab.active {
    background: var(--card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content:not(.view-hidden) {
    display: block;
}

/* --- Roles & Modules Management --- */
.roles-modules-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.roles-list-panel {
    flex: 0 0 250px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 15px;
}

.roles-list-panel h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--text);
}

.roles-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-item {
    padding: 10px 15px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

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

.role-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.modules-mapping-panel {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.modules-mapping-panel h3, .modules-mapping-panel h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text);
}

.modules-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.module-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--card);
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

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

.module-details {
    display: flex;
    flex-direction: column;
}

.module-name {
    font-weight: 700;
    color: var(--text);
}

.module-code {
    font-size: 0.75rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: normal;
}

.module-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.skeleton {
    color: var(--text-subtle);
    font-style: italic;
    background: transparent;
    border: none;
}

/* ==========================================================================
   Accounting & Document Analysis Styles
   ========================================================================== */

.btn-accounting-panel {
    background: #059669;
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-accounting-panel:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.role-badge.role-accounting {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.role-badge.role-default {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.accounting-modal-content {
    max-width: 1000px !important;
    width: 95% !important;
}

.accounting-dropzone {
    border: 2px dashed #94a3b8;
    background: #f8fafc;
    border-radius: var(--radius-lg);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.accounting-dropzone:hover, .accounting-dropzone.dragover {
    border-color: #059669;
    background: #ecfdf5;
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.dropzone-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

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

.selected-file-badge {
    margin-top: 15px;
    background: #d1fae5;
    color: #065f46;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #a7f3d0;
}

.btn-file-remove {
    background: none;
    border: none;
    color: #065f46;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.btn-file-remove:hover {
    color: var(--error);
}

.prompt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 10px 0;
}

.prompt-chip {
    background: #e2e8f0;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.prompt-chip:hover {
    background: #059669;
    color: white;
    border-color: #059669;
}

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

.accounting-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 15px;
}

.accounting-loading-box {
    text-align: center;
    padding: 30px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-top: 20px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #e2e8f0;
    border-top-color: #059669;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px auto;
}

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

.accounting-result-box {
    margin-top: 25px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.accounting-tabs {
    display: flex;
    background: var(--node-bg);
    border-bottom: 1px solid var(--border);
}

.accounting-tab {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.accounting-tab:hover {
    background: #e2e8f0;
}

.accounting-tab.active {
    background: var(--card);
    color: #059669;
    border-bottom: 3px solid #059669;
}

.accounting-tab-pane {
    padding: 20px;
}

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

.meta-tag {
    font-size: 0.8rem;
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.btn-small-action {
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid var(--border-dark);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small-action:hover {
    background: #e2e8f0;
}

.ai-report-content {
    line-height: 1.7;
    font-size: 0.95rem;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-report-content h1, .ai-report-content h2, .ai-report-content h3 {
    color: #065f46;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
}

.ai-report-content strong {
    color: #0f172a;
}

.ai-report-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.ai-report-content th, .ai-report-content td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.ai-report-content th {
    background: #f8fafc;
    font-weight: 700;
}

.raw-data-content {
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius-md);
    max-height: 500px;
    overflow: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* --- Bank Statement & Action Hub Styles --- */
.accounting-mode-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.accounting-mode-btn {
    flex: 1;
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.accounting-mode-btn:hover {
    background: #e2e8f0;
    color: var(--text);
}

.accounting-mode-btn.active {
    background: #059669;
    color: white;
    border-color: #059669;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.bank-kpi-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.bank-kpi-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.bank-kpi-card .kpi-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.bank-kpi-card .kpi-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.bank-kpi-card.income .kpi-value {
    color: #16a34a;
}

.bank-kpi-card.outcome .kpi-value {
    color: #dc2626;
}

.bank-kpi-card.badge-card .kpi-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    background: #dcfce7;
    color: #15803d;
}

.bank-action-hub {
    padding: 16px 20px;
    background: #ecfdf5;
    border-bottom: 1px solid #a7f3d0;
}

.action-hub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 6px;
}

.action-hub-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #065f46;
}

.action-hub-hint {
    font-size: 0.8rem;
    color: #047857;
}

.action-hub-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-action-hub {
    background: white;
    border: 1px solid #6ee7b7;
    color: #065f46;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-action-hub:hover {
    background: #059669;
    color: white;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(5, 150, 105, 0.2);
}

.bank-transactions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.bank-transactions-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    padding: 10px 12px;
    border: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.bank-transactions-table td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    vertical-align: middle;
}

.bank-transactions-table tr:hover {
    background: #f8fafc;
}

.tx-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.tx-badge.badge-green {
    background: #dcfce7;
    color: #15803d;
}

.tx-badge.badge-yellow {
    background: #fef9c3;
    color: #854d0e;
}

.tx-badge.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

.btn-row-action {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-row-action:hover {
    background: #059669;
    color: white;
    border-color: #059669;
}

.action-result-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 480px;
    overflow-y: auto;
}

.action-result-text {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #0f172a;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* --- Client Crypto & Edge Parsing Styles --- */
.crypto-security-badge {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(22, 101, 52, 0.05);
}

.crypto-security-badge strong {
    color: #14532d;
}

.crypto-tag {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* =========================================================================
   Memory & Context Manager Styles
   ========================================================================= */

.btn-memory-panel {
    padding: 8px 14px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-memory-panel:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.badge-mini {
    background: #2563eb;
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.btn-close-session {
    padding: 8px 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #c2410c;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close-session:hover {
    background: #ffedd5;
    border-color: #fdba74;
}

/* Context toggle bar inside control panel */
.context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 8px 14px;
    margin-bottom: 12px;
    font-size: 0.88rem;
}

.context-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: #334155;
}

.context-toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
}

.memory-quick-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #64748b;
}

.memory-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

/* Memory Modal */
.memory-modal-content {
    max-width: 720px;
}

.memory-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.memory-stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
}

.memory-stat-card .stat-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.memory-stat-card .stat-desc {
    font-size: 0.78rem;
    color: #64748b;
}

.memory-summary-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 14px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #1e293b;
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.memory-buffer-list {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 10px;
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.buffer-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.buffer-item-role {
    font-weight: 700;
    font-size: 0.75rem;
    color: #2563eb;
}

.buffer-item-role.ai {
    color: #059669;
}

.buffer-item-text {
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}

.buffer-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 16px;
}

.memory-modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.btn-danger-outline {
    background: transparent;
    color: #dc2626;
    border: 1px solid #f87171;
    border-radius: var(--radius-md);
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger-outline:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

/* Fullscreen session saving overlay */
.session-saving-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.session-saving-card {
    background: #ffffff;
    border-radius: var(--radius-lg, 12px);
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 400px;
}

.session-saving-card h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.2rem;
}

.session-saving-card p {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ==========================================================================
   USER ROLE TABS (WORKSPACE SWITCHER FOR MULTI-ROLE USERS)
   ========================================================================== */
.user-role-tabs-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
    backdrop-filter: blur(8px);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius-md, 8px);
    padding: 8px 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex-wrap: wrap;
    animation: fadeIn 0.3s ease;
}

.user-role-tabs-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
}

.user-role-tabs-header .role-tabs-icon {
    font-size: 1.1rem;
}

.user-role-tabs-list {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.role-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.role-tab-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.role-tab-btn.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-color: #60a5fa;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 700;
}

.role-tab-btn.active::before {
    content: "●";
    color: #93c5fd;
    font-size: 0.75rem;
}

/* Role-specific color accents when active */
.role-tab-btn[data-role="admin"].active {
    background: linear-gradient(135deg, #7e22ce, #6b21a8);
    border-color: #c084fc;
    box-shadow: 0 0 12px rgba(126, 34, 206, 0.5);
}
.role-tab-btn[data-role="admin"].active::before {
    color: #f3e8ff;
}

.role-tab-btn[data-role="accounting"].active {
    background: linear-gradient(135deg, #059669, #047857);
    border-color: #34d399;
    box-shadow: 0 0 12px rgba(5, 150, 105, 0.5);
}
.role-tab-btn[data-role="accounting"].active::before {
    color: #a7f3d0;
}

/* ==========================================================================
   MULTI-ROLE ASSIGNMENT IN ADMIN PANEL
   ========================================================================== */
.admin-roles-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-primary, #0f172a);
    border: 1px solid var(--border-dark, #334155);
    border-radius: var(--radius-sm, 6px);
}

.role-checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.role-checkbox-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

.role-checkbox-card input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
}

.role-checkbox-card .role-card-label {
    display: flex;
    flex-direction: column;
}

.role-checkbox-card .role-card-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text, #f8fafc);
}

.role-checkbox-card .role-card-code {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
}

.user-roles-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.user-roles-cell .role-badge.is-primary {
    box-shadow: 0 0 0 1.5px #3b82f6;
    position: relative;
}

.user-roles-cell .role-badge.is-primary::after {
    content: " ★";
    font-size: 0.7rem;
    color: #f59e0b;
}

/* ==========================================================================
   ROLE CRUD IN ADMIN PANEL (ROLES & MODULES TAB)
   ========================================================================== */
.btn-admin-add-role {
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md, 6px);
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.btn-admin-add-role:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.4);
}

.role-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-dark, #334155);
}

.role-code-badge {
    background: #334155;
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: monospace;
}

.role-system-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.role-system-badge.custom {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.3);
}

.btn-role-delete {
    background: transparent;
    color: #ef4444;
    border: 1px solid #f87171;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-role-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

.roles-list .role-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.roles-list .role-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.roles-list .role-item.active {
    background: rgba(37, 99, 235, 0.15);
    border-color: #3b82f6;
    color: #60a5fa;
    font-weight: 600;
}

.roles-list .role-item .role-count-badge {
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 10px;
}

/* ==========================================================================
   COMPANY SELECTOR & CONTEXT ISOLATION
   ========================================================================== */
.company-selector-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    margin-left: 12px;
}

.company-selector-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #93c5fd;
    white-space: nowrap;
}

.company-select-input {
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    max-width: 260px;
}

.company-select-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-company-add {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.btn-company-add:hover {
    background: #1d4ed8;
}

.active-company-info-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.4), rgba(15, 23, 42, 0.6));
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 14px;
}

.company-banner-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-banner-icon {
    font-size: 1.5rem;
}

.company-banner-meta {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 2px;
}

.btn-company-switch {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-company-switch:hover {
    background: rgba(59, 130, 246, 0.35);
    color: #ffffff;
}

/* ==========================================================================
   PREPAID BILLING, INVOICING & QUOTA MANAGEMENT STYLES
   ========================================================================== */

.btn-user-billing {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: 1px solid #34d399;
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.25);
}

.btn-user-billing:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(16, 185, 129, 0.35);
}

.billing-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.billing-kpi-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease;
}

.billing-kpi-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.billing-kpi-icon {
    font-size: 1.8rem;
    background: #f1f5f9;
    padding: 8px;
    border-radius: var(--radius-md);
}

.billing-kpi-info {
    display: flex;
    flex-direction: column;
}

.billing-kpi-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.billing-kpi-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    margin-top: 3px;
}

.billing-subtabs {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.billing-subtab {
    background: transparent;
    border: none;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.billing-subtab:hover {
    color: var(--primary);
}

.billing-subtab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.billing-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 18px 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-admin-record-payment {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: 1px solid #059669;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-admin-record-payment:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.badge-status-issued {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

.badge-status-paid {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

.badge-status-cancelled {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

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

.billing-tariff-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.billing-tariff-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12);
}

.tariff-card-header {
    margin-bottom: 12px;
}

.tariff-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}

.tariff-price-tag {
    font-size: 1.4rem;
    font-weight: 900;
    color: #2563eb;
    margin: 8px 0;
}

.tariff-card-desc {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 14px;
}

.tariff-features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
    font-size: 0.85rem;
    color: #334155;
}

.tariff-features-list li {
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* User Billing Modal Dashboard */
.billing-user-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.billing-user-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.billing-user-card-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 6px;
}

.billing-user-card-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.billing-user-card-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    margin: 4px 0;
}

.billing-user-card-sub {
    font-size: 0.78rem;
    color: #64748b;
}

.billing-request-invoice-box {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 20px;
}

.billing-requisites-memo {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 0.82rem;
    color: #92400e;
    line-height: 1.5;
    margin-top: 20px;
}

/* ==========================================================================
   OMNI-ACTION ACCOUNTING STUDIO & RECONCILIATION STYLES
   ========================================================================== */
.omni-slots-wrapper {
    margin-bottom: 20px;
}

.omni-slots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 6px;
}

.omni-slots-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.omni-slots-hint {
    font-size: 0.8rem;
    color: #059669;
    font-weight: 500;
}

.omni-slots-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

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

.omni-slot-card {
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.omni-slot-card:hover, .omni-slot-card.dragover {
    border-color: #059669;
    background: #f0fdf4;
}

.omni-slot-card.has-file {
    border-style: solid;
    border-color: #10b981;
    background: #ecfdf5;
}

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

.slot-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.slot-badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.slot-badge-secondary {
    background: #fef3c7;
    color: #92400e;
}

.btn-slot-clear {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.btn-slot-clear:hover {
    color: #b91c1c;
}

.slot-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
}

.slot-icon {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.slot-prompt-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.slot-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.slot-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    margin-top: 6px;
}

.slot-file-icon {
    font-size: 1.5rem;
}

.slot-file-details {
    overflow: hidden;
}

.slot-file-name {
    font-size: 0.86rem;
    font-weight: 700;
    color: #065f46;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.slot-file-size {
    font-size: 0.74rem;
    color: #047857;
}

/* OMNI ACTION SELECTOR GRID */
.omni-action-section {
    margin-bottom: 20px;
}

.action-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.action-auto-badge {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.omni-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.omni-action-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.omni-action-card:hover {
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.08);
}

.omni-action-card.active {
    border-color: #059669;
    background: #f0fdf4;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

.action-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
}

.omni-action-card.active .action-card-badge {
    background: #d1fae5;
    color: #065f46;
}

.action-card-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.action-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.25;
}

.action-card-desc {
    font-size: 0.73rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* RECONCILIATION RESULT STYLES */
.reconcile-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.reconcile-kpi-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
}

.reconcile-kpi-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.reconcile-kpi-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
}

.reconcile-kpi-card.matched .reconcile-kpi-value {
    color: #059669;
}

.reconcile-kpi-card.diff .reconcile-kpi-value {
    color: #d97706;
}

.reconcile-kpi-card.missing .reconcile-kpi-value {
    color: #dc2626;
}

.status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill-matched {
    background: #d1fae5;
    color: #065f46;
}

.status-pill-amount-diff {
    background: #fef3c7;
    color: #92400e;
}

.status-pill-missing-b {
    background: #fee2e2;
    color: #991b1b;
}

.status-pill-missing-a {
    background: #e0e7ff;
    color: #3730a3;
}

/* ==========================================================================
   ACCOUNTING EXTENDED TOOLKIT & NAV TABS (PACKETS 1-4)
   ========================================================================== */
.accounting-nav-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
    padding-bottom: 4px;
    overflow-x: auto;
}

.accounting-nav-tab {
    background: transparent;
    border: none;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.accounting-nav-tab:hover {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.06);
}

.accounting-nav-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

/* Tool Container Panes */
.accounting-pane {
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.2s ease;
}

.accounting-pane.active {
    display: flex;
}

/* Tax Calculators Layout */
.tax-calc-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 900px) {
    .tax-calc-layout {
        grid-template-columns: 1fr;
    }
}

.tax-calc-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tax-calc-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.tax-calc-desc {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.4;
    margin: 0;
}

.tax-calc-result-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 10px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.tax-calc-result-box.highlight {
    background: #f0fdf4;
    border-color: #86efac;
}

.tax-calc-result-box.alert-risk {
    background: #fef2f2;
    border-color: #fca5a5;
}

.tax-delta-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.95rem;
    background: #dcfce7;
    color: #15803d;
    margin-top: 6px;
}

/* Self-Employed Audit Result */
.self-employed-markers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-height: 280px;
    overflow-y: auto;
}

.marker-item {
    background: #fff;
    border-left: 4px solid #ef4444;
    padding: 10px 14px;
    border-radius: 4px;
    border-top: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.marker-item.warning {
    border-left-color: #f59e0b;
}

.marker-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #0f172a;
    display: flex;
    justify-content: space-between;
}

.marker-quote {
    font-style: italic;
    font-size: 0.8rem;
    color: #b91c1c;
    background: #fff1f2;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 4px 0;
}

.marker-expl {
    font-size: 0.78rem;
    color: #475569;
}

/* FNS Requirements Tracker */
.requirements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.req-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    border-top: 4px solid #3b82f6;
}

.req-card.urgent {
    border-top-color: #f59e0b;
    background: #fffbeb;
}

.req-card.overdue {
    border-top-color: #ef4444;
    background: #fef2f2;
}

.req-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.req-deadline-pill {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
}

.req-deadline-pill.urgent {
    background: #fef3c7;
    color: #b45309;
}

.req-deadline-pill.overdue {
    background: #fee2e2;
    color: #b91c1c;
}

.req-deadline-pill.normal {
    background: #e0f2fe;
    color: #0369a1;
}

/* Tax Calendar Events */
.calendar-events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cal-event-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.cal-event-day {
    font-size: 1.4rem;
    font-weight: 800;
    color: #7c3aed;
    min-width: 44px;
    text-align: center;
    background: #f5f3ff;
    padding: 6px 4px;
    border-radius: 6px;
    line-height: 1;
}

.cal-event-info {
    flex: 1;
}

.cal-event-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1e293b;
}

.cal-event-desc {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 2px;
}

/* Booster Cards Grid */
.booster-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 10px;
}

@media (max-width: 600px) {
    .booster-cards-grid {
        grid-template-columns: 1fr;
    }
}

.booster-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.booster-card:hover {
    border-color: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.12);
}

.booster-queries {
    font-size: 1.25rem;
    font-weight: 800;
    color: #7c3aed;
}

.booster-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.btn-booster-buy {
    background: #7c3aed;
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    width: 100%;
}

.btn-booster-buy:hover {
    background: #6d28d9;
}

/* Overdraft / Promised Payment Bar */
.promised-payment-box {
    background: #f8fafc;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-promised-payment {
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-promised-payment:hover {
    background: #0369a1;
}

/* Output Textarea/Pre Preview */
.voucher-pre-box {
    background: #0f172a;
    color: #f8fafc;
    padding: 14px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    max-height: 340px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}



