:root {
  --bg: #ffffff;
  --bg2: #f3f3f6;
  --card: #ffffff;
  --text: #1c1c1e;
  --hint: #8a8a8e;
  --accent: #2f8ade;
  --accent-text: #ffffff;
  --border: rgba(127,127,127,0.2);
  --border-strong: rgba(127,127,127,0.34);
  --q1-bg: rgba(18,160,143,0.14); --q1-fg: #12a08f;
  --q2-bg: rgba(47,138,221,0.13); --q2-fg: #2f8ade;
  --q3-bg: rgba(201,138,23,0.17); --q3-fg: #c98a17;
  --q4-bg: rgba(127,127,127,0.13); --q4-fg: var(--hint);
  --danger: #dd4b46; --danger-bg: rgba(221,75,70,0.13);
  --success: #37a06a; --ok-bg: rgba(55,160,106,0.15);
  --ill-surface: #ffffff; --ill-elev: #eceef2; --ill-line: rgba(0,0,0,0.12);
  --ill-text: #2b2f36; --ill-hint: #9aa1ac;
  --ill-q1: rgba(221,75,70,0.14); --ill-q2: rgba(47,138,221,0.14); --ill-q3: rgba(201,138,23,0.18); --ill-q4: rgba(127,127,127,0.14);
}
body[data-theme="dark"] {
  --ill-surface: rgba(255,255,255,0.06); --ill-elev: rgba(255,255,255,0.10); --ill-line: rgba(255,255,255,0.18);
  --ill-text: #e7e9ee; --ill-hint: #8b93a1;
  --ill-q1: rgba(231,90,85,0.30); --ill-q2: rgba(90,165,240,0.30); --ill-q3: rgba(225,165,55,0.34); --ill-q4: rgba(255,255,255,0.12);
  --card: rgba(255,255,255,0.05);
  --q1-fg: #ff6f6a; --q2-fg: #5aa6f2; --q3-fg: #e8b54e;
  --q1-bg: rgba(231,90,85,0.20); --q2-bg: rgba(90,165,240,0.20); --q3-bg: rgba(230,177,74,0.22); --q4-bg: rgba(255,255,255,0.10);
  --success: #4cca8d; --danger: #ff6f6a; --danger-bg: rgba(255,111,106,0.18); --ok-bg: rgba(76,202,141,0.20);
  --border: rgba(255,255,255,0.14); --border-strong: rgba(255,255,255,0.26);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 15px; -webkit-font-smoothing: antialiased; }
input { font-family: inherit; }

.ph { max-width: 480px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; }
#screen { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.pad { padding: 0 16px; }
.hd { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.bk { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ttl { font-size: 19px; font-weight: 600; text-wrap: balance; }
.sub { font-size: 12px; color: var(--hint); }
.seg { display: flex; gap: 4px; margin: 0 16px 12px; background: var(--bg2); border-radius: 9px; padding: 3px; }
.seg > div { flex: 1; text-align: center; font-size: 13px; padding: 7px 0; border-radius: 7px; color: var(--hint); cursor: pointer; }
.seg > div.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--card); }
.cir { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; cursor: pointer; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.q { border-radius: 12px; padding: 12px; min-height: 104px; cursor: pointer; }
.qh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
.gcard { border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; background: var(--card); cursor: pointer; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 20px; }
.nav { display: flex; border-top: 1px solid var(--border); background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
.nav > div { flex: 1; text-align: center; padding: 9px 0 7px; color: var(--hint); cursor: pointer; font-size: 11px; }
.nav > div.on { color: var(--accent); }
.nav i { font-size: 24px; display: block; }
.btnP { background: var(--accent); color: var(--accent-text); text-align: center; font-weight: 600; padding: 14px; border-radius: 12px; cursor: pointer; font-size: 15px; }
.fab { position: absolute; right: 16px; bottom: 18px; width: 54px; height: 54px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,0.2); }
.fab i { font-size: 28px; color: var(--accent-text); }
.field { border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px; font-size: 16px; width: 100%; background: var(--card); color: var(--text); outline: none; }
.field:focus { border-color: var(--accent); }
.metric { background: var(--bg2); border-radius: 12px; padding: 14px; }
.toast { position: absolute; left: 16px; right: 16px; bottom: 74px; background: #2b2b2e; color: #fff; border-radius: 12px; padding: 12px 16px; display: none; align-items: center; justify-content: space-between; font-size: 14px; z-index: 5; box-shadow: 0 4px 16px rgba(0,0,0,0.25); }
.toast b { cursor: pointer; color: #7cc0ff; font-weight: 600; }
.sheet { position: absolute; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: flex-end; z-index: 6; }
.sheet .panel { background: var(--bg); width: 100%; border-radius: 18px 18px 0 0; padding: 8px 12px 16px; }
.opt { padding: 15px; text-align: center; font-size: 16px; border-top: 1px solid var(--border); cursor: pointer; }
.grab { width: 38px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 10px auto 14px; }
.empty { text-align: center; color: var(--hint); font-size: 15px; padding: 60px 20px; }
.sw { width: 46px; height: 28px; border-radius: 14px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.sw.on { background: var(--success); }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.sw.on::after { left: 21px; }
.weblogin { max-width: 420px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; gap: 14px; }
.empty i { font-size: 30px; display: block; margin-bottom: 10px; }

/* ПИН-код: цифровая клавиатура */
.pinpad { position: relative; max-width: 420px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 28px calc(28px + env(safe-area-inset-bottom)); }
.pin-top { position: absolute; top: 0; left: 0; right: 0; height: 54px; display: flex; align-items: center; padding: 0 18px; }
.pin-cancel { font-size: 15px; color: var(--accent); cursor: pointer; }
.pin-lock { font-size: 32px; color: var(--accent); margin-bottom: 12px; }
.pin-title { font-size: 20px; font-weight: 600; text-align: center; }
.pin-sub { font-size: 13px; color: var(--hint); margin-top: 5px; text-align: center; min-height: 18px; }
.pin-dots { display: flex; gap: 16px; justify-content: center; margin: 22px 0 4px; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); background: transparent; transition: background .12s, border-color .12s; }
.pin-dot.on { background: var(--accent); border-color: var(--accent); }
.pin-err { color: var(--danger); font-size: 13px; min-height: 18px; text-align: center; margin-bottom: 8px; }
.pin-keys { display: grid; grid-template-columns: repeat(3, 74px); gap: 18px 26px; justify-content: center; }
.pin-key { width: 74px; height: 74px; border-radius: 50%; background: var(--bg2); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 500; color: var(--text); cursor: pointer; user-select: none; -webkit-user-select: none; transition: background .1s, transform .05s; }
.pin-key:active { background: var(--border-strong); transform: scale(0.95); }
.pin-key.blank { background: transparent; pointer-events: none; }
.pin-key.act { background: transparent; }
.pin-key.act i { font-size: 26px; color: var(--hint); }
.pin-key.act:active { background: var(--bg2); }
.pin-key.act.off { opacity: .3; pointer-events: none; }
.pin-link { margin-top: 22px; font-size: 14px; color: var(--accent); cursor: pointer; text-align: center; }
.pin-shake { animation: pinshake .32s; }
@keyframes pinshake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
