/* =========================
   ROOT / THEME
========================= */

:root{
  --bg:#0b1020;
  --bg2:#121a33;
  --text:#ffffff;
  --muted:rgba(255,255,255,.65);
  --card:rgba(255,255,255,.06);
  --stroke:rgba(255,255,255,.12);
  --shadow:0 12px 36px rgba(0,0,0,.40);
  --r:18px;
  --tab-h:78px;

  --wb:#7c3aed;
  --ozon:#38bdf8;
}


/* =========================
   BASE
========================= */

*{ box-sizing:border-box; }

html,body{
  height:100%;
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;
  touch-action: manipulation;
  overscroll-behavior: none;
}

body{
  color:var(--text);
  overflow:hidden;
  background:
    radial-gradient(720px 520px at 15% 15%, rgba(255,47,146,.22), transparent 60%),
    radial-gradient(720px 520px at 85% 28%, rgba(77,163,255,.22), transparent 60%),
    radial-gradient(720px 520px at 30% 100%, rgba(34,197,94,.16), transparent 60%),
    linear-gradient(180deg,var(--bg),var(--bg2));
}

#app{
  height:100%;
  display:flex;
  flex-direction:column;
}


/* =========================
   HEADER
========================= */

.header{
  padding:12px;
  display:flex;
  align-items:center;
  gap:10px;
  backdrop-filter: blur(16px);
}

.brand{
  width:42px;
  height:42px;
  border-radius:14px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  box-shadow: var(--shadow);
}

.brand img{
  width:100%;
  height:100%;
}

.hgroup{
  flex:1;
  min-width:0;
}

.h1{
  font-size:16px;
  font-weight:700;
}

.h2{
  font-size:12px;
  color:var(--muted);
}

.hactions{
  position: relative;
  z-index: 60;
}

.iconbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:40px;
  height:40px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:var(--text);
}


/* =========================
   CONTENT
========================= */

.view{
  flex:1;
  overflow:auto;
  padding:8px 16px calc(var(--tab-h) + 16px);
}

.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:14px;
  backdrop-filter: blur(16px);
  margin-bottom:12px;
}

.card.compact{
  padding:6px 8px;
  border-radius:12px;
}

.sectionTitle{
  margin:10px 2px 8px;
  font-size:12px;
  color:var(--muted);
}


/* =========================
   SELECT
========================= */
.pageTop{
  display:flex;
  align-items:center;
  gap:8px;
}

.selectWrap{
  flex:1;
  min-width:0;
}

.select{
  width:100%;
  height:32px;
  padding:0 34px 0 10px;       /* справа место под стрелку */
  border-radius:10px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.05);
  color:var(--text);
  outline:none;

  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;

  /* стрелка как фон */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 10px center;
  background-size:16px 16px;

  backdrop-filter: blur(8px);
}

.select.compact{
  height:28px;
  padding:0 32px 0 8px;
  font-size:13px;
  border-radius:8px;
  background-position:right 8px center;
}

select.select{
  color-scheme: dark;
}

select.select option{
  background:#0b1020;
  color:white;
}


/* =========================
   MARKET TOGGLE
========================= */

.marketToggle{
  flex-shrink:0;
  display:flex;
  background:rgba(255,255,255,.06);
  border-radius:10px;
  padding:3px;
  gap:3px;
}

.mbtn{
  padding:6px 14px;
  font-size:13px;
  font-weight:600;
  border:none;
  background:none;
  border-radius:8px;
  color:var(--muted);
  cursor:pointer;
  white-space:nowrap;
}

.mbtn.wb.active{
  background:linear-gradient(135deg,var(--wb),#a855f7);
  color:white;
}

.mbtn.ozon.active{
  background:linear-gradient(135deg,#0284c7,var(--ozon));
  color:white;
}


/* =========================
   SEGMENTED CONTROL
========================= */

.segmented{
  position:relative;
  display:flex;
  background:rgba(255,255,255,.06);
  border-radius:14px;
  padding:4px;
  border:1px solid rgba(255,255,255,.08);
  margin-bottom:10px;
}

.segmented-btn{
  flex:1;
  padding:8px 0;
  border:none;
  background:none;
  color:var(--muted);
  font-weight:600;
  border-radius:10px;
  z-index:2;
}

.segmented-btn.active{
  color:white;
}

.segmented-bg{
  position:absolute;
  top:4px;
  left:4px;
  width:calc(33.3% - 4px);
  height:calc(100% - 8px);
  background:rgba(255,255,255,.15);
  border-radius:10px;
  transition:.25s;
}


/* =========================
   KPI
========================= */

.kpiRow{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.kpi{
  padding:12px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.04);
}

.kpi .k{
  font-size:12px;
  color:var(--muted);
}

.kpi .v{
  font-size:16px;
  font-weight:700;
}


/* =========================
   BOTTOM NAV
========================= */

.tabs{
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  height:var(--tab-h);
  background:rgba(10,14,25,.62);
  border-top:1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(14px);
}

.tabbar{
  height:100%;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:40px;
}

.tab{
  color:var(--muted);
}

.tab.active{
  color:white;
}

.tab .ico{
  width:40px;
  height:40px;
  border-radius:14px;
  display:grid;
  place-items:center;
}

.tab.active .ico{
  background:linear-gradient(135deg, rgba(255,47,146,.20), rgba(77,163,255,.18));
  border:1px solid rgba(255,255,255,.12);
}


/* KPI loading + smooth update */
.kpi .v{
  transition: opacity .18s ease;
}

.kpi.loading .v{
  opacity:.45;
}

.kpi.loading .v::after{
  content:"";
  display:inline-block;
  width:56px;
  height:14px;
  margin-left:8px;
  border-radius:999px;
  background:linear-gradient(90deg, rgba(255,255,255,.10), rgba(255,255,255,.22), rgba(255,255,255,.10));
  background-size:200% 100%;
  animation: kpiShimmer 1.1s linear infinite;
  vertical-align:middle;
}

@keyframes kpiShimmer{
  0%{ background-position: 200% 0; }
  100%{ background-position: -200% 0; }
}

