/* ============================================================
   TimeSeek Workstation — 核心主题 + 外壳布局
   基于 test 原型: timeseek_futures_panorama_fullwidth_footer_v10.html
   ============================================================ */

/* ---- CSS 变量 (暗色交易工作台) ---- */
:root {
  --primary: #2D9CDB;
  --primary-light: #6BC4FF;
  --primary-dark: #0F6B9C;
  --success: #00D68F;
  --warn: #FFAA3A;
  --danger: #FF4D4F;
  --text: #EFF6FF;
  --muted: #B9D9F5;
  --subtle: #7EA8C9;
  --bg: #0e1621;
  --panel: #07223e;
  --panel-2: #0f233c;
  --line: rgba(45,156,219,.28);
  --glow: 0 0 14px rgba(45,156,219,.26);
  --shadow: 0 14px 34px rgba(0,0,0,.28);

  /* 向后兼容 portal.css 的变量名 */
  --primary-color: var(--primary);
  --primary-light-color: var(--primary-light);
  --success-color: var(--success);
  --warning-color: var(--warn);
  --error-color: var(--danger);
  --text-primary: var(--text);
  --text-secondary: var(--muted);
  --text-tertiary: var(--subtle);
  --border-color: var(--line);
  --border-light: rgba(45,156,219,.18);
  --surface-bg: var(--panel);
  --main-bg: var(--bg);
}

/* ---- Reset ---- */
*,*::before,*::after{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:"Segoe UI","Microsoft YaHei",Arial,sans-serif;
  color:var(--text);
  background:linear-gradient(180deg,#07111d 0%,#0b1827 34%,#0e1621 100%);
  font-size:13px;
  -webkit-font-smoothing:antialiased;
}
body::before{
  content:"";
  position:fixed;inset:0;z-index:-1;
  background:
    radial-gradient(circle at 12% 0,rgba(45,156,219,.22),transparent 34%),
    radial-gradient(circle at 88% 12%,rgba(0,214,143,.08),transparent 28%),
    linear-gradient(180deg,rgba(7,34,62,.35),rgba(7,17,29,.15));
  pointer-events:none;
}
a{text-decoration:none;color:inherit}
button,input,select{font:inherit}
ul,ol{list-style:none;margin:0;padding:0}

/* ---- 滚动条 ---- */
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:rgba(255,255,255,.04)}
::-webkit-scrollbar-thumb{background:rgba(45,156,219,.25);border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:rgba(45,156,219,.45)}

/* ---- 统一下拉框样式 ---- */
select,
.form-select,
.ps-select{
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  background-color:#fff;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 10px center;
  padding-right:30px;
  border:1px solid #d0d5dd;
  color:#1a1a1a;
  border-radius:8px;
  padding:8px 30px 8px 10px;
  font-size:13px;
  outline:none;
  cursor:pointer;
  transition:border-color .2s, box-shadow .2s;
}
select:focus,
.form-select:focus,
.ps-select:focus{
  border-color:#2d9cdb;
  box-shadow:0 0 0 2px rgba(45,156,219,.2);
}
select option,
.form-select option,
.ps-select option{
  background:#fff;
  color:#1a1a1a;
}
select:hover,
.form-select:hover,
.ps-select:hover{
  border-color:#9ca3af;
  background-color:#f9fafb;
}

/* ============================================================
   外壳布局 .app
   grid-template-rows: top(64px) subnav(42px) main(1fr) footer(auto)
   ============================================================ */
.app{
  min-height:100vh;
  display:grid;
  grid-template-rows:64px 42px 1fr auto;
}
.app.no-subnav{
  grid-template-rows:64px 1fr auto;
}

/* ---- 一级导航 .top ---- */
.top{
  background:var(--panel);
  border-bottom:1px solid var(--line);
  display:grid;
  grid-template-columns:200px minmax(0,1fr) auto auto;
  align-items:center;
  gap:10px;
  padding:0 18px;
  box-shadow:0 8px 20px rgba(0,0,0,.2);
  position:sticky;
  top:0;
  z-index:30;
}
.brand{
  height:52px;
  display:flex;
  align-items:center;
  min-width:0;
}
.brand-logo-img{
  display:block;
  height:36px;
  width:auto;
  object-fit:contain;
  object-position:left center;
}

/* 一级导航项 */
.topnav{
  display:flex;
  gap:2px;
  align-items:center;
  justify-content:center;
  overflow:auto;
  min-width:0;
}
.topnav a{
  height:34px;
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  padding:0 8px;
  border-radius:8px;
  white-space:nowrap;
  display:flex;
  align-items:center;
  gap:5px;
  font-size:12px;
  transition:all .18s;
}
.topnav a svg{
  width:15px;height:15px;
  flex:0 0 15px;
}
.topnav a.active{
  background:var(--warn);
  border-color:rgba(255,170,58,.85);
  color:#17202a;
  font-weight:900;
  box-shadow:0 8px 18px rgba(255,170,58,.24);
}
.topnav a:not(.active):hover{
  background:rgba(255,170,58,.14);
  border-color:rgba(255,170,58,.34);
  color:#fff;
}

/* 状态指示器 */
.status-pill{
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  color:var(--muted);
  padding:8px 14px;
  border-radius:8px;
  display:flex;
  align-items:center;
  gap:8px;
  white-space:nowrap;
  font-size:12px;
}
.dot{
  width:8px;height:8px;
  border-radius:99px;
  background:var(--success);
  box-shadow:0 0 10px var(--success);
}
.dot.offline{background:var(--subtle);box-shadow:none}

/* 用户区 */
.user-area{display:flex;align-items:center}
.user-btn{
  display:inline-flex;align-items:center;gap:8px;
  padding:6px 14px 6px 6px;
  border-radius:28px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.1);
  color:var(--muted);
  font-size:13px;
  transition:all .2s;
}
.user-btn:hover{
  background:rgba(238,187,77,.08);
  border-color:rgba(238,187,77,.35);
  color:#fff;
}
.user-avatar{
  width:30px;height:30px;
  border-radius:50%;
  background:rgba(255,255,255,.08);
  display:flex;align-items:center;justify-content:center;
  color:#94a3b8;font-size:14px;
}
.user-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.user-name{max-width:100px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---- 二级导航 .subnav ---- */
.subnav{
  background:rgba(7,34,62,.86);
  backdrop-filter:blur(8px);
  border-bottom:1px solid rgba(45,156,219,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  position:sticky;
  top:64px;
  z-index:20;
}
.subnav-inner{
  width:100%;
  max-width:1380px;
  padding:0 34px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.quick{
  display:flex;
  gap:8px;
  overflow:auto;
}
.quick a{
  height:30px;
  display:flex;
  align-items:center;
  color:var(--subtle);
  padding:0 10px;
  border-radius:8px;
  border:1px solid transparent;
  white-space:nowrap;
  background:transparent;
  font-size:12px;
  transition:all .18s;
}
.quick a.active{
  color:#fff;
  background:rgba(45,156,219,.28);
  border-color:var(--line);
  font-weight:900;
  box-shadow:var(--glow);
}
.quick a:not(.active):hover{
  color:#fff;
  background:rgba(45,156,219,.18);
  border-color:var(--line);
}
.source{
  display:flex;
  gap:10px;
  align-items:center;
  color:var(--subtle);
  font-size:12px;
  white-space:nowrap;
}
.source b{color:var(--success)}

/* ---- 内容区 .main ---- */
.main{
  padding:16px 34px 20px;
  min-width:0;
  width:100%;
  max-width:1380px;
  margin:0 auto;
}
/* 全宽布局：基差、持仓、头寸模块 */
.main.main-full{
  max-width:none;
  padding:0;
}

/* ---- 页脚 .footer ---- */
.footer{
  background:var(--panel);
  border-top:1px solid var(--line);
  box-shadow:0 -8px 20px rgba(0,0,0,.16);
  padding:28px 44px 14px;
}
.footer-inner{
  display:grid;
  grid-template-columns:minmax(240px,1.5fr) repeat(4,minmax(110px,.7fr));
  gap:8px;
  align-items:start;
  max-width:1380px;
  margin:0 auto;
}
.footer-logo{
  width:160px;
  max-width:100%;
  height:auto;
  display:block;
  margin-bottom:8px;
}
.footer-desc{
  color:var(--muted);
  line-height:1.45;
  max-width:320px;
  font-size:12px;
}
.brand-line{
  width:42px;height:2px;
  background:linear-gradient(90deg,var(--primary),transparent);
  margin:8px 0;
}
.footer h4{
  margin:0 0 10px;
  color:#fff;
  font-size:13.5px;
  letter-spacing:.02em;
}
.footer a,.footer p{
  display:block;
  margin:0 0 7px;
  color:var(--muted);
  font-size:12.5px;
  line-height:1.65;
  transition:color .2s;
}
.footer a:hover{color:var(--primary-light)}
.footer-col{padding:0 3px}
.footer-wechat{text-align:center}
.footer-wechat h4{text-align:center}
.footer-qrcode{width:80px;height:80px;border-radius:12px;overflow:hidden;background:#fff;margin:0 auto 6px}
.footer-company{color:#e0eef3;font-weight:600}
.footer-bottom{
  margin-top:12px;
  padding-top:8px;
  border-top:1px solid rgba(45,156,219,.18);
  display:flex;
  justify-content:center;
  gap:16px;
  color:var(--subtle);
  font-size:11px;
}
.footer-qrcode img{width:100%;height:100%;object-fit:cover}
.wechat-tip{font-size:11px;color:var(--subtle);text-align:center}

/* ---- 页面头部 ---- */
.page-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:20px;
  margin-bottom:12px;
}
.page-head h1{font-size:24px;margin:0 0 5px;color:#fff}
.page-head .desc{color:var(--subtle);line-height:1.6;max-width:800px}
.page-head .actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

/* ---- 指标卡片行 ---- */
.metrics{
  display:grid;
  grid-template-columns:repeat(5,minmax(150px,1fr));
  gap:10px;
  margin-bottom:10px;
}
.metric{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:8px;
  padding:10px 14px;
  box-shadow:0 1px 2px rgba(0,0,0,.3);
}
.metric label{display:block;color:var(--subtle);font-size:12px}
.metric strong{display:block;font-size:20px;margin-top:3px;font-family:Consolas,monospace}
.metric small{color:var(--muted);display:block;margin-top:2px;font-size:11px}

/* ---- 双栏布局 ---- */
.layout{
  display:grid;
  grid-template-columns:minmax(0,1.15fr) 420px;
  gap:10px;
  margin-bottom:10px;
}
.layout-equal{grid-template-columns:1fr 1fr}
.layout-wide{grid-template-columns:minmax(0,1fr) 380px}

/* ---- 面板 ---- */
.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:8px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.panel-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding:12px 16px;
  border-bottom:1px solid var(--line);
  background:rgba(15,35,60,.75);
}
.panel-head h2{font-size:16px;margin:0;color:#fff}
.panel-head span{color:var(--subtle);font-size:12px}
.count{
  font-size:10px;
  border:1px solid rgba(45,156,219,.35);
  background:rgba(45,156,219,.12);
  color:var(--primary-light);
  padding:2px 7px;
  border-radius:99px;
}

/* ---- 工具栏 ---- */
.toolbar{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  padding:14px;
  border-bottom:1px solid var(--line);
  background:rgba(15,35,60,.75);
}
.filters{display:flex;gap:8px;flex-wrap:wrap;align-items:center}

/* ---- 空状态 ---- */
.empty-state{
  text-align:center;
  padding:60px 20px;
  color:var(--subtle);
}
.empty-state i{font-size:48px;margin-bottom:16px;opacity:.4}
.empty-state h3{color:var(--muted);margin:0 0 8px}
.empty-state p{margin:0;font-size:13px}

/* ---- 数据表格 ---- */
.table-wrap{overflow:auto}
.table-wrap table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:680px;
}
.table-wrap th,.table-wrap td{
  border-bottom:1px solid rgba(45,156,219,.14);
  padding:6px 7px;
  text-align:right;
  white-space:nowrap;
}
.table-wrap th{
  position:sticky;top:0;
  background:#0d2b4d;
  color:var(--muted);
  font-weight:600;
  font-size:11px;
  z-index:3;
  text-align:center;
}
.table-wrap td{
  font-family:Consolas,"Microsoft YaHei",monospace;
  color:#e8f4ff;
  font-size:12px;
}
.table-wrap td.left{text-align:left}
.table-wrap tr:hover td{background:rgba(45,156,219,.08)}
.table-wrap .code{color:var(--primary-light);font-weight:800}
.table-bar{min-width:80px}
.table-bar b{display:block;font-size:11px;color:inherit}

/* ---- 排行列表 ---- */
.rank-list{padding:10px 14px;display:grid;gap:8px}
.rank-item{
  display:grid;
  grid-template-columns:34px minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  border-bottom:1px solid rgba(45,156,219,.14);
  padding-bottom:8px;
}
.rank-item:last-child{border-bottom:0;padding-bottom:0}
.rank-no{
  width:30px;height:30px;
  border-radius:8px;
  background:#0b1b2f;
  display:grid;place-items:center;
  color:var(--primary-light);
  font-weight:800;
  font-size:13px;
}
.rank-name{
  font-weight:800;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.rank-sub{color:var(--subtle);font-size:12px;margin-top:3px}
.rank-val{font-family:Consolas,monospace;font-weight:800;font-size:14px}

/* ---- 事件列表 ---- */
.event{
  display:grid;
  grid-template-columns:54px minmax(0,1fr) 54px;
  gap:10px;
  align-items:center;
  border-bottom:1px solid rgba(45,156,219,.14);
  padding:8px 0;
}
.event:last-child{border-bottom:0}
.event time{color:var(--warn);font-family:Consolas,monospace;font-size:12px}
.event p{margin:0;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.event em{font-style:normal;color:var(--subtle);text-align:right;font-size:12px}

/* ---- 颜色辅助 ---- */
.up{color:var(--success)}
.down{color:var(--danger)}
.warn{color:var(--warn)}

/* ============================================================
   响应式
   ============================================================ */
@media(max-width:1320px){
  .layout,.layout-equal,.layout-wide{grid-template-columns:1fr}
  .metrics{grid-template-columns:repeat(3,1fr)}
  /* 双栏图表行 */
  .chart-row{grid-template-columns:1fr}
  /* 排行卡片网格 */
  .rank-grid{grid-template-columns:repeat(2,1fr)}
  /* 品种卡片网格 */
  .sb-grid,.it-grid{grid-template-columns:repeat(2,1fr)}
  /* 矩阵行 */
  .matrix-row{grid-template-columns:1fr}
}

@media(max-width:1220px){
  .top{grid-template-columns:180px minmax(0,1fr) auto auto}
  .brand-logo-img{height:32px}
  .topnav{max-width:620px;justify-content:flex-start}
  .subnav-inner{align-items:flex-start;flex-direction:column;padding:8px 0}
  .subnav{height:auto}
  .app{grid-template-rows:64px auto 1fr auto}
  .app.no-subnav{grid-template-rows:64px 1fr auto}
  .footer-inner{grid-template-columns:repeat(2,minmax(0,1fr))}
  .footer-brand{grid-column:1/-1}
}

@media(max-width:900px){
  /* 侧边栏布局 → 单列堆叠 */
  .term-app,.dc-app{grid-template-columns:1fr}
  .term-side,.dc-side{position:relative;top:0;height:auto;border-right:none;border-bottom:1px solid var(--line)}
  /* 居中布局缩小 padding */
  .sb-inner,.it-inner{padding:14px 16px 20px}
  /* 品种卡片 */
  .sb-grid,.it-grid{grid-template-columns:1fr}
  /* 排名卡片 */
  .rank-grid{grid-template-columns:1fr}
  /* 指标卡 */
  .metrics{grid-template-columns:repeat(2,1fr)}
}

@media(max-width:820px){
  .top{height:auto;min-height:64px;align-items:flex-start;grid-template-columns:1fr;padding:10px 14px}
  .brand{height:auto}
  .brand-logo-img{height:auto;max-height:36px;max-width:100%}
  .topnav{width:100%;max-width:none;flex-wrap:wrap}
  .status-pill{align-self:flex-start}
  .user-area{align-self:flex-start}
  .main{padding:14px 12px}
  .main.main-full{padding:0;max-width:none}
  .page-head,.toolbar{flex-direction:column;align-items:stretch}
  .source{white-space:normal}
  .footer{padding:16px 16px 12px}
  .footer-inner{grid-template-columns:1fr}
  .footer-bottom{flex-direction:column;text-align:center;gap:8px}
  /* 驾驶舱磁贴 */
  .cockpit-map{grid-template-columns:repeat(2,1fr)}
  .modules-grid{grid-template-columns:repeat(2,1fr)}
  .features-grid{grid-template-columns:1fr}
  .home-hero{flex-direction:column;text-align:center}
  .hero-stats{justify-content:center}
}

@media(max-width:520px){
  .metrics{grid-template-columns:1fr}
  .footer-inner{grid-template-columns:1fr}
  .cockpit-map{grid-template-columns:1fr}
  .modules-grid{grid-template-columns:1fr}
  .tile.big,.tile.wide{grid-column:auto;grid-row:auto}
  .sb-inner,.it-inner{padding:10px 8px 16px}
  .topnav a{font-size:11px;padding:0 6px}
  .topnav a svg{width:12px;height:12px;flex:0 0 12px}
  .quick a{font-size:11px;padding:0 7px}
  .btn{font-size:12px;padding:7px 10px}
  .page-head h1{font-size:18px}
}
