:root{
  --bg:#0a1430;
  --bg2:#0b1f45;
  --card:#ffffff;
  --text:#0b1220;
  --muted:rgba(11,18,32,.65);
  --stroke:rgba(2,6,23,.10);
  --shadow: 0 22px 60px rgba(2,6,23,.18);
  --r16:16px; --r22:22px;

  --rail1:#0b3aa7;
  --rail2:#0aa6c5;
  --rail3:#12336a;

  --primary:#0b3aa7;
  --primary2:#0aa6c5;
  --danger:#ef4444;
  --ok:#22c55e;
  --focus: 0 0 0 3px rgba(11,58,167,.22);
}

/* Dark theme overrides */
[data-theme="dark"]{
  --bg:#071027;
  --bg2:#091b3f;
  --card: rgba(255,255,255,.06);
  --text:#eef4ff;
  --muted:rgba(238,244,255,.70);
  --stroke:rgba(255,255,255,.10);
  --shadow: 0 24px 70px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial;
  color:var(--text);
  background:
    radial-gradient(900px 500px at 12% 12%, rgba(10,166,197,.18), transparent 60%),
    radial-gradient(900px 500px at 88% 18%, rgba(11,58,167,.18), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

/* Ribbon */
.ribbon{
  background: linear-gradient(90deg, rgba(11,58,167,.92), rgba(10,166,197,.92));
  color:#fff;
  font-weight:700;
  font-size:13px;
}
.ribbon__inner{
  max-width: 1200px;
  margin:0 auto;
  padding:10px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.ribbon__left{display:flex; align-items:center; gap:10px;}
.ribbon__badge{
  width:10px; height:10px; border-radius:50%;
  background:#fff; opacity:.9;
  box-shadow:0 0 0 4px rgba(255,255,255,.18);
}
.ribbon__right{display:flex; gap:10px; flex-wrap:wrap;}
.ribbon__link{
  color:#fff;
  text-decoration:none;
  opacity:.92;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.25);
}
.ribbon__link:hover{opacity:1;}

/* Header */
.header{
  position:sticky; top:0; z-index:10;
  background: rgba(255,255,255,.70);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--stroke);
}
[data-theme="dark"] .header{
  background: rgba(7,16,39,.55);
}
.header__inner{
  max-width:1200px;
  margin:0 auto;
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.brand{display:flex; align-items:center; gap:12px;}
.brand__mark{
  width:44px; height:44px; border-radius:14px;
  background: linear-gradient(135deg, var(--rail1), var(--rail2));
  position:relative;
  box-shadow: 0 12px 30px rgba(11,58,167,.22);
}
.brand__mark:before{
  content:"";
  position:absolute; inset:11px;
  border-radius:12px;
  border:2px solid rgba(255,255,255,.75);
}
.brand__mark:after{
  content:"";
  position:absolute; left:14px; top:14px;
  width:16px; height:16px; border-radius:50%;
  background: rgba(255,255,255,.85);
  box-shadow: 14px 12px 0 rgba(255,255,255,.55);
  opacity:.9;
}
.brand__name{font-weight:900; letter-spacing:.6px}
.brand__sub{font-size:12px; color:var(--muted); margin-top:2px}

.header__actions{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
.select select{
  height:38px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.75);
  color:var(--text);
  padding:0 10px;
  outline:none;
}
[data-theme="dark"] .select select{
  background: rgba(255,255,255,.06);
}

.chip{
  height:38px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.75);
  color:var(--text);
  padding:0 12px;
  cursor:pointer;
  display:flex; align-items:center; gap:10px;
  font-weight:800;
}
[data-theme="dark"] .chip{ background: rgba(255,255,255,.06); }
.chip__dot{
  width:10px; height:10px; border-radius:50%;
  background: linear-gradient(135deg, var(--rail1), var(--rail2));
}
.chip.ghost{background:transparent}
.chip:focus{outline:none; box-shadow: var(--focus);}

/* Page layout */
.page{padding:22px 16px 40px;}
.shell{
  max-width:1200px;
  margin:0 auto;
  display:grid;
  grid-template-columns: 1.35fr .9fr;
  gap:18px;
  align-items:start;
}
.shell--mobile{grid-template-columns:1fr; max-width:680px;}
.card{
  border:1px solid var(--stroke);
  border-radius: var(--r22);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card--auth{padding:18px 18px 0;}
.card--promo{position:relative; min-height: 560px;}

.hero{padding:6px 6px 16px;}
.hero__title{margin:0; font-size:28px; line-height:1.18; letter-spacing:.1px;}
.hero__desc{margin:10px 0 0; color:var(--muted); line-height:1.45;}

.tabs{
  display:flex;
  gap:10px;
  padding: 0 6px 14px;
  flex-wrap:wrap;
}
.tab{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.85);
  color:var(--text);
  padding:10px 14px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:900;
}
[data-theme="dark"] .tab{ background: rgba(255,255,255,.06); }
.tab.active{
  background: rgba(11,58,167,.10);
  border-color: rgba(11,58,167,.35);
  color: var(--text);
}

.alert{
  margin: 0 6px 12px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.10);
}
.alert.ok{
  border-color: rgba(34,197,94,.35);
  background: rgba(34,197,94,.12);
}

.panels{padding:0 6px 16px;}
.panel{display:none;}
.panel.show{display:block;}

.form{display:grid; gap:10px; padding: 0 0 14px;}
.label{font-size:13px; font-weight:900;}
.input, .inputWrap input{
  width:100%;
  height:44px;
  border-radius: 12px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.85);
  padding: 0 12px;
  color:var(--text);
  outline:none;
  font-size:15px;
}
[data-theme="dark"] .input,
[data-theme="dark"] .inputWrap input{
  background: rgba(255,255,255,.06);
}
.input:focus, .inputWrap input:focus{box-shadow: var(--focus); border-color: rgba(11,58,167,.35);}

.inputWrap{position:relative;}
.iconBtn{
  position:absolute;
  right:8px; top:50%;
  transform: translateY(-50%);
  height:30px; width:30px;
  border-radius: 10px;
  border:1px solid var(--stroke);
  background: transparent;
  cursor:pointer;
  color: var(--muted);
  display:grid; place-items:center;
}
.iconBtn:hover{color:var(--text)}

.link{
  text-decoration:none;
  color: var(--primary);
  font-weight:800;
  font-size:13px;
  text-align:center;
  margin: 8px 0 6px;
}
[data-theme="dark"] .link{color: #7db6ff;}

.btn{
  height:46px;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.85);
  color:var(--text);
  font-weight:900;
  cursor:pointer;
}
[data-theme="dark"] .btn{background: rgba(255,255,255,.06);}
.btn:focus{outline:none; box-shadow: var(--focus);}
.btn--primary{
  border-color: rgba(11,58,167,.35);
  background: linear-gradient(135deg, var(--rail1), var(--rail2));
  color:#fff;
}
.btn--ghost{background:transparent;}
.row{display:flex; gap:10px; flex-wrap:wrap;}
.subrow{display:flex; justify-content:center; gap:10px; flex-wrap:wrap; margin-top:8px;}

.muted{color:var(--muted)}
.small{font-size:12px;}
.mini{font-size:12px; margin-top:10px;}
.hr{height:1px; background: var(--stroke); margin: 6px 0; border-radius:1px;}

.cardFoot{
  padding: 12px 6px 14px;
  border-top:1px solid var(--stroke);
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

/* Camera */
.cameraBlock{margin-top:8px;}
.videoBox{
  position:relative;
  border-radius: 16px;
  overflow:hidden;
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.15);
  min-height: 260px;
}
video{width:100%; height:100%; object-fit:cover; display:block; transform: scaleX(-1);}
.overlay{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  flex-direction:column;
  gap:10px;
  pointer-events:none;
}
.frame{
  width:min(70%, 320px);
  height:min(52%, 220px);
  border-radius: 18px;
  border:2px solid rgba(255,255,255,.70);
  box-shadow: 0 0 0 6px rgba(10,166,197,.18);
}
.overlay__text{font-size:12px; color: rgba(255,255,255,.92); text-align:center; padding:0 14px;}

/* QR */
.qrBlock{margin-top:10px;}
.qrTop{display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap; align-items:center;}
.qrTitle{font-weight:900;}
.qrTimer{color:var(--muted); font-size:13px;}
.qrWrap{
  display:grid;
  grid-template-columns: 240px 1fr;
  gap:14px;
  align-items:center;
  margin-top:10px;
}
.qrBox{
  width:240px;
  height:240px;
  display:grid;
  place-items:center;
  border-radius: 18px;
  border:1px dashed rgba(11,58,167,.45);
  background: rgba(11,58,167,.08);
}
.qrInfo{display:grid; gap:10px;}
.qrLine{display:flex; gap:10px; align-items:center; font-size:13px;}
.dot{width:10px; height:10px; border-radius:50%; background: rgba(11,18,32,.25);}
[data-theme="dark"] .dot{background: rgba(238,244,255,.22);}
.dot.ok{background: rgba(34,197,94,.85);}

/* Promo card */
.promoBg{
  position:absolute; inset:0;
  background:
    radial-gradient(700px 400px at 20% 10%, rgba(10,166,197,.35), transparent 60%),
    radial-gradient(700px 500px at 80% 30%, rgba(11,58,167,.35), transparent 60%),
    linear-gradient(180deg, rgba(11,58,167,.92), rgba(7,16,39,.92));
}
.promo{
  position:relative;
  padding: 22px;
  color:#eaf2ff;
  min-height: 560px;
}
.promo__badge{
  display:inline-block;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.10);
  font-weight:900;
  font-size:12px;
}
.promo__title{margin:14px 0 0; font-size:24px; letter-spacing:.2px;}
.promo__desc{margin:10px 0 0; opacity:.9; line-height:1.5;}

.promoCards{
  margin-top:16px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:10px;
}
.pCard{
  border:1px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 12px;
}
.pCard__kpi{font-weight:1000; font-size:18px;}
.pCard__txt{opacity:.9; font-size:12px; margin-top:6px;}

.promo__foot{
  margin-top: 18px;
  border-top:1px solid rgba(255,255,255,.18);
  padding-top:12px;
  display:grid;
  gap:10px;
}
.promo__line{display:flex; gap:10px; align-items:center;}
.ico{
  width:28px; height:28px;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  display:grid; place-items:center;
}

/* Responsive */
@media (max-width: 980px){
  .shell{grid-template-columns:1fr;}
  .card--promo{min-height: 420px;}
  .promo{min-height: 420px;}
  .qrWrap{grid-template-columns: 1fr; }
  .qrBox{width:100%; height:auto; padding:16px;}
}
@media (max-width: 520px){
  .hero__title{font-size:22px;}
  .tab{width:100%; text-align:left;}
  .row .btn{width:100%;}
  .ribbon__right{display:none;}
}
