:root {
  --ink: #17223b;
  --ink-soft: #42506a;
  --navy: #17223b;
  --navy-2: #23345a;
  --paper: #f5f7fb;
  --card: #ffffff;
  --line: #dfe5ef;
  --accent: #e5a53a;
  --accent-soft: #fff4df;
  --green: #26735b;
  --green-soft: #e8f5ef;
  --red: #ad3d4b;
  --red-soft: #fdecef;
  --blue: #2f65a7;
  --blue-soft: #eaf2ff;
  --shadow: 0 18px 45px rgba(23, 34, 59, .11);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.stack { display: flex; flex-direction: column; }
.form-gap { gap: 16px; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 520px) 1fr; background: var(--card); }
.login-card { padding: clamp(36px, 7vw, 96px); display: flex; flex-direction: column; justify-content: center; }
.login-card h1 { margin: 0; font-size: clamp(42px, 7vw, 72px); letter-spacing: -.05em; }
.login-card .muted { max-width: 520px; line-height: 1.7; }
.login-card form { margin-top: 32px; max-width: 420px; }
.demo-note { font-size: 12px; color: var(--ink-soft); }
.brand-mark { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 22px; background: var(--navy); color: #fff; font-weight: 900; letter-spacing: -.04em; box-shadow: var(--shadow); margin-bottom: 28px; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; margin: 0; font-size: 13px; box-shadow: none; background: #fff; color: var(--navy); }
.login-art { position: relative; overflow: hidden; background: linear-gradient(145deg, #17223b, #2b426f); display: grid; place-items: center; padding: 60px; }
.hero-panel { position: relative; z-index: 2; width: min(560px, 90%); padding: 30px; border: 1px solid rgba(255,255,255,.18); border-radius: 30px; background: rgba(255,255,255,.10); backdrop-filter: blur(18px); box-shadow: 0 30px 80px rgba(0,0,0,.24); }
.hero-row { color: #fff; display: flex; align-items: center; gap: 18px; padding: 18px 12px; border-bottom: 1px solid rgba(255,255,255,.14); }
.hero-row:last-child { border-bottom: 0; }
.hero-row > span { font-size: 30px; }
.hero-row div { display: flex; flex-direction: column; gap: 4px; }
.hero-row small { color: rgba(255,255,255,.7); }
.hero-orb { position: absolute; border-radius: 999px; filter: blur(2px); opacity: .85; }
.orb-one { width: 390px; height: 390px; background: radial-gradient(circle at 30% 30%, #f1bd5c, #d98029); top: -150px; right: -90px; }
.orb-two { width: 300px; height: 300px; background: radial-gradient(circle at 30% 30%, #5ab7a6, #26735b); bottom: -110px; left: -80px; }

label { display: flex; flex-direction: column; gap: 7px; font-weight: 700; font-size: 13px; color: var(--ink-soft); }
input, select, textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); outline: none; transition: .15s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 101, 167, .12); }
input[type="checkbox"] { width: 19px; height: 19px; padding: 0; }
.checkbox-row { flex-direction: row; align-items: center; gap: 10px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.button { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 800; transition: transform .15s ease, opacity .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.primary { background: var(--navy); color: #fff; }
.button.secondary { background: var(--accent-soft); color: #8a5b0d; }
.button.outline { background: #fff; color: var(--navy); border: 1px solid #cdd6e5; }
.button.outline:hover { background: #f2f5fa; }
.button.success { background: var(--green-soft); color: var(--green); }
.button.danger { background: var(--red-soft); color: var(--red); }
.button.ghost { background: rgba(255,255,255,.08); color: #fff; }
.login-card .button.ghost { background: #eef2f7; color: var(--navy); }
.button.small { padding: 8px 11px; font-size: 12px; }
.icon-button { border: 0; background: transparent; font-size: 24px; color: inherit; padding: 8px; border-radius: 10px; }
.icon-button:hover { background: rgba(127,127,127,.1); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--navy); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; z-index: 10; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; font-weight: 900; }
.nav-list { display: flex; flex-direction: column; gap: 7px; }
.nav-item { border: 0; background: transparent; color: rgba(255,255,255,.72); padding: 12px 14px; text-align: left; border-radius: 12px; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.11); color: #fff; }
.nav-item span { width: 22px; text-align: center; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; }
.workspace { min-width: 0; }
.topbar { min-height: 92px; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(245,247,251,.91); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 8; }
.topbar h2 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.topbar-actions { display: flex; align-items: end; gap: 12px; }
.child-picker-label { min-width: 180px; }
.content { padding: 28px; max-width: 1480px; margin: 0 auto; }
.mobile-only { display: none; }

.grid { display: grid; gap: 18px; }
.grid.cards-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.cards-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 5px 20px rgba(23,34,59,.04); }
.card h3 { margin: 0 0 16px; font-size: 17px; }
.metric { display: flex; flex-direction: column; gap: 8px; }
.metric .value { font-size: 30px; font-weight: 900; letter-spacing: -.04em; }
.metric .caption { color: var(--ink-soft); font-size: 13px; }
.metric-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--blue-soft); font-size: 21px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 30px 0 14px; }
.section-head:first-child { margin-top: 0; }
.section-head h3 { margin: 0; font-size: 20px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.child-card { position: relative; overflow: hidden; }
.child-card::after { content: ""; position: absolute; width: 100px; height: 100px; border-radius: 50%; background: var(--accent-soft); right: -35px; top: -35px; }
.child-head { display: flex; align-items: center; gap: 13px; position: relative; z-index: 1; }
.avatar { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: var(--blue-soft); font-size: 25px; }
.child-head h3 { margin: 0 0 3px; }
.child-head p { margin: 0; font-size: 12px; color: var(--ink-soft); }
.child-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 20px; }
.child-stat { padding: 11px; border-radius: 12px; background: var(--paper); }
.child-stat strong { display: block; font-size: 17px; }
.child-stat small { color: var(--ink-soft); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.status.good { color: var(--green); background: var(--green-soft); }
.status.warn { color: #945e06; background: var(--accent-soft); }
.status.bad { color: var(--red); background: var(--red-soft); }

.progress { height: 9px; background: #e9edf4; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--navy-2); border-radius: inherit; min-width: 2px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-main strong { display: block; }
.row-main small { color: var(--ink-soft); }
.badge { padding: 5px 8px; border-radius: 9px; background: var(--paper); color: var(--ink-soft); font-size: 11px; font-weight: 900; }
.badge.points { background: var(--accent-soft); color: #87580a; }
.badge.allow { background: var(--green-soft); color: var(--green); }
.badge.block { background: var(--red-soft); color: var(--red); }
.badge.limit { background: var(--blue-soft); color: var(--blue); }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.range-button { border: 1px solid var(--line); background: #fff; color: var(--ink-soft); border-radius: 10px; padding: 8px 11px; font-weight: 800; }
.range-button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.chart { display: flex; align-items: end; gap: 8px; height: 190px; padding-top: 20px; }
.bar-column { flex: 1; min-width: 12px; height: 100%; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 8px; }
.bar { width: min(34px, 80%); background: linear-gradient(#36598c, #17223b); min-height: 2px; border-radius: 7px 7px 3px 3px; }
.bar-column small { font-size: 10px; color: var(--ink-soft); white-space: nowrap; }
.ledger-positive { color: var(--green); font-weight: 900; }
.ledger-negative { color: var(--red); font-weight: 900; }

.notice { padding: 14px 16px; border-radius: 13px; background: var(--blue-soft); color: #244f84; line-height: 1.55; }
.warning { background: var(--accent-soft); color: #7c520d; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-soft); }
.code-box { letter-spacing: .28em; font-size: clamp(38px, 7vw, 68px); text-align: center; font-weight: 900; padding: 28px; background: var(--navy); color: #fff; border-radius: 20px; }
.pair-steps { margin: 14px 0 0; padding-left: 22px; color: var(--ink-soft); line-height: 1.7; }
.server-pill { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

.modal { border: 0; padding: 0; border-radius: 20px; width: min(620px, calc(100vw - 30px)); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.modal::backdrop { background: rgba(15,24,43,.58); backdrop-filter: blur(4px); }
.modal-card { padding: 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { margin: 0; }
.toast { position: fixed; top: 18px; right: 18px; z-index: 100; max-width: 380px; padding: 13px 16px; border-radius: 12px; background: var(--navy); color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(-10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.loading { min-height: 320px; display: grid; place-items: center; color: var(--ink-soft); }
.spinner { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .grid.cards-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.cards-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .login-shell { grid-template-columns: 1fr; }
  .login-art { min-height: 470px; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -270px; width: 250px; transition: left .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .mobile-only { display: block; }
  .topbar { padding: 14px 16px; align-items: flex-start; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .child-picker-label { min-width: 150px; flex: 1; }
  .content { padding: 18px 14px 40px; }
  .grid.cards-4, .grid.cards-3, .grid.two, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .login-card { padding: 34px 24px; }
  .login-art { padding: 24px; min-height: 420px; }
  .topbar { flex-wrap: wrap; }
  .topbar > div:nth-child(2) { flex: 1; }
  .section-head { align-items: flex-start; flex-direction: column; }
}

.day-picker { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.day-picker label { cursor: pointer; }
.day-picker input { position: absolute; opacity: 0; pointer-events: none; }
.day-picker span { display: block; padding: 10px 4px; border: 1px solid #d9dfeb; border-radius: 10px; text-align: center; font-size: 12px; font-weight: 800; background: #fff; }
.day-picker input:checked + span { background: #17223b; color: #fff; border-color: #17223b; }
@media (max-width: 560px) { .day-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
