* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f4f6f9; color: #2c3e50; }
a { color: #2c7be5; text-decoration: none; }
button { font-family: inherit; }
.btn { display: inline-block; padding: 6px 14px; border: 1px solid #2c7be5; background: #2c7be5; color: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn:hover { background: #1a68d1; }
.btn.secondary { background: #fff; color: #2c7be5; }
.btn.danger { background: #e74c3c; border-color: #e74c3c; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.input, select, input[type=text], input[type=number], input[type=date], input[type=password] { padding: 6px 8px; border: 1px solid #ccd4e0; border-radius: 4px; font-size: 13px; width: 100%; }
label { font-size: 12px; color: #5a6b7b; display: block; margin-bottom: 3px; }

/* layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #1f2d3d; color: #cfd8e3; flex-shrink: 0; }
.sidebar h1 { font-size: 16px; padding: 18px 16px; margin: 0; color: #fff; border-bottom: 1px solid #2c3e50; }
.nav a { display: block; padding: 11px 16px; color: #cfd8e3; font-size: 13px; border-left: 3px solid transparent; }
.nav a:hover { background: #28384a; }
.nav a.active { background: #2c7be5; color: #fff; border-left-color: #fff; }
.main { flex: 1; padding: 20px 26px; overflow: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.topbar h2 { margin: 0; font-size: 20px; }

/* login */
.login-wrap { max-width: 360px; margin: 12vh auto; background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.login-wrap h2 { margin-top: 0; text-align: center; }

/* cards / tables */
.card { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.05); margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.grid.cols4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols3 { grid-template-columns: repeat(3, 1fr); }
.stat { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.stat .num { font-size: 26px; font-weight: 600; color: #2c7be5; }
.stat .lbl { font-size: 12px; color: #5a6b7b; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #eef1f5; text-align: left; }
th { background: #f8fafc; color: #5a6b7b; font-weight: 600; }
tr:hover td { background: #fafcff; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; }
.tag.ok { background: #e3f5e9; color: #1c8a48; }
.tag.warn { background: #fdeede; color: #c47d12; }
.tag.bad { background: #fdeaea; color: #d23b3b; }
.tag.info { background: #e6f0fb; color: #2c7be5; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row .field { flex: 1; min-width: 120px; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 8px; padding: 22px; width: 520px; max-width: 92vw; max-height: 88vh; overflow: auto; }
.modal h3 { margin-top: 0; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tabs button { border: 1px solid #ccd4e0; background: #fff; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.tabs button.active { background: #2c7be5; color: #fff; border-color: #2c7be5; }
.muted { color: #8a97a6; font-size: 12px; }
.toast { position: fixed; top: 16px; right: 16px; background: #323a45; color: #fff; padding: 10px 16px; border-radius: 6px; z-index: 99; font-size: 13px; }
.toast.err { background: #e74c3c; }
.toast.ok { background: #27ae60; }
.err-text { color: #e74c3c; font-size: 12px; }
.empty { text-align: center; color: #8a97a6; padding: 30px; }
