:root {
    --primary: #4a6fa5;
    --secondary: #6b8cbc;
    --backtesting: #607D8B;
    --background: #f5f7fb;
    --editor-bg: #1e1e1e;
    --border: #dde3ed;
    --toolbar-width: 44px;
    --toolbar-width-neg: -44px;
    --divider-size: 4px;
    --radius-size: 8px;    
}

/* 暗色主题样式 */
.sl-theme-dark {
    --bg-color: #1a1a2e;
    --text-color: #e6e6ff;
    --card-bg: #16213e;
    --card-border: #0f3460;
    /*--accent-color: #e94560;*/
    --accent-color:#e6e6ff4d;
    --shadow-color: rgba(0, 0, 0, 0.5);
}


/* 亮色主题样式 */
.sl-theme-light {
    --bg-color: #f0f5ff;
    --text-color: #333366;
    --card-bg: #ffffff;
    --card-border: #d6e4ff;
    --accent-color: #4d6cfa;
    --shadow-color: rgba(100, 100, 150, 0.1);
}

html {
    overflow:auto;
}
body {
    height:100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0.0rem 0.0rem 0.0rem 0.0rem;
    background-color: var(--sl-color-neutral-200);
    overflow:auto;
}

.topbar {    
    padding:0.1rem 0.2rem 0.1rem 0.2rem;    
    background-color: var(--sl-color-neutral-0);
}

.viewpanel {
    flex:1;display:flex;flex-direction: row;margin-top:0.2rem;margin-bottom:0rem;    
}

.fullpanel {
    z-index:5;background:var(--sl-color-neutral-200);border-left:1px solid var(--sl-color-neutral-200);position:fixed;top:0px;left:0px;width:calc(100vw);height:calc(100vh);
}
.marketpanel {
    flex:1;display:flex;flex-direction: row;margin-top:0.2rem;margin-bottom:0rem;
}

#leftbar {
    display:flex;flex-direction: column; width:var(--toolbar-width);    
    background-color: var(--sl-color-neutral-0);
    margin-right:var(--divider-size);
    border-top-right-radius: var(--radius-size);
}
#rightbar {
    display:flex;flex-direction: column; width:var(--toolbar-width);    
    background-color: var(--sl-color-neutral-0);    
    border-left:1px solid     var(--sl-color-neutral-200)
}

.tv-lightweight-charts {
    border-radius: var(--radius-size);
}

.chart-pane {
    width:100;
    height:100%;
    position:relative;
}

.chart-toolbar {
    position: absolute;
    left:var(--divider-size);
    top:var(--divider-size);
    z-index:2;    
}

sl-split-panel {
    flex:1;    
}

sl-split-panel .left-panel{
    border-radius: 0px;    
    border-top-left-radius: var(--radius-size);
    border-top-right-radius: var(--radius-size);
    height: 100%; background: var(--sl-color-neutral-0); 
    max-height:calc(100vh - var(--toolbar-width) - var(--divider-size))
}
sl-split-panel .right-panel{
    border-radius: 0px;
    border-top-left-radius: var(--radius-size);
    height: 100%; background: var(--sl-color-neutral-0); 
    max-height:calc(100vh - var(--toolbar-width) - var(--divider-size))
}

sl-split-panel .left-panel .up-panel {
    border-radius: var(--radius-size);    
    width:100%;
    height:100%;
    background: var(--sl-color-neutral-0);        
    overflow:hidden; 
}

sl-split-panel .left-panel .down-panel {
    border-top-left-radius: var(--radius-size);
    border-top-right-radius: var(--radius-size);
    height:100%;
    background: var(--sl-color-neutral-0);    
    overflow:hidden;
    position:relative;
}

sl-split-panel .right-panel .up-panel {
    border-top-left-radius: var(--radius-size);    
    border-bottom-left-radius: var(--radius-size);    
    height:100%;
    background: var(--sl-color-neutral-0);
    overflow:auto;
    display:flex;
    flex-direction: column;
}

sl-split-panel .right-panel .down-panel {
    border-top-left-radius: var(--radius-size);    
    height:100%;
    background: var(--sl-color-neutral-0);
    overflow:auto;        
}

.input-row {
    display: flex;           /* 启用 Flexbox */
    flex-direction: row;     /* 水平排列（默认值，可省略） */
    gap: 12px;              /* 元素间距（可选） */
    align-items: center;     /* 垂直居中对齐（可选） */
  }
  
  /* 可选：防止输入框宽度溢出 */
  .input-row sl-input.searchbox {
    flex: 1;                /* 平均分配宽度 */
    min-width: 140px;       /* 最小宽度限制 */
    max-width: 140px;    
  }
  .searchsuggest {
    display:none;
    z-index:4;
    position:absolute;
    top:var(--toolbar-width);
    border-bottom-left-radius: var(--radius-size);
    border-bottom-right-radius: var(--radius-size);
    border:1px solid var(--sl-color-neutral-200);
    background-color: var(--sl-color-neutral-0);
    box-shadow: 0 4px 10px var(--shadow-color);
    padding:0.5rem;
  }

  .searchsuggest .table tr{
    white-space: nowrap;
  }

  .input-row sl-input#input_buying_condition {
    flex: 1;                /* 平均分配宽度 */
    min-width: 200px;       /* 最小宽度限制 */
    max-width: 60rem;
  }

.icon-button {
    font-size:1.5rem;
}
  
  .theme-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--card-bg);
    border-radius: 2rem;
    padding: 0.5rem;
    box-shadow: 0 4px 10px var(--shadow-color);
    cursor: pointer;
}

.theme-toggle sl-icon {
    font-size: 1.5rem;
    padding: 0.2rem;
    border-radius: 50%;
    color: var(--text-color);
}

.theme-toggle sl-icon.active {
    background: var(--accent-color);
    color: white;
}

.theme-toggle sl-icon.active {
    background: var(--accent-color);
    color: white;
}


.ag-row-dark-odd {
    background-color: #4a4a4a; /* 更深的灰色 */
    border-radius: 10px;
}
.ag-row-dark-even {
    background-color: #3a3a3a; /* 深灰色 */
    border-radius: 10px;
}

.ag-row-light-odd {
    background-color: rgb(238, 241, 238);
    border-radius: 10px;
}
.ag-row-light-even {
    background-color: white;
    border-radius: 10px;
}



/*
Marked Style
*/
/* 通用标记样式 */
.marked {
    font-size: 1.05rem;
    color: var(--sl-color-neutral-800);
}

.marked h1 {
    font-size: 2rem;
    color: var(--sl-color-primary-600);
    margin: 2rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--sl-color-primary-200);
}

.marked h2 {
    font-size: 1.7rem;
    color: var(--sl-color-primary-500);
    margin: 1.8rem 0 1.2rem;
}

.marked h3 {
    font-size: 1.4rem;
    color: var(--sl-color-primary-400);
    margin: 1.5rem 0 1rem;
}

.marked p {
    margin: 1rem 0;
    line-height: 1.7;
}

.marked a {
    color: var(--sl-color-primary-500);
    text-decoration: none;
    border-bottom: 1px dotted var(--sl-color-primary-300);
    transition: all 0.2s ease;
}

.marked a:hover {
    color: var(--sl-color-primary-600);
    border-bottom-style: solid;
}

.marked blockquote {
    border-left: 4px solid var(--sl-color-primary-300);
    padding: 0.8rem 1.2rem;
    margin: 1.5rem 0;
    background: var(--sl-color-primary-50);
    border-radius: 0 6px 6px 0;
    font-style: italic;
}

.marked pre {
    background: var(--sl-color-neutral-100);
    border-radius: 8px;
    padding: 1.2rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--sl-color-neutral-200);
}

.marked code {
    font-family: 'Fira Code', 'Consolas', monospace;
    background: var(--sl-color-neutral-100);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.95rem;
}

.marked pre code {
    background: transparent;
    padding: 0;
}

.marked ul, .marked ol {
    margin: 1.2rem 0;
    padding-left: 2rem;
}

.marked li {
    margin: 0.6rem 0;
}

.marked hr {
    border: none;
    border-top: 1px solid var(--sl-color-neutral-200);
    margin: 2rem 0;
}

/* 表格样式 */
.marked table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.marked th {
    background: var(--sl-color-primary-500);
    color: white;
    text-align: left;
    padding: 0.8rem 1rem;
    font-weight: 600;
}

.marked td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--sl-color-neutral-200);
}

.marked tr:nth-child(even) {
    background: var(--sl-color-neutral-50);
}


.editor-container {
    flex: 3;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

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

.editor-actions {
    display: flex;
    gap: 10px;
}

#editor {
    height: 100%;
    width: 100%;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    background-color:  rgba(0, 0, 0, 0.08);
}

.sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 300px;
}

.panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.panel-header {
    padding: 15px 20px;
    background-color: #f8fafd;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-content {
    padding: 20px;
}

.fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.field-card {
    background: #f8fafd;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.field-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.field-name {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 5px;
}

.field-name-backtesting {
    font-weight: 600;
    color: var(--backtesting);
    margin-bottom: 5px;
}

.field-type {
    font-size: 0.85rem;
    color: #666;
    background: #eef2f7;
    padding: 3px 8px;
    border-radius: 20px;
    display: inline-block;
}

.suggestion-highlight {
    color: var(--primary);
    font-weight: bold;
}

.database-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f0f7ff;
    border-radius: 8px;
    margin-bottom: 15px;
}

.feature-badge {
    background: #e6f7ff;
    color: #1890ff;
    border: 1px solid #91d5ff;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.8rem;
    margin-top: 5px;
    display: inline-block;
}

/* 自定义样式 */
.neutral-text::part(base) {
background-color: transparent;
border: none;
color: var(--sl-color-neutral-1000);
box-shadow: none;
}

.neutral-text::part(base):hover,
.neutral-text::part(base):focus {
background-color:var(--sl-color-neutral-200);
color: var(--sl-color-neutral-1000);
}

.bold-text::part(base) {
    background-color: transparent;
    border: none;
    color: var(--sl-color-neutral-1000);
    box-shadow: none;
    font-weight: bold;
}
    
.bold-text::part(base):hover,
.bold-text::part(base):focus {
background-color:var(--sl-color-neutral-200);
color: var(--sl-color-neutral-1000);
font-weight: bold;
}

#tv-attr-logo {
    display:none;
}


.table tr:hover .tr-action-btn {
    position:absolute;
    right:0px;
    top:0px;
    display: inline;
  }

  .tr-action-btn {    
    display:none;
    vertical-align: middle;
    text-align: right;
    
    white-space: nowrap;
  }

  .alert-toast {
    z-index:100000;
    position:fixed;
    top:0.5rem;
    left:0.5rem;
  }

  sl-tab::part(base) {
    padding: 0.5rem;
  }

.jsPanel {
    border-radius: var(--radius-size);
}

.jsPanel-hdr {
    border-top-left-radius: var(--radius-size);
    border-top-right-radius: var(--radius-size);
}
.jsPanel-headerbar{
    border-bottom:1px solid var(--sl-color-neutral-200);
}

.jsPanel-content {
    border-bottom-left-radius: var(--radius-size);
    border-bottom-right-radius: var(--radius-size);
}