:root {
  --blue: #0b4db8;
  --blue-dark: #143568;
  --cyan: #0ea5b7;
  --orange: #f28c28;
  --red: #dc3948;
  --green: #16845b;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e1ec;
  --soft: #f3f6fa;
  --white: #ffffff;
  --sidebar: 244px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--soft); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(360px, .85fr);
  background: var(--white);
}
.login-brand {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 24px;
  padding: 64px;
  color: white;
  overflow: hidden;
  background: var(--blue-dark) url('assets/training.jpg') center/cover no-repeat;
}
.login-brand::before { content: ""; position: absolute; inset: 0; background: rgba(8, 41, 91, .72); }
.login-brand::after { content: ""; position: absolute; right: -70px; bottom: 80px; width: 330px; height: 70px; border: 12px solid rgba(255,255,255,.18); border-radius: 50%; transform: rotate(-18deg); }
.login-brand img { position: relative; z-index: 1; width: 98px; height: 98px; object-fit: cover; background: white; border: 6px solid white; border-radius: 6px; }
.login-brand div { position: relative; z-index: 1; display: grid; gap: 9px; }
.login-brand strong { font-size: clamp(30px, 4vw, 58px); line-height: 1.05; }
.login-brand span { font-size: 16px; opacity: .88; }
.login-panel { align-self: center; width: min(430px, calc(100% - 64px)); margin: auto; }
.eyebrow { margin: 0 0 10px; color: var(--cyan); font-size: 12px; font-weight: 800; }
.login-panel h1 { margin: 0; font-size: 34px; color: var(--blue-dark); }
.login-copy { margin: 16px 0 32px; color: var(--muted); line-height: 1.7; }
label { display: grid; gap: 8px; color: #344054; font-size: 13px; font-weight: 650; }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 10px 12px; color: var(--ink); background: white;
  border: 1px solid #cbd5e1; border-radius: 5px; outline: none;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(14,165,183,.12); }
.login-panel label + label { margin-top: 18px; }
.primary, .secondary, .danger, .quiet {
  min-height: 40px; padding: 0 16px; border-radius: 5px; border: 1px solid transparent; font-weight: 750;
}
.primary { color: white; background: var(--blue); }
.primary:hover { background: #083e96; }
.secondary { color: var(--blue); background: #edf4ff; border-color: #bdd3f5; }
.danger { color: #a81828; background: #fff1f2; border-color: #fecdd3; }
.quiet { color: #344054; background: white; border-color: var(--line); }
.wide { width: 100%; margin-top: 24px; }
.form-error { min-height: 20px; color: var(--red); font-size: 13px; }
.demo-note { color: var(--muted); font-size: 12px; text-align: center; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; color: #dfeaff; background: #123667; }
.brand-lockup { display: flex; align-items: center; gap: 11px; height: 78px; padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-lockup img { width: 45px; height: 45px; object-fit: cover; border-radius: 4px; background: white; }
.brand-lockup div { min-width: 0; display: grid; gap: 3px; }
.brand-lockup strong { color: white; font-size: 15px; white-space: nowrap; }
.brand-lockup span { color: #9eb6d8; font-size: 11px; }
#mainNav { flex: 1; padding: 18px 10px; overflow-y: auto; }
.nav-button { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 12px; margin-bottom: 4px; color: #c8d7ed; background: transparent; border: 0; border-left: 3px solid transparent; border-radius: 4px; text-align: left; }
.nav-button span:first-child { width: 23px; color: #79d8e4; font-size: 12px; font-weight: 900; }
.nav-button:hover { color: white; background: rgba(255,255,255,.07); }
.nav-button.active { color: white; background: rgba(14,165,183,.16); border-left-color: #22d3ee; }
.sidebar-foot { padding: 16px 18px 20px; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 4px; }
.sidebar-foot span { color: #9eb6d8; font-size: 11px; }
.sidebar-foot strong { color: white; font-size: 14px; }
.text-button { width: max-content; padding: 6px 0; color: #79d8e4; background: transparent; border: 0; font-size: 12px; }

.main-area { min-width: 0; }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 30px; background: white; border-bottom: 1px solid var(--line); }
.breadcrumb { margin: 0 0 4px; color: var(--muted); font-size: 11px; }
.topbar h2 { margin: 0; color: var(--blue-dark); font-size: 21px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.venue-switch { display: flex; align-items: center; grid-auto-flow: column; gap: 10px; white-space: nowrap; }
.venue-switch select { min-width: 150px; min-height: 36px; padding: 7px 28px 7px 10px; }
.system-status { display: flex; align-items: center; gap: 7px; color: var(--green); font-size: 12px; font-weight: 700; }
.system-status i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px #dcfce7; }
.mobile-menu { display: none; width: 38px; height: 38px; color: var(--blue-dark); background: white; border: 1px solid var(--line); border-radius: 5px; }
.content { padding: 24px 30px 50px; }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.view-head h3 { margin: 0 0 5px; font-size: 19px; }
.view-head p { margin: 0; color: var(--muted); font-size: 13px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.metrics { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric { min-height: 110px; padding: 16px; background: white; border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: 6px; }
.metric:nth-child(2n) { border-top-color: var(--cyan); }
.metric:nth-child(3n) { border-top-color: var(--orange); }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 14px; color: var(--blue-dark); font-size: 30px; line-height: 1; }
.metric small { display: block; margin-top: 9px; color: #98a2b3; font-size: 11px; }

.band { margin-top: 18px; padding: 18px 0 0; border-top: 1px solid var(--line); }
.band-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.band-title h3 { margin: 0; font-size: 16px; }
.table-wrap { width: 100%; overflow: auto; background: white; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 12px; color: #475467; background: #f8fafc; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #edf1f6; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbfe; }
.cell-main { display: grid; gap: 4px; min-width: 110px; }
.cell-main strong { font-size: 13px; }
.cell-main span { color: var(--muted); font-size: 11px; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; color: #344054; background: #eef2f6; border-radius: 999px; white-space: nowrap; font-size: 11px; font-weight: 700; }
.tag.blue { color: #0b4db8; background: #eaf2ff; }
.tag.green { color: #087451; background: #e8f8f1; }
.tag.orange { color: #a14d00; background: #fff1dc; }
.tag.red { color: #b42334; background: #ffeaed; }
.tag.cyan { color: #08717c; background: #e3f8fa; }
.table-actions { display: flex; gap: 6px; min-width: max-content; }
.mini-button { min-height: 30px; padding: 0 9px; color: var(--blue); background: white; border: 1px solid #bdd3f5; border-radius: 4px; font-size: 11px; font-weight: 700; }
.mini-button.warn { color: #a14d00; border-color: #f6c681; }
.mini-button.danger { color: #b42334; border-color: #f2b8bf; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-button { min-height: 32px; padding: 0 11px; color: #475467; background: white; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
.filter-button.active { color: white; background: var(--blue); border-color: var(--blue); }
.empty { padding: 56px 20px; color: var(--muted); text-align: center; }
.loading { padding: 70px 20px; color: var(--muted); text-align: center; }

dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 7px; box-shadow: 0 24px 80px rgba(16,32,60,.28); }
dialog::backdrop { background: rgba(16, 32, 60, .54); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 15px; border-bottom: 1px solid var(--line); }
.dialog-head h3 { margin: 0; color: var(--blue-dark); font-size: 19px; }
.icon-button { width: 36px; height: 36px; color: var(--muted); background: white; border: 1px solid var(--line); border-radius: 4px; font-size: 24px; line-height: 1; }
.entity-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 22px; overflow-y: auto; }
.entity-form .full { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; padding-top: 5px; }
.check-label { display: flex; align-items: center; grid-auto-flow: column; justify-content: start; gap: 9px; }
.check-label input { width: 18px; min-height: 18px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 360px; padding: 13px 16px; color: white; background: #173a70; border-radius: 5px; box-shadow: 0 12px 35px rgba(16,32,60,.25); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b42334; }

@media (max-width: 1180px) { .metrics { grid-template-columns: repeat(3, minmax(140px, 1fr)); } }
@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { min-height: 220px; padding: 30px; align-items: center; }
  .login-brand img { width: 70px; height: 70px; }
  .login-panel { padding: 44px 0; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: calc(-1 * var(--sidebar)); z-index: 15; width: var(--sidebar); transition: left .2s ease; }
  .sidebar.open { left: 0; box-shadow: 16px 0 50px rgba(16,32,60,.25); }
  .mobile-menu { display: inline-grid; place-items: center; }
  .topbar { height: auto; min-height: 72px; padding: 12px 16px; }
  .system-status { display: none; }
  .venue-switch { align-items: start; gap: 4px; }
  .venue-switch select { min-width: 125px; }
  .content { padding: 18px 14px 40px; }
  .metrics { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .view-head { align-items: start; }
  .entity-form { grid-template-columns: 1fr; }
  .entity-form .full, .form-actions { grid-column: 1; }
}
@media (max-width: 520px) {
  .login-brand { min-height: 180px; padding: 24px; }
  .login-brand span { display: none; }
  .login-panel { width: calc(100% - 40px); }
  .login-panel h1 { font-size: 27px; }
  .topbar h2 { font-size: 18px; }
  .breadcrumb { display: none; }
  .view-head { display: grid; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { min-height: 96px; padding: 13px; }
  .metric strong { font-size: 25px; }
  .topbar-actions { gap: 6px; }
}
