/* ==========================================================================
   DeepCode V2.0 Web — Design Tokens & Base
   对齐 Createable / harness 设计语言（暗色主题）
   ========================================================================== */
:root {
  --primary: #6C5CE7;
  --primary-hover: #5A4BD1;
  --primary-light: #A29BFE;
  --primary-ghost: rgba(108, 92, 231, 0.1);
  --accent: #FF7675;
  --accent-hover: #F06261;
  --accent-light: #FFA8A7;
  --success: #00B894;
  --success-light: #81ECEC;
  --warning: #FDCB6E;
  --info: #74B9FF;
  --danger: #E17055;
  --bg: #1F2033;
  --card: #2A2C42;
  --border: #3A3D5C;
  --text-main: #F2F3F8;
  --text-sub: #A6ABC2;
  --text-weak: #6E7390;
  --amigo-gold: #F9CA24;
  --amigo-gold-deep: #F0A500;
  --grad-primary: linear-gradient(135deg, #6C5CE7, #A29BFE);
  --grad-amigo: linear-gradient(135deg, #F9CA24, #FF7675);
  --grad-bg: linear-gradient(135deg, #252640, #2A2C42);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --fs-xs: 11px;
  --fs-caption: 12px;
  --fs-body: 14px;
  --fs-h4: 16px;
  --fs-h3: 18px;
  --fs-h2: 22px;
  --fs-h1: 28px;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semi: 600;
  --fw-bold: 700;
  --lh-title: 1.3;
  --lh-body: 1.6;
  --r-xs: 4px;
  --r-sm: 6px;
  --r-btn: 10px;
  --r-input: 10px;
  --r-md: 10px;
  --r-pill: 20px;
  --r-card: 16px;
  --r-xl: 24px;
  --r-full: 999px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-amigo: 0 4px 16px rgba(249, 202, 36, 0.25);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-page: 300ms;
  --dur-emphasis: 500ms;
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 64px;
  --right-panel-w: 320px;
  --topbar-h: 60px;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal: 1000;
  --z-popover: 1500;
  --z-toast: 2000;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-family);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-main);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-weak); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(108,92,231,.4); } 70% { box-shadow: 0 0 0 12px rgba(108,92,231,0); } 100% { box-shadow: 0 0 0 0 rgba(108,92,231,0); } }
.animate-fadeIn { animation: fadeIn var(--dur) var(--ease) both; }
.animate-slideUp { animation: slideUp var(--dur-page) var(--ease) both; }

.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--r-btn);
  font-size: var(--fs-body); font-weight: var(--fw-medium);
  transition: all var(--dur-fast) var(--ease); white-space: nowrap;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-hover); }
.btn-ghost { background: transparent; color: var(--text-sub); border-color: var(--border); }
.btn-ghost:hover { background: var(--primary-ghost); color: var(--primary); border-color: var(--primary-light); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-ghost); }
.btn-sm { padding: 5px 12px; font-size: var(--fs-caption); border-radius: var(--r-sm); }
.btn-lg { padding: 12px 28px; font-size: var(--fs-h4); border-radius: var(--r-md); }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: var(--r-btn); }
.btn-icon:hover { background: var(--primary-ghost); color: var(--primary); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-gradient { background: var(--grad-primary); color: #fff; }
.btn-gradient:hover { box-shadow: var(--shadow-hover); }

/* ---- Inputs ---- */
.input-group { position: relative; margin-bottom: 16px; }
.input-group label { display: block; font-size: var(--fs-caption); color: var(--text-sub); margin-bottom: 6px; font-weight: var(--fw-medium); }
.input, .select, .textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--r-input); font-size: var(--fs-body); color: var(--text-main);
  background: var(--card); transition: all var(--dur-fast) var(--ease); outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ghost); }
.input::placeholder { color: var(--text-weak); }

/* ---- Cards ---- */
.card {
  background: var(--card); border-radius: var(--r-card);
  box-shadow: var(--shadow-card); border: 1px solid var(--border);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
}
.badge-primary { background: var(--primary-ghost); color: var(--primary); }
.badge-success { background: rgba(0,184,148,.15); color: var(--success); }
.badge-warning { background: rgba(253,203,110,.15); color: var(--warning); }
.badge-danger { background: rgba(225,112,85,.15); color: var(--danger); }
.badge-gold { background: rgba(249,202,36,.15); color: var(--amigo-gold-deep); }
.badge-accent { background: rgba(255,118,117,.15); color: var(--accent); }
.badge-info { background: rgba(116,185,255,.15); color: var(--info); }

/* ---- Card 结构（共享基础组件，供各业务页复用） ---- */
.card-hover:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 20px; }
.card-title { font-size: var(--fs-h4); font-weight: var(--fw-semi); color: var(--text-main); }

/* ---- 用量条（进度/配额） ---- */
.usage-bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.usage-bar-fill { height: 100%; border-radius: 3px; transition: width var(--dur-emphasis) var(--ease); }

/* ---- 通用页面容器（各业务页根节点） ---- */
.page { animation: fadeIn var(--dur-page) var(--ease) both; }
.page-header { margin-bottom: 24px; }
.page-title { font-size: var(--fs-h2); font-weight: var(--fw-bold); margin-bottom: 4px; color: var(--text-main); }
.page-subtitle { color: var(--text-sub); font-size: var(--fs-body); }

/* ---- Avatar ---- */
.avatar {
  width: 36px; height: 36px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--fw-semi); font-size: var(--fs-caption); color: #fff;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: var(--fs-xs); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--fs-h4); }
.avatar-human { background: var(--grad-primary); }
.avatar-agent { background: var(--grad-amigo); }

/* ---- Logo mark ---- */
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold); font-size: 18px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(108,92,231,.4);
}

/* ---- Spinner ---- */
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--primary-ghost);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .8s linear infinite; display: inline-block;
}

/* ---- 窄屏提示 ---- */
.width-warn { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; }
.width-warn-inner { max-width: 420px; text-align: center; }
.width-warn-icon { font-size: 48px; margin-bottom: 16px; }
.width-warn-inner h3 { font-size: var(--fs-h3); margin-bottom: 8px; }
.width-warn-inner p { color: var(--text-sub); font-size: var(--fs-body); }
@media (min-width: 1024px) { .width-warn.visible { display: none; } }
