/* ============================================================
   AioKK 控制台 · 暗色轻奢
   ============================================================ */

:root {
  --bg: #0a0b0f;
  --bg-2: #0e1015;
  --panel: rgba(255, 255, 255, 0.03);
  --panel-2: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(232, 201, 125, 0.35);
  --text: #f2efe8;
  --muted: #9b978d;
  --gold-1: #efd9a0;
  --gold-2: #c9a25e;
  --gold-3: #8c6430;
  --gold-grad: linear-gradient(135deg, #efd9a0 0%, #c9a25e 45%, #96703a 100%);
  --danger: #e06a5e;
  --ok: #7fbf7a;
  --radius: 14px;
  --font: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: Consolas, "JetBrains Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14.5px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: var(--gold-1); text-decoration: none; }
.hidden { display: none !important; }
.gold-text { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- 登录 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
.auth-wrap::before { content: ""; position: absolute; inset: -30% -10%; background: radial-gradient(640px 320px at 50% 18%, rgba(201,162,94,0.13), transparent 65%); pointer-events: none; }
.auth-card { position: relative; width: 400px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 44px 40px; }
.auth-logo { width: 40px; height: 40px; margin-bottom: 14px; }
.auth-title { font-size: 28px; font-weight: 500; letter-spacing: 0.03em; }
.auth-sub { color: var(--muted); margin: 6px 0 28px; font-size: 13.5px; letter-spacing: 0.08em; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; letter-spacing: 0.06em; }
.field input, .field select, .field textarea, .modal input, .modal select, .modal textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14.5px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
/* 下拉菜单选项样式修复：确保字体颜色可见 */
.field select option, .modal select option,
.field select optgroup, .modal select optgroup {
  background: #1a1c22;
  color: #f2efe8;
  font-size: 14px;
  padding: 8px 12px;
}
.field select option:hover, .modal select option:hover,
.field select option:checked, .modal select option:checked {
  background: rgba(201,162,94,0.25);
  color: #efd9a0;
}
.field input:focus, .modal input:focus, .modal select:focus, .modal textarea:focus, .field select:focus, .field textarea:focus { border-color: var(--line-strong); }
.field textarea, .modal textarea { min-height: 110px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.auth-error { color: var(--danger); font-size: 13px; margin: 4px 0 12px; }
.auth-switch { margin-top: 22px; color: var(--muted); font-size: 14px; text-align: center; }
.auth-switch a { margin-left: 6px; }
.auth-hint { margin-top: 14px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 20px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; font-size: 14px; font-family: var(--font); letter-spacing: 0.03em; transition: all 0.18s; }
.btn-gold { background: var(--gold-grad); color: #17130a; font-weight: 600; }
.btn-gold:hover { box-shadow: 0 8px 22px rgba(201,162,94,0.3); }
.btn-ghost { border-color: var(--line-strong); color: var(--gold-1); background: transparent; }
.btn-ghost:hover { background: rgba(201,162,94,0.08); }
.btn-danger { border-color: rgba(224,106,94,0.5); color: var(--danger); background: transparent; }
.btn-danger:hover { background: rgba(224,106,94,0.1); }
.btn-sm { padding: 5px 14px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 5px 11px; cursor: pointer; font-size: 15px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; min-width: 224px;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 22px 22px 18px; font-size: 20px; color: var(--text); }
.side-brand img { width: 26px; height: 26px; }
.side-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 4px;
  color: var(--muted); border-radius: 10px; font-size: 14.5px;
  border: 1px solid transparent;
}
.side-nav a:hover { color: var(--text); background: var(--panel); }
.side-nav a.active { color: var(--gold-1); background: rgba(201,162,94,0.09); border-color: rgba(201,162,94,0.22); }
.side-nav .nav-sep { color: var(--muted); opacity: 0.55; font-size: 12px; letter-spacing: 0.18em; padding: 14px 14px 6px; }
.side-foot { padding: 16px 20px; border-top: 1px solid var(--line); }
.env-badge { font-size: 12px; color: var(--gold-2); border: 1px solid var(--line-strong); padding: 2px 12px; border-radius: 999px; letter-spacing: 0.12em; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,11,15,0.8);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 18px; font-weight: 500; letter-spacing: 0.02em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { color: var(--muted); font-size: 13.5px; }
#menuBtn { display: none; }
.content { padding: 28px; max-width: 1560px; width: 100%; }

/* ---------- 卡片与统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stat-card .k { color: var(--muted); font-size: 13px; letter-spacing: 0.1em; margin-bottom: 8px; }
.stat-card .v { font-size: 30px; font-weight: 500; color: var(--gold-1); }
.stat-card .s { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.panel h3 { font-size: 16px; font-weight: 600; margin-bottom: 14px; letter-spacing: 0.03em; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table th { color: var(--gold-2); font-weight: 500; letter-spacing: 0.08em; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.table td { border-bottom: 1px solid var(--line); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }
.table .actions { display: flex; gap: 6px; white-space: nowrap; justify-content: flex-start; }
.table .actions .btn-sm { padding: 4px 10px; font-size: 12px; flex-shrink: 0; }
.table .mono { font-family: var(--mono); font-size: 12.5px; }
/* 长文本单元格：截断 + 悬停显示全文（配合 title），避免撑出横向滚动条 */
.clip { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-wide { max-width: 320px; }
.empty { color: var(--muted); text-align: center; padding: 28px !important; }

/* ---------- 模型广场卡片 ---------- */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.model-card { display: flex; flex-direction: column; gap: 14px; }
.model-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.model-card-name { font-size: 16px; font-weight: 600; }
.model-card-alias { color: var(--muted); font-size: 12px; margin-top: 2px; }
.model-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.model-card-price { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.price-item { display: flex; flex-direction: column; gap: 2px; }
.price-item .k { color: var(--muted); font-size: 12px; }
.price-item .v { color: var(--gold-1); font-size: 16px; font-weight: 600; }
.price-item .u { color: var(--muted); font-size: 11px; }
.model-card-meta { display: flex; gap: 16px; color: var(--muted); font-size: 12px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: rgba(232,201,125,0.12); border: 1px solid rgba(232,201,125,0.3); color: var(--gold-1); font-size: 11.5px; }

/* ---------- 状态徽标 ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.on { color: var(--ok); border-color: rgba(127,191,122,0.4); }
.badge.off { color: var(--danger); border-color: rgba(224,106,94,0.4); }
.badge.warn { color: var(--gold-1); border-color: var(--line-strong); }
.cap { font-size: 11.5px; color: var(--gold-1); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 8px; margin-right: 4px; display: inline-block; }

/* ---------- 工具条 ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select {
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); padding: 8px 12px; font-size: 13.5px; font-family: var(--font); outline: none;
}
.toolbar select option { background: #1a1c22; color: #f2efe8; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--line-strong); }
.toolbar .grow { flex: 1; min-width: 160px; }
.toolbar label { color: var(--muted); font-size: 13px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.pager button { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 5px 14px; cursor: pointer; font-size: 13px; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- 模态 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(4,5,8,0.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: #101218; border: 1px solid var(--line); border-radius: 18px; width: 560px; max-width: 100%; max-height: 90vh; overflow-y: auto; padding: 28px; }
.modal h3 { font-size: 18px; margin-bottom: 20px; font-weight: 600; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; position: sticky; bottom: 0; background: #101218; padding-top: 12px; }
.secret-box { background: rgba(201,162,94,0.07); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 14px; font-family: var(--mono); font-size: 13px; word-break: break-all; color: var(--gold-1); margin: 10px 0 4px; }
.form-err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); cursor: pointer; }
.checks label:has(input:checked) { color: var(--gold-1); border-color: var(--line-strong); }
.checks input { accent-color: #c9a25e; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: #14161c; border: 1px solid var(--line-strong); color: var(--text); padding: 12px 18px; border-radius: 12px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: slidein 0.25s ease; }
.toast.err { border-color: rgba(224,106,94,0.5); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 图表 ---------- */
.chart { width: 100%; }
.chart .bar { fill: url(#goldbar); }
.chart .bar-err { fill: rgba(224,106,94,0.55); }
.axis-text { fill: var(--muted); font-size: 10px; font-family: var(--font); }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,0.6); }
  #menuBtn { display: inline-block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .modal .row { grid-template-columns: 1fr; }
}
