/* AYAsha (ayatoys.ru) — cabinet styles. Derived from AYA public design tokens,
   with a warm accent for the children's toy. Mobile-first. */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Geist:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --aya-bg: #f6f7fb;
  --aya-bg-elevated: #ffffff;
  --aya-surface: #ffffff;
  --aya-surface-2: #f1f3f9;
  --aya-surface-3: #e9edf5;
  --aya-text: #111827;
  --aya-text-soft: #4f596b;
  --aya-text-muted: #677184;
  --aya-line: rgba(17, 24, 39, 0.08);
  --aya-line-strong: rgba(17, 24, 39, 0.14);
  --aya-brand: #005f6d;
  --aya-brand-strong: #004b57;
  --aya-brand-soft: rgba(15, 118, 110, 0.10);
  /* warm toy accent */
  --toy-accent: #ef7d54;
  --toy-accent-strong: #e0663b;
  --toy-accent-soft: rgba(239, 125, 84, 0.12);
  --aya-danger: #b42318;
  --aya-warning: #b54708;
  --aya-success: #067647;
  --aya-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --aya-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --aya-shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.12);
  --aya-radius-sm: 12px;
  --aya-radius-md: 18px;
  --aya-radius-lg: 24px;
  --site-max: 1120px;
  --content-max: 720px;
  --aya-font-ui: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --aya-font-heading: "Geist", "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --aya-bg: #121416;
    --aya-bg-elevated: #171a1d;
    --aya-surface: #1b1f23;
    --aya-surface-2: #23282e;
    --aya-surface-3: #2b3138;
    --aya-text: #eef2f6;
    --aya-text-soft: #c2c9d2;
    --aya-text-muted: #8f98a3;
    --aya-line: rgba(255, 255, 255, 0.07);
    --aya-line-strong: rgba(255, 255, 255, 0.12);
    --aya-brand: #2f6f78;
    --aya-brand-strong: #3c8792;
    --aya-brand-soft: rgba(47, 111, 120, 0.18);
    --toy-accent: #f2966f;
    --toy-accent-strong: #ef7d54;
    --toy-accent-soft: rgba(242, 150, 111, 0.16);
    --aya-danger: #ff7b72;
    --aya-warning: #f0b36a;
    --aya-success: #4ade80;
    --aya-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
    --aya-shadow-md: 0 10px 30px rgba(0, 0, 0, 0.34);
    --aya-shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.44);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--aya-font-ui);
  background: var(--aya-bg);
  color: var(--aya-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--aya-font-heading);
  color: var(--aya-text);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

a { color: var(--aya-brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--aya-text-muted); }
.soft { color: var(--aya-text-soft); }
.center { text-align: center; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

/* --- Brand mark --- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--aya-font-heading);
  font-weight: 700;
  font-size: 20px;
  color: var(--aya-text);
}
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--toy-accent), var(--aya-brand));
  display: grid; place-items: center;
  color: #fff; font-size: 18px;
  box-shadow: var(--aya-shadow-sm);
}

/* --- Layout shells --- */
.shell {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 20px 18px 100px;
}
.narrow { max-width: 460px; margin: 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--aya-bg-elevated) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--aya-line);
}
.topbar-inner {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* --- Cards --- */
.card {
  background: var(--aya-surface);
  border: 1px solid var(--aya-line);
  border-radius: var(--aya-radius-md);
  padding: 18px;
  box-shadow: var(--aya-shadow-sm);
}
.card + .card { margin-top: 14px; }
.card h2, .card h3 { margin-top: 0; }
.card-title { font-size: 18px; margin-bottom: 12px; }

.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi {
  background: var(--aya-surface); border: 1px solid var(--aya-line);
  border-radius: var(--aya-radius-md); padding: 16px;
}
.kpi-value { font-family: var(--aya-font-heading); font-size: 26px; font-weight: 700; }
.kpi-label { color: var(--aya-text-muted); font-size: 14px; margin-top: 4px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--aya-surface-2); color: var(--aya-text-soft);
}
.pill.ok { background: color-mix(in srgb, var(--aya-success) 16%, transparent); color: var(--aya-success); }
.pill.off { background: var(--aya-surface-3); color: var(--aya-text-muted); }
.pill.warn { background: color-mix(in srgb, var(--aya-warning) 16%, transparent); color: var(--aya-warning); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* --- Forms --- */
label { display: block; font-size: 14px; font-weight: 600; color: var(--aya-text-soft); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=date], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--aya-line-strong);
  border-radius: var(--aya-radius-sm);
  background: var(--aya-bg-elevated);
  color: var(--aya-text);
  font-size: 16px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--aya-brand);
  box-shadow: 0 0 0 3px var(--aya-brand-soft);
}
.field + .field { margin-top: 14px; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; }
.checkbox input { width: auto; margin-top: 3px; }
.checkbox label { margin: 0; font-weight: 400; color: var(--aya-text-soft); }

/* code input for pairing */
.code-input {
  letter-spacing: 0.4em; text-align: center; font-size: 28px;
  font-family: var(--aya-font-heading); font-weight: 700;
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 999px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--aya-brand); color: #fff; }
.btn-primary:hover { background: var(--aya-brand-strong); }
.btn-accent { background: var(--toy-accent); color: #fff; }
.btn-accent:hover { background: var(--toy-accent-strong); }
.btn-ghost { background: var(--aya-surface-2); color: var(--aya-text); border-color: var(--aya-line); }
.btn-ghost:hover { background: var(--aya-surface-3); }
.btn-danger { background: color-mix(in srgb, var(--aya-danger) 14%, transparent); color: var(--aya-danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* --- Toggle switch --- */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { display: none; }
.switch .track {
  position: absolute; inset: 0; background: var(--aya-surface-3); border-radius: 999px; transition: .2s;
}
.switch .track::before {
  content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--aya-shadow-sm);
}
.switch input:checked + .track { background: var(--aya-brand); }
.switch input:checked + .track::before { transform: translateX(20px); }

/* --- List rows --- */
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--aya-line);
}
.list-row:last-child { border-bottom: none; }
.list-row .rt { font-weight: 600; }
.list-row .rs { color: var(--aya-text-muted); font-size: 14px; }

/* --- Tags / chips --- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; background: var(--toy-accent-soft);
  color: var(--toy-accent-strong); font-size: 14px; font-weight: 600;
}
.chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }

/* --- Bar chart (simple) --- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding-top: 8px; }
.bars .bar {
  flex: 1; background: linear-gradient(var(--aya-brand), var(--toy-accent));
  border-radius: 6px 6px 0 0; min-height: 4px; position: relative;
}
.bars .bar span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--aya-text-muted); }
.bar-axis { display: flex; gap: 8px; margin-top: 6px; }
.bar-axis span { flex: 1; text-align: center; font-size: 12px; color: var(--aya-text-muted); }

.progress { height: 12px; border-radius: 999px; background: var(--aya-surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--aya-brand); border-radius: 999px; }

/* --- Bottom tab bar (mobile-first) --- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: color-mix(in srgb, var(--aya-bg-elevated) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--aya-line);
  display: flex; justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0));
}
.tabbar a {
  flex: 1; text-align: center; color: var(--aya-text-muted);
  font-size: 12px; font-weight: 600; padding: 4px; border-radius: 12px;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a .ic { display: block; font-size: 20px; margin-bottom: 2px; }
.tabbar a.active { color: var(--aya-brand); }

/* --- Hero / landing --- */
.hero { padding: 40px 0 20px; }
.hero h1 { font-size: clamp(30px, 7vw, 44px); }
.hero p.lead { font-size: 18px; color: var(--aya-text-soft); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.feature-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 28px; }
.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li { display: flex; gap: 10px; padding: 6px 0; color: var(--aya-text-soft); }
.feature-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--toy-accent); margin-top: 8px; flex: none; }

.notice {
  padding: 12px 14px; border-radius: var(--aya-radius-sm);
  background: var(--aya-brand-soft); color: var(--aya-text-soft); font-size: 14px;
}
.error-box {
  padding: 12px 14px; border-radius: var(--aya-radius-sm);
  background: color-mix(in srgb, var(--aya-danger) 12%, transparent); color: var(--aya-danger);
  font-size: 14px;
}
.ok-box {
  padding: 12px 14px; border-radius: var(--aya-radius-sm);
  background: color-mix(in srgb, var(--aya-success) 14%, transparent); color: var(--aya-success);
  font-size: 14px;
}

/* --- Table (admin) --- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--aya-line); white-space: nowrap; }
table.data th { color: var(--aya-text-muted); font-weight: 600; }
table.data tr:hover td { background: var(--aya-surface-2); }

.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--aya-text-muted); margin: 22px 0 10px; }

@media (min-width: 720px) {
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .kpi-row { grid-template-columns: repeat(4, 1fr); }
}
