:root {
  --ink: #1B1446; --muted: #6B6790; --bg: #F4F1FB; --card: #fff; --line: #E6E0F5;
  --yellow: #FFC93C; --yellow-d: #E09A00; --violet: #7B5CFF; --pink: #FF6FA8; --mint: #2BB673; --red: #D92D5B;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body { font-family: 'Baloo 2', ui-rounded, system-ui, sans-serif; background: var(--bg); color: var(--ink); }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input { font: inherit; color: var(--ink); }
svg.char { display: block; width: 100%; height: 100%; overflow: visible; }

.btn { background: #fff; padding: 10px 18px; border-radius: 14px; font-weight: 700; box-shadow: 0 0 0 2px var(--line); }
.btn.primary { background: var(--yellow); box-shadow: 0 4px 0 var(--yellow-d); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--yellow-d); }
.btn.big { width: 100%; padding: 14px; font-size: 20px; }
.btn.ghost { box-shadow: none; color: var(--muted); }
.btn:disabled { opacity: .6; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 0%, #FFE7A3, var(--bg) 60%); }
.login-card { background: #fff; border-radius: 28px; padding: 28px 24px; width: 100%; max-width: 340px; text-align: center; box-shadow: 0 20px 60px rgba(27,20,70,.12); }
.login-ic { width: 84px; height: 84px; border-radius: 22px; }
.login h1 { font-size: 26px; line-height: 1.1; margin-top: 8px; }
.login p { color: var(--muted); }
.dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--violet); }
.dots i.on { background: var(--violet); }
.dots.err { animation: shake .4s; }
.dots.err i { border-color: var(--red); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { background: var(--bg); border-radius: 18px; font-size: 26px; font-weight: 700; padding: 10px 0; }
.keypad button:active { background: #E4DEFF; }

/* ---------- Topo ---------- */
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 42px; height: 42px; border-radius: 12px; }
.brand div { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-size: 18px; }
.brand small { color: var(--muted); }
.top-r { display: flex; align-items: center; gap: 8px; }
.live { color: var(--mint); font-weight: 700; font-size: 14px; }
.live.off { color: var(--red); }

/* ---------- Grade ---------- */
.grid { display: grid; grid-template-columns: 300px 1fr 300px; gap: 16px; padding: 16px 20px 30px; align-items: start; max-width: 1400px; margin: 0 auto; }
.panel { background: var(--card); border-radius: 22px; padding: 16px; box-shadow: 0 2px 10px rgba(27,20,70,.05); }
.col-detail { display: flex; flex-direction: column; gap: 16px; }
.col-list, .col-coupons { position: sticky; top: 84px; max-height: calc(100vh - 104px); display: flex; flex-direction: column; }
.panel h2 { font-size: 20px; }
.panel h3 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 6px; }
.muted { color: var(--muted); font-size: 14px; }
.empty { color: var(--muted); font-size: 14px; padding: 14px 4px; text-align: center; }

.search { width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 9px 12px; margin: 8px 0; font-size: 16px; outline: none; }
.search:focus, #couponInput:focus, .money input:focus { border-color: var(--violet); }
.list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.fam { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; border-radius: 16px; border: 2px solid transparent; position: relative; }
.fam:hover { background: var(--bg); }
.fam.on { border-color: var(--yellow); background: #FFF8E3; }
.fam-avs { display: flex; flex: none; }
.fam-avs .av + .av { margin-left: -14px; }
.av { width: 38px; height: 38px; border-radius: 50%; background: #EFEAFF; padding: 2px; border: 2px solid #fff; display: inline-block; flex: none; }
.av.big { width: 64px; height: 64px; }
.fam-t { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.fam-t small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot-on { position: absolute; right: 10px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px #D7F5E6; }

.placeholder { text-align: center; padding: 50px 20px; }
.ph-ic { font-size: 50px; }
.placeholder p { color: var(--muted); }

.client { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.client small { color: var(--violet); font-weight: 700; }
.client h2 { font-size: 26px; line-height: 1.1; }
.client p { color: var(--muted); }
.on-txt { color: var(--mint); font-weight: 700; }
.badge { background: #FFF1C9; border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 14px; }

.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.kid { display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px; border-radius: 18px; border: 2px solid var(--line); }
.kid.on { border-color: var(--violet); background: #F4F0FF; }
.kid-t { display: flex; flex-direction: column; line-height: 1.15; flex: 1; }
.kid-t b { font-size: 18px; }
.kid-t small { color: var(--muted); }
.mini-card { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin-top: 6px; }
.mini-card i { aspect-ratio: 1; border-radius: 50%; border: 2px solid #F3D58A; background: #FFFBEF; font-style: normal; font-size: 9px; display: grid; place-items: center; }
.mini-card i.on { background: var(--yellow); border-color: var(--yellow-d); }

.launch { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.launch > label { font-weight: 700; display: flex; flex-direction: column; gap: 4px; }
.money { display: flex; align-items: center; border: 2px solid var(--line); border-radius: 16px; padding: 0 14px; background: #fff; }
.money span { font-weight: 800; color: var(--muted); font-size: 22px; }
.money input { border: 0; outline: none; font-size: 30px; font-weight: 800; padding: 6px 10px; width: 100%; background: transparent; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 14px; border-radius: 999px; background: var(--bg); font-weight: 700; }
.chip.on { background: var(--ink); color: #fff; }
.launch > label.check { flex-direction: row; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--violet); }
.check.dis { color: var(--muted); }
.check em { font-style: normal; font-size: 13px; background: var(--bg); padding: 0 8px; border-radius: 999px; }
.calc { display: grid; grid-template-columns: 1fr auto; align-items: center; background: #FFF6DE; border-radius: 16px; padding: 10px 16px; }
.calc span { font-weight: 700; }
.calc b { font-size: 40px; line-height: 1; grid-row: span 2; color: var(--yellow-d); }
.calc small { color: var(--muted); }
.result { margin-top: 12px; background: #E3F8EE; color: #146C43; border-radius: 14px; padding: 10px 14px; font-weight: 700; animation: pop .3s; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hist { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.hist li { display: grid; grid-template-columns: 90px 110px 1fr auto; gap: 8px; font-size: 14px; align-items: center; }
.hist span, .hist small { color: var(--muted); }
.hist em { font-style: normal; font-weight: 800; color: var(--yellow-d); }

.inline { display: flex; gap: 8px; margin: 8px 0; }
#couponInput { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 14px; padding: 9px 12px; font-size: 18px; text-transform: uppercase; font-weight: 700; letter-spacing: .05em; outline: none; }
.coupons { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.cp { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 14px; background: var(--bg); }
.cp:hover { background: #FFF1C9; }
.cp-e { font-size: 24px; }
.cp div { display: flex; flex-direction: column; line-height: 1.15; }
.cp b { color: var(--violet); letter-spacing: .04em; }
.cp small { color: var(--muted); font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 16px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #146C43; }
.toast.err { background: var(--red); }

@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
@keyframes pop { from { transform: scale(.95); opacity: 0; } }

@media (max-width: 1100px) {
  .grid { grid-template-columns: 280px 1fr; }
  .col-coupons { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; padding: 12px; }
  .col-list { position: static; max-height: 360px; }
  .top { padding: 10px 12px; }
  .hist li { grid-template-columns: 1fr auto; }
  .hist li span, .hist li small { grid-column: 1; }
}
