:root{
  --bg:#07090e;
  --bg-2:#0b0f18;
  --surface:#101521;
  --surface-2:#131a29;
  --surface-3:#0d121d;

  --glass:rgba(18,24,37,.82);
  --glass-2:rgba(14,19,30,.90);
  --glass-3:rgba(10,14,24,.96);

  --text:#eef2f8;
  --text-soft:#d8dfeb;
  --muted:#a6afc2;

  --gold:#d6b15e;
  --gold-soft:rgba(214,177,94,.08);
  --gold-line:rgba(214,177,94,.18);
  --gold-line-2:rgba(214,177,94,.28);

  --line:rgba(255,255,255,.06);
  --line-2:rgba(255,255,255,.09);

  --ok:#d7efc9;
  --bad:#f2b7b7;
  --warn:#e1c37a;

  --shadow-sm:0 8px 20px rgba(0,0,0,.14);
  --shadow-md:0 14px 34px rgba(0,0,0,.22);
  --shadow-lg:0 22px 60px rgba(0,0,0,.32);

  --inner-top:inset 0 1px 0 rgba(255,255,255,.04);
  --inner-gold:inset 0 0 0 1px rgba(214,177,94,.05);

  --radius:18px;
  --radius-lg:24px;
  --header-offset:120px;
}

*{box-sizing:border-box}
html,body{max-width:100%;overflow-x:hidden}
html{scroll-behavior:smooth}

body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(214,177,94,.08), transparent 26%),
    radial-gradient(circle at 82% 16%, rgba(214,177,94,.06), transparent 24%),
    linear-gradient(180deg, #07090e 0%, #0a0d14 35%, #0b0f18 100%);
  color:var(--text);
  line-height:1.45;
}

body.is-booting{overflow:hidden}
body.is-ready{overflow:auto}

a{color:inherit}
button,input,select,textarea{font:inherit}
img{max-width:100%;display:block}

.wrap{
  width:100%;
  max-width:1260px;
  margin:0 auto;
  padding:0 18px;
  min-width:0;
}

main{
  padding-top:calc(var(--header-offset,0px) + 18px);
  padding-bottom:34px;
}

.grid{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:16px;
  min-width:0;
}

.stack{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.row{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:10px;
  min-width:0;
}

.toolbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin:12px 0 0;
}

.right{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
  min-width:0;
}

.btns{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
  min-width:0;
}

.mono{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  color:#dfe6f3;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.hint,.small,.mini{
  color:var(--muted);
  font-size:12px;
  line-height:1.55;
}
.hint{margin-top:10px}
.warn{color:#f0ddb2;font-weight:700;margin-bottom:4px}
.ok{color:var(--ok)}
.bad{color:var(--bad)}

hr{
  border:none;
  height:1px;
  background:linear-gradient(90deg, transparent, rgba(214,177,94,.22), transparent);
}

.sectionSpacer{height:2px}

/* Header */
.sdsHeader{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:1200;
  padding:calc(env(safe-area-inset-top) + 14px) 0 14px;
  background:linear-gradient(180deg, rgba(18,24,37,.86), rgba(10,14,24,.94));
  border-bottom:1px solid var(--gold-line);
  box-shadow:
    0 10px 28px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.04),
    inset 0 -1px 0 rgba(214,177,94,.04);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
}
.sdsHeader::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:linear-gradient(180deg, rgba(255,255,255,.035), transparent 34%);
}
.sdsHeader-inner{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:16px;
  align-items:center;
  min-width:0;
}
.sdsHeader-left{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}
.sdsHeader-logo{
  width:48px;
  height:48px;
  border-radius:14px;
  flex:0 0 auto;
  box-shadow:
    0 0 0 1px rgba(214,177,94,.22),
    0 6px 18px rgba(0,0,0,.22);
}
.sdsHeader-text{min-width:0}
.sdsHeader-kicker{
  color:#f2ddb2;
  font-size:11px;
  letter-spacing:.16em;
  text-transform:uppercase;
  margin-bottom:4px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.sdsHeader-title{
  font-size:22px;
  font-weight:800;
  letter-spacing:.01em;
  color:var(--text);
  text-shadow:0 1px 0 rgba(0,0,0,.25);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.sdsHeader-sub{
  font-size:12px;
  color:var(--muted);
  margin-top:4px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.sdsHeader-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  min-width:0;
  max-width:100%;
}

.headerChip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--gold-line);
  background:linear-gradient(180deg, rgba(23,29,45,.92), rgba(15,20,32,.96));
  box-shadow:
    var(--inner-top),
    var(--inner-gold),
    0 10px 24px rgba(0,0,0,.16);
  color:#d9dfeb;
  font-size:12px;
  white-space:nowrap;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
}

.headerAction{
  border:1px solid var(--gold-line);
  background:linear-gradient(180deg, rgba(33,41,63,.92), rgba(18,24,39,.96));
  box-shadow:
    0 12px 28px rgba(0,0,0,.22),
    inset 0 1px 0 rgba(255,255,255,.05),
    inset 0 0 0 1px rgba(214,177,94,.04);
  color:var(--text);
  border-radius:14px;
  padding:10px 12px;
  font-weight:700;
  cursor:pointer;
}
.headerAction:hover{filter:brightness(1.04)}

/* Offline bar */
.offlineStateBar{
  display:none;
  position:fixed;
  left:0;
  right:0;
  top:var(--header-offset,120px);
  z-index:1180;
  background:linear-gradient(180deg, rgba(47,36,19,.96), rgba(33,26,15,.98));
  border-bottom:1px solid var(--gold-line);
  box-shadow:
    0 10px 24px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.03);
}
.offlineStateBar.is-visible{display:block}
.offlineStateBar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:11px 0;
  color:#f3e3bb;
}
.offlineStateBar button{
  border:1px solid var(--gold-line-2);
  background:#2f251a;
  color:#f5e8c7;
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
}

/* Cards */
.card,
.metricsBox,
.statusBarPremium,
.signalCanon,
.statusCard{
  position:relative;
  background:linear-gradient(180deg, rgba(18,24,38,.88), rgba(10,14,24,.95));
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px;
  min-width:0;
  box-shadow:var(--shadow-md), var(--inner-top), var(--inner-gold);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
}

.card::before,
.metricsBox::before,
.statusBarPremium::before,
.signalCanon::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:linear-gradient(180deg, rgba(255,255,255,.03), transparent 28%);
  pointer-events:none;
}

.cardHead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.cardTitle,
.cardHead h2,
h2{
  margin:0;
  color:#f0f3fa;
}

.cardTitle{
  font-size:15px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:#f2ddb2;
}

.cardSub{
  margin-top:6px;
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}

/* Pills */
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  background:linear-gradient(180deg, rgba(24,30,46,.92), rgba(15,20,32,.96));
  border:1px solid var(--line);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 6px 18px rgba(0,0,0,.12);
  color:var(--muted);
  font-size:12px;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
}
.pill strong{color:var(--text)}
.pill.gold{
  border-color:var(--gold-line);
  background:var(--gold-soft);
  color:#f1ddb5;
}

/* Fields */
label{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin:10px 0 6px;
  letter-spacing:.03em;
}

input,
textarea,
select{
  width:100%;
  max-width:100%;
  border-radius:14px;
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(15,20,31,.94), rgba(9,13,22,.98));
  color:var(--text);
  padding:12px 13px;
  outline:none;
  font-size:14px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.03),
    0 6px 14px rgba(0,0,0,.12);
  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    background .18s ease;
}

input:focus,
textarea:focus,
select:focus{
  border-color:var(--gold-line-2);
  box-shadow:
    0 0 0 3px rgba(214,177,94,.08),
    inset 0 1px 0 rgba(255,255,255,.04),
    0 10px 20px rgba(0,0,0,.16);
}

input::placeholder,
textarea::placeholder{
  color:#8d96aa;
}

textarea{
  min-height:96px;
  resize:vertical;
  line-height:1.55;
}

select{cursor:pointer}

/* Buttons */
button{
  border-radius:14px;
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(29,36,55,.94), rgba(17,23,37,.98));
  color:var(--text);
  padding:10px 14px;
  cursor:pointer;
  font-size:14px;
  font-weight:700;
  box-shadow:
    0 10px 22px rgba(0,0,0,.20),
    inset 0 1px 0 rgba(255,255,255,.05),
    inset 0 0 0 1px rgba(214,177,94,.025);
  transition:
    filter .16s ease,
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease;
}

button:hover{
  filter:brightness(1.04);
  transform:translateY(-1px);
}

button.primary,
.primary{
  border-color:var(--gold-line-2);
  background:linear-gradient(180deg, rgba(58,46,26,.98), rgba(33,26,16,.99));
  color:#fff5de;
  box-shadow:
    0 14px 30px rgba(0,0,0,.24),
    inset 0 1px 0 rgba(255,255,255,.06),
    inset 0 0 0 1px rgba(214,177,94,.10),
    0 0 24px rgba(214,177,94,.05);
}

button.primary:hover,
.primary:hover{
  filter:brightness(1.05);
  transform:translateY(-1px);
  box-shadow:
    0 16px 34px rgba(0,0,0,.28),
    inset 0 1px 0 rgba(255,255,255,.07),
    0 0 28px rgba(214,177,94,.07);
}

.ghost{
  background:rgba(255,255,255,.02);
}

/* Output */
.out{
  margin-top:12px;
  border:1px solid var(--gold-line);
  border-radius:16px;
  padding:14px;
  background:linear-gradient(180deg, rgba(13,17,28,.94), rgba(8,11,20,.98));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.03),
    0 10px 28px rgba(0,0,0,.18);
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  white-space:pre-wrap;
  word-break:break-word;
  overflow-wrap:anywhere;
  min-height:420px;
  line-height:1.55;
  color:#edf1f8;
}

/* QR */
.qrWrap{
  display:grid;
  grid-template-columns:minmax(0,220px) minmax(0,1fr);
  gap:14px;
  align-items:start;
  margin-top:14px;
  min-width:0;
}

.qrPanel{
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:flex-start;
}

canvas{
  background:#fff;
  border-radius:16px;
  padding:10px;
  box-shadow:
    0 12px 26px rgba(0,0,0,.18),
    0 0 0 1px rgba(214,177,94,.08);
  width:100%;
  max-width:220px;
  height:auto;
}

/* Status */
.statusBarPremium{
  margin-top:14px;
  padding:12px 14px;
  border-radius:16px;
  background:linear-gradient(180deg, rgba(20,26,40,.90), rgba(11,15,25,.96));
  border:1px solid var(--gold-line);
}

.statusBarPremium-head{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:10px;
  min-width:0;
  flex-wrap:wrap;
}

.statusBarPremium-kicker{
  font-size:11px;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:var(--gold);
  white-space:nowrap;
}

.statusBarPremium-sep{
  color:var(--muted);
  flex:0 0 auto;
}

.statusBarPremium-title{
  font-size:14px;
  font-weight:700;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.statusBarPremium-track{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:flex-start;
}

.statusPill{
  flex:0 1 100px;
  min-width:190px;
  max-width:240px;
  padding:9px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:linear-gradient(180deg, rgba(21,27,41,.92), rgba(12,16,26,.96));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.03),
    0 8px 18px rgba(0,0,0,.12);
  display:inline-flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.statusPill-label{
  font-size:11px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.05em;
  white-space:nowrap;
  flex:0 0 auto;
}

.statusPill-value{
  font-size:13px;
  font-weight:700;
  color:var(--text);
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-align:right;
}

.statusPill-value.ok{color:var(--ok)}
.statusPill-value.bad{color:var(--bad)}
.statusPill-value.warn{color:var(--warn)}

/* Canonical signal */
.signalCanon{
  margin-top:10px;
  padding:14px 16px;
  border-radius:16px;
  background:linear-gradient(180deg, rgba(20,26,40,.92), rgba(10,14,24,.98));
  border:1px solid var(--gold-line);
}

.signalCanon-kicker{
  font-size:11px;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:var(--gold);
  margin-bottom:6px;
}

.signalCanon-text{
  font-size:14px;
  line-height:1.55;
  color:#f0f3f8;
  font-weight:600;
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* Metrics */
.metricsBox{
  margin-top:12px;
}

.metricsTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.metricsMeta{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  min-width:0;
}

.switch{
  display:inline-flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  user-select:none;
  min-width:0;
}
.switch input{width:auto}

/* Bottom bar */
.sdsBottomBar{
  position:fixed;
  left:12px;
  right:12px;
  bottom:calc(env(safe-area-inset-bottom) + 12px);
  z-index:1150;
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  padding:10px;
  border:1px solid var(--gold-line);
  border-radius:18px;
  background:linear-gradient(180deg, rgba(15,20,31,.86), rgba(10,14,24,.94));
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
  box-shadow:
    0 18px 38px rgba(0,0,0,.30),
    inset 0 1px 0 rgba(255,255,255,.04),
    inset 0 0 0 1px rgba(214,177,94,.04);
}
.sdsBottomBar button{
  flex:1 1 0;
  min-height:46px;
  border-radius:14px;
  font-size:14px;
}
.sdsBottomBar button:first-child{
  border-color:var(--gold-line-2);
}
body.has-sds-bottom-bar{
  padding-bottom:116px;
}

/* Responsive core */
@media (min-width:981px){
  .sdsBottomBar{display:none}
  body.has-sds-bottom-bar{padding-bottom:0}
}

@media (max-width:980px){
  .wrap{padding:0 14px}
  .row{grid-template-columns:1fr}
  .qrWrap{grid-template-columns:1fr}
  .right{justify-content:flex-start}
  .metricsTop{flex-direction:column;align-items:stretch}
  .metricsMeta{justify-content:flex-start}
}

@media (max-width:640px){
  .wrap{padding:0 12px}

  .sdsHeader{
    padding:calc(env(safe-area-inset-top) + 10px) 0 10px;
  }
  .sdsHeader-inner{
    grid-template-columns:1fr;
  }
  .sdsHeader-logo{
    width:40px;
    height:40px;
  }
  .sdsHeader-title{
    font-size:18px;
  }
  .sdsHeader-sub,
  .sdsHeader-kicker{
    font-size:11px;
  }
  .sdsHeader-right{
    width:100%;
    justify-content:flex-start;
  }
  .headerChip{
    display:none;
  }

  .card,
  .metricsBox,
  .signalCanon,
  .statusBarPremium{
    padding:14px;
    border-radius:18px;
  }

  .cardHead{
    flex-direction:column;
  }

  .toolbar{
    flex-direction:column;
  }

  .right{
    width:100%;
  }

  .btns{
    flex-direction:column;
  }

  .btns button,
  .right button{
    width:100%;
  }

  .out{
    min-height:260px;
    font-size:13px;
  }

  .statusBarPremium{
    padding:12px;
    border-radius:14px;
  }

  .statusBarPremium-track{
    flex-direction:column;
    gap:8px;
  }

  .statusPill{
    width:100%;
    min-width:0;
    max-width:none;
    border-radius:14px;
    padding:10px 12px;
  }

  .statusPill-value{
    white-space:normal;
    overflow-wrap:anywhere;
    word-break:break-word;
  }

  .signalCanon{
    padding:12px 14px;
    border-radius:14px;
  }

  .signalCanon-text{
    font-size:13px;
    line-height:1.5;
  }

  input,
  textarea,
  select,
  button{
    font-size:16px;
    border-radius:14px;
  }

  .sdsBottomBar{
    left:10px;
    right:10px;
    gap:8px;
    padding:8px;
  }

  .sdsBottomBar button{
    font-size:12px;
    min-height:42px;
  }
}
#appSplash{
  position:fixed;
  inset:0;
  z-index:3000;
  display:flex;
  align-items:center;
  justify-content:center;
  background:
    radial-gradient(circle at 50% 38%, rgba(214,177,94,.10), transparent 22%),
    linear-gradient(180deg, rgba(6,8,12,.94) 0%, rgba(9,12,19,.98) 100%);
  opacity:1;
  visibility:visible;
  pointer-events:none;
  transition:opacity .18s ease, visibility .18s ease;
}

#appSplash.is-hidden{
  opacity:0;
  visibility:hidden;
}

.appSplash-inner{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
  padding:28px;
  text-align:center;
}

.appSplash-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:1px solid rgba(214,177,94,.18);
  background:rgba(214,177,94,.08);
  padding:6px 12px;
  border-radius:999px;
  color:#f2ddb2;
  font-size:12px;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.appSplash-title{
  font-size:26px;
  font-weight:800;
  color:#f2f4f9;
}

.appSplash-sub{
  font-size:13px;
  color:#b7bfd1;
  max-width:320px;
}

body.is-booting{
  overflow:hidden;
}

body.is-ready{
  overflow:auto;
}