:root {
  --bg: #f6f8fb;
  --bg-soft: #eef3f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #111827;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #dde6f0;
  --line-soft: #edf2f7;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --sidebar: #101624;
  --sidebar-2: #172033;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
input, select, button, textarea { font: inherit; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); outline: none; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
input, select { height: 38px; padding: 0 11px; }
textarea { min-height: 92px; padding: 10px 11px; resize: vertical; line-height: 1.6; }
input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
label { display: grid; gap: 7px; color: var(--ink-2); font-weight: 650; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 820px; }
th, td { padding: 12px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; color: #475569; font-size: 12px; font-weight: 750; background: #f8fafc; white-space: nowrap; }
td { color: #1f2937; background: #fff; }
tbody tr:hover td { background: #fbfdff; }
pre { margin: 10px 0 0; overflow: auto; padding: 14px; border: 1px solid #1e293b; border-radius: 8px; background: #0b1020; color: #dbeafe; line-height: 1.7; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 18% 18%, rgba(37, 99, 235, .28), transparent 28%), linear-gradient(145deg, #07111f 0%, #101624 100%); }
.auth-shell { width: min(1040px, 100%); min-height: 620px; display: grid; grid-template-columns: 1.12fr .88fr; background: #fff; border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; overflow: hidden; box-shadow: 0 28px 90px rgba(0, 0, 0, .38); }
.auth-visual { padding: 54px; color: white; background: linear-gradient(145deg, rgba(15, 23, 42, .92), rgba(23, 32, 51, .98)); display: flex; flex-direction: column; justify-content: center; }
.auth-visual h1 { margin: 24px 0 12px; max-width: 620px; font-size: clamp(32px, 4vw, 54px); line-height: 1.05; letter-spacing: 0; }
.auth-visual p { max-width: 520px; margin: 0; color: #b8c4d9; font-size: 16px; line-height: 1.8; }
.auth-card { padding: 54px 42px; display: flex; flex-direction: column; justify-content: center; }
.auth-card h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: 0; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 10px; background: #fff; color: #0f172a; font-weight: 900; box-shadow: 0 18px 40px rgba(0, 0, 0, .18); }
.code-panel { display: grid; gap: 10px; margin-top: 34px; padding: 18px; border: 1px solid rgba(255,255,255,.13); border-radius: 10px; background: rgba(3, 7, 18, .62); color: #93c5fd; font-family: Consolas, monospace; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%); color: white; padding: 18px 14px; position: sticky; top: 0; height: 100vh; box-shadow: 1px 0 0 rgba(255,255,255,.06) inset; }
.side-brand { min-height: 54px; display: flex; align-items: center; gap: 11px; padding: 0 8px 18px; color: white; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: linear-gradient(145deg, #3b82f6, #10b981); font-weight: 900; letter-spacing: 0; }
.side-brand strong { font-size: 16px; letter-spacing: 0; }
.side-nav { display: grid; gap: 5px; margin-top: 18px; }
.side-nav a { position: relative; display: flex; align-items: center; min-height: 40px; color: #b7c3d6; padding: 0 12px; border-radius: 8px; font-weight: 650; transition: background .15s ease, color .15s ease, transform .15s ease; }
.side-nav a:hover { color: white; background: rgba(255,255,255,.07); }
.side-nav a.active { color: white; background: rgba(37, 99, 235, .26); box-shadow: inset 3px 0 0 #60a5fa; }
.main { min-width: 0; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 4; backdrop-filter: blur(12px); }
.topbar strong { font-size: 15px; }
.topbar span { color: var(--muted); margin-left: 8px; font-size: 12px; }
.userbar { display: flex; align-items: center; gap: 12px; }
.userbar > span { min-height: 30px; display: inline-flex; align-items: center; padding: 0 10px; margin: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-soft); color: var(--ink-2); }
.content { padding: 26px; max-width: 1800px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: 0; }
.page-head p, .muted { margin: 6px 0 0; color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric { min-height: 112px; padding: 18px; display: grid; align-content: space-between; gap: 10px; }
.metric span { color: var(--muted); font-weight: 700; }
.metric strong { font-size: 32px; line-height: 1; letter-spacing: 0; }
.panel { padding: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 17px; letter-spacing: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.split-grid { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.stacked-panels { display: grid; gap: 16px; }
.docs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.docs-grid .panel:last-child { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 14px; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-soft); }
.toolbar input { max-width: 260px; }
.toolbar select { max-width: 180px; }
.table-wrap { overflow: auto; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.row-form { display: flex; align-items: center; gap: 8px; }
.row-form select { width: 102px; height: 32px; }
.row-form input { height: 32px; min-width: 120px; }
.quota-form { display: grid; grid-template-columns: 78px 70px minmax(130px, 1fr) auto; gap: 8px; align-items: center; min-width: 380px; }
.quota-form input { height: 32px; padding: 0 8px; }
.tenant-form { display: grid; grid-template-columns: 90px 150px 82px 82px 90px auto; gap: 8px; align-items: center; min-width: 620px; }
.tenant-form input, .tenant-form select { height: 32px; padding: 0 8px; }
.notice-form { display: grid; grid-template-columns: 72px 150px minmax(180px, 1fr) 86px 82px 98px auto; gap: 8px; align-items: center; min-width: 760px; }
.notice-form textarea { min-height: 34px; height: 38px; padding: 6px 8px; resize: vertical; }
.checkline { display: inline-flex; grid-auto-flow: column; align-items: center; gap: 6px; font-weight: 650; white-space: nowrap; color: var(--ink-2); }
.checkline input { width: 16px; height: 16px; box-shadow: none; }
.is-hidden { display: none !important; }

.btn { min-height: 36px; border: 1px solid var(--line); border-radius: 7px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: #fff; color: #1f2937; cursor: pointer; white-space: nowrap; font-weight: 700; transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.primary { border-color: var(--primary); background: var(--primary); color: white; box-shadow: 0 8px 18px rgba(37, 99, 235, .2); }
.btn.primary:hover { background: var(--primary-2); transform: translateY(-1px); }
.btn.danger { border-color: #fecaca; background: var(--danger-soft); color: var(--danger); }
.btn.ghost { height: 32px; min-height: 32px; background: #f8fafc; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 12px; }
.tag { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 0 9px; background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 800; white-space: nowrap; }
.tag.success { background: var(--success-soft); color: var(--success); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.warning { background: var(--warning-soft); color: var(--warning); }
.tag.info { background: var(--primary-soft); color: var(--primary); }
.alert { margin-bottom: 14px; padding: 11px 12px; border-radius: 8px; border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8; font-weight: 650; }
.alert.success { border-color: #bbf7d0; background: #f0fdf4; color: #047857; }
.alert.danger { border-color: #fecaca; background: #fef2f2; color: var(--danger); }
.mono { font-family: Consolas, "Cascadia Code", monospace; font-size: 12px; }
.secret { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.copyable { cursor: copy; }
.copyable.copied { color: var(--success); }
.empty { text-align: center; color: var(--muted); padding: 34px; background: #fff; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .content { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .auth-shell, .app-shell, .split-grid, .docs-grid { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .sidebar { position: static; height: auto; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { position: static; }
}

@media (max-width: 640px) {
  .auth-body { padding: 12px; }
  .auth-card, .content { padding: 18px; }
  .topbar, .page-head, .toolbar { align-items: stretch; flex-direction: column; }
  .stats-grid, .inline-fields { grid-template-columns: 1fr; }
  .toolbar input, .toolbar select { max-width: none; }
  .side-nav { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
}

/* 分页条 */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px 4px;
  border-top: 1px solid #e2e8f0;
  margin-top: 8px;
}
.pager-info {
  color: #64748b;
  font-size: 13px;
}
.pager .btn {
  text-decoration: none;
}

/* 顶栏内联小表单（退出按钮等） */
.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
