/* === EXCEL THEME SYSTEM === */
:root {
  --bg-excel-header: #107c41; /* 엑셀 시그니처 그린 */
  --grid-line: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #595959;
  --excel-gray: #f3f3f3;
  --excel-light-green: #e2f0d9;
  --excel-dark-green: #375623;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Calibri, Arial, "Malgun Gothic", sans-serif;
  background-color: #e2e8f0;
  color: var(--text-main);
  padding: 10px;
}

.excel-workbook {
  max-width: 1200px;
  margin: 0 auto;
  background-color: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Window title bar */
.excel-title-bar {
  background-color: var(--bg-excel-header);
  color: #ffffff;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 3px 3px 0 0;
}

.excel-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.excel-export-btn, .excel-login-btn {
  background-color: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 3px !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: background-color 0.15s;
}

.excel-export-btn:hover, .excel-login-btn:hover {
  background-color: rgba(255, 255, 255, 0.3) !important;
}

/* Mock Menu bar */
.excel-menu-mock {
  background-color: var(--excel-gray);
  border-bottom: 1px solid var(--grid-line);
  padding: 4px 12px;
  font-size: 11px;
  color: #333333;
  display: flex;
  gap: 15px;
  user-select: none;
}

.excel-menu-item {
  cursor: pointer;
}

.excel-menu-item.active {
  font-weight: 700;
  border-bottom: 2px solid var(--bg-excel-header);
}

/* Formula Bar */
.excel-formula-bar-container {
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border-bottom: 1px solid var(--grid-line);
  padding: 4px;
  font-size: 11px;
  gap: 4px;
}

#excel-address-box {
  width: 50px;
  border: 1px solid var(--grid-line);
  padding: 2px 4px;
  text-align: center;
  background-color: #f8fafc;
  font-weight: 600;
  color: #333333;
  min-height: 18px;
  user-select: none;
}

.excel-fx-icon {
  color: var(--bg-excel-header);
  font-weight: 700;
  font-style: italic;
  padding: 0 6px;
  border-right: 1px solid var(--grid-line);
  user-select: none;
}

#excel-formula-bar {
  flex-grow: 1;
  border: 1px solid var(--grid-line);
  padding: 2px 8px;
  outline: none;
  font-family: Consolas, monospace;
  font-size: 12px;
  color: #333333;
  background-color: #ffffff;
}

/* === SHEET CONTENT PANELS === */
.excel-sheet-content {
  padding: 15px;
  min-height: 600px;
}

/* Table Grid Base */
.excel-grid {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  margin-bottom: 15px;
}

.excel-grid th, .excel-grid td {
  border: 1px solid var(--grid-line);
  font-size: 12px;
  padding: 4px 6px;
  height: 28px;
  vertical-align: middle;
  box-sizing: border-box;
  position: relative;
}

/* Row & Column Headers */
.excel-grid th.excel-col-hdr {
  background-color: var(--excel-gray);
  color: var(--text-muted);
  font-weight: 400;
  text-align: center;
  user-select: none;
}

.excel-grid td.excel-row-hdr {
  background-color: var(--excel-gray);
  color: var(--text-muted);
  font-weight: 400;
  text-align: center;
  width: 30px;
  user-select: none;
}

/* Section Category divider */
.excel-section-hdr {
  background-color: var(--excel-light-green) !important;
  font-weight: 700;
  color: var(--excel-dark-green);
  padding-left: 10px !important;
  text-align: left !important;
}

.excel-label-cell {
  background-color: #fafafa;
  color: #333333;
  font-weight: 500;
}

.excel-val-cell {
  text-align: right;
  font-weight: 600;
  transition: background-color 0.4s ease;
}

.excel-val-cell.up {
  color: #f04438; /* K-상승 빨강 */
}

.excel-val-cell.down {
  color: #3182f6; /* K-하락 파랑 */
}

/* Flash Animations for Price Ticks */
.flash-up {
  background-color: rgba(240, 68, 56, 0.15) !important;
}

.flash-down {
  background-color: rgba(49, 130, 246, 0.15) !important;
}

/* Active focused cell outline */
.excel-grid td:focus-within, .excel-grid td.active-cell {
  outline: 2px solid var(--bg-excel-header) !important;
  outline-offset: -1px !important;
  z-index: 10;
}

/* Inputs/Dropdowns inside grid */
.excel-cell-input, .excel-cell-select {
  border: none !important;
  background: transparent !important;
  width: 100% !important;
  height: 100% !important;
  outline: none !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #0050ff !important;
  padding: 0 !important;
}

.excel-cell-select {
  cursor: pointer !important;
}

/* Filters style like image 2 */
.excel-filter-tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
  align-items: center;
}

.excel-filter-btn {
  background-color: #ffffff;
  border: 1px solid var(--grid-line);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
}

.excel-filter-btn:hover {
  background-color: #f1f5f9;
}

.excel-filter-btn.active {
  background-color: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.excel-star-toggle {
  cursor: pointer;
  color: #ffad5c;
  font-size: 14px;
  text-align: center;
  user-select: none;
}

/* === SHEET 2: TOOL HUB SPECIFIC LAYOUT === */
.tool-hub-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 15px;
}

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

.tool-list-container {
  overflow-y: auto;
  max-height: 580px;
  border: 1px solid var(--grid-line);
}

.tool-detail-pane {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.tool-search-box {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.tool-search-input {
  flex-grow: 1;
  border: 1px solid var(--grid-line);
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 3px;
  outline: none;
}

.tool-search-input:focus {
  border-color: var(--bg-excel-header);
}

/* Preview section styling */
.preview-box {
  border: 1px solid var(--grid-line);
  background-color: #fafafa;
  border-radius: 4px;
  padding: 10px;
}

.preview-title {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-iframe-wrapper {
  height: 480px;
  border: 1px solid var(--grid-line);
  background-color: #ffffff;
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.blogger-btn {
  background-color: #f1f5f9;
  border: 1px solid var(--grid-line);
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.blogger-btn:hover {
  background-color: #e2e8f0;
}

/* TradingView chart layout wrapper */
.tradingview-cell-container {
  width: 100%;
  height: 380px;
  background-color: #ffffff;
}
.live-chart-head { display:flex; justify-content:space-between; align-items:center; padding:10px 16px 0; color:#344054; font-size:12px; }
.live-chart-head strong { font-size:14px; color:#101828; }
.live-chart-head span { color:#667085; }
.live-price-chart { display:block; width:100%; height:335px; overflow:visible; }
.live-price-chart text { fill:#667085; font:11px Arial,sans-serif; }
.live-chart-empty { height:100%; display:flex; align-items:center; justify-content:center; color:#667085; font-size:13px; background:#f9fafb; }

/* === SHEET TABS AT BOTTOM === */
.excel-sheet-tabs {
  background-color: var(--excel-gray);
  border-top: 1px solid var(--grid-line);
  display: flex;
  font-size: 11px;
  padding: 4px 12px;
  gap: 4px;
  align-items: center;
  user-select: none;
  border-radius: 0 0 3px 3px;
}

.excel-tab-label {
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 10px;
}

.excel-tab {
  background-color: #ffffff;
  border: 1px solid var(--grid-line);
  border-bottom: none;
  padding: 4px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 2px 2px 0 0;
  transition: background-color 0.15s;
}

.excel-tab:hover {
  background-color: #fafafa;
}

.excel-tab.active {
  border-top: 3px solid var(--bg-excel-header);
  color: var(--bg-excel-header);
  font-weight: 700;
  background-color: #ffffff;
}

/* Accounting double line */
.excel-accounting-double {
  border-bottom: 3px double #000000 !important;
  font-weight: 700 !important;
}

/* Modal Dialog CSS for Cloud Sync Setup */
.excel-modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.excel-modal-box {
  width: 450px;
  background-color: #ffffff;
  border: 1px solid #707070;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 12px;
  font-family: 'Segoe UI', Calibri, Arial, sans-serif;
}

.excel-modal-header {
  background-color: var(--bg-excel-header);
  color: #ffffff;
  padding: 6px 10px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.excel-modal-close-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}

.excel-modal-body {
  padding: 15px;
  background-color: #f3f3f3;
}

.excel-modal-section {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 3px;
  text-align: left;
}

.excel-modal-section-title {
  font-weight: 700;
  color: var(--excel-dark-green);
  margin-bottom: 8px;
  border-bottom: 1px solid #e2f0d9;
  padding-bottom: 3px;
}

.excel-modal-row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  gap: 10px;
}

.excel-modal-row label {
  width: 120px;
  font-weight: 600;
  color: #333333;
  text-align: left;
}

.excel-modal-input {
  flex-grow: 1;
  border: 1px solid #cbd5e1;
  padding: 3px 6px;
  outline: none;
  font-size: 11px;
}

.excel-modal-input:focus {
  border-color: var(--bg-excel-header);
}

.excel-modal-select {
  flex-grow: 1;
  border: 1px solid #cbd5e1;
  padding: 2px 4px;
  outline: none;
  font-size: 11px;
}

.excel-modal-footer {
  background-color: #f3f3f3;
  border-top: 1px solid #cbd5e1;
  padding: 8px 15px;
  text-align: right;
}

.excel-modal-btn {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 4px 15px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 5px;
  border-radius: 2px;
}

.excel-modal-btn:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
}

.excel-modal-btn.primary {
  background-color: var(--bg-excel-header);
  color: #ffffff;
  border-color: var(--bg-excel-header);
}

.excel-modal-btn.primary:hover {
  background-color: #0e6b38;
}

/* === QUANT & BACKTEST LAYOUTS === */
.quant-layout {
  display: flex;
  gap: 15px;
  padding: 10px;
}

.quant-sidebar {
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quant-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quant-card {
  border: 1px solid var(--grid-line);
  border-radius: 4px;
  background-color: #ffffff;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.quant-card-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 2px solid var(--bg-excel-header);
  padding-bottom: 6px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Heatmap grid table styles */
.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: center;
}

.heatmap-table th {
  background-color: var(--excel-gray);
  border: 1px solid var(--grid-line);
  font-weight: 600;
  padding: 4px;
  color: var(--text-muted);
}

.heatmap-table td {
  border: 1px solid var(--grid-line);
  padding: 4px;
  font-weight: 600;
}

/* Monospaced code preview box */
.code-preview-box {
  background-color: #f8fafc;
  border: 1px solid var(--grid-line);
  border-radius: 4px;
  padding: 8px;
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 11px;
  color: #0f172a;
  overflow: auto;
  max-height: 250px;
  white-space: pre;
  line-height: 1.4;
  text-align: left;
}

/* Agent streaming terminal box */
.agent-terminal {
  background-color: #0c1017;
  border: 1px solid #1f2937;
  border-radius: 4px;
  padding: 10px;
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 11px;
  color: #34d399; /* Green text */
  overflow-y: auto;
  height: 150px;
  line-height: 1.5;
  white-space: pre-wrap;
  text-align: left;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.agent-log-line {
  margin-bottom: 4px;
}

.agent-tag-director { color: #f59e0b; }
.agent-tag-quant { color: #3b82f6; }
.agent-tag-risk { color: #ef4444; }
.agent-tag-execution { color: #10b981; }

/* Performance Grid Cards */
.perf-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.perf-metric-card {
  border: 1px solid var(--grid-line);
  border-radius: 4px;
  background-color: var(--excel-gray);
  padding: 8px;
  text-align: center;
}

.perf-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.perf-metric-value {
  font-size: 16px;
  font-weight: 800;
  margin-top: 4px;
}

.excel-compare-checkbox {
  cursor: pointer;
  margin-right: 5px;
}


/* Shared working surface: preserve the existing spreadsheet layout. */
.site-status {display:flex;flex-wrap:wrap;gap:8px 20px;padding:12px 16px;background:#eff6f1;border-bottom:1px solid #cbd5e1;font-size:14px;line-height:1.6;}
.site-status span {flex:1 1 320px;}
.site-status a {color:#14532d;}
.example-notice {padding:12px;background:#fff7df;color:#78350f;font-size:14px;border-left:3px solid #d97706;}
button,input,select {font:inherit;}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible {outline:3px solid #2563eb;outline-offset:2px;}
.excel-modal-body {font-size:16px;line-height:1.6;}
.excel-title-bar {font-size:16px;gap:12px;flex-wrap:wrap;}
.excel-tabs {overflow-x:auto;}
@media(max-width:700px) {
 body{padding:0;}
 .excel-workbook{width:100%;min-width:0;}
 .excel-market-panel{display:block!important;}
 .excel-market-card{min-width:0!important;width:100%;margin-bottom:10px;}
 .excel-sheet-content{overflow-x:auto;}
 .excel-modal-box{width:calc(100vw - 24px);max-width:520px;}
 .excel-title-bar{padding:12px;}
}

.excel-header-controls{flex-wrap:wrap;gap:8px}.workspace-blog-button{display:inline-flex;align-items:center;padding:8px 12px;border:1px solid #107c41;border-radius:4px;background:#fff;color:#107c41;font-size:14px;font-weight:700;text-decoration:none}.workspace-home-link{color:inherit;font-size:14px}.workspace-blog-panel{margin:16px 0;padding:16px;border:1px solid var(--border-color);background:white}.workspace-blog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.workspace-blog-heading h2{font-size:18px;margin:0}.workspace-blog-panel #blog-posts-status{font-size:14px;color:var(--text-muted)}.workspace-blog-panel #blog-posts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.workspace-blog-panel .blog-card{display:flex;flex-direction:column;gap:10px;padding:16px;border:1px solid var(--border-color);color:var(--text-primary);text-decoration:none}.workspace-blog-panel .blog-card h3{font-size:16px;line-height:1.6;margin:0;overflow-wrap:anywhere}.workspace-blog-panel .eyebrow{font-size:14px;color:var(--text-muted)}.workspace-blog-panel .text-link{font-size:14px;color:#107c41;margin-top:auto}.workspace-blog-panel #blog-more{padding:8px 12px;margin-top:12px;font-size:14px}@media(min-width:701px){.workspace-blog-panel #blog-more{display:none}}@media(max-width:700px){.workspace-blog-panel #blog-posts{grid-template-columns:1fr}.workspace-blog-panel #blog-posts:not(.expanded) .blog-card:nth-child(n+4){display:none}.excel-title-bar{flex-wrap:wrap;gap:10px}}
