:root {
  --bg-page: #FCF9F6;
  --bg-sidebar: #F7F0EA;
  --bg-card: #FFFFFF;
  --bg-hover: #F7ECE5;
  --bg-active: #FFF1DD;
  --bg-table-header: #FBF5EF;
  --bg-table-hover: #FFF9F4;

  --accent: #B77A2D;
  --accent-dark: #8F571F;
  --accent-hover: #D5963E;
  --accent-active: #9B6326;
  --accent-pale: #FFF3DE;

  --text-primary: #33231F;
  --text-secondary: #79625A;
  --text-tertiary: #A18B80;

  --border: #E9DDD4;
  --border-hover: #D8BCAB;
  --border-focus: #B77A2D;

  --success: #3E9874;
  --error: #D4513F;
  --warning: #C98827;

  --shadow-sm: 0 1px 2px rgba(70, 37, 26, 0.04), 0 5px 16px rgba(122, 71, 43, 0.05);
  --shadow-md: 0 6px 26px rgba(113, 66, 41, 0.09), 0 0 24px rgba(211, 82, 43, 0.035);

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --font-serif: var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;

  --transition: 0.15s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: radial-gradient(700px 420px at 92% -8%, rgba(230, 117, 57, 0.11), transparent 64%), radial-gradient(550px 360px at 18% 110%, rgba(229, 181, 103, 0.10), transparent 70%), var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-sidebar);
  padding: 2px 6px;
  border-radius: 4px;
}

pre {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-sidebar);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

strong {
  font-weight: 600;
  color: var(--text-primary);
}

ul, ol {
  padding-left: 24px;
  margin: 8px 0;
}

li {
  margin: 4px 0;
}

.app-header {
  background: linear-gradient(100deg, #FFFDFC 0%, #FFF7F0 58%, #FFF9F2 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
}

.brand-mark {
  font-size: 0;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(238, 167, 55, 0.30), rgba(219, 65, 38, 0.07) 62%, transparent 70%);
  box-shadow: 0 0 18px rgba(228, 101, 39, 0.18);
  overflow: hidden;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.brand-text {
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.layout {
  display: block;
  height: calc(100vh - 64px);
}

nav.sidebar {
  width: 72px;
  background: linear-gradient(165deg, rgba(255,255,255,.97) 0%, rgba(251,242,234,.97) 54%, rgba(244,225,205,.96) 100%);
  border: 1px solid rgba(176, 118, 66, .20);
  border-radius: 22px;
  padding: 14px 0 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  top: 78px;
  bottom: 16px;
  left: 14px;
  z-index: 90;
  transform: none;
  transition: width 260ms cubic-bezier(.22,.82,.26,1), box-shadow 260ms ease, border-color 260ms ease;
  box-shadow: 0 18px 42px rgba(81, 48, 24, .13), 0 2px 9px rgba(128, 74, 31, .07);
  overscroll-behavior: contain;
}
nav.sidebar:is(:hover, :focus-within, .is-open) { width:min(324px, calc(100vw - 40px)); overflow-y:auto; border-color:rgba(190, 120, 51, .38); box-shadow:0 24px 52px rgba(81,48,24,.20), 0 2px 9px rgba(128,74,31,.08); }
.nav-drawer-toggle { display:inline-flex; align-items:center; gap:7px; height:34px; padding:0 12px; border:1px solid var(--border); border-radius:10px; background:linear-gradient(135deg, var(--bg-card), #FFF7EB); color:var(--text-secondary); cursor:pointer; font-size:13px; font-weight:650; box-shadow:0 3px 12px rgba(117,72,35,.06); transition:all .2s ease; }
.nav-drawer-toggle:hover { color:var(--accent); border-color:rgba(202,132,45,.65); box-shadow:0 6px 18px rgba(184,112,39,.16); transform:translateY(-1px); }
.nav-drawer-backdrop { display:none; }

.nav-group {
  margin-bottom: 14px;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 0 24px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1px 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 450;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
  border: none;
  background: transparent;
  width: calc(100% - 24px);
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(212, 81, 63, 0.11), var(--accent-pale));
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--error), 0 3px 12px rgba(208, 84, 47, 0.06);
}

.nav-item.active::before {
  content: none;
}

.nav-item.soon {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-ico {
  font-size: 18px;
  line-height: 1;
  width: 20px;
  text-align: center;
}

.nav-tag {
  margin-left: auto;
  font-size: 11px;
  background: var(--bg-card);
  color: var(--text-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Desktop: a compact icon rail expands into a floating command palette when
   hovered or keyboard-focused. The top button pins it for long admin flows. */
@media (min-width: 961px) {
  nav.sidebar:is(:hover, :focus-within, .is-open) .nav-group:first-child { padding-top:6px; }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .nav-group { margin-bottom:8px; }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .nav-group + .nav-group { border-top:1px solid rgba(151,100,59,.13); padding-top:8px; }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .nav-group-title { height:0; padding:0; margin:0; opacity:0; overflow:hidden; }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .nav-item { width:48px; height:46px; min-height:46px; margin:2px auto; padding:0; justify-content:center; gap:0; border-radius:14px; }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .nav-item > span:not(.nav-ico),
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .nav-tag { display:none; }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .nav-ico { width:22px; display:inline-flex; align-items:center; justify-content:center; }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .nav-item.active { background:linear-gradient(145deg, rgba(225,134,40,.20), rgba(212,81,63,.10)); box-shadow:inset 2px 0 0 var(--error), 0 5px 16px rgba(207,111,40,.14); }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .sidebar-foot { margin:10px 11px 0; padding:10px 0 0; text-align:center; }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .sidebar-foot div { display:none; }
  nav.sidebar:not(:hover):not(:focus-within):not(.is-open) .sidebar-foot::after { content:'◆'; color:var(--accent); font-size:11px; opacity:.75; }
  nav.sidebar:is(:hover, :focus-within, .is-open) .nav-group-title { transition:opacity .17s ease .05s; }
}

@media (max-width: 960px) {
  nav.sidebar { width:min(310px, calc(100vw - 48px)); border-radius:0 18px 18px 0; border-left:0; top:64px; bottom:0; left:0; padding:18px 0; transform:translateX(-104%); transition:transform 220ms ease; box-shadow:18px 0 42px rgba(66,43,26,.16); }
  nav.sidebar.is-open { transform:translateX(0); }
  .nav-drawer-backdrop { display:block; position:fixed; inset:64px 0 0; z-index:80; background:rgba(50,35,26,.22); opacity:0; pointer-events:none; transition:opacity 220ms ease; backdrop-filter:blur(1px); }
  .nav-drawer-backdrop.is-open { opacity:1; pointer-events:auto; }
}

.card { background:linear-gradient(145deg, #FFFFFF, #FFFDFC); }
.page-title { text-shadow:0 0 20px rgba(201,122,45,.08); }
.btn-primary { background:linear-gradient(135deg, #E15C38, #C98737); border-color:#E8A24C; box-shadow:0 6px 18px rgba(208,76,38,.20); }
.btn-primary:hover { background:linear-gradient(135deg, #F06C42, #E0A64D); box-shadow:0 8px 22px rgba(225,82,38,.30); }

main.content {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}

.page {
  display: none;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px;
}

.page.active {
  display: block;
}

/* Playground 页面：不滚动，内部各区域独立管理 overflow */
#page-playground {
  display: none;
  padding: 24px 32px;
  height: calc(100vh - 64px);
  box-sizing: border-box;
  overflow: hidden;
}
#page-playground.active {
  display: flex;
  flex-direction: column;
}

.page-title {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.page-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.page-head {
  margin-bottom: 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head .page-title,
.page-head .page-desc {
  margin-bottom: 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
  margin-bottom: 20px;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.prototype-note { display:inline-flex; align-items:center; gap:6px; padding:5px 9px; border:1px solid #E9D7A3; border-radius:999px; background:var(--accent-pale); color:#9A7417; font-size:12px; font-weight:600; }
.ops-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:20px; }
.ops-metric { padding:18px; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--bg-card); box-shadow:var(--shadow-sm); }
.ops-metric .label { color:var(--text-secondary); font-size:13px; }.ops-metric .value { margin-top:5px; color:var(--text-primary); font-size:25px; font-weight:650; letter-spacing:-.03em; }.ops-metric .hint { margin-top:3px; color:var(--success); font-size:12px; }
.filter-bar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:14px; border-bottom:1px solid var(--border); }
.data-card { padding:0; overflow:hidden; }
.data-card-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 24px 14px; border-bottom:1px solid var(--border); }
.data-card-toolbar .card-h { margin:0; }
.data-card-toolbar .filter-bar { flex:0 1 280px; padding:0; border:0; }
.data-card-toolbar .filter-bar .form-control { margin-left:0 !important; width:100%; max-width:none !important; }
.filter-chip { border:1px solid var(--border); background:var(--bg-page); border-radius:999px; padding:5px 10px; color:var(--text-secondary); font-size:12px; }.filter-chip.active { background:var(--accent-pale); border-color:#E7CD80; color:#957116; }
.status-badge { display:inline-flex; align-items:center; gap:5px; padding:3px 8px; border-radius:999px; background:#EAF8EE; color:#287B40; font-size:12px; font-weight:600; }.status-badge.warn { background:#FFF3D7; color:#AD6D08; }.status-badge.muted { background:#F0ECE6; color:#817463; }
.route-flow { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:20px 0 4px; }.route-node { min-width:145px; padding:13px 14px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--bg-page); }.route-node strong { display:block; font-size:13px; }.route-node span { color:var(--text-secondary); font-size:12px; }.route-arrow { color:var(--accent); font-size:20px; }
.budget-row { display:grid; grid-template-columns:160px 1fr 86px; gap:14px; align-items:center; margin:14px 0; font-size:13px; }.budget-track { height:8px; overflow:hidden; background:var(--bg-sidebar); border-radius:999px; }.budget-track i { display:block; height:100%; border-radius:999px; background:var(--accent); }
@media (max-width:900px) { .ops-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }.budget-row { grid-template-columns:120px 1fr 70px; } }
@media (max-width:640px) { .data-card-toolbar { align-items:stretch; flex-direction:column; padding:16px; }.data-card-toolbar .filter-bar { flex-basis:auto; } }

.card-h {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.card-b {
  color: var(--text-secondary);
  line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  background: var(--accent);
  color: #FFFFFF;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn:active {
  background: var(--accent-active);
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-hover);
}

.btn-ghost:hover {
  background: var(--accent-pale);
  border-color: var(--accent);
  color: var(--accent-hover);
  transform: none;
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}

.btn-danger:hover {
  background: rgba(200, 48, 48, 0.08);
  border-color: var(--error);
}

.btn-sm {
  font-size: 13px;
  padding: 6px 14px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 10px;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--transition);
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

label.field {
  display: block;
  margin-bottom: 10px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: all var(--transition);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(224,112,32, 0.12);
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
  font-family: var(--font-mono);
  font-size: 13px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B6860' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

input[type="range"]::-moz-range-thumb:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background: var(--border-hover);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.switch.on {
  background: var(--accent);
}

.switch.on::after {
  transform: translateX(20px);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  cursor: pointer;
  user-select: none;
}

.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  background: var(--bg-sidebar);
  color: var(--text-secondary);
}

.chip-ok {
  background: rgba(74, 158, 94, 0.12);
  color: var(--success);
}

.chip-err {
  background: rgba(200, 48, 48, 0.12);
  color: var(--error);
}

.chip-acc {
  background: var(--accent-pale);
  color: var(--accent);
}
.chat-meta-bar .chip {
  background: var(--bg-table-header);
  border: 1px solid var(--border);
  padding: 4px 11px;
}
.chat-meta-bar .chip-acc {
  background: var(--accent-pale);
  border-color: rgba(224,112,32,.25);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-sm);
}

.stat-card.good {
  border-left: 4px solid var(--success);
}

.stat-card.bad {
  border-left: 4px solid var(--error);
}

.stat-card.wait {
  border-left: 4px solid var(--warning);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

.stat-value {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 4px;
}

.stat-value.good { color: var(--success); }
.stat-value.bad { color: var(--error); }

.stat-sub {
  font-size: 13px;
  color: var(--text-tertiary);
}

.test-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
}

.test-row:last-child {
  border-bottom: none;
}

.test-name {
  font-weight: 600;
  color: var(--accent-hover);
  font-family: var(--font-mono);
  min-width: 28px;
}

.test-desc {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
}

.test-result {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.test-result.pass {
  background: rgba(74, 158, 94, 0.12);
  color: var(--success);
}

.test-result.fail {
  background: rgba(200, 48, 48, 0.12);
  color: var(--error);
}

.test-result.idle {
  background: var(--bg-sidebar);
  color: var(--text-tertiary);
}

.test-result.run {
  background: rgba(212, 136, 32, 0.12);
  color: var(--warning);
}

/* ── Playground Tab Navigation ── */
.pg-tabs {
  display: flex;
  gap: 2px;
  padding: 0 0 0 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  background: var(--bg-card);
  border-radius: 14px 14px 0 0;
  overflow: hidden;
}
.pg-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  border-bottom: 2px solid transparent;
  font-family: var(--font-sans);
  white-space: nowrap;
}
.pg-tab:hover { color: var(--text-secondary); background: rgba(224,112,32,.04); }
.pg-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(224,112,32,.06);
}
.pg-tab svg { flex-shrink: 0; }

.pg-panel { display: none; flex-direction: column; flex: 1; min-height: 0; }
.pg-panel.active { display: flex; }

/* Image/Video output gallery */
.gen-output-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.gen-output-area::-webkit-scrollbar { width: 6px; }
.gen-output-area::-webkit-scrollbar-track { background: transparent; }
.gen-output-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.gen-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-tertiary);
  text-align: center;
  margin: auto;
}
.gen-empty svg { margin-bottom: 12px; opacity: .35; }
.gen-empty-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.gen-empty-sub { font-size: 13px; line-height: 1.6; }

.gen-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  word-break: break-word;
  overflow-wrap: break-word;
}
.gen-result-card .gen-prompt {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.6;
}
.gen-result-card .gen-prompt strong { color: var(--text-primary); }
.gen-result-card .gen-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.gen-result-card .gen-images {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  overflow: hidden;
}
.gen-result-card .gen-images.cols-1 { grid-template-columns: 1fr; }
.gen-result-card .gen-images.cols-2 { grid-template-columns: 1fr 1fr; }
.gen-result-card .gen-images.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.gen-result-card .gen-images img {
  width: 100%;
  border-radius: 6px;
  cursor: pointer;
  transition: transform .2s;
  object-fit: cover;
}
.gen-result-card .gen-images img:hover { transform: scale(1.02); }
.gen-result-card .gen-video-wrap {
  border-radius: 8px;
  overflow: hidden;
}
.gen-result-card .gen-video-wrap video {
  width: 100%;
  border-radius: 8px;
  background: #000;
}

/* Sidebar model select per tab */
.sidebar-model-sel {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.pg-grid {
  display: flex;
  gap: 24px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.pg-grid > aside {
  width: 380px;
  flex-shrink: 0;
  height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  padding-right: 4px;
  overflow: hidden;
}
/* 接入配置卡填满侧边栏高度 */
.pg-grid > aside > .cfg-card:first-child { flex: 1; overflow-y: auto; }
.pg-grid > aside > .cfg-card:last-child { margin-bottom: 0; }
/* 生成输入区样式 */
.gen-input-wrap {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.gen-input-wrap textarea {
  min-height: 80px;
}
/* 侧边栏生成输入区 */
.gen-input-section {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(56,52,46,.05);
}
.gen-input-section.active { display: flex; }
.gen-input-section textarea {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  min-height: 60px;
  line-height: 1.6;
}
.gen-input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gen-input-summary {
  flex: 1;
  font-size: 11px;
  color: var(--text-tertiary);
}

.chat-area {
  flex: 1;
  min-width: 0;
  height: calc(100vh - 112px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 3px rgba(56,52,46,.04), 0 8px 24px rgba(56,52,46,.04);
}

.chat-meta-bar {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--bg-card);
  min-height: 44px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  
  background: var(--bg-card);
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

.chat-input-wrap {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-input-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px 10px;
  transition: border-color .2s, box-shadow .25s cubic-bezier(.16,1,.3,1);
  box-shadow: 0 2px 12px rgba(56,52,46,.05);
}
.chat-input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224,112,32,.12), 0 4px 20px rgba(224,112,32,.08);
}
.chat-input-box textarea {
  width: 100%;
  min-height: 24px;
  max-height: 200px;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  line-height: 1.6;
  font-family: var(--font-sans);
  color: var(--text-primary);
  padding: 2px 2px 4px;
}
.chat-input-box textarea::placeholder { color: var(--text-tertiary); }
.chat-input-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}
.chat-input-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
  padding: 0 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-input-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--bg-table-header);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-tertiary);
}

.chat-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Coze-style toolbar buttons */
.pg-tool-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all .18s ease;
}
.pg-tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.pg-send-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--border-hover);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: not-allowed;
  transition: all .2s cubic-bezier(.16,1,.3,1);
  flex-shrink: 0;
}
.pg-send-btn.ready {
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(224,112,32,.35);
}
.pg-send-btn.ready:hover { background: var(--accent-hover); transform: translateY(-1px); }
.pg-send-btn.ready:active { transform: scale(.94); }
.pg-send-btn.busy {
  background: var(--error);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,82,82,.3);
}
.pg-send-btn.busy svg { stroke-width: 3; }

/* Scroll-to-bottom floating button */
.scroll-bottom-btn {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  box-shadow: 0 4px 16px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.06);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s cubic-bezier(.16,1,.3,1), box-shadow .2s;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
}
.scroll-bottom-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.scroll-bottom-btn:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.14);
  background: var(--accent-pale);
  color: var(--accent);
}
.scroll-bottom-btn .arrow {
  font-size: 14px;
  animation: arrowBounce 1.5s ease-in-out infinite;
}
@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(2px); }
}

/* Loading dots animation */
.thinking-dots {
  display: inline-flex;
  gap: 4px;
  padding: 8px 4px;
  align-items: center;
}
.thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: dotPulse 1.4s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 80%, 100% { opacity: .3; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1.1); }
}
/* Status indicator – premium shimmer design */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.status-indicator.thinking {
  color: #D4943A;
  background: rgba(212, 148, 58, 0.07);
  border: 1px solid rgba(212, 148, 58, 0.2);
  box-shadow: 0 0 16px rgba(212, 148, 58, 0.06);
}
.status-indicator.generating {
  color: var(--accent);
  background: var(--accent-pale);
  border: 1px solid rgba(224,112,32, 0.2);
  box-shadow: 0 0 14px rgba(224,112,32, 0.08);
}
.status-indicator .status-bar {
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: rgba(45,32,23,0.12);
  overflow: hidden;
  position: relative;
}
.status-indicator .status-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 60%;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  animation: statusShimmer 1.4s ease-in-out infinite;
}
@keyframes statusShimmer {
  0% { left: -60%; }
  100% { left: 160%; }
}
.status-indicator .status-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-indicator .status-label svg {
  opacity: .75;
  flex-shrink: 0;
}

/* Message timestamp styling */
.message-meta .msg-time {
  font-size: 10px;
  color: var(--text-tertiary);
  opacity: .7;
}

/* 选中模型标签高亮 */
.message-assistant .bubble h1,
.message-assistant .bubble h2,
.message-assistant .bubble h3 {
  margin: 12px 0 6px;
  font-weight: 600;
  color: var(--text-primary);
}
.message-assistant .bubble h1 { font-size: 18px; }
.message-assistant .bubble h2 { font-size: 16px; }
.message-assistant .bubble h3 { font-size: 15px; }

.message-assistant .bubble blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 14px;
  margin: 10px 0;
  color: var(--text-secondary);
  background: rgba(224,112,32,.04);
  border-radius: 0 8px 8px 0;
}

.message-assistant .bubble table {
  border-collapse: collapse;
  margin: 10px 0;
  width: 100%;
  font-size: 13px;
}
.message-assistant .bubble th,
.message-assistant .bubble td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.message-assistant .bubble th {
  background: var(--bg-table-header);
  font-weight: 600;
}

.cfg-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 12px;
}

.cfg-card-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cfg-card-title::before {
  content: '';
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
  flex-shrink: 0;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-row input {
  flex: 1;
}

/* Session card */
.conv-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #C9A84C 0%, #B8941A 50%, #9A7A18 100%);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(180,80,20,.30);
  letter-spacing: .5px;
}
.new-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(180,80,20,.40);
  background: linear-gradient(135deg, #D4B050 0%, #C09830 50%, #A88520 100%);
}
.new-chat-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(180,80,20,.25);
}
.conv-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding-left: 2px;
  letter-spacing: .3px;
}

/* Conversation list */
.conv-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}
.conv-list::-webkit-scrollbar {
  width: 4px;
}
.conv-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}
.conv-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}
.conv-item.active {
  background: #fff;
  border-color: rgba(224,112,32,.2);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  color: var(--accent-dark);
  font-weight: 600;
}
.conv-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-sidebar);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}
.conv-item.active .conv-icon {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(224,112,32,.06);
}
.conv-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.conv-item-del {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  cursor: pointer;
  color: var(--text-tertiary);
}
.conv-item:hover .conv-item-del {
  opacity: 1;
}
.conv-item-del:hover {
  background: rgba(212,72,44,.08);
  color: var(--error);
}

/* Gen History Gallery Cards (right panel bottom) */
.gen-history-section {
  flex-shrink: 0;
  max-height: 160px;
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
}
.gen-history-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 8px 12px 4px;
  flex-shrink: 0;
}
.gen-hist-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 12px 10px;
  flex: 1;
}
.gen-hist-list::-webkit-scrollbar { height: 4px; }
.gen-hist-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.gen-hist-card {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .2s ease;
  background: var(--bg-card);
  position: relative;
}
.gen-hist-card:hover {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transform: translateY(-1px);
}
.gen-hist-card.active {
  border-color: rgba(224,112,32,.4);
  box-shadow: 0 2px 10px rgba(180,80,20,.15);
}
.gen-hist-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gen-hist-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--bg-card) 100%);
  color: var(--text-tertiary);
}
.gen-hist-placeholder svg { opacity: .35; }
.gen-hist-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 4px;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  color: #fff;
  font-size: 8px;
  line-height: 1.3;
}
.gen-hist-info .prompt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gen-hist-info .model { display: none; }
.gen-hist-status {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 7px;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
}
.gen-hist-status.generating {
  background: rgba(255,180,50,.9);
  color: #1a1a1a;
  animation: genPulse 1.5s ease-in-out infinite;
}
.gen-hist-status.done {
  background: rgba(72,199,142,.85);
  color: #fff;
}
.gen-hist-status.error {
  background: rgba(212,72,44,.85);
  color: #fff;
}
@keyframes genPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
.gen-hist-del {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(0,0,0,.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  cursor: pointer;
  font-size: 10px;
}
.gen-hist-card:hover .gen-hist-del { opacity: 1; }
.gen-hist-del:hover { background: rgba(212,72,44,.8); }
.gen-hist-elapsed {
  position: absolute;
  bottom: 18px;
  right: 3px;
  font-size: 7px;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(0,0,0,.6);
  color: rgba(255,255,255,.9);
  font-weight: 500;
  line-height: 1.2;
  pointer-events: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.gen-hist-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: var(--text-tertiary);
  font-size: 11px;
  white-space: nowrap;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 88%;
  animation: msgIn 0.35s cubic-bezier(.16,1,.3,1);
}
.message + .message { margin-top: 4px; }
.message-user + .message-assistant,
.message-assistant + .message-user { margin-top: 18px; }
.message-user { margin-left: auto; flex-direction: row-reverse; max-width: 75%; }
.message-assistant { margin-right: auto; max-width: 80%; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
  user-select: none;
  transition: transform 0.2s ease;
}
.message-user .msg-avatar {
  background: #EDE5D8;
  color: var(--accent);
  box-shadow: none;
}
.message-assistant .msg-avatar {
  background: none;
  box-shadow: 0 2px 8px rgba(224,112,32,.18);
  overflow: hidden;
  padding: 0;
}
.message-assistant .msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.msg-body { display: flex; flex-direction: column; min-width: 0; align-self: flex-start; }

.message .bubble {
  padding: 10px 15px;
  line-height: 1.75;
  font-size: 14px;
  word-break: break-word;
  overflow-wrap: break-word;
  position: relative;
  transition: none;
  max-width: 100%;
  box-sizing: border-box;
}
.message-assistant .bubble {
  min-width: 200px;
}
.message-assistant .bubble:has(strong:first-child) {
  min-width: 320px;
}
.message .bubble:hover {
  transform: none;
}

.message-user .bubble {
  background: #F0E8DC;
  color: var(--text-primary);
  border-radius: 16px 16px 4px 16px;
  text-shadow: none;
  box-shadow: none;
}
.message-user .bubble a { color: var(--accent); }
.message-user .bubble strong { color: var(--text-primary); }
.message-user .bubble code {
  background: rgba(224,112,32,.1);
  color: var(--accent);
}
.message-user .bubble pre {
  background: #1e1e1e;
}
.message-user .bubble li::marker { color: var(--text-tertiary); }

.message-assistant .bubble {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  padding: 14px 16px;
}

.message .bubble pre {
  margin: 8px 0 4px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #1e1e1e;
  box-shadow: 0 2px 8px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.06);
}
.message .bubble pre .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 12px;
  background: #2a2a2a;
  border-bottom: 1px solid #383838;
}
.message .bubble pre .code-header .code-lang-label {
  font-size: 12px;
  font-family: var(--font-mono);
  color: #999;
  letter-spacing: 0.03em;
  line-height: 1;
}

.message .bubble pre .code-header .code-copy-btn {
  position: static;
  top: auto;
  right: auto;
  opacity: 1;
  margin-left: auto;
}
.message .bubble pre code {
  display: block;
  padding: 12px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}
.message-assistant .bubble pre code {
  background: transparent !important;
  color: #d4d4d4;
}

.code-copy-btn {
  position: absolute;
  top: 36px; right: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font-sans);
  background: rgba(255,255,255,.08);
  color: #888;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s, background .15s, color .15s, transform .15s;
  z-index: 2;
}
.message .bubble pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.code-copy-btn:active { transform: scale(.92); }
.code-copy-btn.copied { color: #27c93f; border-color: rgba(39,201,63,.3); }

.message .bubble code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-table-header);
  color: var(--accent-hover);
  word-break: break-all;
  white-space: pre-wrap;
}
.message-user .bubble code { padding: 2px 6px; }

.message .bubble ul,
.message .bubble ol {
  margin: 10px 0;
  padding-left: 22px;
}
.message .bubble li {
  margin: 6px 0;
  line-height: 1.7;
}
.message .bubble li::marker { color: var(--text-tertiary); }
.message-user .bubble li::marker { color: rgba(255,255,255,.6); }

.message .bubble img {
  max-width: 100%;
  border-radius: 10px;
  margin: 8px 0;
  display: block;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.message .bubble p { margin: 6px 0; line-height: 1.7; }
.message .bubble p:first-child { margin-top: 0; }
.message .bubble p:last-child { margin-bottom: 0; }

.message .bubble strong { font-weight: 600; }
.message-user .bubble strong { color: #fff; }

.message .bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.message-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
  padding: 0 4px;
  font-family: var(--font-mono);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.message-user .message-meta { justify-content: flex-end; }
.message-assistant .message-meta { padding-left: 46px; }

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink .8s ease-in-out infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.bubble-caret {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink .8s ease-in-out infinite;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 32px;
  color: var(--text-tertiary);
  flex: 1 1 auto;
  overflow: hidden;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
.empty-state .empty-logo {
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
}
.empty-state .empty-logo img {
  width: 80px !important; height: 80px !important; border-radius: 18px; object-fit: cover;
}
.empty-state .empty-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.empty-sub {
  font-size: 13px;
  margin-top: 6px;
  color: var(--text-tertiary);
}
.empty-quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
  text-align: left;
}
.empty-quick button {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  font-size: 13px;
  font-family: var(--font-sans);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: all .22s cubic-bezier(.16,1,.3,1);
  box-shadow: 0 1px 3px rgba(56,52,46,.03);
  line-height: 1.5;
}
.empty-quick button .eq-ico {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-pale);
  color: var(--accent);
}
.empty-quick button .eq-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.empty-quick button .eq-t { font-weight: 600; color: var(--text-primary); font-size: 13.5px; }
.empty-quick button .eq-d { font-size: 12px; color: var(--text-tertiary); }
.empty-quick button:hover {
  border-color: var(--accent);
  background: var(--accent-pale);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(224,112,32,.14);
}
.empty-quick button:active { transform: translateY(0) scale(.99); }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 240px;
  padding: 16px 0 0;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  height: 100%;
}

.bar {
  width: 100%;
  max-width: 36px;
  background: var(--accent);
  border-radius: 6px 6px 0 0;
  transition: all var(--transition);
  min-height: 3px;
  height: var(--h, 0%);
}

.bar:hover {
  background: var(--accent-hover);
}

.bar.today {
  background: var(--accent-active);
}

.bar-label {
  font-size: 11px;
  color: var(--text-tertiary);
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead {
  background: var(--bg-table-header);
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--bg-table-hover);
}

.wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.wallet-item {
  background: var(--bg-table-header);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.w-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.w-val {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.w-avail { color: var(--success); }
.w-income { color: var(--accent); }
.w-spend { color: var(--warning); }

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-md);
  min-width: 280px;
  font-size: 14px;
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
  animation: slideIn 0.3s ease;
  transition: opacity 0.3s;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--success);
}

.toast-err::before { background: var(--error); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 42, 38, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
}

/* ── 网关弹窗样式 ── */
.modal-content {
  background: #fff;
  border: 1px solid #e0ddd6;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.02);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #2c2a26;
  letter-spacing: -0.01em;
}

.modal-header .btn-ghost {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #ddd9d0;
  background: #f5f4f0;
  color: #8a8780;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.modal-header .btn-ghost:hover {
  background: #ebe9e3;
  color: #2c2a26;
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body .form-group:last-child {
  margin-bottom: 0;
}

.modal-body .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #706e68;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.modal-body .form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text-primary, #e8e6e3);
  background: #f5f4f0;
  border: 1px solid #ddd9d0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
  font-family: var(--font-sans, inherit);
}

.modal-body .form-control:focus {
  border-color: #c9a84c;
  box-shadow: 0 0 0 2px rgba(201,168,76,0.15);
}

.modal-body .form-control::placeholder {
  color: #a09e99;
}

.modal-body .form-control option {
  background: #fff;
  color: #333;
}

.modal-body select.form-control {
  appearance: none;
  background-color: #f5f4f0;
  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='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.modal-body .form-row {
  display: flex;
  gap: 12px;
}

.modal-body .form-row .form-group {
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #ebe9e3;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-footer .btn {
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  font-family: var(--font-sans, inherit);
}

.modal-footer .btn-secondary {
  background: #f0eee8;
  color: #5a5850;
  border: 1px solid #ddd9d0;
}

.modal-footer .btn-secondary:hover {
  background: #e6e3dc;
}

.modal-footer .btn-primary {
  background: #c9a84c;
  color: #fff;
  font-weight: 600;
}

.modal-footer .btn-primary:hover {
  background: #d4b45a;
}

.modal-footer .btn-danger {
  background: #c0392b;
  color: #fff;
}

.modal-footer .btn-danger:hover {
  background: #d44637;
}

/* ── 模型目录 ── */
.model-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.model-search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: all var(--transition);
}
.model-search:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(224,112,32, 0.12);
}
.model-cats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cat-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.cat-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.cat-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.model-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.model-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.model-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cat-color, var(--border));
}
.model-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.model-card-name {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.model-status {
  flex-shrink: 0;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-top: 5px;
}
.model-status.available {
  background: var(--success);
  box-shadow: 0 0 6px rgba(224,112,32,0.5);
}
.model-status.unavailable {
  background: var(--error);
  box-shadow: 0 0 6px rgba(255,82,82,0.4);
}
.model-status.unknown {
  background: var(--text-tertiary);
  opacity: 0.5;
}
.model-status.checking {
  background: var(--warning);
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.model-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 12px;
}
.model-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.model-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-sidebar);
  color: var(--text-secondary);
}
.model-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-tertiary);
}
.model-card-ctx {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-sidebar);
  padding: 2px 6px;
  border-radius: 4px;
}
.model-card-latency {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--success);
}
.model-price-summary {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid rgba(222,190,164,.65);
}
.model-price-block { min-width:0; }
.model-price-block .label { display:block;font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--text-tertiary);margin-bottom:4px; }
.model-price-block strong { display:block;font:700 13px/1.45 var(--font-mono);color:var(--text-primary); }
.model-price-block.platform strong { color:#bd5b20; }
.model-credit-price { grid-column:1/-1;display:flex;justify-content:space-between;gap:12px;align-items:center;margin-top:3px;padding:8px 10px;border-radius:10px;background:linear-gradient(90deg,rgba(248,185,73,.14),rgba(222,91,53,.08));font-size:11px;color:var(--text-secondary); }
.model-credit-price strong { color:#9f451c;font-family:var(--font-mono);text-align:right; }
.model-maker { display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border:1px solid rgba(213,139,77,.28);border-radius:999px;background:rgba(255,250,243,.86);font-size:10px;font-weight:700;color:#8b5c43; }
.model-price-pending { margin-top:14px;padding:12px;border-top:1px solid rgba(222,190,164,.55);background:rgba(246,239,232,.55);border-radius:0 0 10px 10px;color:var(--text-tertiary);font-size:12px; }
.model-catalog-note { display:flex;align-items:center;justify-content:space-between;gap:12px;margin:12px 0 18px;padding:12px 15px;border:1px solid rgba(216,151,91,.3);border-radius:14px;background:linear-gradient(90deg,rgba(255,247,231,.92),rgba(255,252,247,.84));color:var(--text-secondary);font-size:12px; }
.model-catalog-note strong { color:#9d481f; }
@media (max-width:640px) { .model-price-summary { grid-template-columns:1fr; }.model-credit-price { grid-column:1;align-items:flex-start;flex-direction:column; }.model-catalog-note { align-items:flex-start;flex-direction:column; } }
.check-progress {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: 8px;
}

/* 协议提示条 */
.protocol-badge {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 6px;
}
.protocol-badge.chat { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.2); color: var(--text-tertiary); display: none !important; }
.protocol-badge.image { background: rgba(236,72,153,.08); border-color: rgba(236,72,153,.25); color: #EC4899; }
.protocol-badge.video { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.25); color: #EF4444; }
.protocol-badge.embedding { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: #F59E0B; }

/* 额外参数区 */
.extra-params {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Upload area */
.upload-area { display:flex; align-items:center; gap:6px; }
.upload-dropdown { position:relative; }
.upload-toggle-btn { display:flex; align-items:center; justify-content:center; width:32px; height:32px; border-radius:8px; border:none; background:transparent; cursor:pointer; color:var(--text-secondary); transition:all var(--transition); }
.upload-toggle-btn:hover { background:var(--bg-hover); color:var(--accent); }
.upload-menu { position:absolute; bottom:calc(100% + 6px); left:0; background:var(--bg-card); border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow-md); overflow:hidden; z-index:100; min-width:168px; display:none; }
.upload-menu.show { display:block; animation:fadeSlideUp .15s ease; }
@keyframes fadeSlideUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.upload-menu-item { display:flex; align-items:center; gap:10px; padding:10px 14px; cursor:pointer; transition:background var(--transition); font-size:.85rem; color:var(--text-primary); border:none; background:none; width:100%; text-align:left; }
.upload-menu-item:hover { background:var(--bg-hover); }
.upload-menu-item.disabled { opacity:.3; cursor:not-allowed; pointer-events:none; }
.upload-menu-item svg { flex-shrink:0; color:var(--text-secondary); }
.upload-menu-item .upload-item-text { display:flex; flex-direction:column; gap:1px; }
.upload-menu-item .upload-item-label { font-weight:500; }
.upload-menu-item .upload-item-hint { font-size:.72rem; color:var(--text-tertiary); }
.upload-preview-area { display:flex; flex-wrap:wrap; gap:8px; padding:8px 0 0; }
.upload-preview-area:empty { display:none; }
.upload-preview-item { position:relative; width:68px; height:68px; border-radius:8px; border:1px solid var(--border); overflow:hidden; background:var(--bg-sidebar); }
.upload-preview-item img { width:100%; height:100%; object-fit:cover; }
.upload-preview-audio { display:flex; align-items:center; justify-content:center; width:100%; height:100%; background:linear-gradient(135deg,rgba(224,112,32,.08),rgba(212,72,44,.08)); }
.upload-preview-remove { position:absolute; top:-5px; right:-5px; width:18px; height:18px; border-radius:50%; background:var(--error); color:#fff; border:2px solid var(--bg-card); cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:10px; line-height:1; z-index:2; }
.upload-preview-name { position:absolute; bottom:0; left:0; right:0; background:rgba(0,0,0,.55); color:#fff; font-size:9px; padding:2px 4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

@media (max-width: 960px) {
  .pg-grid { flex-direction: column; height: auto; }
  .pg-grid > aside { width: 100%; flex-shrink: 1; height: auto; }
  .chat-area { height: auto; }
  .chat-area { min-height: 500px; }
  .chat-messages { padding: 16px; }
  .chat-input-wrap { padding: 12px 16px 16px; }
  .message { max-width: 95%; }
  .msg-avatar { width: 28px; height: 28px; font-size: 12px; border-radius: 8px; }
  nav.sidebar { width:min(310px, calc(100vw - 48px)); }
  .page { padding: 24px 16px; }
  .app-header { padding: 0 16px; }
}

/* ── User Center ── */
.uc-subtabs { display:flex; gap:2px; border-bottom:1px solid var(--border); margin-bottom:24px; }
.uc-subtab { padding:10px 18px; cursor:pointer; font-size:13.5px; font-weight:500; color:var(--text-secondary); border-bottom:2px solid transparent; transition:all .2s; background:none; border-top:none; border-left:none; border-right:none; }
.uc-subtab:hover { color:var(--text); }
.uc-subtab.active { color:var(--accent); border-bottom-color:var(--accent); }
.uc-subpage { display:none; }
.uc-subpage.active { display:block; animation:fadeIn .25s; }

.uc-info-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:24px; }
.uc-info-item { display:flex; flex-direction:column; gap:4px; }
.uc-info-label { font-size:12px; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:.05em; }
.uc-info-value { font-size:15px; color:var(--text); font-weight:500; }
.uc-info-value.admin-badge { display:inline-flex; align-items:center; gap:6px; color:var(--accent); background:rgba(224,112,32,.08); padding:4px 10px; border-radius:6px; font-size:13px; width:fit-content; }

.key-card { display:flex; align-items:center; justify-content:space-between; padding:14px 18px; background:var(--bg-card); border:1px solid var(--border); border-radius:10px; margin-bottom:10px; transition:border-color .2s; }
.key-card:hover { border-color:var(--accent); }
.key-card-info { flex:1; min-width:0; }
.key-card-name { font-weight:600; font-size:14px; color:var(--text); margin-bottom:3px; }
.key-card-value { font-family:'SF Mono','Fira Code',monospace; font-size:12.5px; color:var(--text-secondary); letter-spacing:.02em; }
.key-card-meta { font-size:11px; color:var(--text-tertiary); margin-top:4px; }
.key-card-actions { display:flex; gap:6px; flex-shrink:0; margin-left:12px; }
.key-card-actions button { padding:6px 10px; border-radius:6px; border:1px solid var(--border); background:var(--bg-card); color:var(--text-secondary); cursor:pointer; font-size:12px; transition:all .15s; display:flex; align-items:center; gap:4px; }
.key-card-actions button:hover { border-color:var(--accent); color:var(--accent); }
.key-card-actions button.danger:hover { border-color:var(--error); color:var(--error); }

.key-allowed-models { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.key-model-tag { font-size:11px; padding:2px 8px; border-radius:4px; background:rgba(224,112,32,.08); color:var(--accent); border:1px solid rgba(224,112,32,.15); white-space:nowrap; }
.key-model-more { font-size:11px; color:var(--text-tertiary); padding:2px 4px; }
.usage-guide { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; margin-bottom:20px; overflow:hidden; }
.usage-guide-toggle { width:100%; display:flex; align-items:center; justify-content:space-between; padding:14px 18px; background:none; border:none; color:var(--text); font-size:14px; font-weight:500; cursor:pointer; text-align:left; }
.usage-guide-toggle svg { transition:transform .25s; flex-shrink:0; }
.usage-guide-toggle.open svg { transform:rotate(180deg); }
.usage-guide-content { display:none; padding:0 18px 18px; }
.usage-guide-content.open { display:block; }
.guide-section { margin-bottom:16px; }
.guide-section:last-child { margin-bottom:0; }
.guide-label { font-size:11px; font-weight:600; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:.06em; margin-bottom:6px; }
.guide-value { font-family:'SF Mono','Fira Code',monospace; font-size:13px; color:var(--accent); background:var(--bg-sidebar); padding:8px 12px; border-radius:6px; border:1px solid var(--border); word-break:break-all; }
.guide-code { font-family:'SF Mono','Fira Code',monospace; font-size:12px; color:var(--text); background:var(--bg-sidebar); padding:12px 14px; border-radius:8px; border:1px solid var(--border); white-space:pre-wrap; word-break:break-all; line-height:1.6; position:relative; margin-top:6px; }
.guide-code-copy { position:absolute; top:8px; right:8px; padding:4px 8px; font-size:11px; border-radius:4px; border:1px solid var(--border); background:var(--bg-card); color:var(--text-secondary); cursor:pointer; }
.guide-code-copy:hover { border-color:var(--accent); color:var(--accent); }
.guide-tab-bar { display:flex; gap:2px; margin-bottom:0; border-bottom:1px solid var(--border); }
.guide-tab { padding:8px 14px; font-size:12px; font-weight:500; color:var(--text-secondary); background:none; border:none; border-bottom:2px solid transparent; cursor:pointer; transition:all .15s; }
.guide-tab:hover { color:var(--text); }
.guide-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.guide-tab-content { display:none; }
.guide-tab-content.active { display:block; }
.guide-overview-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:12px 0 18px; }
.guide-overview-card { padding:13px 14px; border:1px solid var(--border); border-radius:10px; background:linear-gradient(135deg,rgba(255,255,255,.86),rgba(255,244,226,.6)); }
.guide-overview-card span { display:block; color:var(--text-tertiary); font-size:10px; font-weight:700; letter-spacing:.08em; margin-bottom:5px; }
.guide-overview-card strong { display:block; font-size:13px; color:var(--text); margin-bottom:3px; }
.guide-overview-card small { color:var(--text-secondary); line-height:1.5; }
.guide-note { padding:11px 13px; border-radius:9px; background:rgba(224,112,32,.07); border:1px solid rgba(224,112,32,.18); color:var(--text-secondary); font-size:12px; line-height:1.7; margin-top:10px; }
.guide-list { margin:8px 0 0; padding-left:20px; color:var(--text-secondary); font-size:12.5px; line-height:1.85; }
.guide-list code,.guide-inline-code { font-family:'SF Mono','Fira Code',monospace; color:var(--accent); background:var(--bg-sidebar); border-radius:4px; padding:1px 5px; }
.guide-error-table { width:100%; border-collapse:collapse; margin-top:8px; font-size:12px; }
.guide-error-table th,.guide-error-table td { padding:9px 10px; text-align:left; border-bottom:1px solid var(--border); vertical-align:top; }
.guide-error-table th { color:var(--text-tertiary); font-size:10px; letter-spacing:.06em; }
.guide-error-table td:first-child { font-family:'SF Mono','Fira Code',monospace; color:var(--accent); white-space:nowrap; }
@media (max-width:720px) { .guide-overview-grid { grid-template-columns:1fr; }.guide-tab-bar { overflow-x:auto; }.guide-tab { white-space:nowrap; }.guide-code { font-size:11px; overflow-x:auto; }.guide-error-table { min-width:560px; } }
.model-select-groups { max-height:280px; overflow-y:auto; border:1px solid var(--border); border-radius:8px; padding:8px; }
.model-select-group { margin-bottom:8px; }
.model-select-group:last-child { margin-bottom:0; }
.model-select-group-label { font-size:11px; font-weight:600; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:.04em; margin-bottom:4px; padding:0 4px; }
.model-select-options { display:flex; flex-wrap:wrap; gap:4px; padding:0 4px; }
.model-check-item { display:flex; align-items:center; gap:5px; padding:4px 8px; border-radius:6px; border:1px solid var(--border); cursor:pointer; font-size:12px; color:var(--text-secondary); transition:all .15s; user-select:none; }
.model-check-item:hover { border-color:var(--accent); color:var(--text); }
.model-check-item.checked { background:rgba(224,112,32,.08); border-color:var(--accent); color:var(--accent); }
.model-check-item input { display:none; }
.model-select-all { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.model-select-all-label { font-size:12px; color:var(--text-secondary); }
.model-select-all-btn { font-size:11px; color:var(--accent); background:none; border:none; cursor:pointer; padding:2px 6px; border-radius:4px; }
.model-select-all-btn:hover { background:rgba(224,112,32,.08); }

.bill-stat-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:24px; }
.bill-stat-grid.billing-real { grid-template-columns:repeat(4,minmax(0,1fr)); }
.bill-stat-card { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:18px; }
.bill-stat-label { font-size:12px; color:var(--text-tertiary); margin-bottom:6px; }
.bill-stat-value { font-size:22px; font-weight:700; color:var(--text); }
.bill-stat-value.accent { color:var(--accent); }
.bill-stat-sub { font-size:11px; color:var(--text-tertiary); margin-top:4px; }
@media (max-width:900px) { .bill-stat-grid.billing-real { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.data-table { width:100%; border-collapse:collapse; }
.data-table th { text-align:left; padding:10px 14px; font-size:11.5px; font-weight:600; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:.05em; border-bottom:1px solid var(--border); }
.data-table td { padding:10px 14px; font-size:13px; color:var(--text); border-bottom:1px solid var(--border-light); }
.data-table tbody tr:hover { background:var(--bg-hover); }

.form-group { margin-bottom:20px; }
.form-group label { display:block; font-size:12.5px; font-weight:600; color:var(--text-secondary); margin-bottom:6px; }
.form-group input { width:100%; padding:10px 14px; border:1px solid var(--border); border-radius:8px; font-size:14px; background:var(--bg-card); color:var(--text); outline:none; transition:border-color .2s; box-sizing:border-box; }
.form-group input:focus { border-color:var(--accent); }
.form-hint { font-size:11.5px; color:var(--text-tertiary); margin-top:4px; }

.uc-empty { text-align:center; padding:40px 20px; color:var(--text-tertiary); }
.uc-empty svg { margin-bottom:12px; opacity:.4; }
.uc-badge-active { color:#16a34a; font-weight:600; }
.uc-badge-revoked { color:var(--error); font-weight:600; }

/* Password Strength Indicator */
.pw-strength { margin-top:8px; }
.pw-strength-bars { display:flex; gap:4px; margin-bottom:4px; }
.pw-strength-bar { height:4px; flex:1; border-radius:2px; background:rgba(255,255,255,0.08); transition:background 0.3s; }
.pw-strength-text { font-size:12px; color:rgba(255,255,255,0.5); }
.pw-rules { display:flex; flex-wrap:wrap; gap:4px 10px; margin-top:6px; }
.pw-rules .rule { font-size:11px; color:rgba(255,255,255,0.35); transition:color 0.2s; }
.pw-rules .rule.pass { color:#16a34a; }

/* ═══════════════════════════════════════════════════════════════
   多模态媒体卡片（图片网格 / 视频播放器）
   PhoenAIx · 2026-09-01
   ═══════════════════════════════════════════════════════════════ */
.media-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.025) 0%, rgba(255,255,255,0.008) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px;
  margin: 4px 0;
}
.media-card.image-card { border-left: 3px solid #d4a259; }
.media-card.video-card { border-left: 3px solid #7c9dd9; }
.media-card-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  flex-wrap: wrap;
}
.media-type-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
  text-transform: uppercase;
}
.media-type-tag.image { background: rgba(212,162,89,0.15); color: #e4b77a; }
.media-type-tag.video { background: rgba(124,157,217,0.15); color: #9ab4e3; }
.media-meta { font-size: 11px; color: var(--text-tertiary, #888); letter-spacing: .2px; }
.media-prompt {
  font-size: 12.5px; color: var(--text-secondary, #bbb);
  line-height: 1.55; margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.025);
  border-left: 2px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  font-style: italic;
}
.image-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.image-grid.cols-1 { grid-template-columns: minmax(280px, 480px); }
.image-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.image-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) {
  .image-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .image-grid.cols-2 { grid-template-columns: 1fr; }
}
.image-cell { display: flex; flex-direction: column; gap: 6px; }
.image-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
  aspect-ratio: 1 / 1;
  cursor: zoom-in;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: transform .25s ease, box-shadow .25s ease;
}
.image-frame:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
}
.image-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.image-frame:hover img { transform: scale(1.04); }
.image-hover-actions {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,0.55) 100%);
  display: flex; align-items: flex-end; justify-content: flex-end;
  gap: 6px; padding: 10px;
  opacity: 0; transition: opacity .25s ease;
}
.image-frame:hover .image-hover-actions { opacity: 1; }
.img-act-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.92);
  color: #1a1a1a;
  border: none; border-radius: 8px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.img-act-btn:hover { background: #fff; transform: scale(1.08); }
.img-revised {
  font-size: 11px; color: var(--text-tertiary, #888);
  line-height: 1.45; padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
}
.video-frame {
  border-radius: 12px; overflow: hidden;
  background: #000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  aspect-ratio: 16 / 9;
}
.video-frame video {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.media-card-footer {
  display: flex; gap: 8px; margin-top: 12px;
  flex-wrap: wrap;
}
.media-retry-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary, #bbb);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  font-size: 12px; cursor: pointer;
  transition: all .18s ease;
}
.media-retry-btn:hover {
  background: rgba(212,162,89,0.12);
  color: #e4b77a;
  border-color: rgba(212,162,89,0.3);
}
/* 媒体下载按钮 */
.media-dl-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 8px;
  background: rgba(207,168,76,0.12); border: 1px solid rgba(207,168,76,0.25);
  color: var(--accent-gold, #cfa84c); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease; white-space: nowrap;
}
.media-dl-btn:hover { background: rgba(207,168,76,0.25); border-color: var(--accent-gold, #cfa84c); transform: translateY(-1px); }
.media-dl-btn:active { transform: translateY(0); }
/* 图片预览下载按钮 */
.image-preview-actions { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; }
.image-preview-close { position: static; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2); width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; color: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; }
.image-preview-close:hover { background: rgba(255,255,255,0.15); color: #fff; }
.image-preview-dl-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 20px;
  background: rgba(207,168,76,0.2); border: 1px solid rgba(207,168,76,0.4);
  color: #cfa84c; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease; backdrop-filter: blur(8px);
}
.image-preview-dl-btn:hover { background: rgba(207,168,76,0.35); border-color: #cfa84c; }
.media-task-id {
  margin-top: 8px;
  font-size: 11px; color: var(--text-tertiary, #888);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  overflow-wrap: break-word;
}
.media-task-id code {
  background: rgba(255,255,255,0.05);
  padding: 2px 6px; border-radius: 4px;
  color: #9ab4e3;
  word-break: break-all;
  white-space: pre-wrap;
}
.media-empty {
  padding: 24px; text-align: center;
  color: var(--text-tertiary, #888);
  font-size: 13px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
}
.image-preview-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(8px);
  animation: fadeIn .2s ease;
}
.image-preview-body {
  position: relative;
  max-width: 92vw; max-height: 92vh;
}
.image-preview-body img {
  max-width: 92vw; max-height: 92vh;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  display: block;
}
.image-preview-close {
  position: absolute; top: -40px; right: 0;
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none; border-radius: 50%;
  font-size: 20px; line-height: 1;
  cursor: pointer;
  transition: background .15s ease;
}
.image-preview-close:hover { background: rgba(255,255,255,0.25); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Math formula styling */
.message .bubble .katex-display { margin: 12px 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.message .bubble .katex-display-block { margin: 12px 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; text-align: center; }
.message .bubble .katex-pending { margin: 12px 0; text-align: center; font-style: italic; color: var(--text-secondary); }
.message .bubble .katex { font-size: 1.05em; }
.message .bubble .katex-display > .katex, .message .bubble .katex-display-block > .katex { padding: 0 4px; }
.message-assistant .bubble .katex { color: var(--text-primary); }
.message-user .bubble .katex { color: var(--text-primary); }
.message .bubble .katex-error { color: var(--error); font-size: 12px; font-family: var(--font-mono); }

/* ── 供应商管理 & 模型管理 ── */
.provider-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.provider-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.provider-status .status-dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(74,158,94,.15); }
.provider-status .status-dot.offline { background: var(--error); box-shadow: 0 0 0 3px rgba(200,48,48,.12); }
.provider-status .status-dot.untested { background: var(--text-tertiary); }
.provider-balance { display:inline-flex; align-items:center; gap:6px; min-height:28px; font-variant-numeric:tabular-nums; }
.provider-balance-value { color:var(--text-primary); font-family:var(--font-mono); font-weight:650; }
.provider-balance-meta { color:var(--text-tertiary); font-size:12px; }
.provider-balance-empty { color:var(--text-tertiary); font-size:13px; }
.provider-balance-retry { border:0; padding:0; color:var(--accent); background:transparent; font:inherit; font-size:13px; cursor:pointer; }
.provider-balance-retry:hover { text-decoration:underline; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-switch .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: background .2s ease;
}
.toggle-switch .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle-switch input:checked + .slider {
  background: var(--success);
}
.toggle-switch input:checked + .slider::before {
  transform: translateX(18px);
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-radius: 20px;
  line-height: 1.6;
}
.badge-chat { background: #EEF2FF; color: #4338CA; }
.badge-image { background: #FFF1F2; color: #BE123C; }
.badge-video { background: #F0FDF4; color: #15803D; }
.badge-embeddings { background: #FFFBEB; color: #B45309; }
.badge-audio { background: #F5F3FF; color: #7C3AED; }
.badge-provider { background: var(--accent-pale); color: var(--accent-dark); font-size: 12px; }

.model-row-offline {
  opacity: 0.45;
}

.model-mgmt-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-table-header);
}
.model-mgmt-toolbar select,
.model-mgmt-toolbar input[type="text"] {
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.model-mgmt-toolbar select:focus,
.model-mgmt-toolbar input[type="text"]:focus {
  border-color: var(--border-focus);
}
.model-mgmt-toolbar input[type="text"] {
  width: auto;
  min-width: 260px;
  flex: 1 1 300px;
}
.model-mgmt-toolbar select {
  width: auto;
  min-width: 130px;
  flex: 0 1 150px;
}
.model-mgmt-reset {
  white-space: nowrap;
}
@media (max-width: 900px) {
  .model-mgmt-toolbar select { flex: 1 1 150px; }
  .model-mgmt-toolbar input[type="text"] { flex-basis: 100%; }
}

.modal-body .field { margin-bottom: 16px; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-body .field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.modal-body .field-label .required {
  color: var(--error);
  margin-left: 2px;
}
.modal-body input[type="text"],
.modal-body input[type="password"],
.modal-body input[type="url"],
.modal-body select,
.modal-body textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  border-color: var(--border-focus);
}
.modal-body textarea {
  resize: vertical;
  min-height: 60px;
}
.modal-body .password-wrap {
  position: relative;
}
.modal-body .password-wrap .toggle-pw {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 4px;
  display: flex;
  align-items: center;
}
.modal-body .password-wrap .toggle-pw:hover {
  color: var(--text-secondary);
}
.modal-body .cap-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.modal-body .cap-tags label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all var(--transition);
}
.modal-body .cap-tags label:hover {
  border-color: var(--accent);
  background: var(--accent-pale);
}
.modal-body .cap-tags input {
  display: none;
}
.modal-body .cap-tags input:checked + span {
  color: var(--accent-dark);
  font-weight: 600;
}
.modal-body .cap-tags label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-pale);
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  color: var(--text-secondary);
}
.action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.action-btn.danger {
  color: var(--error);
}
.action-btn.danger:hover {
  background: rgba(200,48,48,.08);
  color: var(--error);
}
/* ── 网关配置 (Gateway Config) ── */
.gw-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.gw-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gw-stat-card .gw-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.gw-stat-card .gw-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.gw-stat-card .gw-stat-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}
.gw-strategy-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  letter-spacing: 0.2px;
}
.gw-strategy-badge.round_robin { background: #EEF2FF; color: #4338CA; }
.gw-strategy-badge.consistent_hash { background: #F0FDF4; color: #15803D; }
.gw-strategy-badge.failover { background: #FFF7ED; color: #C2410C; }
.gw-strategy-badge.least_cost { background: #FFFBEB; color: #B45309; }
.gw-strategy-badge.least_latency { background: #F5F3FF; color: #7C3AED; }
.gw-strategy-badge.least_busy { background: #FDF2F8; color: #BE123C; }
.gw-targets-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.gw-target-tag {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
}
.gw-limit-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.gw-limit-tag {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  background: #FEF3C7;
  border: 1px solid #F59E0B40;
  border-radius: 4px;
  color: #92400E;
  font-weight: 500;
}
.gw-scope-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
}
.gw-scope-tag.model { background: #EEF2FF; color: #4338CA; }
.gw-scope-tag.api_key { background: #F0FDF4; color: #15803D; }
.gw-scope-tag.team { background: #FFF7ED; color: #C2410C; }
.gw-guardrail-dir {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
}
.gw-guardrail-dir.input { background: #DBEAFE; color: #1D4ED8; }
.gw-guardrail-dir.output { background: #FCE7F3; color: #BE185D; }
.gw-guardrail-dir.both { background: #E0E7FF; color: #4338CA; }
.gw-provider-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  background: var(--accent-pale);
  color: var(--accent-dark);
}
.gw-cache-scope {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 4px;
}
.gw-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
  text-align: center;
}
.gw-empty-state svg {
  margin-bottom: 16px;
  opacity: 0.4;
}
.gw-empty-state p {
  font-size: 14px;
  margin-bottom: 4px;
}
.gw-empty-state small {
  font-size: 12px;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════════
   PhoenAIx · Phoenix constellation visual system
   A light, luminous system: ivory panels, phoenix gold, ember red and a
   restrained wing-line motif. These overrides deliberately target shared
   primitives so every existing console module inherits the same quality bar.
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  --bg-page: #FFF9F3;
  --bg-sidebar: #FFF4E8;
  --bg-card: rgba(255,255,255,.88);
  --bg-hover: #FFF0E2;
  --bg-active: #FFEBD2;
  --bg-table-header: #FFF7EF;
  --bg-table-hover: #FFFAF5;
  --accent: #B96B24;
  --accent-dark: #7C3B19;
  --accent-hover: #DE8D37;
  --accent-active: #9A501F;
  --accent-pale: #FFF0D9;
  --text-primary: #30211D;
  --text-secondary: #735D54;
  --text-tertiary: #A59085;
  --border: #EEDDD0;
  --border-hover: #DDAF83;
  --border-focus: #D66B30;
  --radius-sm: 10px;
  --radius-md: 15px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 4px rgba(83,37,18,.035), 0 12px 28px rgba(111,59,30,.065);
  --shadow-md: 0 10px 28px rgba(104,45,20,.11), 0 28px 60px rgba(183,90,32,.08);
}
body {
  background:
    radial-gradient(720px 460px at 100% -12%, rgba(232,126,48,.16), transparent 65%),
    radial-gradient(620px 440px at -10% 108%, rgba(241,190,103,.16), transparent 68%),
    linear-gradient(125deg, rgba(255,255,255,.7), rgba(255,248,241,.15) 46%, rgba(255,255,255,.46)), var(--bg-page);
}
body::before {
  content:''; position:fixed; pointer-events:none; z-index:-1; inset:64px 0 0;
  background:repeating-linear-gradient(135deg, transparent 0 58px, rgba(190,92,30,.018) 59px 60px, transparent 61px 118px);
  mask-image:linear-gradient(to bottom, rgba(0,0,0,.7), transparent 74%);
}
.app-header { height:70px; padding:0 30px; background:rgba(255,252,248,.82); backdrop-filter:blur(16px); border-bottom:1px solid rgba(201,142,89,.25); box-shadow:0 3px 20px rgba(99,52,27,.045); }
.brand { gap:12px; font-size:18px; }
.brand-mark { width:40px; height:40px; border:1px solid rgba(214,111,36,.25); box-shadow:0 0 0 4px rgba(247,181,89,.10), 0 8px 18px rgba(203,82,29,.15); }
.brand-text strong { letter-spacing:.01em; }
nav.sidebar { top:84px; bottom:18px; left:18px; width:76px; padding:15px 0 12px; border-radius:24px; background:linear-gradient(170deg, rgba(255,255,255,.96), rgba(255,247,239,.94) 58%, rgba(255,236,214,.94)); box-shadow:0 22px 48px rgba(97,46,20,.14), inset 0 1px 0 rgba(255,255,255,.9); }
nav.sidebar::before { content:''; position:absolute; top:16px; right:-1px; width:3px; height:56px; border-radius:999px 0 0 999px; background:linear-gradient(#F5BF4E, #D44F37); box-shadow:0 0 13px rgba(222,95,36,.36); }
nav.sidebar:is(:hover, :focus-within, .is-open) { width:min(336px, calc(100vw - 44px)); border-color:rgba(204,120,53,.4); }
.nav-group-title { padding:0 26px 9px; color:#A46D39; letter-spacing:.13em; }
.nav-item { min-height:41px; margin:2px 13px; border-radius:12px; font-weight:520; }
.nav-item:hover { transform:translateX(2px); background:linear-gradient(90deg, rgba(255,225,196,.64), rgba(255,246,235,.36)); color:var(--accent-dark); }
.nav-item.active { background:linear-gradient(105deg, rgba(218,75,51,.13), rgba(252,201,107,.25)); color:var(--accent-dark); box-shadow:inset 3px 0 0 #D95137, 0 7px 18px rgba(204,92,34,.10); }
.nav-ico { color:inherit; display:inline-flex; align-items:center; justify-content:center; }
.nav-ico svg { width:20px; height:20px; display:block; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; vector-effect:non-scaling-stroke; }
.nav-item:hover .nav-ico svg { filter:drop-shadow(0 2px 3px rgba(203,89,29,.18)); }
.nav-item.active .nav-ico svg { stroke-width:2.2; filter:drop-shadow(0 2px 4px rgba(216,77,54,.24)); }
main.content { padding-left:94px; }
.page { max-width:1380px; padding:42px 38px 56px; }
.page-head { margin-bottom:28px; padding-bottom:20px; border-bottom:1px solid rgba(226,193,168,.48); position:relative; }
.page-head::after { content:''; width:84px; height:3px; position:absolute; left:0; bottom:-2px; border-radius:99px; background:linear-gradient(90deg, #D84D36, #F4BF4D, transparent); }
.page-title { font-size:28px; letter-spacing:-.035em; }
.page-desc { max-width:760px; color:#80675D; }
.card, .ops-metric { border-color:rgba(229,205,189,.82); background:linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,250,246,.88)); box-shadow:var(--shadow-sm); }
.card { position:relative; overflow:hidden; }
.card:not(.data-card)::before { content:''; width:74px; height:74px; position:absolute; right:-31px; top:-35px; border:1px solid rgba(219,133,51,.18); border-radius:50%; box-shadow:0 0 0 12px rgba(219,133,51,.035), 0 0 0 25px rgba(219,133,51,.025); pointer-events:none; }
.card:hover, .ops-metric:hover { border-color:rgba(212,135,68,.45); transform:translateY(-1px); }
.ops-metric { overflow:hidden; position:relative; padding:20px; }
.ops-metric::before { content:''; position:absolute; left:0; top:16px; bottom:16px; width:3px; border-radius:0 99px 99px 0; background:linear-gradient(#F2BD52, #D55037); }
.ops-metric .label { padding-left:5px; text-transform:uppercase; letter-spacing:.065em; font-size:11px; font-weight:700; }
.ops-metric .value { padding-left:5px; font-size:29px; }
.ops-metric .hint { padding-left:5px; }
.data-card { background:rgba(255,255,255,.87); }
.data-card-toolbar { background:linear-gradient(90deg, rgba(255,249,243,.95), rgba(255,255,255,.95)); padding:20px 24px 16px; }
.card-h { font-size:17px; }
.btn { border:1px solid transparent; border-radius:11px; font-weight:650; letter-spacing:.005em; padding:10px 18px; box-shadow:0 4px 10px rgba(112,55,23,.07); }
.btn-primary { background:linear-gradient(135deg, #D95338 0%, #C67A2A 62%, #EDAF4D 120%); border-color:rgba(231,158,74,.65); box-shadow:0 8px 20px rgba(194,81,30,.20); }
.btn-primary:hover { transform:translateY(-2px); box-shadow:0 12px 24px rgba(202,75,28,.29); }
.btn-ghost, .action-btn { border-color:rgba(209,170,140,.7); background:rgba(255,255,255,.76); color:var(--accent-dark); }
.btn-ghost:hover, .action-btn:hover { border-color:#D68843; background:#FFF2E1; color:#A84A24; }
input, select, textarea, .form-control { border-radius:10px !important; border-color:#E9D6C8 !important; background:rgba(255,255,255,.84) !important; box-shadow:inset 0 1px 1px rgba(110,56,26,.025); }
input:focus, select:focus, textarea:focus, .form-control:focus { border-color:#D87938 !important; box-shadow:0 0 0 4px rgba(216,104,43,.12) !important; outline:none; }
.filter-bar { background:rgba(255,250,246,.66); border-color:rgba(232,211,196,.75); padding:13px 16px; }
.filter-chip { border-radius:99px; padding:6px 12px; font-weight:600; }
.filter-chip.active { background:linear-gradient(135deg, #FFF0D5, #FFE6C8); border-color:#E9BB70; color:#9B551E; }
.data-table thead th { background:linear-gradient(180deg, #FFF9F4, #FFF4EA); color:#9B7867; font-size:11px; letter-spacing:.08em; text-transform:uppercase; border-bottom-color:#ECD8C8; }
.data-table tbody tr { transition:background .16s ease, box-shadow .16s ease; }
.data-table tbody tr:hover { background:linear-gradient(90deg, rgba(255,239,224,.55), rgba(255,255,255,.1)); box-shadow:inset 3px 0 0 rgba(218,88,43,.68); }
.status-badge, .badge, .provider-status { border:1px solid rgba(74,142,105,.13); box-shadow:0 2px 5px rgba(46,112,72,.05); }
.prototype-note { border-color:#F0D095; background:linear-gradient(135deg, #FFF9E7, #FFF0CF); color:#A76C17; }
.route-node { border-radius:13px; background:linear-gradient(145deg, #FFFDFC, #FFF4E9); border-color:#ECD8C5; box-shadow:0 5px 12px rgba(103,51,25,.045); }
.route-arrow { color:#D66B31; text-shadow:0 0 10px rgba(225,123,45,.25); }
.modal, .modal-content { border:1px solid rgba(226,193,164,.7); border-radius:20px !important; box-shadow:0 28px 80px rgba(65,31,16,.23) !important; background:linear-gradient(145deg, #FFFDFC, #FFF7F0) !important; }
.modal-header { border-bottom-color:#EEDDD0 !important; background:linear-gradient(90deg, rgba(255,248,240,.9), rgba(255,255,255,.65)); }
.modal-footer { border-top-color:#EEDDD0 !important; }
.gw-empty-state { min-height:190px; background:radial-gradient(circle at 50% 38%, rgba(249,191,95,.12), transparent 45%); }
.gw-empty-state::before { content:'✦'; margin-bottom:9px; color:#D57931; font-size:22px; text-shadow:0 0 16px rgba(223,125,45,.32); }
@media (max-width:960px) { .app-header{height:64px;padding:0 16px;} main.content{padding-left:0;} .page{padding:28px 18px 42px;} #page-playground{padding:16px 18px;height:calc(100vh - 64px);} nav.sidebar{top:64px;left:0;} }

/* Command-deck layout: deliberately more architectural than a generic admin. */
.page-head > div:first-child::before { content:'PHOENIX COMMAND DECK'; display:block; margin-bottom:7px; color:#C46B2D; font-size:10px; font-weight:800; letter-spacing:.19em; text-transform:uppercase; }
#page-playground { max-width:none; padding:26px 38px 30px; background:linear-gradient(135deg, rgba(255,255,255,.55), rgba(255,241,226,.32)); }
.pg-grid { gap:18px; padding:12px; border:1px solid rgba(230,193,159,.55); border-radius:26px; background:linear-gradient(140deg, rgba(255,255,255,.62), rgba(255,241,227,.42)); box-shadow:0 20px 50px rgba(103,48,18,.07), inset 0 1px 0 rgba(255,255,255,.9); }
.pg-grid > aside { width:350px; padding:4px; border-radius:18px; background:linear-gradient(180deg, rgba(255,253,250,.75), rgba(255,238,219,.55)); }
.cfg-card { border-radius:17px; border-color:rgba(230,196,165,.72); background:linear-gradient(155deg, rgba(255,255,255,.96), rgba(255,247,239,.90)); box-shadow:0 12px 25px rgba(105,52,20,.07); }
.cfg-card-title { font-size:12px; letter-spacing:.13em; text-transform:uppercase; color:#9D5A27; }
.cfg-card-title::before { width:5px; border-radius:99px; background:linear-gradient(#F5C24E,#D95138); box-shadow:0 0 10px rgba(225,106,41,.3); }
.chat-area { border:1px solid rgba(229,193,161,.75); border-radius:20px; overflow:hidden; background:rgba(255,255,255,.85); box-shadow:0 16px 35px rgba(94,43,18,.08); }
.chat-meta-bar { min-height:57px; padding:13px 20px; background:linear-gradient(90deg, #FFF9F3, #FFF1E2 55%, #FFFDFB); border-bottom-color:rgba(232,204,183,.8); }
.chat-meta-bar::before { content:'✦'; color:#D6662D; margin-right:4px; font-size:16px; text-shadow:0 0 12px rgba(219,93,31,.35); }
.chat-messages { background:radial-gradient(520px 230px at 86% 0%, rgba(244,178,84,.09), transparent 67%), linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,250,246,.92)); }
.chat-input-wrap { background:linear-gradient(180deg, rgba(255,249,243,.83), #FFFDFB); padding:16px 20px 20px; }
.chat-input-box { border-radius:16px; border-color:rgba(224,176,133,.72); background:rgba(255,255,255,.95); box-shadow:0 5px 16px rgba(105,51,20,.07), inset 0 1px 0 #fff; }
.chat-input-box:focus-within { transform:translateY(-1px); }
.model-card { border-radius:18px; background:linear-gradient(145deg, #FFFFFF, #FFF7F0); border-color:rgba(231,203,183,.85); box-shadow:0 8px 20px rgba(99,45,19,.06); }
.model-card::after { content:'✦'; position:absolute; right:15px; top:13px; color:rgba(202,102,36,.28); font-size:14px; }
.model-card:hover { border-color:rgba(213,119,49,.55); box-shadow:0 16px 30px rgba(112,48,18,.12); }
.table-wrap { border-radius:0 0 18px 18px; }
.data-table th { padding:15px 16px; }
.data-table td { padding:15px 16px; }
.data-table tbody tr:nth-child(even) { background:rgba(255,250,246,.42); }
.form-group > label, .field-label { color:#76574A; font-weight:700; letter-spacing:.015em; }
.provider-balance-empty, .table-sub { color:#9B786B; }
.ops-deck { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1px; overflow:hidden; margin:0 0 20px; border:1px solid rgba(228,190,157,.72); border-radius:18px; background:rgba(228,190,157,.62); box-shadow:0 12px 30px rgba(98,45,19,.06); }
.ops-deck-item { min-height:112px; padding:19px 20px 17px; display:flex; flex-direction:column; gap:4px; background:linear-gradient(145deg, rgba(255,255,255,.95), rgba(255,245,235,.88)); position:relative; overflow:hidden; }
.ops-deck-item::after { content:'✦'; position:absolute; right:16px; top:14px; color:rgba(207,100,34,.20); font-size:18px; }
.ops-deck-kicker { color:#C5722C; font-size:10px; font-weight:800; letter-spacing:.14em; }
#billingAcceptanceChecklist { grid-template-columns:repeat(4,minmax(0,1fr)); }
@media (max-width:1100px) { #billingAcceptanceChecklist { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:640px) { #billingAcceptanceChecklist { grid-template-columns:1fr; } }
.ops-deck-item strong { font-size:16px; font-weight:720; }
.ops-deck-item small { max-width:270px; color:#8D756A; font-size:12px; line-height:1.55; }
#page-providers .card, #page-model-mgmt .card { border-radius:20px; }
#page-providers .data-table td:first-child strong, #page-model-mgmt .data-table td:nth-child(2) { color:#663A26; }
#page-model-mgmt .model-mgmt-toolbar { padding:14px; margin-bottom:18px; border:1px solid rgba(227,196,174,.75); border-radius:17px; background:linear-gradient(120deg, rgba(255,255,255,.87), rgba(255,243,230,.72)); box-shadow:0 8px 22px rgba(100,48,20,.055); }
#page-model-mgmt .model-mgmt-toolbar input, #page-model-mgmt .model-mgmt-toolbar select { min-height:39px; }
#page-budgets .ops-grid { gap:12px; padding:10px; border:1px solid rgba(233,207,187,.55); border-radius:22px; background:rgba(255,255,255,.44); }
#page-budgets .ops-metric { box-shadow:none; }
#page-budgets .route-flow { padding:14px 0 2px; }
#page-budgets .route-node { flex:1 1 170px; min-height:86px; }
@media (max-width:760px) { .ops-deck { grid-template-columns:1fr; } .ops-deck-item { min-height:92px; } #page-budgets .ops-grid { padding:0; border:0; background:transparent; } }
@media (max-width:960px) { #page-playground { padding:12px 14px 20px; } .pg-grid { padding:8px; border-radius:18px; } .pg-grid > aside { width:100%; } }
/* ── Usage Command Center ─────────────────────────────────── */
.usage-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.usage-range-select { width:128px; min-height:38px; }
.usage-source-strip { display:flex; align-items:center; gap:10px; min-height:48px; padding:11px 16px; margin-bottom:20px; border:1px solid rgba(196,126,35,.22); border-radius:14px; background:linear-gradient(90deg,rgba(255,246,225,.78),rgba(255,252,246,.62)); color:var(--text-secondary); font-size:13px; }
.usage-source-strip strong { color:var(--text-primary); }
.usage-source-strip .prototype-note { margin-left:auto; white-space:nowrap; }
.usage-live-dot { width:9px; height:9px; border-radius:50%; background:#32a36f; box-shadow:0 0 0 5px rgba(50,163,111,.12); flex:0 0 auto; }
.usage-kpi-grid { grid-template-columns:repeat(5,minmax(0,1fr)); margin-bottom:20px; }
.usage-filter-bar { display:grid; grid-template-columns:repeat(4,minmax(150px,1fr)); gap:12px; margin-bottom:20px; }
.usage-filter-bar .form-control { min-height:44px; background:rgba(255,255,255,.78); }
.usage-latency-grid { grid-template-columns:repeat(3,minmax(0,1fr)); margin-bottom:20px; }
.usage-dashboard-grid { display:grid; grid-template-columns:minmax(0,1.7fr) minmax(300px,.9fr); gap:20px; margin-bottom:20px; }
.usage-bottom-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.usage-trend-card,.usage-health-card,.usage-model-card,.usage-channel-card { min-height:292px; }
.usage-legend { display:flex; align-items:center; gap:7px; color:var(--text-tertiary); font-size:12px; white-space:nowrap; }
.usage-legend i { width:8px; height:8px; border-radius:50%; display:inline-block; }
.legend-request { background:var(--accent); }.legend-token { background:#c64b35; }
.usage-trend-chart { height:238px; padding:2px 0 0; }
.usage-trend-chart svg { width:100%; height:100%; overflow:visible; }
.usage-trend-chart text { fill:var(--text-tertiary); font-size:10px; font-family:var(--font-sans); }
.usage-chart-grid { stroke:rgba(122,99,77,.12); stroke-width:1; stroke-dasharray:4 5; }
.usage-chart-bar { fill:rgba(196,126,35,.54); transition:fill .18s ease,opacity .18s ease; }
.usage-chart-bar:hover { fill:var(--accent); }
.usage-chart-line { fill:none; stroke:#c64b35; stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round; filter:drop-shadow(0 2px 2px rgba(198,75,53,.18)); }
.usage-health-list,.usage-channel-list,.usage-model-share { display:flex; flex-direction:column; gap:10px; padding-top:10px; }
.usage-health-row,.usage-channel-row { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:42px; padding:9px 0; border-bottom:1px solid rgba(122,99,77,.11); }
.usage-health-row:last-child,.usage-channel-row:last-child { border-bottom:0; }
.usage-health-row > div,.usage-channel-row > div { display:flex; align-items:center; gap:9px; min-width:0; }
.usage-health-row small,.usage-channel-row small { color:var(--text-tertiary); font-size:12px; margin-left:auto; }
.usage-health-value { font-family:var(--font-mono); font-weight:750; }.usage-health-value.success { color:#249262; }.usage-health-value.warning { color:#c47e23; }.usage-health-value.danger { color:#c64b35; }
.usage-signal,.usage-channel-mark { width:9px; height:9px; border-radius:50%; background:#a8a096; box-shadow:0 0 0 4px rgba(168,160,150,.1); flex:0 0 auto; }
.usage-signal.success { background:#32a36f; box-shadow:0 0 0 4px rgba(50,163,111,.12); }.usage-signal.warning,.usage-channel-mark.pending { background:#d69a27; box-shadow:0 0 0 4px rgba(214,154,39,.12); }.usage-signal.danger { background:#d75242; box-shadow:0 0 0 4px rgba(215,82,66,.12); }
.usage-share-row { padding:7px 0; }.usage-share-title { display:flex; justify-content:space-between; gap:12px; margin-bottom:7px; font-size:12px; }.usage-share-title strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.usage-share-title span { color:var(--text-tertiary); white-space:nowrap; }.usage-share-track { height:8px; border-radius:99px; overflow:hidden; background:rgba(122,99,77,.1); }.usage-share-track i { display:block; height:100%; min-width:2px; border-radius:99px; background:linear-gradient(90deg,var(--accent),#e0b34a); }
.usage-channel-row > div { display:flex; flex-direction:column; align-items:flex-start; gap:2px; }.usage-channel-row > div strong { max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width:1180px) { .usage-kpi-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }.usage-filter-bar { grid-template-columns:repeat(2,minmax(0,1fr)); }.usage-dashboard-grid { grid-template-columns:1fr; }.usage-bottom-grid { grid-template-columns:1fr; } }
@media (max-width:720px) { .usage-source-strip { align-items:flex-start; flex-wrap:wrap; }.usage-source-strip .prototype-note { margin-left:19px; }.usage-kpi-grid,.usage-latency-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }.usage-filter-bar { grid-template-columns:1fr; }.usage-actions { width:100%; }.usage-range-select { flex:1; }.usage-actions .btn { flex:1; }.usage-legend { display:none; } }
/* ── Phoenix Ascension: global visual system ───────────────────────
   A light, layered command surface inspired by Phoenix armour: ivory plates,
   ember-red energy seams and restrained auric highlights.  These overrides
   deliberately cover every existing page instead of introducing a one-off
   dashboard skin. */
:root {
  --bg-page:#fbf7f2;
  --bg-sidebar:#f7eee4;
  --bg-card:rgba(255,255,255,.88);
  --text-primary:#2f2624;
  --text-secondary:#74635c;
  --text-tertiary:#a28e83;
  --accent:#bf6729;
  --accent-dark:#893515;
  --border:#e7d6c8;
  --shadow-sm:0 2px 3px rgba(89,39,18,.02),0 13px 32px rgba(102,48,21,.08);
  --shadow-md:0 16px 38px rgba(91,35,14,.12),0 34px 72px rgba(196,95,30,.08);
}
body {
  min-height:100vh;
  background:
    radial-gradient(900px 540px at 104% -10%,rgba(237,158,62,.20),transparent 60%),
    radial-gradient(720px 520px at -16% 104%,rgba(202,67,41,.13),transparent 62%),
    linear-gradient(118deg,#fffdf9 0%,#fbf5ee 44%,#f8eee5 100%);
  color:var(--text-primary);
}
body::before {
  inset:0; z-index:-2; opacity:.8;
  background:
    linear-gradient(116deg,transparent 0 49.7%,rgba(201,117,55,.027) 49.8% 50%,transparent 50.1%),
    repeating-linear-gradient(90deg,transparent 0 105px,rgba(112,59,28,.025) 106px 107px);
  mask-image:linear-gradient(to bottom,rgba(0,0,0,.85),transparent 86%);
}
body::after { content:''; position:fixed; pointer-events:none; z-index:-1; width:520px; height:520px; right:-350px; top:110px; border:1px solid rgba(211,113,41,.12); border-radius:50%; box-shadow:0 0 0 32px rgba(211,113,41,.018),0 0 0 72px rgba(211,113,41,.012); }
.app-header {
  height:76px; margin:12px 16px 0; padding:0 24px; border:1px solid rgba(220,188,162,.75); border-radius:20px;
  background:linear-gradient(104deg,rgba(255,255,255,.91),rgba(255,249,242,.78));
  box-shadow:0 13px 35px rgba(93,42,20,.08),inset 0 1px 0 #fff;
}
.app-header::before { content:''; width:78px; height:3px; position:absolute; left:25px; bottom:-2px; border-radius:99px; background:linear-gradient(90deg,#d44838,#f3bd50); box-shadow:0 0 12px rgba(214,78,43,.35); }
.brand { position:relative; gap:14px; }.brand-mark { width:43px; height:43px; border-radius:14px; background:linear-gradient(145deg,#fff8ed,#ffe6ce); border-color:rgba(204,98,33,.3); box-shadow:0 0 0 5px rgba(246,178,79,.10),0 10px 18px rgba(175,57,21,.14); }
.brand-text strong { color:#45231c; font-size:19px; letter-spacing:.035em; }.brand-text small { letter-spacing:.15em; color:#a26743; }
.header-right { gap:10px; }.user-badge,.header-user { border:1px solid rgba(225,194,167,.82); border-radius:12px; background:rgba(255,255,255,.65); }
nav.sidebar {
  top:102px; bottom:24px; left:18px; width:78px; padding:16px 0 14px; border:1px solid rgba(226,191,161,.85); border-radius:27px;
  background:linear-gradient(165deg,rgba(255,255,255,.97),rgba(255,247,238,.94) 52%,rgba(255,230,205,.86));
  box-shadow:0 24px 48px rgba(92,38,16,.14),inset 0 1px 0 rgba(255,255,255,.96);
}
nav.sidebar::before { top:22px; right:-2px; width:4px; height:82px; border-radius:99px 0 0 99px; background:linear-gradient(#f4ca51 0%,#df7232 49%,#c93838 100%); box-shadow:0 0 16px rgba(214,70,42,.42); }
nav.sidebar::after { content:'✦'; position:absolute; right:13px; bottom:15px; color:rgba(181,74,28,.44); font-size:12px; text-shadow:0 0 12px rgba(226,142,44,.42); }
nav.sidebar:is(:hover,:focus-within,.is-open) { width:min(346px,calc(100vw - 44px)); border-color:rgba(202,114,49,.52); box-shadow:0 30px 64px rgba(85,31,13,.19),inset 0 1px 0 #fff; }
.nav-group { position:relative; }.nav-group-title { padding:15px 27px 9px; font-size:10px; font-weight:800; letter-spacing:.18em; color:#ad784e; }
.nav-group + .nav-group { margin-top:4px; }.nav-group + .nav-group::before { content:''; position:absolute; left:24px; right:24px; top:1px; height:1px; background:linear-gradient(90deg,transparent,rgba(187,119,69,.18),transparent); }
.nav-item { position:relative; min-height:43px; margin:3px 13px; padding-left:13px; border-radius:13px; font-weight:620; color:#715e55; overflow:hidden; }
.nav-item::after { content:''; position:absolute; inset:0 auto 0 0; width:0; background:linear-gradient(#d74b38,#efb344); transition:width .2s ease; }
.nav-item:hover { transform:translateX(3px); color:#7e391a; background:linear-gradient(90deg,rgba(255,225,200,.7),rgba(255,247,239,.12)); }.nav-item:hover::after { width:2px; }
.nav-item.active { color:#883517; background:linear-gradient(100deg,rgba(225,72,51,.14),rgba(255,194,83,.27) 72%,rgba(255,248,239,.2)); box-shadow:inset 3px 0 0 #d74b38,0 8px 20px rgba(191,76,25,.12); }.nav-item.active::after { width:3px; }
.nav-ico { width:22px; color:inherit; }.nav-item .nav-tag { margin-left:auto; border:1px solid rgba(201,111,42,.2); background:#fff2dd; color:#ad641e; }
main.content { padding-left:108px; }.page { max-width:1480px; padding:48px 42px 64px; }
.page-head { margin-bottom:31px; padding:7px 0 23px 18px; border:0; }.page-head::before { content:''; position:absolute; left:0; top:8px; bottom:24px; width:3px; border-radius:99px; background:linear-gradient(#efbb4b,#d64a38); box-shadow:0 0 12px rgba(214,77,37,.28); }.page-head::after { width:130px; height:2px; bottom:0; background:linear-gradient(90deg,#d84f37,#efb947,transparent); }
.page-head > div:first-child::before { color:#ad5725; letter-spacing:.23em; }.page-title { color:#382522; font-size:32px; font-weight:780; letter-spacing:-.045em; }.page-desc { color:#806b61; font-size:14px; line-height:1.7; }
.card,.ops-metric,.route-node,.cfg-card,.model-card { border:1px solid rgba(228,207,191,.9); background:linear-gradient(145deg,rgba(255,255,255,.94),rgba(255,249,244,.84)); box-shadow:var(--shadow-sm); }
.card { border-radius:20px; }.card::after { content:''; position:absolute; pointer-events:none; right:16px; top:14px; width:7px; height:7px; transform:rotate(45deg); border:1px solid rgba(202,100,34,.28); }
.card:hover,.ops-metric:hover,.route-node:hover,.cfg-card:hover { transform:translateY(-3px); border-color:rgba(206,121,55,.56); box-shadow:var(--shadow-md); }
.ops-metric { border-radius:18px; padding:22px; }.ops-metric::before { left:0; top:18px; bottom:18px; width:4px; background:linear-gradient(#f4c04d,#d64038); }.ops-metric .value { font-size:31px; color:#392520; }.ops-metric .label { color:#a57659; }
.data-card { border-radius:22px; overflow:hidden; background:rgba(255,255,255,.76); }.data-card-toolbar { padding:20px 24px 17px; border-bottom:1px solid rgba(230,211,198,.68); background:linear-gradient(90deg,rgba(255,246,236,.9),rgba(255,255,255,.78)); }
.card-h { color:#462c25; font-weight:760; }.card-h::before { content:'◆'; color:#d9782d; font-size:10px; margin-right:8px; }
.btn { position:relative; border-radius:12px; min-height:40px; padding:10px 18px; overflow:hidden; font-weight:720; }.btn-primary { background:linear-gradient(120deg,#ba482c,#cf6f27 54%,#edb247); border-color:rgba(232,163,74,.72); box-shadow:0 10px 22px rgba(184,69,25,.22),inset 0 1px 0 rgba(255,255,255,.25); }.btn-primary::before { content:''; position:absolute; inset:0; background:linear-gradient(105deg,transparent 20%,rgba(255,255,255,.28) 45%,transparent 65%); transform:translateX(-110%); transition:transform .45s ease; }.btn-primary:hover::before { transform:translateX(110%); }.btn-primary:hover { transform:translateY(-2px); box-shadow:0 15px 28px rgba(178,62,20,.31); }
.btn-secondary,.btn-ghost,.action-btn { border-color:rgba(210,167,132,.75); background:rgba(255,255,255,.76); color:#88401d; }.btn-secondary:hover,.btn-ghost:hover,.action-btn:hover { border-color:#db8740; background:#fff0df; color:#873215; }
input,select,textarea,.form-control { min-height:41px; border-radius:12px !important; border-color:#e8d4c4 !important; background:rgba(255,255,255,.84) !important; }.filter-bar,.model-mgmt-toolbar { border-radius:16px !important; background:linear-gradient(110deg,rgba(255,250,246,.86),rgba(255,242,230,.66)) !important; }.filter-chip { border-radius:99px; }.filter-chip.active { background:linear-gradient(135deg,#fff5d8,#ffe1c5); border-color:#e6ad60; }
.data-table thead th { height:50px; background:linear-gradient(180deg,#fffaf5,#fff1e5); color:#9f806d; border-bottom-color:#ead7c9; }.data-table tbody tr { border-bottom-color:rgba(231,214,201,.75); }.data-table tbody tr:nth-child(even) { background:rgba(255,249,243,.48); }.data-table tbody tr:hover { background:linear-gradient(90deg,rgba(255,234,216,.63),rgba(255,255,255,.18)); box-shadow:inset 3px 0 0 #d95c36; }
.status-badge,.badge,.provider-status,.prototype-note { border-radius:999px; }.prototype-note { border-color:#efd18d; background:linear-gradient(135deg,#fff9e5,#ffedc6); color:#a46419; }
.modal,.modal-content { border-radius:24px !important; background:linear-gradient(145deg,#fffefd,#fff5eb) !important; }.modal-header { padding:21px 24px; background:linear-gradient(90deg,#fff9f3,#fff0df); }.modal-footer { padding:17px 24px; }
.toast { border:1px solid rgba(221,180,139,.75); border-radius:16px; background:rgba(255,253,250,.94); box-shadow:0 20px 48px rgba(76,30,12,.18); }
#page-playground { max-width:none; padding:33px 42px 38px; }.pg-grid { border-radius:28px; background:linear-gradient(135deg,rgba(255,255,255,.72),rgba(255,239,220,.52)); box-shadow:0 24px 54px rgba(87,31,10,.1),inset 0 1px 0 #fff; }.chat-area { border-radius:22px; }.chat-meta-bar { background:linear-gradient(90deg,#fffaf5,#fff0df 60%,#fffdf9); }.chat-messages { background:radial-gradient(650px 270px at 96% 0%,rgba(239,165,70,.13),transparent 65%),linear-gradient(180deg,#fffefd,#fff8f1); }.chat-input-wrap { background:linear-gradient(180deg,rgba(255,247,238,.84),#fffefd); }
.ops-deck { border-radius:21px; border-color:rgba(229,195,165,.76); gap:1px; }.ops-deck-item { min-height:118px; background:linear-gradient(145deg,rgba(255,255,255,.96),rgba(255,243,230,.88)); }.ops-deck-item strong { color:#422923; }.usage-source-strip { border-radius:16px; background:linear-gradient(90deg,rgba(255,244,221,.83),rgba(255,253,248,.72)); }.usage-trend-card,.usage-health-card,.usage-model-card,.usage-channel-card { border-radius:20px; }
@media (prefers-reduced-motion:no-preference) { .card,.ops-metric,.route-node,.cfg-card,.model-card,.btn { transition:transform .18s ease,box-shadow .2s ease,border-color .2s ease,background .2s ease; } nav.sidebar::before { animation:phoenix-flame 3.2s ease-in-out infinite; } }
@keyframes phoenix-flame { 50% { filter:saturate(1.25) brightness(1.08); box-shadow:0 0 23px rgba(214,70,42,.58); } }
@media (max-width:960px) { .app-header { height:64px; margin:0; border-radius:0; border-left:0; border-right:0; }.app-header::before { left:16px; }.page { padding:32px 18px 48px; } main.content { padding-left:0; } #page-playground { padding:16px 14px 28px; } nav.sidebar { top:64px; left:0; bottom:0; border-radius:0 23px 23px 0; } }
@media (max-width:620px) { .brand-text small { display:none; }.page-title { font-size:27px; }.page-head { padding-left:14px; }.page-head::before { bottom:23px; }.data-card-toolbar { padding:15px; }.ops-metric { padding:18px; } }

/* Page families: give operational work surfaces their own visual rhythm while
   keeping the shared Phoenix shell recognisable. */
#page-status .stat-grid,#page-account .stat-grid,#page-team .stat-grid { gap:16px; }
#page-status .stat-card,#page-account .stat-card,#page-team .stat-card { position:relative; overflow:hidden; min-height:126px; border:1px solid rgba(228,205,186,.9); border-radius:18px; background:linear-gradient(145deg,rgba(255,255,255,.95),rgba(255,246,236,.84)); box-shadow:var(--shadow-sm); }
#page-status .stat-card::after,#page-account .stat-card::after,#page-team .stat-card::after { content:'✦'; position:absolute; right:15px; top:12px; color:rgba(204,101,35,.2); font-size:17px; }
#page-status .stat-card:hover,#page-account .stat-card:hover,#page-team .stat-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-md); }
#page-status .check-row { min-height:64px; padding:14px 20px; border-bottom:1px solid rgba(231,214,199,.72); transition:background .18s ease; }
#page-status .check-row:hover { background:linear-gradient(90deg,rgba(255,239,221,.56),transparent); }
#page-status .check-row:last-child { border-bottom:0; }
#page-providers .card,#page-model-mgmt .card,#page-gw-routing .card,#page-gw-ratelimit .card,#page-gw-guardrails .card,#page-gw-cache .card,#page-gw-observability .card { border-radius:22px; }
#page-providers .data-table td:first-child strong { display:block; color:#4b2b22; font-size:15px; }
#page-providers .data-table td:first-child small { display:block; margin-top:5px; color:#a07d6d; }
#page-model-mgmt .model-mgmt-toolbar { position:sticky; top:90px; z-index:3; backdrop-filter:blur(12px); box-shadow:0 13px 28px rgba(100,47,19,.08); }
#page-model-mgmt .model-mgmt-toolbar::before { content:'MODEL ARMOURY'; display:block; flex-basis:100%; color:#b4662a; font-size:9px; font-weight:800; letter-spacing:.17em; }
#page-gw-routing .data-table td:first-child,#page-gw-ratelimit .data-table td:first-child,#page-gw-guardrails .data-table td:first-child { font-weight:720; color:#573127; }
#page-gw-cache .card-b > .form-grid,#page-gw-guardrails .card-b > .form-grid,#page-gw-ratelimit .card-b > .form-grid { padding:22px 24px; background:linear-gradient(90deg,rgba(255,248,241,.82),rgba(255,255,255,.3)); border-bottom:1px solid rgba(232,213,198,.65); }
#page-requests .ops-grid,#page-budgets .ops-grid,#page-pricing .ops-grid,#page-credits .ops-grid,#page-revenue .ops-grid { margin-bottom:20px; }
#page-requests .data-card,#page-budgets .data-card,#page-pricing .data-card,#page-credits .data-card,#page-revenue .data-card { box-shadow:0 18px 42px rgba(93,39,14,.075); }
#page-requests .data-card-toolbar,#page-budgets .data-card-toolbar,#page-pricing .data-card-toolbar,#page-credits .data-card-toolbar,#page-revenue .data-card-toolbar { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }
#page-budgets .route-flow,#page-prompts .route-flow,#page-evaluations .route-flow { padding:5px 2px; }
#page-budgets .route-node,#page-prompts .route-node,#page-evaluations .route-node { min-height:98px; padding:18px; }
#page-budgets .route-node strong,#page-prompts .route-node strong,#page-evaluations .route-node strong { color:#663520; }
#page-pricing .filter-bar,#page-channel-costs .filter-bar,#page-credits .filter-bar,#page-requests .filter-bar { min-width:min(100%,360px); }
#page-credits > .card:not(.data-card) { background:linear-gradient(135deg,rgba(255,255,255,.93),rgba(255,244,227,.80)); }
#page-credits #paymentChannelStatus { padding:13px 15px; border:1px dashed rgba(202,142,73,.4); border-radius:13px; background:rgba(255,250,243,.62); }
#page-revenue .grid-2 > .card { min-height:300px; }
#page-revenue .ops-metric:first-child::before { background:linear-gradient(#e9b843,#ce5337); }
#page-revenue .ops-metric:nth-child(2)::before { background:linear-gradient(#d97935,#c64936); }
#page-revenue .ops-metric:nth-child(3)::before { background:linear-gradient(#45a976,#2e8b68); }
#page-revenue .ops-metric:nth-child(4)::before { background:linear-gradient(#e4b34a,#bc6b2c); }
#page-account .card,#page-team .card,#page-settings .card,#page-enterprise .card { border-radius:21px; }
#page-account .card-b,#page-settings .card-b { line-height:1.7; }
#page-enterprise .card-h { padding:2px 0 14px; border-bottom:1px solid rgba(232,213,198,.65); }
#page-keys .key-card { border-radius:18px; border-left:3px solid #d96a37; background:linear-gradient(100deg,rgba(255,255,255,.94),rgba(255,247,239,.82)); box-shadow:var(--shadow-sm); }
#page-keys .key-card.revoked { border-left-color:#a89a8f; opacity:.8; }
.empty-state,.gw-empty-state { padding:44px 24px; color:#987565; background:radial-gradient(260px 130px at 50% 35%,rgba(245,182,84,.13),transparent 72%); }
.empty-state::before,.gw-empty-state::before { display:block; margin-bottom:10px; font-size:22px; color:#d57631; }
@media (max-width:960px) { #page-model-mgmt .model-mgmt-toolbar { position:relative; top:auto; } #page-requests .data-card-toolbar,#page-budgets .data-card-toolbar,#page-pricing .data-card-toolbar,#page-credits .data-card-toolbar,#page-revenue .data-card-toolbar { padding:17px; } }
