/* ============================================================================
   АУЫЛ 2026 — агитатор шпаргалкасы. Алтын/ақ бренд, мобиль-first.
   ============================================================================ */
:root {
  --gold: #D5A94E;
  --gold-deep: #B4863A;
  --gold-soft: #F4E9CE;
  --ink: #1A1A1A;
  --bg: #FFFFFF;
  --surface: #FAF7F0;
  --surface-2: #F3EEE2;
  --muted: #726B5C;
  --line: #ECE4D2;
  --mark: #FBE3A6;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --r: 16px;
  --r-sm: 12px;
  --maxw: 620px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #F1ECE2;
    --bg: #131211;
    --surface: #1C1B18;
    --surface-2: #232019;
    --muted: #A49C8C;
    --line: #2C2822;
    --gold-soft: #3A3016;
    --mark: #6B551F;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
::selection { background: var(--gold-soft); }

.splash { display: grid; place-items: center; height: 100vh; color: var(--gold); font-size: 40px; letter-spacing: .3em; }

/* ---------- Language toggle ---------- */
.lang { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.lang button {
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  padding: 5px 10px; border-radius: 999px; color: var(--muted);
  transition: transform 140ms var(--ease-out), background 160ms, color 160ms;
}
.lang button.on { background: var(--bg); color: var(--gold-deep); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.lang button:active { transform: scale(0.94); }

/* ---------- Header ---------- */
.app-hd {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.hd-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 12px; color: var(--ink);
  transition: transform 140ms var(--ease-out), background 160ms;
}
.hd-btn:active { transform: scale(0.9); background: var(--surface-2); }
.hd-mark { font-weight: 800; letter-spacing: .18em; color: var(--gold-deep); font-size: 18px; padding-left: 4px; }
.hd-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-actions { display: flex; align-items: center; gap: 6px; }
.home-hd { justify-content: space-between; border-bottom: none; }

.app-main { padding: 16px 16px calc(40px + var(--safe-b)); }
.app-main.reading { padding-top: 12px; }

/* ---------- LOCK ---------- */
.lock { display: flex; flex-direction: column; min-height: 100vh; padding: 0 22px calc(24px + var(--safe-b)); }
.lock-top { display: flex; justify-content: flex-end; padding-top: 16px; }
.lock-brand { text-align: center; margin-top: 6vh; }
.lock-logo { width: 168px; max-width: 62%; margin: 0 auto; }
.lock-tag { color: var(--muted); font-size: 14px; margin-top: 10px; letter-spacing: .01em; }
.lock-body { margin-top: auto; }
.lock-hint { text-align: center; color: var(--ink); font-weight: 600; font-size: 15px; margin-bottom: 18px; }
.dots { display: flex; justify-content: center; gap: 16px; margin-bottom: 12px; height: 16px; }
.dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--gold); transition: transform 160ms var(--ease-out), background 160ms; }
.dot.on { background: var(--gold); transform: scale(1.12); }
.lock-err { text-align: center; color: #D9483B; font-size: 14px; font-weight: 600; height: 20px; margin-bottom: 8px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 320px; margin: 6px auto 0; }
.key {
  height: 74px; border-radius: 20px; font-size: 30px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center;
  transition: transform 110ms var(--ease-out), background 140ms;
}
.key:active { transform: scale(0.93); background: var(--surface-2); }
.key-del { background: transparent; border-color: transparent; color: var(--muted); }
.shake { animation: shake 260ms var(--ease-in-out); }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-9px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(4px); }
}

/* ---------- HOME ---------- */
.home-brand { text-align: center; padding: 14px 0 8px; }
.home-logo { width: 150px; max-width: 55%; margin: 0 auto; }
.home-tag { color: var(--muted); font-size: 14px; margin-top: 8px; }
.searchbar {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 22px; padding: 14px 16px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  transition: transform 150ms var(--ease-out), background 160ms;
}
.searchbar:active { transform: scale(0.985); background: var(--surface-2); }
.searchbar svg { color: var(--gold-deep); }
.home-lbl { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 4px 4px 12px; }
.mods { display: flex; flex-direction: column; gap: 12px; }
.mod {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform 160ms var(--ease-out), box-shadow 200ms, border-color 200ms;
}
.mod-ic { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 14px; background: var(--gold-soft); color: var(--gold-deep); }
.mod-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mod-t { font-weight: 680; font-size: 16.5px; display: flex; align-items: center; gap: 8px; }
.mod-s { color: var(--muted); font-size: 13.5px; }
.mod .chev { color: var(--muted); flex: 0 0 auto; }
.mod:active { transform: scale(0.98); }
.badge { font-size: 10px; font-weight: 800; letter-spacing: .05em; color: var(--gold-deep); background: var(--gold-soft); border-radius: 6px; padding: 2px 6px; }
@media (hover: hover) and (pointer: fine) {
  .mod:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); border-color: var(--gold); }
  .searchbar:hover { border-color: var(--gold); }
}

/* ---------- Sections / prose ---------- */
.sec { margin-bottom: 26px; }
.sec-h { font-size: 20px; font-weight: 750; line-height: 1.28; margin: 6px 0 14px; letter-spacing: -.01em; }
.prose p { margin: 0 0 12px; }
.prose p:last-child { margin-bottom: 0; }
.b-h { font-size: 16px; font-weight: 700; margin: 16px 0 8px; }
.b-list { margin: 6px 0 14px; padding: 0; list-style: none; }
.b-list li { position: relative; padding: 4px 0 4px 20px; margin-bottom: 4px; }
.b-list li::before { content: ""; position: absolute; left: 4px; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.slogan { text-align: center; color: var(--gold-deep); font-weight: 750; font-size: 16px; letter-spacing: .01em; margin: 8px 0 0; padding: 20px; border-top: 1px solid var(--line); }

/* ---------- Accordion ---------- */
.acc-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.tools-row { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.toggle-all {
  font-size: 13px; font-weight: 700; color: var(--gold-deep);
  background: var(--gold-soft); padding: 8px 14px; border-radius: 999px;
  transition: transform 130ms var(--ease-out), background 160ms;
}
.toggle-all:active { transform: scale(0.95); }
.hb-group {
  font-size: 12.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); margin: 14px 4px 0;
}
.acc { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; transition: border-color 200ms; }
.acc.open { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.acc-h {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 15px 16px; font-weight: 620; font-size: 15.5px; line-height: 1.4;
}
.acc-ht { flex: 1; min-width: 0; display: flex; align-items: flex-start; }
.acc-qt { flex: 1; min-width: 0; }
.acc-sub { display: block; font-weight: 500; font-size: 13px; color: var(--muted); margin-top: 2px; }
.acc-h .chev { flex: 0 0 auto; color: var(--muted); transition: transform 240ms var(--ease-out); }
.acc.open .acc-h .chev { transform: rotate(90deg); color: var(--gold-deep); }
.acc-h:active { background: var(--surface-2); }
.acc-p { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 260ms var(--ease-out); }
.acc.open .acc-p { grid-template-rows: 1fr; }
.acc-in { overflow: hidden; }
.acc-in .prose { padding: 0 16px 16px; }
.pnum, .qnum {
  display: inline-grid; place-items: center; width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 8px; background: var(--gold-soft); color: var(--gold-deep);
  font-size: 13px; font-weight: 800; margin-right: 10px;
}

/* ---------- Filter (QA) ---------- */
.filter, .s-input {
  width: 100%; padding: 13px 16px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  font-size: 16px; outline: none; margin-bottom: 16px;
  transition: border-color 160ms;
}
.filter:focus, .s-input:focus { border-color: var(--gold); }

/* ---------- Tables (mobile cards) ---------- */
.tbl { margin: 12px 0 16px; display: flex; flex-direction: column; gap: 10px; }
.tbl-cap { font-weight: 700; font-size: 14px; color: var(--muted); }
.t-row { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.t-cell { display: flex; flex-direction: column; gap: 1px; }
.t-cell:not(:last-child) { border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.t-k { font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.t-v { font-size: 15px; }

/* ---------- Handbook index ---------- */
.ru-note { display: inline-block; font-size: 12px; font-weight: 700; color: var(--gold-deep); background: var(--gold-soft); border-radius: 999px; padding: 5px 12px; margin-bottom: 14px; }
.hb-index { display: flex; flex-direction: column; gap: 10px; }
.hb-card {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  font-weight: 620; font-size: 15.5px; line-height: 1.35;
  transition: transform 150ms var(--ease-out), border-color 200ms;
}
.hb-tx { flex: 1; }
.hb-card .chev { color: var(--muted); flex: 0 0 auto; }
.hb-card:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) { .hb-card:hover { border-color: var(--gold); } }

/* ---------- Search ---------- */
.s-inputwrap { position: relative; margin-bottom: 16px; }
.s-inputwrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gold-deep); pointer-events: none; }
.s-input { padding-left: 44px; margin-bottom: 0; }
.s-count { font-size: 13px; color: var(--muted); margin: 4px 2px 12px; }
.s-empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 15px; }
.s-item {
  display: block; padding: 14px 16px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  transition: transform 140ms var(--ease-out), border-color 200ms;
}
.s-item:active { transform: scale(0.985); }
.s-badge { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; margin-bottom: 7px; background: var(--gold-soft); color: var(--gold-deep); }
.s-program { background: #E7F0E1; color: #4C7A3A; }
.s-qa { background: var(--gold-soft); color: var(--gold-deep); }
.s-handbook { background: #E4ECF5; color: #3E6293; }
.s-title { display: block; font-weight: 650; font-size: 15px; line-height: 1.35; margin-bottom: 5px; }
.s-snip { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
@media (hover: hover) and (pointer: fine) { .s-item:hover { border-color: var(--gold); } }

/* ---------- Install bar (PWA) ---------- */
.ibar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  padding: 0 12px calc(12px + var(--safe-b));
  transform: translateY(140%); transition: transform 340ms var(--ease-out);
  pointer-events: none;
}
.ibar.show { transform: translateY(0); pointer-events: auto; }
.ibar-in {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: 1px solid var(--line);
  box-shadow: 0 10px 34px rgba(0,0,0,.18); border-radius: 16px; padding: 12px;
}
.ibar-ic { width: 42px; height: 42px; border-radius: 11px; flex: 0 0 42px; }
.ibar-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ibar-tx b { font-size: 14.5px; font-weight: 680; }
.ibar-tx span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.ibar-btn {
  flex: 0 0 auto; background: var(--gold); color: #1A1A1A;
  font-weight: 750; font-size: 14px; padding: 10px 16px; border-radius: 11px;
  transition: transform 130ms var(--ease-out), background 160ms;
}
.ibar-btn:active { transform: scale(0.95); background: var(--gold-deep); }
.ibar-x { flex: 0 0 auto; width: 30px; height: 30px; color: var(--muted); font-size: 14px; border-radius: 8px; }
.ibar-x:active { background: var(--surface-2); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
