:root{--bg-body:#fff;--bg-hero:#f0f4f8;--bg-panel:#f8f9fa;--bg-card:#fff;--bg-input:#fff;--text-main:#1d252d;--text-muted:#627182;--primary:#006fe6;--primary-hover:#0056b3;--border:#dee2e6;--chat-ai-bg: 243, 244, 246;--chat-user-bg:#006fe6;--chat-user-text:#fff;--shadow:0 4px 24px #0000000f;--nav-height:70px; --collapser-arrow: black;
--upload-queue: 0.8;
--upload-done: lime;
--upload-fail: red;
--upload-proc: navy;
}
[data-theme="dark"]{--bg-body:#0d1117;--bg-hero:#161b22;--bg-panel:#161b22;--bg-card:#21262d;--bg-input:#0d1117;--text-main:#c9d1d9;--text-muted:#8b949e;--primary:#1f6feb;--primary-hover:#388bfd;--border:#30363d;--chat-ai-bg: #21262d;;--chat-user-bg:#1f6feb;--chat-user-text:#fff;--shadow:0 4px 24px #00000080; --collapser-arrow: white;
--upload-queue: opacity:.45;
--upload-done: lime;
--upload-fail: #ff2f63;
--upload-proc: #89b4fa;}
body{font-family:'Inter',sans-serif;background-color:var(--bg-body);color:var(--text-main);margin:0;transition:background-color 0.3s,color .3s}

/* NAVBAR & BUTTONS */
.navbar{ height:var(--nav-height);background:var(--bg-card);border-bottom:1px solid var(--border);display:flex;align-items:center;padding:0 2rem;position:sticky;top:0;z-index:100}
.nav-container{width:100%;margin:0 auto;display:flex;justify-content:space-between;align-items:center}
.logo { display: flex; align-items: center; gap: 5px; font-size: 1.25rem; font-weight: 500; color: var(--text-main); }
.logo-icon_old { width: 24px; height: 24px; background: var(--primary); border-radius: 4px; }
.logo-circle{width:72px;height:72px;border-radius:50%;display:flex;align-items:center;justify-content:center}
.logo-icon{width:44px;height:auto;object-fit:contain;display:block}
.btn-primary { background: var(--primary); color: white; border: none; padding: 10px 10px; border-radius: 4px; cursor: pointer; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary.big { padding: 0.9rem 2rem; font-size: 1rem; }
.btn-secondary.big { background:var(--bg-card);border:1px solid var(--border);color:var(--text-main);padding:.9rem 2rem;font-size:1rem;border-radius:6px;cursor:pointer;font-weight:500}
.btn-success { background-color: #418f46; }
.btn-error {background-color:#E45252;}
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-main); padding: 8px 16px; border-radius: 6px; cursor: pointer; }
.btn-icon { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 8px; margin-right: 10px; }
.btn-text { background: none; border: none; color: var(--text-muted); cursor: pointer; text-decoration: underline; }

/* The spinner */
.btn-primary .spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: var(--collapser-arrow); border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn-primary.loading .spinner { display: inline-block; position: relative; top: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }


/* HERO SECTION */
.hero-section { background: var(--bg-hero); padding: 6rem 0; border-bottom: 1px solid var(--border); }
.container { margin: 0 auto; padding: 0 2rem; }
.hero-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.hero-text h1 { color: var(--text-main); font-size: 3.5rem; font-weight: 700; line-height: 1.1; margin-bottom: 1.5rem; }
.hero-text .highlight { color: var(--primary); }
.hero-sub { color: var(--text-muted); font-size: 1.25rem; line-height: 1.6; margin-bottom: 2.5rem; }
.hero-actions { display: flex; gap: 1rem; }

/* MOCKUP WINDOW */
.mockup-window{background:var(--bg-card);border-radius:12px;box-shadow:0 20px 50px -12px #00000026;border:1px solid var(--border);overflow:hidden;transform:perspective(1000px) rotateY(-5deg) rotateX(2deg);transition:transform .3s ease}
.mockup-window:hover { transform: perspective(1000px) rotateY(0deg) rotateX(0deg); }
.mockup-header { background: var(--bg-panel); padding: 12px 16px; display: flex; gap: 8px; border-bottom: 1px solid var(--border); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dotHome { width: 10px; height: 10px; border-radius: 50%; }
.red { background: #ff5f56; } .yellow { background: #ffbd2e; } .green { background: #27c93f; }
.mockup-body { padding: 24px; background: var(--bg-card); display: flex; flex-direction: column; gap: 16px; height: 250px; }
.mock-chat-bubble { padding: 12px; border-radius: 8px; width: 80%; }
.mock-chat-bubble.ai { background: var(--bg-panel); align-self: flex-start; }
.mock-chat-bubble.user { background: var(--primary); align-self: flex-end; width: 60%; }
.mock-line { height: 8px; background: var(--border); border-radius: 4px; margin-bottom: 6px; }
.mock-chat-bubble.user .mock-line { background: rgba(255,255,255,0.4); }
.long { width: 90%; } .short { width: 50%; } .medium { width: 70%; }
.mock-source { font-size: 10px; color: var(--primary); margin-top: 8px; font-weight: 600; }

/* FEATURES SECTION */
.features-section { padding: 5rem 0; background: var(--bg-body); }
.section-header { text-align: center; margin-bottom: 4rem; }
.section-header h2 { font-size: 2rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-main); }
.section-header p { color: var(--text-muted); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.feature-card{background:var(--bg-card);border:1px solid var(--border);border-radius:8px;padding:2rem;transition:box-shadow 0.2s,transform .2s}

.feature-card:hover { box-shadow: var(--shadow); transform: translateY(-4px); border-color: transparent; }
.icon-box { height: 48px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; margin-bottom: 1.5rem; }
.blue { background: #006fe6; } .purple { background: #7c3aed; } .green { background: #10b981; }
.feature-card h3 { font-size: 1.25rem; margin-bottom: 1rem; color: var(--text-main); }
.feature-card p { color: var(--text-muted); line-height: 1.5; margin-bottom: 1.5rem; }
.link-arrow { text-decoration: none; color: var(--primary); font-weight: 600; font-size: 0.9rem; }

/* APP LAYOUT */
.app-layout { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; height: calc(100vh - 120px); }
.sidebar .panel { background: var(--bg-panel); padding: 1.5rem; border-radius: 8px; margin-bottom: 1.5rem; border: 1px solid var(--border); }
.stat-box { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-box small { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; display: block; }
.dropdown { width: 100%; padding: 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-main); }

/* UPLOAD AREA */
.upload-area { border: 2px dashed var(--border); padding: 2rem; text-align: center; border-radius: 8px; cursor: pointer; transition: border 0.2s; }
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: rgba(0, 111, 230, 0.05); }
.status-text { padding-top: 15px; max-width: 100%; overflow-wrap: break-word; word-break: break-word; white-space: normal; }
.lds-dual-ring, .lds-dual-ring:after { box-sizing: border-box; } .lds-dual-ring { float:left; padding-right: 25px; width: 20px; height: 20px; } .lds-dual-ring:after { content: " "; display: block; width: 16px; height: 16px; margin: 4px; border-radius: 50%; border: 6.4px solid currentColor; border-color: var(--border) transparent currentColor transparent; animation: lds-dual-ring 1.2s linear infinite; } @keyframes lds-dual-ring { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* CHAT AREA */
.chat-container { border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; background: var(--bg-card); overflow: hidden; height: 100%; }

.message1 { max-width: 75%; padding: 12px 18px; border-radius: 12px; font-size: 0.95rem; line-height: 1.5; position: relative; word-wrap: break-word; margin-bottom: 10px; }
.message1.user { min-width: 150px; text-align: right; align-self: flex-end; background-color: var(--chat-user-bg); color: var(--chat-user-text); border-bottom-right-radius: 2px; }
.message1.ai { align-self: flex-start; background-color: var(--chat-ai-bg); color: var(--text-main); border-bottom-left-radius: 2px; border: 1px solid var(--border); }
.message1.ai { align-self: flex-start; background-color: var(--bg-panel); color: var(--text-main); border-bottom-left-radius: 2px; border: 1px solid var(--border); }

/* ── Base bubble ── */
.message { max-width: 75%; padding: 22px 20px; border-radius: 18px; font-size: 0.95rem; line-height: 1.5; position: relative; word-wrap: break-word; margin-bottom: 10px; border: 1px solid var(--border);}
    .message p {
      font-size: 14px;
      line-height: 1.6;
      text-align: left;
    }

    /* ── Left — light gray ── */
    .message.ai {
       align-self: flex-start; min-width: 150px; background-color: var(--chat-ai-bg); color: var(--text-main);
      padding-bottom: 42px;
      box-shadow: none;
      border: 1px solid var(--border);
    }

    .message.ai::after,
    .message.ai::before {
      content: none;
    }

    /* ── Right — light blue ── */
    .message.user {
       min-width: 150px; text-align: right; align-self: flex-end; background-color: var(--chat-user-bg); color: var(--chat-user-text);
      box-shadow: none;
      border: 1px solid rgba(0, 0, 0, 0.12);
    }
    .message.user p { color: white; text-align: right; }

    .message.user::after,
    .message.user::before {
      content: none;
    }




.message.ai .small-text {font-size: 0.75em;color: var(--text-muted);}
.bubble-header {
    display: flex; align-items: center; gap: 7px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
}
.bubble-logo {
    width: 22px; height: 22px;
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
}
.bubble-brand {
    font-size: 0.75rem; font-weight: 600;
    color: var(--primary, #006fe6);
    letter-spacing: 0.01em;
    flex: 1;
}
.bubble-ts {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.bubble-actions {
    position: absolute; bottom: 6px; left: 10px; right: auto;
    display: flex; align-items: center; gap: 4px;
    opacity: 0; transition: opacity 0.2s;
}
.message.ai:hover .bubble-actions { opacity: 0.9; }
.bubble-action-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted);
    padding: 6px; border-radius: 6px;
    line-height: 1; display: inline-flex; align-items: center; justify-content: center;
    transition: color 0.15s, background 0.15s, opacity 0.15s;
}
.bubble-action-btn svg {
    width: 22px; height: 22px; min-width: 22px; min-height: 22px; display: block;
}
.bubble-action-btn:hover:not(:disabled) { color: var(--primary); background: rgba(0,0,0,0.04); opacity: 1; }
.bubble-action-btn.selected { color: var(--primary); opacity: 1; }
.bubble-action-btn.copied { color: var(--primary); }
.bubble-action-btn:disabled { opacity: 0.35; cursor: default; }
.bubble-export-btn { /* kept as alias class on export icon button */ }
.feedback-reasons {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border);
}
.feedback-reasons.hidden { display: none; }
.feedback-reasons-label {
    font-size: 0.75rem; color: var(--text-muted); margin-right: 4px;
}
.feedback-reason-chip {
    background: transparent; border: 1px solid var(--border); color: var(--text-main);
    border-radius: 4px; padding: 4px 8px; font-size: 0.75rem; cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.feedback-reason-chip:hover {
    border-color: var(--primary); color: var(--primary); background: rgba(0,0,0,0.03);
}
.approved-badge {
    font-size: 0.75rem; color: var(--text-muted); margin: 0 0 8px;
    font-style: italic;
}
.approved-answers-list .doc-row { grid-template-columns: 1fr 120px; }
.approved-edit-box textarea {
    width: 100%; min-height: 90px; padding: 8px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-input); color: var(--text-main); font-family: inherit;
    margin-bottom: 8px;
}
.chat-input-area { padding: 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 10px; background: var(--bg-card); }
.chat-input-area input { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-input); color: var(--text-main); }

/* DOC MANAGER MODAL */
.modal-header-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.modal-actions {display: flex;justify-content: space-between;}
.modal-header-row h2 { margin: 0; font-size: 1.5rem; color: var(--text-main); }
.close-icon { font-size: 1.5rem; line-height: 1; padding: 4px 8px; color: var(--text-muted); border-radius: 4px; transition: color 0.15s, background 0.15s; }
.close-icon:hover { color: var(--text-main); background: var(--border); text-decoration: none; }
.filter-bar { margin-bottom: 1rem; }
.filter-input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-input); color: var(--text-main); box-sizing: border-box; }
.docs-table-header { display: grid; grid-template-columns: 1fr 100px; padding: 8px 16px; background: var(--bg-panel); border: 1px solid var(--border); border-bottom: none; font-weight: 600; color: var(--text-muted); }
.docs-list-container { max-height: 400px; overflow-y: auto; border: 1px solid var(--border); background: var(--bg-card); }
.doc-row { display: grid; grid-template-columns: 1fr 100px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: center; transition: background 0.1s; color: var(--text-main); }
.doc-row:hover { background: var(--bg-panel); }
.doc-name { display: flex; align-items: center; gap: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-name a { color: var(--text-main); text-decoration: none; }
.btn-delete { background: #fee2e2; color: #dc2626; border: none; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; font-weight: 600; }
.btn-delete:hover { background: #fecaca; }
.doc-meta-sub{font-size:.75rem;color:#888;margin-top:2px}

/* LOADING DOTS */
.typing-dots { display: flex; gap: 4px; padding: 4px; }
.dot { width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* UTILS */
.hidden { display: none !important; }
.modal { position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); display:flex; align-items:center; justify-content:center; z-index:999; }
.modal-content { background: var(--bg-card); padding: 2.5rem; border-radius: 8px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.input-group { margin-bottom: 1rem; }
.input-group label { display: block; font-size: 0.875rem; color: var(--text-main); margin-bottom: 0.5rem; font-weight: 500; }
.input-group input { width: 100%; padding: 0.6rem; border: 1px solid var(--border); border-radius: 4px; box-sizing: border-box; background: var(--bg-input); color: var(--text-main); }
.full-width { width: 100%; margin-top: 1rem; }

/* --- MARKDOWN RICH TEXT STYLES --- */ /* 1. Code Blocks */ 
.message pre{background:#2d2d2d;/* Dark background for code */ color:#e0e0e0;padding:12px;border-radius:6px;overflow-x:auto; margin:10px 0;font-family:'Consolas','Monaco',monospace;font-size:0.9em;}
.message code{background:rgba(0,0,0,0.1);padding:2px 4px;border-radius:4px;font-family:'Consolas','Monaco',monospace;font-size:0.9em;}
/* 2. Tables (Great for financial data) */ .message table{border-collapse:collapse;width:100%;margin:15px 0;font-size:0.9rem;}
.message th,.message td{border:1px solid var(--border);padding:8px 12px;text-align:left;}
.message th{background-color:rgba(0,0,0,0.05);font-weight:600;}
/* 3. Lists and Blockquotes */ .message ul,.message ol{margin-left:20px;margin-bottom:10px;}
.message blockquote{text-align:right; border-left:4px solid var(--primary);margin:10px 0;padding-left:15px;color:var(--text-muted);font-style:italic;background:rgba(0,0,0,0.07);padding:8px 15px;}
/* Dark Mode Adjustments */ [data-theme="dark"] .message code{background:rgba(255,255,255,0.15);}
[data-theme="dark"] .message th{background-color:rgba(255,255,255,0.1);}

/* Sidebar Transitions */
.collapser {position: absolute; right: 0; top: 50%; transform: translateY(-50%); padding: 10px;}
.sidebar{width:280px;transition:width .3s ease;overflow-x:hidden;white-space:nowrapl; position: relative;}
.sidebar.collapsed{width:50px}
.sidebar.collapsed h2,.sidebar.collapsed .panel,.sidebar.collapsed .doc-item{display:none}
.sidebar.collapsed #toggle-sidebar-btn{transform:rotate(180deg)}
.sidebar.collapsed.sideBar { background-color: var(--bg-card); }
.btn-collapser{text-decoration:none;left:20px;position:relative;width:30px;height:50px;background:var(--sidebar-bg);border:1px solid var(--border);border-radius:6px;cursor:pointer; color: var(--collapser-arrow);}

/* The Wrapper */
.app-layout{display:flex;width:100%;overflow:hidden}

/* Sidebar */
.sidebar{width:280px;min-width:280px;background:var(--sidebar-bg);border-right:1px solid var(--border);transition:all .3s ease;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;padding:10px}

/* The Collapsed State */
.sidebar.collapsed{width:60px;min-width:60px}

/* Hide text content when collapsed */
.sidebar.collapsed h2,.sidebar.collapsed .panel,.sidebar.collapsed .doc-item,.sidebar.collapsed #app-version-display,.sidebar.collapsed .sidebar-footer{display:none;opacity:0}

/* The Main Chat Area (Fluid Width) */
main{flex:1;display:flex;flex-direction:column;position:relative}

/* History grid styles */
/* Container for the list (Scrollable Body) */
.history-grid{display:flex;flex-direction:column;overflow-y:auto;max-height:600px;border:1px solid var(--border);border-radius:8px;background:var(--surface-color)}

/* The Header Row (Stays at the top) */
.history-header{display:grid;grid-template-columns:1fr 1fr 2fr 1fr;gap:10px;padding:12px 15px;background:var(--sidebar-bg);border-bottom:2px solid var(--border);font-weight:700;color:var(--text-color);position:sticky;top:0;z-index:10}

/* Individual Data Rows */
.history-row{display:grid;grid-template-columns:1fr 1fr 2fr 1fr;gap:10px;padding:10px 15px;border-bottom:1px solid var(--border);align-items:center;font-size:.9rem;transition:background .2s}

/* Zebra Striping for readability */
.history-row:nth-child(even) { background-color: rgba(0, 0, 0, 0.02); }

.history-row:hover { background-color: rgba(0, 0, 0, 0.05); }

.filter-bar{display:flex;flex-direction:row;gap:10px;margin-bottom:15px;align-items:center;flex-wrap:nowrap}

.filter-group{display:flex;flex-direction:row;gap:10px;flex-wrap:nowrap;min-width:0}

.password {position: relative; display: inline-block; width:100%;}
.password .fa-eye {position: absolute;top: 70%;right: 10px;transform: translateY(-50%); cursor: pointer;}
.password .fa-eye-slash {position: absolute;top: 70%;right: 10px;transform: translateY(-50%);cursor: pointer;}

.sources-list a {color: var(--primary)}

.dropdown-container{position:relative;width:230px;display:inline-block;background:var(--bg-card);color:var(--text-main);border:1px solid var(--border); border-radius: 6px;}
.dropdown-selected{border:none;padding:14px 16px;cursor:pointer;display:flex;align-items:center;gap:12px;transition:background .2s ease}
.flag-icon{width:24px;height:18px;flex-shrink:0}
.country-name{flex:1;font-size:15px;font-weight:500}
.arrow{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid var(--text-main);transition:transform .2s ease}
.arrow.open{transform:rotate(180deg)}
.dropdown-options{position:absolute;top:100%;left:0;right:0;background:var(--bg-card);max-height:0;overflow:hidden;transition:max-height .2s ease;z-index:1000;box-shadow:0 2px 8px var(--border);}
.dropdown-options.open{max-height:300px;overflow-y:auto}
.dropdown-option{padding:14px 16px;display:flex;align-items:center;gap:12px;cursor:pointer;transition:background .15s ease;border-bottom:1px solid #ecf0f1}
.dropdown-option:last-child{border-bottom:none}
.dropdown-options::-webkit-scrollbar{width:6px}
.dropdown-options::-webkit-scrollbar-track{background:transparent}

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

/* Flat tab navigation */
.tab{display:flex;background-color:var(--bg-card);border-bottom:2px solid #e0e0e0}
.tab button{flex:1;background-color:transparent;border:none;outline:none;cursor:pointer;padding:16px 20px;font-size:15px;font-weight:500;color:#666;transition:all 0.2s ease;border-bottom:3px solid transparent;position:relative}
.tab button:hover {color: #333;}
.tab button.active{color:#2196F3;border-bottom-color:#2196F3;background-color:transparent}

/* Flat tab content */
.tabcontent {display: none;padding: 30px 24px;background-color: #fff;}
.tabcontent.active {display: block;}
.tabcontent h3 {font-size: 24px;font-weight: 600;color: #333;margin-bottom: 12px;}
.tabcontent p {font-size: 15px;line-height: 1.6;color: #666;}

/* NEW APPOROACH FOR TEXT BOX */
.timestamp {color: var(--text-muted);font-size: x-small; position: absolute; top: -20px; left: 2px;}

.content-container{display: flex;flex-direction: column;height: 100%;}
.chat-history{scrollbar-width:none;-ms-overflow-style:none;overflow-y:scroll;flex:1;overflow-y:auto;overflow-x:hidden;padding:2rem;display:flex;flex-direction:column;gap:1.5rem}

.box-container{width:100%;display:flex;justify-content:center;padding:15px 0;border-top:1px var(--border) solid;background-color:var(--bg-main);color:var(--text-main)}
.box{position:relative;border-radius:12px;border:1.5px solid var(--border);box-shadow:0 2px 12px var(--border);width:90%;padding:0 10px}

  /* Mirror + textarea share identical text styles */
#mirror,#user-input{width:100%;padding-top:12px;font-size:15px;line-height:1.6;white-space:pre-wrap;word-break:break-word}
#mirror{position:absolute;inset:0;overflow-y:auto;pointer-events:none;color:transparent;border-radius:12px}
#mirror mark{background:#2563eb33;color:transparent;border-radius:4px;position:relative;left:6px}
#user-input{position:relative;display:block;border:none;outline:none;border-radius:12px;resize:vertical;background:transparent;color:var(--text-main);caret-color:var(--collapser-arrow);min-height:100px}
.footer{display:flex;justify-content:space-between;align-items:center;padding:6px 12px 10px;border-top:1px solid #f0f0f0}

  
/* Responsive design */
@media (max-width: 768px) {
    .tab {
        flex-wrap: wrap;
    }

    .tab button {
        flex: 1 1 50%;
        font-size: 14px;
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .tab button {
        flex: 1 1 100%;
    }
}


/* ========================================
   TOKEN USAGE DASHBOARD STYLES
======================================== */

/* Dashboard Modal */
.dashboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.dashboard-modal.active {
    display: flex;
}

.dashboard-container {
    background: var(--bg-body);
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Dashboard Header */
.dashboard-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-title h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-main);
}

.dashboard-tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--bg-panel);
    color: var(--primary);
}

.dashboard-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.year-selector {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
    cursor: pointer;
}

.time-filter {
    display: flex;
    gap: 5px;
    background: var(--bg-panel);
    padding: 4px;
    border-radius: 6px;
}

.time-filter button {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.time-filter button.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.export-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

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

.close-dashboard {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

/* Dashboard Content */
.dashboard-content {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
    background: var(--bg-body);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.stat-card.tokens-in::before {
    background: var(--tokens-in-color);
}

.stat-card.tokens-out::before {
    background: var(--tokens-out-color);
}

.stat-card.storage::before {
    background: var(--storage-color);
}

.stat-card.total::before {
    background: var(--total-tokens-color);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-card.tokens-in .stat-icon {
    background: rgba(74, 144, 226, 0.1);
    color: var(--tokens-in-color);
}

.stat-card.tokens-out .stat-icon {
    background: rgba(46, 204, 113, 0.1);
    color: var(--tokens-out-color);
}

.stat-card.storage .stat-icon {
    background: rgba(243, 156, 18, 0.1);
    color: var(--storage-color);
}

.stat-card.total .stat-icon {
    background: rgba(155, 89, 182, 0.1);
    color: var(--total-tokens-color);
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.stat-change {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-change.positive {
    color: var(--status-normal);
}

.stat-change.negative {
    color: var(--status-high);
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 20px;
}

.chart-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.tokens-in {
    background: var(--tokens-in-color);
}

.legend-color.tokens-out {
    background: var(--tokens-out-color);
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 250px;
    gap: 15px;
    padding: 20px 0;
    border-bottom: 2px solid var(--border);
    position: relative;
}

.bar-chart::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: repeating-linear-gradient(
        to top,
        var(--chart-grid) 0px,
        var(--chart-grid) 1px,
        transparent 1px,
        transparent 50px
    );
    pointer-events: none;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    height: 100%;
    position: relative;
}

.bars {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.bar {
    width: 20px;
    border-radius: 4px 4px 0 0;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.bar.tokens-in {
    background: var(--tokens-in-color);
}

.bar.tokens-out {
    background: var(--tokens-out-color);
}

.bar:hover {
    opacity: 0.8;
    transform: translateY(-3px);
}

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

/* Donut Chart */
.donut-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.donut-chart {
    position: relative;
    width: 200px;
    height: 200px;
}

.donut-chart svg {
    transform: rotate(-90deg);
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-percentage {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

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

.ratio-stats {
    width: 100%;
}

.ratio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ratio-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ratio-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.ratio-dot.tokens-in {
    background: var(--tokens-in-color);
}

.ratio-dot.tokens-out {
    background: var(--tokens-out-color);
}

.ratio-name {
    font-size: 0.9rem;
    color: var(--text-main);
}

.ratio-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.storage-progress {
    margin-top: 20px;
}

.storage-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.storage-label-text {
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.storage-value {
    color: var(--storage-color);
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--progress-bg);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--storage-color);
    border-radius: 10px;
    transition: width 0.5s ease;
}

/* Monthly Breakdown Table */
.breakdown-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
}

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

.breakdown-filters {
    display: flex;
    gap: 10px;
    background: var(--bg-panel);
    padding: 4px;
    border-radius: 6px;
}

.breakdown-filters button {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.breakdown-filters button.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.breakdown-table thead {
    background: var(--bg-panel);
}

.breakdown-table th {
    padding: 12px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.breakdown-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.breakdown-table tbody tr:hover {
    background: var(--bg-panel);
}

.breakdown-table td {
    padding: 15px 12px;
    color: var(--text-main);
}

.month-cell {
    font-weight: 600;
}

.tokens-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.token-bar {
    height: 6px;
    border-radius: 3px;
    min-width: 60px;
    max-width: 120px;
}

.token-bar.tokens-in {
    background: var(--tokens-in-color);
}

.token-bar.tokens-out {
    background: var(--tokens-out-color);
}

.storage-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.storage-badge.normal {
    background: rgba(46, 204, 113, 0.1);
    color: var(--status-normal);
}

.storage-badge.moderate {
    background: rgba(243, 156, 18, 0.1);
    color: var(--status-moderate);
}

.storage-badge.high {
    background: rgba(231, 76, 60, 0.1);
    color: var(--status-high);
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.trend.up {
    color: var(--status-normal);
}

.trend.down {
    color: var(--status-high);
}

/* Responsive */
@media (max-width: 968px) {
    .charts-section {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 640px) {
    .dashboard-content {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .bar-chart {
        height: 200px;
    }

    .breakdown-table {
        font-size: 0.85rem;
    }

    .dashboard-controls {
        flex-wrap: wrap;
    }
}


/* Responsive design */
@media (max-width: 768px) {
    .tab {
        flex-wrap: wrap;
    }

    .tab button {
        flex: 1 1 50%;
        font-size: 14px;
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .tab button {
        flex: 1 1 100%;
    }
}

