@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root{
  --bg:#0a0d14;
  --bg-gradient-start: #1a1f35;
  --bg-gradient-end: #0a0d14;
  --panel: rgba(255,255,255,.04);
  --panel2: rgba(255,255,255,.02);
  --border: rgba(255,255,255,.08);
  --border2: rgba(255,255,255,.05);
  --text:#f1f4f9;
  --text-secondary:#b4bcd0;
  --muted:#7b8599;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59,130,246,.15);
  --good:#10b981;
  --good-light: rgba(16,185,129,.15);
  --bad:#ef4444;
  --bad-light: rgba(239,68,68,.15);
  --warning:#f59e0b;
  --shadow: 0 4px 6px -1px rgba(0,0,0,.2), 0 2px 4px -1px rgba(0,0,0,.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.3), 0 10px 10px -5px rgba(0,0,0,.2);
  --input-bg: rgba(15,20,35,.8);
  --hover-bg: rgba(255,255,255,.06);
  --table-hover: rgba(255,255,255,.03);
  --scrollbar: rgba(255,255,255,.1);
  --chart-tick: #b4bcd0;
  --chart-grid: rgba(255,255,255,.05);
  --chart-legend: #f1f4f9;
  --radius:12px;
  --radius-lg:16px;
  --sidebarW: 320px;
  --sidebarWCollapsed: 70px;
}

body.light-theme{
  --bg:#fafbfc;
  --bg-gradient-start: #f0f4f8;
  --bg-gradient-end: #fafbfc;
  --panel: rgba(255,255,255,.98);
  --panel2: rgba(255,255,255,.9);
  --border: rgba(0,0,0,.06);
  --border2: rgba(0,0,0,.04);
  --text:#0f1419;
  --text-secondary:#495057;
  --muted:#6c757d;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59,130,246,.08);
  --good:#10b981;
  --good-light: rgba(16,185,129,.08);
  --bad:#ef4444;
  --bad-light: rgba(239,68,68,.08);
  --warning:#f59e0b;
  --shadow: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.03);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.08), 0 10px 10px -5px rgba(0,0,0,.05);
  --input-bg: #ffffff;
  --hover-bg: rgba(0,0,0,.03);
  --table-hover: rgba(0,0,0,.015);
  --scrollbar: rgba(0,0,0,.12);
  --chart-tick: #495057;
  --chart-grid: rgba(0,0,0,.04);
  --chart-legend: #0f1419;
}

*{ 
  box-sizing:border-box;
  margin: 0;
  padding: 0;
}
html, body{ 
  height:100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body{
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(ellipse 1400px 800px at 30% 0%, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 60%);
  color: var(--text);
  overflow:hidden;
  transition: background .3s ease, color .3s ease;
  font-size: 14px;
  line-height: 1.6;
}

.app{
  height:100%;
  display:grid;
  grid-template-columns: var(--sidebarW) 1fr;
  transition: grid-template-columns .25s cubic-bezier(0.4, 0, 0.2, 1);
}
body.sidebar-collapsed .app{
  grid-template-columns: var(--sidebarWCollapsed) 1fr;
}

.sidebar{
  height:100%;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
  backdrop-filter: blur(20px);
  padding: 20px 16px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.sidebar-inner{
  overflow:auto;
  padding-right: 6px;
  flex: 1;
}
.sidebar-inner::-webkit-scrollbar{ width: 10px; }
.sidebar-inner::-webkit-scrollbar-thumb{ background: var(--scrollbar); border-radius: 999px; }

.project-list{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.project-item{
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--panel);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.project-item::before{
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  transition: height .2s ease;
}
.project-item:hover{
  background: var(--hover-bg);
  border-color: var(--border);
  transform: translateX(2px);
}
.project-item.active{
  background: var(--accent-light);
  border-color: var(--accent);
}
.project-item.active::before{
  height: 60%;
}
.project-item .name{
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-item.active .name{
  color: var(--accent);
  font-weight: 600;
}
.project-item .actions{
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .2s ease;
}
.project-item:hover .actions{
  opacity: 1;
}
.project-item .act-btn{
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel2);
  display: grid;
  place-items: center;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s ease;
}
.project-item .act-btn:hover{
  background: var(--hover-bg);
  border-color: var(--border);
  transform: scale(1.05);
}
.new-project-btn{
  width: 100%;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: 0 2px 8px rgba(59,130,246,.25);
}
.new-project-btn:hover{
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,.35);
}
.new-project-btn:active{
  transform: translateY(0);
}
.section-title{
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  font-weight: 600;
  padding-left: 2px;
}

.section-divider{
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* Scenario List Styles */
.scenario-list{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.scenario-item{
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--panel);
  cursor: pointer;
  transition: all .2s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}

.scenario-item::before{
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: all .2s ease;
}

.scenario-item:hover{
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.scenario-item.active{
  background: var(--accent-bg);
  border-color: var(--accent);
}

.scenario-item.active::before{
  background: var(--accent);
}

.scenario-main{
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.scenario-name{
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scenario-item.active .scenario-name{
  color: var(--accent);
  font-weight: 600;
}

.scenario-meta{
  font-size: 11px;
  color: var(--muted);
}

.scenario-tags{
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.scenario-tags .tag{
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(59,130,246,.1);
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.scenario-actions{
  display: flex;
  gap: 6px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity .2s ease;
}

.scenario-item:hover .scenario-actions{
  opacity: 1;
}

.scenario-actions .act-btn{
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}

.scenario-actions .act-btn:hover{
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}

/* Context Menu */
.context-menu{
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  padding: 6px;
  z-index: 10000;
  min-width: 150px;
}

.context-menu-item{
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all .15s ease;
}

.context-menu-item:hover{
  background: var(--accent-bg);
  color: var(--accent);
}

/* Modal Styles */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  animation: fadeIn .2s ease;
}

.modal-content{
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  animation: slideUp .3s cubic-bezier(0.4,0,0.2,1);
}

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

.modal{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp .3s cubic-bezier(0.4,0,0.2,1);
}

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

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

.modal-header h3{
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close{
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  transition: all .15s ease;
}

.modal-close:hover{
  background: var(--bg);
  color: var(--text);
}

.modal-body{
  padding: 24px;
  overflow-y: auto;
}

.form-group{
  margin-bottom: 20px;
}

.form-group:last-child{
  margin-bottom: 0;
}

.form-group label{
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group textarea{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all .15s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group textarea{
  resize: vertical;
  min-height: 80px;
}

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

.btn-primary,
.btn-secondary{
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  border: none;
}

.btn-primary{
  background: var(--accent);
  color: white;
}

.btn-primary:hover{
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,.3);
}

.btn-secondary{
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover{
  background: var(--panel);
  border-color: var(--accent);
}

/* Version History Styles */
.version-list{
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.version-list::-webkit-scrollbar{ width: 8px; }
.version-list::-webkit-scrollbar-thumb{ background: var(--scrollbar); border-radius: 999px; }

.version-item{
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  transition: all .15s ease;
}

.version-item:hover{
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.version-item.current{
  background: var(--accent-bg);
  border-color: var(--accent);
}

.version-main{
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.version-time{
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

.version-relative{
  font-size: 11px;
  color: var(--muted);
}

.version-badge-line{
  margin-bottom: 6px;
}

.version-badge{
  display: inline-block;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.version-actions{
  display: flex;
  gap: 4px;
}

.version-btn{
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}

.version-btn:hover{
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

.empty-state{
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* Version Comparison Modal */
.modal-large{
  max-width: 700px;
}

.comparison-header{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 20px;
  gap: 20px;
}

.comparison-times{
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.comparison-stats{
  display: flex;
  align-items: center;
}

.comparison-label{
  font-size: 13px;
  color: var(--text);
}

.comparison-label strong{
  color: var(--muted);
  font-weight: 500;
}

.diff-container{
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

.diff-container::-webkit-scrollbar{ width: 8px; }
.diff-container::-webkit-scrollbar-thumb{ background: var(--scrollbar); border-radius: 999px; }

.diff-group{
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.diff-group:last-child{
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.diff-field{
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.diff-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}

.diff-item:last-child{
  margin-bottom: 0;
}

.diff-label{
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  min-width: 40px;
}

.diff-old{
  padding: 4px 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-radius: 4px;
  font-weight: 500;
  min-width: 80px;
  text-align: center;
}

.diff-arrow{
  color: var(--muted);
  font-size: 14px;
}

.diff-new{
  padding: 4px 8px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-radius: 4px;
  font-weight: 500;
  min-width: 80px;
  text-align: center;
}

.no-changes{
  padding: 40px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}

.diff-summary{
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  background: var(--bg);
  border-radius: 4px;
  margin: 6px 0;
}

.s-header{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: all .2s ease;
}
.s-header:hover{
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}
.brand{ display:flex; align-items:center; gap:12px; min-width:0; }
.logo{
  width:38px; height:38px; border-radius:10px;
  border:1px solid var(--border);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  display:grid; place-items:center;
  font-weight:700;
  color: white;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(59,130,246,.25);
}
.brand .txt{ min-width:0; }
.brand .txt .t{ 
  font-size:14px; 
  font-weight:600; 
  white-space:nowrap; 
  overflow:hidden; 
  text-overflow:ellipsis;
  letter-spacing: -0.01em;
}
.brand .txt .s{ 
  font-size:11px; 
  color: var(--muted); 
  white-space:nowrap; 
  overflow:hidden; 
  text-overflow:ellipsis;
  font-weight: 400;
  margin-top: 2px;
}
.iconbtn{
  cursor:pointer;
  border:1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  height:38px; width:38px;
  display:grid; place-items:center;
  transition: all .15s ease;
  font-size: 16px;
}
.iconbtn:hover{ 
  background: var(--hover-bg);
  border-color: var(--border);
  transform: translateY(-1px);
}
.iconbtn:active{
  transform: translateY(0);
}

body.sidebar-collapsed .brand .txt{ display:none; }
body.sidebar-collapsed .sidebar{ padding: 20px 10px; }
body.sidebar-collapsed .sidebar .sidebar-inner{ padding-right:0; }
body.sidebar-collapsed .sidebar .hide-when-collapsed{ display:none !important; }
body.sidebar-collapsed .s-header{
  flex-direction: column;
  padding: 10px;
}
body.sidebar-collapsed .s-header > div{
  flex-direction: column;
  gap: 8px;
}
.collapsed-hint{
  display:none;
  margin-top:10px;
  border:1px dashed rgba(255,255,255,.18);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align:center;
}
body.sidebar-collapsed .collapsed-hint{ display:block; }

.main{
  height:100%;
  overflow:auto;
  padding: 24px;
}
.main::-webkit-scrollbar{ width: 8px; }
.main::-webkit-scrollbar-track{ background: transparent; }
.main::-webkit-scrollbar-thumb{ 
  background: var(--scrollbar); 
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.main::-webkit-scrollbar-thumb:hover{
  background: var(--muted);
  background-clip: padding-box;
}

.topbar{
  display:flex; 
  align-items:center; 
  justify-content:space-between; 
  gap:16px;
  margin-bottom: 24px;
}
.topbar .title{
  display:flex; 
  align-items:center; 
  gap:12px; 
  min-width:0;
}
.topbar .title h1{
  font-size:24px; 
  font-weight:700;
  letter-spacing: -0.02em;
  margin:0;
  white-space:nowrap; 
  overflow:hidden; 
  text-overflow:ellipsis;
}
.pill{
  display:inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  white-space:nowrap;
  letter-spacing: 0.01em;
}

.tabs{
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: fit-content;
}
.tab{
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.tab:hover{
  color: var(--text);
  background: var(--hover-bg);
}
.tab.active{
  background: white;
  color: var(--accent);
  box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
body.light-theme .tab.active{
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
body:not(.light-theme) .tab.active{
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(59,130,246,.25);
}
.tab-content{
  display: none;
}
.tab-content.active{
  display: block;
}

.sub-tabs{
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 3px;
  background: var(--panel2);
  border-radius: 10px;
  border: 1px solid var(--border2);
  width: fit-content;
}
.sub-tab{
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s ease;
}
.sub-tab:hover{
  color: var(--text);
  background: var(--hover-bg);
}
.sub-tab.active{
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 6px rgba(59,130,246,.2);
}
body.light-theme .sub-tab.active{
  background: var(--accent);
  color: white;
}

.card{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:24px;
  box-shadow: var(--shadow);
  transition: all .2s ease;
}
.card:hover{
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}
.muted{ 
  color: var(--muted); 
  font-size:13px; 
  line-height:1.5;
}
.mono{ 
  font-family: 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

label{ 
  font-size:13px; 
  color: var(--text-secondary); 
  display:block; 
  margin-bottom:8px;
  font-weight: 500;
}
input[type="number"], input[type="text"], select{
  width:100%;
  padding:11px 14px;
  border-radius: 10px;
  border:1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline:none;
  font-size: 14px;
  font-family: inherit;
  transition: all .2s ease;
}
input[type="number"]:focus, input[type="text"]:focus, select:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
input[type="number"]:hover, input[type="text"]:hover, select:hover{
  border-color: var(--border);
}
input[type="range"]{ 
  width:100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 999px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
  transition: all .2s ease;
}
input[type="range"]::-webkit-slider-thumb:hover{
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(59,130,246,.4);
}
input[type="range"]::-moz-range-thumb{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.row{
  display:grid;
  grid-template-columns: 1fr 110px;
  gap:12px;
  align-items:center;
  margin: 12px 0;
}
.val{ 
  text-align:right; 
  font-variant-numeric: tabular-nums; 
  font-size:14px;
  font-weight: 600;
  color: var(--text);
}
.two{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.btns{ display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
button{
  cursor:pointer;
  border:none;
  border-radius: 10px;
  padding: 11px 16px;
  color: var(--text);
  background: var(--panel);
  border:1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all .2s ease;
}
button:hover{ 
  background: var(--hover-bg);
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
button:active{
  transform: translateY(0);
}

.kpis{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:16px;
  margin-top:20px;
}
@media (max-width: 980px){ .kpis{ grid-template-columns: repeat(2, 1fr); } }
.kpi{
  padding: 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border:1px solid var(--border);
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
}
.kpi::before{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  opacity: 0;
  transition: opacity .2s ease;
}
.kpi:hover{
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.kpi:hover::before{
  opacity: 1;
}
.kpi .t{ 
  font-size:12px; 
  color: var(--text-secondary); 
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi .n{ 
  font-size:24px; 
  margin-top:8px; 
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chart-controls{
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--panel2);
  border-radius: var(--radius);
  border: 1px solid var(--border2);
}
.chart-control-group{
  display: flex;
  align-items: center;
  gap: 12px;
}
.chart-control-group label{
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
}
.chart-control-group select{
  min-width: 280px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all .2s ease;
}
.chart-control-group select:hover{
  border-color: var(--accent);
}
.chart-control-group select:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.chart-wrap{
  margin-top: 0;
  height: 380px;
  border-radius: var(--radius);
  border:1px solid var(--border);
  background: var(--panel2);
  padding: 20px;
  transition: all .2s ease;
}
.chart-wrap:hover{
  border-color: var(--border);
}
canvas{ width:100% !important; height:100% !important; }

.table-wrap{
  overflow:auto;
  border-radius: var(--radius);
  border:1px solid var(--border);
  background: var(--panel2);
  margin-top:20px;
}
.table-wrap::-webkit-scrollbar{ height: 8px; }
.table-wrap::-webkit-scrollbar-track{ background: transparent; }
.table-wrap::-webkit-scrollbar-thumb{ 
  background: var(--scrollbar); 
  border-radius: 999px;
}
table{ 
  width:100%; 
  border-collapse:collapse; 
  table-layout: auto;
}
#dataTab table{
  min-width: 700px;
}
#outcomeTab table{
  min-width: 1200px;
}
thead th{
  position: sticky; 
  top: 0;
  background: var(--panel);
  backdrop-filter: blur(20px);
  text-align:right;
  padding: 14px 12px;
  font-size: 10px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  z-index: 1;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.3;
}
thead th:first-child,
tbody td:first-child{ 
  text-align:left;
  width: 80px;
}
tbody td{
  padding: 12px;
  border-bottom: 1px solid var(--border2);
  text-align:right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
  font-size: 13px;
}
tbody tr{
  transition: all .15s ease;
}
tbody tr:hover{ 
  background: var(--table-hover);
}
tbody tr:last-child td{
  border-bottom: none;
}

/* Data tab specific columns */
#dataTab table{
  min-width: 1000px;
}
#dataTab tbody td:nth-child(2),
#dataTab tbody td:nth-child(5),
#dataTab tbody td:nth-child(7){
  width: 150px;
}
#dataTab tbody td:nth-child(3){
  width: 100px;
}
#dataTab tbody td:nth-child(4),
#dataTab tbody td:nth-child(6){
  width: 90px;
  text-align: center;
}
#dataTab thead th:nth-child(4),
#dataTab thead th:nth-child(6){
  text-align: center;
}

/* Outcome tab column widths - optimized for screen fit */
#outcomeTab thead th,
#outcomeTab tbody td{
  padding: 12px 6px;
}
#outcomeTab tbody td:nth-child(1){
  width: 60px;
}
/* Revenue columns */
#outcomeTab tbody td:nth-child(2),
#outcomeTab tbody td:nth-child(3),
#outcomeTab tbody td:nth-child(5),
#outcomeTab tbody td:nth-child(8),
#outcomeTab tbody td:nth-child(10),
#outcomeTab tbody td:nth-child(11),
#outcomeTab tbody td:nth-child(12){
  width: 8.5%;
  min-width: 80px;
}
/* ROI/Percentage columns */
#outcomeTab tbody td:nth-child(4),
#outcomeTab tbody td:nth-child(6),
#outcomeTab tbody td:nth-child(7),
#outcomeTab tbody td:nth-child(9),
#outcomeTab tbody td:nth-child(13){
  width: 7%;
  min-width: 70px;
}

.cell-input{
  width: 100%;
  max-width: 150px;
  padding: 8px 12px;
  border-radius: 8px;
  border:1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline:none;
  font-size: 13px;
  font-family: inherit;
  transition: all .2s ease;
}
.cell-input:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.cell-input:hover{
  border-color: var(--border);
}
.cell-input.tiny{ 
  width: 100%;
  max-width: 70px;
}
.cell-check{
  width: 18px; 
  height: 18px;
  accent-color: var(--accent);
  cursor:pointer;
  border-radius: 4px;
  transition: all .2s ease;
}
.cell-check:hover{
  transform: scale(1.1);
}
.left{ text-align:left !important; }
.good{ color: var(--good); }
.bad{ color: var(--bad); }

.ltv-input-table{
  width: 100%;
  border-collapse: collapse;
}
.ltv-input-table th{
  background: var(--panel);
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}
.ltv-input-table th:first-child{
  left: 0;
  z-index: 3;
}
.ltv-input-table td{
  padding: 8px 4px;
  border: 1px solid var(--border2);
  text-align: center;
}
.ltv-input-table td:first-child{
  font-weight: 600;
  background: var(--panel);
  position: sticky;
  left: 0;
  z-index: 1;
}
.ltv-cell-wrapper{
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
}
.ltv-cell-wrapper-single{
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 80px;
}
.ltv-cell-input{
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: all .2s ease;
}
.ltv-cell-input:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.ltv-cell-label{
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

.ltv-cohort-table{
  width: 100%;
  border-collapse: collapse;
}
.ltv-cohort-table th{
  background: #a4346d;
  color: white;
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.2);
  position: sticky;
  top: 0;
  z-index: 2;
}
.ltv-cohort-table th:first-child{
  left: 0;
  z-index: 3;
  background: #a4346d;
}
.ltv-cohort-table td{
  padding: 12px 8px;
  border: 1px solid var(--border2);
  text-align: center;
  font-weight: 600;
  font-size: 13px;
}
.ltv-cohort-table td:first-child{
  background: var(--panel);
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 1;
}
.ltv-cohort-table td.empty{
  background: var(--panel2);
}
.ltv-cohort-table td.below-breakeven{
  background: rgba(164, 52, 109, 0.15);
}
.ltv-cohort-table td.breakeven-zone{
  background: rgba(244, 143, 177, 0.3);
}
.ltv-cohort-table td.profitable{
  background: rgba(186, 104, 200, 0.3);
}
.ltv-cohort-table tr.average-row td{
  background: #a4346d;
  color: white;
  font-weight: 700;
}
.ltv-cohort-table tr.average-row td:first-child{
  background: #8b2e5c;
}

.ltv-controls{
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ltv-control-group{
  display: flex;
  align-items: center;
  gap: 8px;
}
.ltv-control-group label{
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
}
.ltv-control-group select{
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.ltv-legend{
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 12px;
  margin-top: 12px;
  padding: 12px;
  background: var(--panel2);
  border-radius: 8px;
  border: 1px solid var(--border2);
}
.ltv-legend-item{
  display: flex;
  align-items: center;
  gap: 6px;
}
.ltv-legend-color{
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.modeling-controls-wrapper{
  margin-bottom: 24px;
}
.modeling-controls{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
@media (max-width: 1200px){ 
  .modeling-controls{ grid-template-columns: 1fr; } 
}
.control-card{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:24px;
  box-shadow: var(--shadow);
  transition: all .2s ease;
}
.control-card:hover{
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}
.control-group{
  margin-bottom: 20px;
}
.control-group:last-child{
  margin-bottom: 0;
}
.control-title{
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border2);
}
.section-collapse-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: all .2s ease;
}
.section-collapse-header:hover{
  border-color: var(--accent);
  background: var(--hover-bg);
}
.section-collapse-header h3{
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}
.collapse-icon{
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform .2s ease;
  font-size: 14px;
}
.modeling-controls-wrapper.collapsed .collapse-icon{
  transform: rotate(-90deg);
}
.modeling-controls{
  max-height: 3000px;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(0.4, 0, 0.2, 1), opacity .2s ease;
  opacity: 1;
}
.modeling-controls-wrapper.collapsed .modeling-controls{
  max-height: 0;
  opacity: 0;
}

/* Sensitivity Analysis Styles */
.sensitivity-controls{
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.sensitivity-control-group{
  display: flex;
  align-items: center;
  gap: 10px;
}
.sensitivity-control-group label{
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.sensitivity-control-group select{
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 180px;
}
.sensitivity-control-group select:hover{
  border-color: var(--accent);
}
.sensitivity-control-group select:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.sensitivity-container{
  display: flex;
  gap: 20px;
  margin-top: 20px;
}
.sensitivity-chart-panel{
  flex: 0 0 60%;
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
}
.sensitivity-chart-panel h3{
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.sensitivity-chart-panel .muted{
  margin: 0 0 20px 0;
  font-size: 14px;
  color: var(--muted);
}

.sensitivity-metrics-panel{
  flex: 0 0 calc(40% - 20px);
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
}

.tornado-chart-container{
  height: 600px;
  position: relative;
}

.loading-state{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  gap: 16px;
}
.loading-state .spinner{
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin{
  to{ transform: rotate(360deg); }
}
.loading-state p{
  color: var(--muted);
  font-size: 14px;
}

.empty-state{
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}
.empty-state p{
  font-size: 14px;
  line-height: 1.6;
  max-width: 400px;
}

.sensitivity-metrics-header{
  margin-bottom: 20px;
}
.sensitivity-metrics-header h3{
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.sensitivity-metrics-header p{
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.sensitivity-metrics-table{
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.sensitivity-metrics-table thead{
  background: var(--panel-alt);
  border-bottom: 2px solid var(--border);
}
.sensitivity-metrics-table th{
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sensitivity-metrics-table th.right{
  text-align: right;
}
.sensitivity-metrics-table tbody tr{
  border-bottom: 1px solid var(--border);
}
.sensitivity-metrics-table tbody tr.highlighted{
  background: var(--accent-light);
}
.sensitivity-metrics-table td{
  padding: 12px;
  font-size: 14px;
  color: var(--text);
}
.sensitivity-metrics-table td.left{
  font-weight: 500;
}
.sensitivity-metrics-table td.right{
  text-align: right;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
}
.sensitivity-metrics-table td.positive{
  color: var(--good);
}
.sensitivity-metrics-table td.negative{
  color: var(--bad);
}

.sensitivity-actions{
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 1024px){
  .sensitivity-container{
    flex-direction: column;
  }
  .sensitivity-chart-panel,
  .sensitivity-metrics-panel{
    flex: 1 1 auto;
    width: 100%;
  }
}

/* AI Assistant Styles */

/* Floating AI Button */
.ai-floating-btn{
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9998;
}
.ai-floating-btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}
.ai-floating-btn:active{
  transform: translateY(0);
}
.ai-floating-btn svg{
  width: 24px;
  height: 24px;
}

/* Badge for unread insights */
.ai-badge{
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--bad);
  color: white;
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

/* Chat Panel */
.ai-chat-panel{
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 140px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  transform: translateX(450px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.ai-chat-panel.open{
  transform: translateX(0);
  opacity: 1;
  pointer-events: all;
}

/* Chat Header */
.ai-chat-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-alt);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.ai-chat-title{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.ai-chat-title svg{
  color: var(--accent);
}
.ai-chat-close{
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.ai-chat-close:hover{
  background: var(--panel);
  color: var(--text);
}

/* Chat Messages */
.ai-chat-messages{
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-message{
  display: flex;
  gap: 12px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn{
  from{
    opacity: 0;
    transform: translateY(10px);
  }
  to{
    opacity: 1;
    transform: translateY(0);
  }
}
.ai-message-user{
  flex-direction: row-reverse;
}
.ai-message-content{
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.ai-message-assistant .ai-message-content{
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
}
.ai-message-user .ai-message-content{
  background: var(--accent);
  color: white;
  margin-left: auto;
}
.ai-message-content p{
  margin: 0;
}
.ai-message-content p + p{
  margin-top: 8px;
}

/* Typing Indicator */
.ai-typing{
  display: flex;
  gap: 4px;
  padding: 8px 0;
}
.ai-typing-dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.4s infinite;
}
.ai-typing-dot:nth-child(2){
  animation-delay: 0.2s;
}
.ai-typing-dot:nth-child(3){
  animation-delay: 0.4s;
}
@keyframes typing{
  0%, 60%, 100%{
    transform: translateY(0);
    opacity: 0.5;
  }
  30%{
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Suggested Questions */
.ai-suggestions{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.ai-suggestion-btn{
  text-align: left;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ai-suggestion-btn:hover{
  background: var(--accent-light);
  border-color: var(--accent);
}

/* Chat Input */
.ai-chat-input{
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel-alt);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.ai-chat-input textarea{
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  transition: border-color 0.2s ease;
}
.ai-chat-input textarea:focus{
  outline: none;
  border-color: var(--accent);
}
.ai-chat-input textarea::placeholder{
  color: var(--muted);
}
.ai-chat-send{
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.ai-chat-send:hover{
  background: var(--accent);
  opacity: 0.9;
  transform: translateY(-1px);
}
.ai-chat-send:active{
  transform: translateY(0);
}
.ai-chat-send:disabled{
  opacity: 0.5;
  cursor: not-allowed;
}

/* AI Insight Cards */
.ai-insights-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.ai-insights-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ai-insights-title{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.ai-insights-title svg{
  color: var(--accent);
}
.ai-insights-refresh{
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.ai-insights-refresh:hover{
  background: var(--panel-alt);
  border-color: var(--accent);
}
.ai-insights-refresh svg{
  width: 14px;
  height: 14px;
}

.ai-insights-list{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-insight-item{
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--panel-alt);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.ai-insight-icon{
  font-size: 20px;
  flex-shrink: 0;
}
.ai-insight-content{
  flex: 1;
}
.ai-insight-title{
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px 0;
}
.ai-insight-message{
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px 0;
  line-height: 1.5;
}
.ai-insight-action{
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.ai-insight-action:hover{
  opacity: 0.8;
}

.ai-insights-loading{
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.ai-insights-loading .spinner{
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

.ai-insights-error{
  text-align: center;
  padding: 20px;
  color: var(--bad);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px){
  .ai-chat-panel{
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  .ai-floating-btn{
    right: 16px;
    bottom: 16px;
  }
}
