:root {
  --bg: #fff8e8;
  --paper: #ffffff;
  --ink: #34406b;
  --muted: #73809f;
  --primary: #45b7e8;
  --primary-dark: #188fc2;
  --secondary: #89d982;
  --accent: #ffd86b;
  --pink: #ff9bb0;
  --danger: #ff6b7a;
  --line: rgba(52, 64, 107, 0.12);
  --shadow: 0 8px 0 rgba(52, 64, 107, 0.12), 0 20px 40px rgba(52, 64, 107, 0.12);
  --radius: 34px;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html { min-height: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 216, 107, 0.5), transparent 26%),
    radial-gradient(circle at 88% 16%, rgba(137, 217, 130, 0.45), transparent 24%),
    linear-gradient(180deg, #fff8e8, #f4fbff);
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, transparent 56px, rgba(255, 155, 176, 0.18) 56px, rgba(255, 155, 176, 0.18) 58px, transparent 58px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 39px, rgba(69, 183, 232, 0.12) 39px, rgba(69, 183, 232, 0.12) 40px);
  opacity: 0.7;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 46px;
}

.card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 28px;
  align-items: center;
  min-height: 520px;
}

.brand-logo {
  display: block;
  width: min(390px, 100%);
  margin: -8px 0 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  background: lightgreen;
  color: #225322;
  padding: 10px 16px;
  font-family: "Patrick Hand", cursive;
  font-size: 20px;
}

.pill.green { background: var(--secondary); color: #225322; }
.pill.red { background: rgba(255, 107, 122, 0.2); color: #922d3a; }

h1, h2, h3 { margin: 0; }

h1 {
  margin-top: 18px;
  font-family: "Caveat", cursive;
  font-size: clamp(54px, 8vw, 92px);
  line-height: 0.92;
  color: var(--primary-dark);
}

h2 {
  font-family: "Caveat", cursive;
  font-size: 44px;
  color: var(--primary-dark);
}

.lead {
  font-size: 22px;
  line-height: 1.48;
  color: var(--muted);
  max-width: 720px;
}

.hero-actions, .actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 20px 0 10px;
}

.button {
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border-radius: 999px;
  padding: 14px 22px;
  font-family: "Patrick Hand", cursive;
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 0 rgba(52, 64, 107, 0.14);
  transition: transform 120ms ease, box-shadow 120ms ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(52, 64, 107, 0.14); }
.button.primary { background: aquamarine; color: #174c47; }
.button.secondary { background: var(--secondary); color: #225322; }
.button.warning { background: var(--accent); color: #624b00; }
.button.danger { background: var(--danger); color: white; }
.button.disabled, .button:disabled { pointer-events: none; opacity: 0.55; }

.status-text, .note, small {
  color: var(--muted);
  font-family: "Patrick Hand", cursive;
  font-size: 19px;
}

.hero-device { display: flex; justify-content: center; min-width: 0; }
.tablet-frame { width: min(440px, 100%); aspect-ratio: 1.35; border-radius: 42px; background: #33406b; padding: 18px; box-shadow: 0 16px 40px rgba(52, 64, 107, 0.24); transform: rotate(2deg); overflow: hidden; }
.tablet-screen { height: 100%; min-width: 0; border-radius: 28px; background: #fffdfa; padding: 18px 22px; display: grid; gap: 14px; align-content: center; text-align: center; overflow: hidden; }
.letter-card { margin: 0 auto; width: 138px; height: 138px; max-width: 100%; border-radius: 36px; background: rgba(69, 183, 232, 0.12); color: var(--primary-dark); font-family: "Caveat", cursive; font-size: 116px; line-height: 138px; }
.trace-line { width: 100%; height: 18px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--primary), var(--secondary)); }
.stars { color: #e5a600; font-size: 32px; letter-spacing: 6px; }
.mini-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; font-family: "Patrick Hand", cursive; color: var(--muted); font-size: 20px; }

.grid { display: grid; gap: 18px; margin-top: 22px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feature .emoji { font-size: 52px; margin-bottom: 12px; }
.feature p, .card p, .steps { color: var(--muted); font-size: 18px; line-height: 1.52; }
.install { margin-top: 22px; }
.steps { padding-left: 24px; }
.steps li { margin: 10px 0; }

.session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.session-bar .status-text { margin: 8px 0 0; }
.compact-actions { margin: 0; justify-content: flex-end; flex-shrink: 0; }
.compact-actions .button { min-height: 46px; padding: 10px 18px; }

.panel-login, .filters {
  display: grid;
  gap: 12px;
  margin: 18px 0 22px;
}

.filters { grid-template-columns: minmax(220px, 1.3fr) minmax(150px, 0.7fr) minmax(180px, 0.7fr) auto; align-items: end; }

.input, select, textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 24px;
  padding: 14px 16px;
  font: 800 16px "Nunito", system-ui, sans-serif;
  color: var(--ink);
  outline: none;
  background: white;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 54px;
  background-color: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2334406b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 22px center;
  background-size: 18px 18px;
  text-overflow: ellipsis;
}

select::-ms-expand {
  display: none;
}

textarea { min-height: 92px; resize: vertical; }
.input:focus, select:focus, textarea:focus { border-color: var(--primary); }
label { display: grid; gap: 6px; color: var(--muted); font-family: "Patrick Hand", cursive; font-size: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
.stat strong { display: block; font-family: "Caveat", cursive; font-size: 50px; color: var(--primary-dark); line-height: .9; }
.stat span { color: var(--muted); font-family: "Patrick Hand", cursive; font-size: 20px; }
.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.chart-card { min-height: 220px; }
.bars { display: grid; gap: 8px; margin-top: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(86px, 110px) minmax(90px, 1fr) 52px; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.bar-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 14px; background: rgba(69,183,232,.14); border-radius: 999px; overflow: hidden; }
.bar span { display:block; height:100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius:999px; }

.table-wrap { overflow-x: auto; margin-top: 18px; border-radius: 22px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 980px; background: rgba(255,255,255,.55); }
th, td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; background: #fffdfa; font-family: "Patrick Hand", cursive; color: var(--primary-dark); font-size: 20px; }
td { color: var(--muted); }
.badge { display:inline-flex; border-radius:999px; padding:5px 10px; font-size:12px; font-weight:900; }
.badge.active { background: rgba(137,217,130,.28); color:#225322; }
.badge.blocked { background: rgba(255,107,122,.22); color:#922d3a; }
.row-actions { display:flex; flex-wrap:wrap; gap:8px; }
.row-actions button { min-height: auto; padding: 8px 12px; font-size: 16px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(52,64,107,.42); display: none; align-items: center; justify-content: center; padding: 18px; z-index: 20; }
.modal-backdrop.open { display: flex; }
.modal { width: min(620px, 100%); max-height: 90vh; overflow: auto; }

@media (max-width: 920px) {
  .hero, .grid.three, .grid.two, .stat-grid, .chart-grid, .filters { grid-template-columns: 1fr; }
  .card { padding: 22px; }
  .hero { min-height: auto; }
  .session-bar { align-items: flex-start; }
  .compact-actions { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .session-bar {
    display: grid;
    justify-content: stretch;
  }
  .compact-actions .button { flex: 1 1 130px; }
  .bar-row { grid-template-columns: minmax(72px, 96px) minmax(70px, 1fr) 42px; }
}

@media (max-width: 560px) {
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 16px; }
  .hero { gap: 20px; }
  h1 { font-size: clamp(46px, 15vw, 62px); }
  h2 { font-size: 38px; }
  .lead { font-size: 19px; }
  .brand-logo { width: min(320px, 100%); }
  .tablet-frame {
    width: min(100%, 330px);
    border-radius: 32px;
    padding: 12px;
    transform: none;
  }
  .tablet-screen {
    border-radius: 22px;
    padding: 14px;
    gap: 10px;
  }
  .letter-card {
    width: 92px;
    height: 92px;
    border-radius: 26px;
    font-size: 78px;
    line-height: 92px;
  }
  .trace-line { height: 12px; }
  .stars { font-size: 23px; letter-spacing: 3px; }
  .mini-row { font-size: 16px; gap: 6px; }
}

@media (max-width: 360px) {
  .hero-device { display: none; }
}
