
/* ============================================================
   ComputeHub 设计系统
   视觉参考：阿里巴巴矢量图标库 iconfont.cn
   白底 / 阿里橙 / 浅灰栅格 / 小圆角 / 线性图标 / 图标矩阵卡片
   ============================================================ */
:root {
  --brand: #ff6600;
  --brand-600: #ed5c00;
  --brand-700: #d95300;
  --brand-100: #ffe8d9;
  --brand-050: #fff5ef;

  --ink: #1d2129;
  --ink-2: #4e5969;
  --ink-3: #86909c;
  --ink-4: #b7bec8;

  --line: #e9ebef;
  --line-2: #f2f3f5;
  --bg: #f5f6f8;
  --panel: #ffffff;

  --ok: #00a870;
  --ok-bg: #e8fff5;
  --warn: #ff7d00;
  --warn-bg: #fff4e8;
  --danger: #f53f3f;
  --danger-bg: #ffece8;
  --info: #2a6df4;
  --info-bg: #eaf1ff;
  --purple: #7b5cff;
  --purple-bg: #f1edff;

  --shadow-card: 0 1px 2px rgba(29, 33, 41, 0.03);
  --shadow-hover: 0 6px 20px rgba(255, 102, 0, 0.12);

  /* shadcn 主题变量：主色改为阿里橙 */
  --background: 0 0% 100%;
  --foreground: 216 12% 12%;
  --card: 0 0% 100%;
  --card-foreground: 216 12% 12%;
  --popover: 0 0% 100%;
  --popover-foreground: 216 12% 12%;
  --primary: 24 100% 50%;
  --primary-foreground: 0 0% 100%;
  --secondary: 220 14% 96%;
  --secondary-foreground: 216 12% 12%;
  --muted: 220 14% 96%;
  --muted-foreground: 215 9% 55%;
  --accent: 24 100% 96%;
  --accent-foreground: 24 100% 40%;
  --destructive: 0 87% 60%;
  --destructive-foreground: 0 0% 100%;
  --border: 220 13% 92%;
  --input: 220 13% 92%;
  --ring: 24 100% 50%;
  --radius: 0.375rem;
}

* { box-sizing: border-box; }

html, body, #root { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.num {
  font-family: "DIN Alternate", "Roboto Mono", "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d8dce3; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c2c8d2; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局 ---------- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: 60px;
  flex: 0 0 60px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, #ff8a2b, #ff5a00);
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(255, 102, 0, .28);
  flex: none;
}

.body-row { display: flex; flex: 1; min-height: 0; align-items: stretch; }

.sidebar {
  width: 224px;
  flex: 0 0 224px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 14px 10px 32px;
  overflow-y: auto;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  transition: width .2s ease, flex-basis .2s ease;
}
.sidebar.collapsed { width: 60px; flex-basis: 60px; padding-left: 6px; padding-right: 6px; }

.nav-label {
  font-size: 11px; color: var(--ink-4); letter-spacing: .6px;
  padding: 14px 12px 6px; font-weight: 600;
}
.sidebar.collapsed .nav-label { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 11px; margin: 2px 0;
  border-radius: 5px; color: var(--ink-2);
  cursor: pointer; user-select: none;
  font-size: 13px; white-space: nowrap;
  transition: background .16s, color .16s;
}
.nav-item:hover { background: var(--brand-050); color: var(--brand); }
.nav-item.active { background: var(--brand-050); color: var(--brand); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav-item .nav-ico { flex: none; }
.sidebar.collapsed .nav-item span.nav-text,
.sidebar.collapsed .nav-item .nav-badge { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; }

.main { flex: 1; min-width: 0; padding: 20px 24px 48px; }

/* ---------- 通用组件 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
}
.panel-hd {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-2);
}
.panel-title { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0; }
.panel-body { padding: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: 4px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  transition: all .16s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--brand-050); }
.btn-sm { height: 27px; padding: 0 10px; font-size: 12px; }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 12px; border-radius: 14px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: all .16s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }

.tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 3px; font-size: 11px;
  line-height: 18px; font-weight: 500; white-space: nowrap;
}
.tag-p0 { background: var(--danger-bg); color: var(--danger); }
.tag-p1 { background: var(--info-bg); color: var(--info); }
.tag-p2 { background: var(--warn-bg); color: var(--warn); }
.tag-plus { background: var(--purple-bg); color: var(--purple); }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.tag-info { background: var(--info-bg); color: var(--info); }
.tag-gray { background: #f2f3f5; color: var(--ink-3); }

.input, .select {
  height: 32px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 4px; background: #fff; color: var(--ink);
  font-size: 13px; outline: none; transition: border-color .16s, box-shadow .16s;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(255,102,0,.1); }
.input::placeholder { color: var(--ink-4); }
.select { cursor: pointer; padding-right: 22px; }

.search-pill {
  height: 36px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--bg); display: flex; align-items: center;
  padding: 0 6px 0 14px; gap: 8px; transition: all .18s;
}
.search-pill:focus-within { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255,102,0,.08); }
.search-pill input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 13px; }
.search-pill input::placeholder { color: var(--ink-4); }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-weight: 500; color: var(--ink-3);
  background: #fafbfc; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-size: 12px;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: middle; }
.data-table tbody tr { transition: background .14s; }
.data-table tbody tr:hover { background: #fffaf6; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .cell-main { color: var(--ink); font-weight: 500; }

/* ---------- iconfont 风格图标矩阵 ---------- */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.icon-grid.compact { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }

.icon-card {
  position: relative; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer; overflow: hidden;
  transition: border-color .18s, box-shadow .18s, transform .18s;
  min-height: 116px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 14px 8px 10px;
}
.icon-card:hover { border-color: var(--brand); box-shadow: var(--shadow-hover); }
.icon-card .ico-box {
  width: 46px; height: 46px; border-radius: 8px; background: var(--brand-050);
  display: grid; place-items: center; color: var(--brand);
  transition: background .18s, color .18s;
}
.icon-card:hover .ico-box { background: var(--brand); color: #fff; }
.icon-card .ico-name {
  font-size: 12px; color: var(--ink-2); text-align: center; line-height: 1.35;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-card .ico-meta { font-size: 10px; color: var(--ink-4); }
.icon-card .ico-corner { position: absolute; top: 6px; right: 6px; }
.icon-card .ico-actions {
  position: absolute; left: 0; right: 0; bottom: 0; height: 28px;
  background: var(--brand); color: #fff; display: flex; align-items: center;
  justify-content: center; gap: 12px; font-size: 11px;
  transform: translateY(100%); transition: transform .18s ease;
}
.icon-card:hover .ico-actions { transform: translateY(0); }
.icon-card .ico-actions button { color: #fff; opacity: .9; }
.icon-card .ico-actions button:hover { opacity: 1; text-decoration: underline; }

.center-card {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 16px; cursor: pointer; transition: border-color .18s, box-shadow .18s;
  display: flex; gap: 13px; align-items: flex-start; min-height: 104px;
}
.center-card:hover { border-color: var(--brand); box-shadow: var(--shadow-hover); }
.center-card .cc-ico {
  width: 40px; height: 40px; flex: none; border-radius: 8px;
  display: grid; place-items: center; background: var(--brand-050); color: var(--brand);
}
.center-card:hover .cc-ico { background: var(--brand); color: #fff; }

/* ---------- 统计卡 ---------- */
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 15px 16px; position: relative; overflow: hidden;
}
.stat .s-label { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.stat .s-value { font-size: 25px; font-weight: 650; color: var(--ink); margin-top: 7px; line-height: 1.2; }
.stat .s-foot { font-size: 11px; color: var(--ink-4); margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.stat .s-ico { position: absolute; right: 14px; top: 14px; color: var(--brand); opacity: .16; }
.trend-up { color: var(--danger); }   /* 国内习惯：涨用红 */
.trend-down { color: var(--ok); }

/* ---------- 弹窗 / 抽屉 ---------- */
.mask { position: fixed; inset: 0; background: rgba(29,33,41,.42); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 8px; width: 520px; max-width: 100%; max-height: 86vh; overflow: auto; box-shadow: 0 12px 48px rgba(0,0,0,.18); }
.modal-hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-bd { padding: 20px; }
.modal-ft { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.toast-wrap { position: fixed; top: 74px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--ok);
  border-radius: 5px; padding: 10px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.1);
  font-size: 13px; color: var(--ink); min-width: 220px;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ---------- 其他 ---------- */
.breadcrumb { font-size: 12px; color: var(--ink-4); display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.page-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-title { font-size: 20px; font-weight: 650; color: var(--ink); margin: 0 0 4px; }
.page-desc { font-size: 12px; color: var(--ink-3); margin: 0; }

.hero-search {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 22px 24px; margin-bottom: 18px;
}
.hero-title { font-size: 18px; font-weight: 650; margin: 0 0 3px; }
.hero-sub { font-size: 12px; color: var(--ink-3); margin: 0 0 16px; }

.bar-track { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--brand); transition: width .3s; }

.code-block {
  background: #f7f8fa; border: 1px solid var(--line); border-radius: 5px;
  padding: 12px 14px; font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px; color: #3d4658; white-space: pre-wrap; word-break: break-all;
}
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-3); }
.kv .v { color: var(--ink); font-weight: 500; text-align: right; }

.switch { width: 34px; height: 19px; border-radius: 19px; background: #d8dce3; position: relative; cursor: pointer; transition: background .18s; flex: none; }
.switch.on { background: var(--brand); }
.switch::after { content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: left .18s; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.switch.on::after { left: 17px; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-danger { background: var(--danger); }
.dot-off { background: var(--ink-4); }

.link { color: var(--brand); cursor: pointer; }
.link:hover { text-decoration: underline; }

.empty { padding: 40px 16px; text-align: center; color: var(--ink-4); font-size: 13px; }

@media (max-width: 1024px) {
  .sidebar { width: 60px; flex-basis: 60px; padding-left: 6px; padding-right: 6px; }
  .sidebar .nav-label, .sidebar .nav-text, .sidebar .nav-badge { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 0; }
  .main { padding: 16px; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .main { padding: 14px 12px 40px; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}

/* 双栏自适应：看板与详情页在窄屏自动堆叠 */
@media (max-width: 1100px) {
  .resp-2 { grid-template-columns: 1fr !important; }
}
.resp-2 { min-width: 0; }

/* 顶栏在中小屏隐藏次要信息，保证胶囊搜索可用 */
@media (max-width: 900px) {
  .topbar > div:first-child { min-width: auto !important; }
  .topbar > div:first-child > div:last-child { display: none; }
  .topbar .btn-ghost, .topbar #envBadge { display: none; }
}
