:root {
  --bg: #f4f6fb; --card: #fff; --ink: #1f2937; --muted: #6b7280;
  --brand: #2563eb; --brand2: #1d4ed8; --ok: #16a34a; --warn: #d97706;
  --danger: #dc2626; --line: #e5e7eb;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }

.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 14px 24px; background: linear-gradient(135deg, #1d4ed8, #2563eb); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; }
.topbar h1 { margin: 0; font-size: 19px; }
.sub { margin: 2px 0 0; font-size: 12px; opacity: .85; }
.controls { display: flex; gap: 12px; align-items: center; }
.userbox { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.16); padding: 7px 14px; border-radius: 10px; }
.avatar { font-size: 22px; }
.userinfo { display: flex; flex-direction: column; line-height: 1.15; }
.uname { font-size: 14px; font-weight: 700; }
.urole { font-size: 10.5px; opacity: .85; text-transform: uppercase; letter-spacing: .6px; }
.bell { position: relative; background: rgba(255,255,255,.18); border: none; color: #fff; font-size: 18px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; border-radius: 50%; padding: 2px 5px; }
.notif-panel { position: fixed; top: 70px; right: 24px; width: 340px; max-height: 70vh; overflow-y: auto; background: #fff; border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.2); z-index: 50; padding: 12px; }
.notif-item { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.notif-item:last-child { border-bottom: none; }
.notif-item small { color: var(--muted); display: block; margin-top: 4px; }
.notif-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 16px; }

main { padding: 18px 24px; max-width: 1280px; margin: 0 auto; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--card); border-radius: 12px; padding: 16px; border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.stat-label { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { display: block; font-size: 28px; font-weight: 700; margin: 5px 0 2px; }
.stat-sub { font-size: 12px; color: var(--muted); }

.panel { background: var(--card); border-radius: 14px; padding: 20px; border: 1px solid var(--line); margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.panel h2 { margin: 0; font-size: 17px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { background: #fafbfe; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.hidden { display: none !important; }
.hint { color: var(--muted); font-size: 13px; min-height: 18px; }

.btn { background: var(--brand); color: #fff; border: none; padding: 10px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 13.5px; }
.btn:hover { background: var(--brand2); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost { background: rgba(255,255,255,.18); }
.btn.ghost:hover { background: rgba(255,255,255,.32); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warn); }
.btn.ok { background: var(--ok); }
.btn.outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f1f5f9; color: #475569; font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; }
tr:hover td { background: #f8fafc; }

.badge { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #b91c1c; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.gray { background: #f1f5f9; color: #475569; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-label { width: 190px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { flex: 1; height: 14px; background: #eef2f7; border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 7px; }
.bar-fill.alt { background: #10b981; }
.bar-val { width: 60px; font-size: 12px; font-weight: 600; text-align: right; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 13.5px; background: #f8fafc; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-card { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto; }
.modal-card h3 { margin: 0 0 16px; }

.countdown { display: inline-flex; align-items: baseline; gap: 8px; }
.countdown .cd-num { font-size: 26px; font-weight: 800; color: var(--brand); }
.countdown .cd-label { font-size: 11px; color: var(--muted); text-transform: uppercase; }

.empty { color: var(--muted); text-align: center; padding: 24px; font-size: 13.5px; }

@media (max-width: 640px) { .bar-label { width: 110px; } .topbar { flex-direction: column; align-items: flex-start; } }
