:root {
  --navy: #243b7a;
  --navy-dark: #17295b;
  --blue-soft: #eef3fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #58657a;
  --line: #d9e1ef;
  --danger: #a62929;
  --success: #17643a;
  --warning: #725200;
  --shadow: 0 10px 30px rgba(24, 43, 91, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--blue-soft); }
body { margin: 0; min-height: 100vh; background: var(--blue-soft); color: var(--text); font-size: 17px; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .58; }
[hidden] { display: none !important; }
.network-banner, .update-banner { position: sticky; top: 0; z-index: 50; padding: 10px 16px; text-align: center; font-weight: 700; }
.network-banner { background: #fff0cf; color: #5e4300; }
.update-banner { background: #dce8ff; color: var(--navy-dark); display: flex; justify-content: center; gap: 12px; align-items: center; }
.app-header { min-height: 86px; background: linear-gradient(135deg, var(--navy-dark), var(--navy)); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px clamp(16px, 4vw, 40px); box-shadow: var(--shadow); }
.brand-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { width: 58px; height: 58px; object-fit: contain; border-radius: 14px; background: #fff; padding: 4px; flex: 0 0 auto; }
.brand-name { font-weight: 800; font-size: clamp(18px, 3vw, 24px); line-height: 1.15; }
.brand-slogan { color: #f1f5ff; font-size: 14px; margin-top: 3px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.app-main { width: min(1120px, 100%); margin: 0 auto; padding: 24px clamp(14px, 3vw, 28px) 90px; }
.center-card, .auth-card, .content-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.center-card, .auth-card { width: min(520px, 100%); margin: 36px auto; padding: clamp(22px, 5vw, 36px); text-align: center; }
.auth-card form { display: grid; gap: 10px; text-align: left; margin-top: 22px; }
.auth-card label { font-weight: 700; }
input, select { width: 100%; min-height: 50px; border: 1px solid #b9c5d8; border-radius: 12px; padding: 10px 12px; background: #fff; color: var(--text); }
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(59, 99, 185, .25); outline-offset: 2px; border-color: var(--navy); }
.primary-button, .ghost-button, .small-button, .tab-button { border: 0; border-radius: 12px; min-height: 44px; font-weight: 800; padding: 10px 16px; }
.primary-button { background: var(--navy); color: #fff; min-height: 52px; }
.primary-button:hover { background: var(--navy-dark); }
.ghost-button { color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); }
.small-button { background: #e7eefc; color: var(--navy-dark); }
.link-button { display: inline-flex; text-decoration: none; align-items: center; justify-content: center; }
.muted { color: var(--muted); }
.microcopy { color: var(--muted); font-size: 13px; }
.form-message { border-radius: 12px; padding: 12px; margin-top: 14px; text-align: left; }
.form-message.error { background: #fff0f0; color: var(--danger); border: 1px solid #f1c4c4; }
.info-box { background: #f4f7ff; border: 1px solid #cbd8f2; border-radius: 12px; padding: 12px; text-align: left; overflow-wrap: anywhere; }
.recovery-codes { white-space: pre-wrap; text-align: left; background: #f7f9fc; border: 1px solid var(--line); padding: 14px; border-radius: 12px; overflow-wrap: anywhere; }
.top-tabs { display: flex; gap: 8px; position: sticky; top: 0; z-index: 30; padding: 10px; background: rgba(238,243,251,.95); backdrop-filter: blur(8px); border-radius: 15px; margin-bottom: 18px; }
.tab-button { background: #fff; color: var(--navy); flex: 1; border: 1px solid var(--line); }
.tab-button.active { background: var(--navy); color: #fff; }
.panel-view { animation: fade .16s ease-out; }
@keyframes fade { from { opacity: .7; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(24px, 5vw, 34px); line-height: 1.2; }
h2 { font-size: 21px; }
.inline-status { min-height: 24px; color: var(--muted); margin-bottom: 10px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 6px 18px rgba(24,43,91,.06); }
.kpi-label { font-weight: 700; color: var(--muted); }
.kpi-value { font-size: 30px; font-weight: 900; color: var(--navy-dark); margin-top: 4px; }
.content-card { padding: 18px; margin-bottom: 16px; }
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr auto; gap: 10px; align-items: center; }
.bar-track { height: 12px; background: #e8edf6; border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--navy); border-radius: inherit; }
.filter-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.filter-grid label { font-weight: 700; }
.filter-grid select { margin-top: 6px; }
.profile-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.profile-field { padding: 12px; background: #f7f9fc; border-radius: 12px; }
.profile-label { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.profile-value { display: block; font-weight: 800; margin-top: 3px; overflow-wrap: anywhere; }
.people-list { display: grid; gap: 10px; margin-top: 14px; }
.person-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.person-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.person-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.person-actions a { text-decoration: none; color: var(--navy); background: #eef3fb; padding: 8px 12px; border-radius: 10px; font-weight: 800; }
.empty-state { color: var(--muted); text-align: center; padding: 30px; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; width: min(520px, calc(100% - 28px)); background: #172033; color: #fff; border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow); text-align: center; font-weight: 700; }
.spinner { width: 38px; height: 38px; margin: 0 auto 16px; border: 4px solid #dbe3f1; border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.offline-page { display: grid; place-items: center; padding: 20px; }
.offline-card { width: min(520px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 32px; text-align: center; }
.offline-logo { width: 90px; height: 90px; object-fit: contain; margin-bottom: 12px; }
@media (max-width: 720px) {
  body { font-size: 16px; }
  .app-header { align-items: flex-start; }
  .brand-logo { width: 50px; height: 50px; }
  .brand-slogan { font-size: 13px; }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-grid, .profile-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; }
  .section-heading { align-items: flex-start; }
}
@media (max-width: 480px) {
  .app-header { display: block; }
  .header-actions { margin-top: 10px; justify-content: flex-start; }
  .app-main { padding-top: 14px; }
  .top-tabs { gap: 5px; }
  .tab-button { font-size: 14px; padding: 9px 8px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 26px; }
}
