* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #185FA5;
  --primary-dark: #0C447C;
  --primary-light: #E6F1FB;
  --success: #0F6E56;
  --success-light: #E1F5EE;
  --warning: #BA7517;
  --warning-light: #FAEEDA;
  --danger: #A32D2D;
  --danger-light: #FCEBEB;
  --text: #2C2C2A;
  --text-muted: #5F5E5A;
  --border: #E3E1DA;
  --bg: #F6F5F1;
  --card: #FFFFFF;
  --sidebar-bg: #1B2A3A;
  --sidebar-text: #C9D4E0;
}
body { font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }

/* ===== 登录页 ===== */
.login-wrap, .license-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0C447C 0%, #185FA5 60%, #378ADD 100%); }
.login-box, .license-box { background: #fff; border-radius: 16px; padding: 40px 36px; width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,.25); text-align: center; }
.login-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--primary); color: #fff; font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.login-box h1 { font-size: 22px; font-weight: 600; }
.login-sub { color: var(--text-muted); font-size: 12px; margin: 6px 0 24px; letter-spacing: 1px; }
.login-form input, .license-form input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; margin-bottom: 12px; outline: none; }
.login-form input:focus, .license-form input:focus { border-color: var(--primary); }
.login-msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-demo-tip { margin-top: 18px; font-size: 12px; color: var(--text-muted); background: var(--bg); border-radius: 6px; padding: 8px; }

/* ===== 授权页 ===== */
.license-box { width: 440px; }
.license-box h2 { font-size: 20px; margin-bottom: 12px; }
.license-status-line { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }
.license-tip { margin-top: 16px; font-size: 12px; color: var(--text-muted); }
.license-tip code { background: var(--warning-light); color: var(--warning); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* ===== 布局 ===== */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 210px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; }
.sidebar-brand { padding: 20px 20px; font-size: 17px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: #5DCAA5; display: inline-block; }
.nav { flex: 1; padding: 8px 12px; }
.nav-item { display: block; padding: 11px 14px; border-radius: 8px; color: var(--sidebar-text); text-decoration: none; font-size: 14px; margin-bottom: 4px; cursor: pointer; transition: background .15s; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item.nav-link { opacity: .85; }
.nav-item.nav-link:hover { opacity: 1; text-decoration: none; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.license-badge { font-size: 12px; background: rgba(255,255,255,.1); border-radius: 6px; padding: 8px 10px; text-align: center; }
.license-badge.warn { background: rgba(229,150,60,.25); color: #FAC775; }

.content { margin-left: 210px; padding: 20px 28px 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.topbar h2 { font-size: 20px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { background: var(--primary-light); color: var(--primary-dark); padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; }
.online-users { font-size: 13px; color: var(--text-muted); }

/* ===== 卡片 ===== */
.card { background: var(--card); border-radius: 12px; padding: 20px; margin-bottom: 18px; border: 1px solid var(--border); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-weight: 500; font-size: 15px; }

/* ===== 统计卡片 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.stat-label { color: var(--text-muted); font-size: 13px; }
.stat-value { font-size: 30px; font-weight: 600; margin: 6px 0 2px; color: var(--primary-dark); }
.stat-value.danger { color: var(--danger); }
.stat-sub { color: var(--text-muted); font-size: 12px; }

/* ===== 图表 ===== */
.chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding: 10px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bar { width: 60%; min-height: 4px; background: var(--primary); border-radius: 6px 6px 0 0; transition: height .3s; }
.chart-bar.today { background: var(--success); }
.chart-label { margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.chart-val { font-size: 12px; font-weight: 500; color: var(--primary-dark); margin-bottom: 4px; }

/* ===== 打印机网格 ===== */
.printer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.printer-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; position: relative; }
.printer-card .p-name { font-weight: 500; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.p-status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.p-status-dot.online { background: var(--success); }
.p-status-dot.offline { background: #B4B2A9; }
.p-status-dot.error, .p-status-dot.paused { background: var(--danger); }
.p-status-dot.busy { background: var(--warning); }
.printer-card .p-meta { color: var(--text-muted); font-size: 12px; margin-top: 8px; line-height: 1.7; }
.printer-card .p-badge { position: absolute; top: 12px; right: 12px; font-size: 11px; padding: 3px 8px; border-radius: 10px; }
.pb-online { background: var(--success-light); color: var(--success); }
.pb-offline { background: var(--bg); color: var(--text-muted); }
.pb-error, .pb-paused { background: var(--danger-light); color: var(--danger); }
.pb-busy { background: var(--warning-light); color: var(--warning); }

/* ===== 表格 ===== */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px 12px; font-size: 12px; color: var(--text-muted); font-weight: 500; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #FAFAF8; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; }
.tag-green { background: var(--success-light); color: var(--success); }
.tag-red { background: var(--danger-light); color: var(--danger); }
.tag-gray { background: var(--bg); color: var(--text-muted); }
.tag-blue { background: var(--primary-light); color: var(--primary-dark); }
.tag-amber { background: var(--warning-light); color: var(--warning); }

/* ===== 按钮 ===== */
.btn { border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 4px; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #854F0B; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #791F1F; }
.btn-danger-ghost { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-light); }

/* ===== 表单 ===== */
.filter-bar { display: flex; gap: 8px; }
.input-sm { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; }
.input-sm:focus { border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; font-size: 13px; color: var(--text-muted); gap: 6px; }
.form-grid input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; }
.form-grid input:focus { border-color: var(--primary); }

/* ===== 弹窗 ===== */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; border-radius: 14px; padding: 28px; width: 520px; }
.modal-box h3 { margin-bottom: 18px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ===== 分页 ===== */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--text-muted); }

/* ===== 提示 ===== */
.tip-box { background: var(--primary-light); border: 1px solid #B5D4F4; color: var(--primary-dark); border-radius: 8px; padding: 12px 14px; font-size: 13px; margin-bottom: 16px; line-height: 1.7; }

/* ===== 授权详情 ===== */
.license-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.license-item { background: var(--bg); border-radius: 8px; padding: 14px 16px; }
.license-item .k { font-size: 12px; color: var(--text-muted); }
.license-item .v { font-size: 18px; font-weight: 600; margin-top: 4px; }
.license-item .v.expired { color: var(--danger); }

/* 配额条 */
.quota-bar { width: 100px; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.quota-bar-fill { height: 100%; background: var(--success); border-radius: 4px; }
.quota-bar-fill.warn { background: var(--warning); }
.quota-bar-fill.over { background: var(--danger); }
