* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #0f172a; color: #e2e8f0; height: 100%; }

button { cursor: pointer; border-radius: 6px; border: 1px solid transparent;
  padding: 8px 14px; font-size: 14px; transition: all .15s; }
button.primary { background: #3b82f6; color: #fff; }
button.primary:hover { background: #2563eb; }
button.ghost { background: transparent; color: #cbd5e1; border-color: #334155; }
button.ghost:hover { background: #1e293b; }
button.danger { background: #ef4444; color: #fff; }
button.success { background: #10b981; color: #fff; }
.badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.active { background: #064e3b; color: #6ee7b7; }
.badge.disabled { background: #7f1d1d; color: #fca5a5; }
.badge.warn { background: #78350f; color: #fbbf24; }
/* 授权表行高亮：已过期 / 即将到期 */
.grid tbody tr.expired { background: rgba(239,68,68,.08); }
.grid tbody tr.warn    { background: rgba(245,158,11,.06); }
button.danger:hover { background: #dc2626; }
button.success:hover { background: #059669; }
input, select { width: 100%; padding: 8px 10px; border: 1px solid #334155; background: #0b1220;
  color: #e2e8f0; border-radius: 6px; font-size: 14px; }
input:focus, select:focus { outline: none; border-color: #3b82f6; }

/* 登录 */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; }
.card { background: #1e293b; padding: 32px 36px; border-radius: 12px; width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.card h1 { margin: 0 0 18px; font-size: 20px; color: #f1f5f9; text-align: center; }
.card label { display: block; font-size: 12px; color: #94a3b8; margin: 12px 0 4px; }
.card button { width: 100%; margin-top: 18px; padding: 10px; }
.error { color: #f87171; font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }

/* 主布局 */
.app { display: flex; height: 100vh; }
.sidebar { width: 220px; background: #0b1220; border-right: 1px solid #1e293b;
  display: flex; flex-direction: column; padding: 18px 0; }
.brand { display: flex; align-items: center; padding: 0 18px 18px; gap: 10px;
  border-bottom: 1px solid #1e293b; }
.logo { font-size: 26px; }
.brand .title { font-weight: 600; }
.brand .subtitle { font-size: 12px; color: #64748b; }
.sidebar nav { flex: 1; padding: 14px 8px; display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a { padding: 10px 14px; border-radius: 6px; color: #94a3b8; text-decoration: none;
  cursor: pointer; font-size: 14px; }
.sidebar nav a:hover { background: #1e293b; color: #e2e8f0; }
.sidebar nav a.active { background: #1d4ed8; color: #fff; }
.logout { margin: 12px 18px; }

main { flex: 1; overflow: auto; padding: 24px 32px; }
main h2 { margin: 0 0 18px; font-size: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 8px; }
.section-head > div { display: flex; gap: 8px; align-items: center; }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat-card { background: #1e293b; border-radius: 10px; padding: 18px; border: 1px solid #334155; }
.stat-card .label { font-size: 12px; color: #94a3b8; margin-bottom: 6px; }
.stat-card .value { font-size: 28px; font-weight: 600; color: #f1f5f9; }
.stat-card .sub { font-size: 12px; color: #64748b; margin-top: 4px; }

/* 表格 */
table.grid, table.tree { width: 100%; border-collapse: collapse; background: #1e293b;
  border-radius: 8px; overflow: hidden; }
table th, table td { padding: 10px 12px; text-align: left; font-size: 13px; border-bottom: 1px solid #334155; }
table th { background: #0b1220; color: #94a3b8; font-weight: 500; }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #0f172a; }
.tree-wrap { background: #1e293b; border-radius: 8px; padding: 4px; }

.badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.active { background: #064e3b; color: #6ee7b7; }
.badge.disabled { background: #7f1d1d; color: #fca5a5; }
.badge.l0 { background: #1e3a8a; color: #bfdbfe; }
.badge.l1 { background: #4c1d95; color: #ddd6fe; }
.badge.l2 { background: #134e4a; color: #99f6e4; }

.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.row-actions button { padding: 4px 8px; font-size: 12px; }

.tree-toggle { display: inline-block; width: 18px; cursor: pointer; color: #64748b; user-select: none; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 99; }
.modal-card { background: #1e293b; padding: 24px; border-radius: 10px; width: 420px; }
.modal-card h3 { margin: 0 0 14px; }
.modal-card label { display: block; font-size: 12px; color: #94a3b8; margin: 10px 0 4px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* 单选按钮组 */
.radio-group { display: flex; gap: 8px; }
.radio-pill { flex: 1; cursor: pointer; }
.radio-pill input { display: none; }
.radio-pill span { display: block; text-align: center; padding: 10px;
  background: #0b1220; border: 1px solid #334155; border-radius: 6px;
  color: #94a3b8; font-size: 14px; transition: all .15s; }
.radio-pill input:checked + span { background: #1d4ed8; color: #fff; border-color: #3b82f6; }
.radio-pill:hover span { border-color: #475569; }

/* 表单提示 */
.hint { font-size: 12px; color: #64748b; margin-top: 4px; }
.hint.warn { color: #f59e0b; }
.hint.error { color: #f87171; }

/* 语言切换器 */
.lang-row { display: inline-flex; background: #0b1220; border: 1px solid #334155;
  border-radius: 6px; padding: 2px; gap: 2px; }
.lang-row-side { margin: 8px 18px 4px; }
.lang-row .lang-btn { background: transparent; color: #94a3b8; border: none;
  padding: 4px 10px; font-size: 12px; border-radius: 4px; cursor: pointer;
  min-width: 32px; }
.lang-row .lang-btn:hover { color: #e2e8f0; }
.lang-row .lang-btn.active { background: #1d4ed8; color: #fff; }
.card .lang-row { margin: 0 auto 14px; display: flex; justify-content: center; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #f1f5f9; padding: 10px 18px; border-radius: 6px; border: 1px solid #334155;
  display: none; z-index: 100; }
.toast.show { display: block; }
.toast.error { border-color: #ef4444; }
.toast.success { border-color: #10b981; }
