:root{
  --bg0:#07080b;
  --bg1:#0b0d12;
  --card:#0f121a;
  --card2:#111626;
  --line:rgba(255,255,255,.08);
  --text:#e9ecf3;
  --muted:rgba(233,236,243,.68);

  --red:#d11f2f;
  --gold:#d6b15a;
  --cedar:#1f7a4a;

  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --radius: 18px;
  --radius2: 22px;

  --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font);
  background:
    radial-gradient(900px 500px at 12% 0%, rgba(209,31,47,.14), transparent 62%),
    radial-gradient(700px 500px at 88% 12%, rgba(214,177,90,.10), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(31,122,74,.12), transparent 58%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color:var(--text);
}

.shell{
  display:grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 72px 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  min-height:100%;
}

.topbar{
  grid-area:topbar;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 18px;
  border-bottom:1px solid var(--line);
  background: rgba(10,12,16,.55);
  backdrop-filter: blur(14px);
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
}
.brandMark{
  width:38px;height:38px;border-radius:12px;
  background:
    radial-gradient(12px 12px at 30% 35%, rgba(214,177,90,.9), transparent 62%),
    radial-gradient(14px 14px at 70% 65%, rgba(209,31,47,.85), transparent 64%),
    radial-gradient(18px 18px at 52% 46%, rgba(31,122,74,.75), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.02));
  border:1px solid rgba(255,255,255,.10);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.brandTitle{ font-weight:700; letter-spacing:.2px; }
.brandSub{ font-size:12px; color:var(--muted); margin-top:1px; }

.topbarRight{
  display:flex; align-items:center; gap:10px;
}

.langPills{ display:flex; gap:6px; }
.pill{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor:pointer;
}
.pill.active{
  border-color: rgba(214,177,90,.55);
  background: rgba(214,177,90,.12);
}

.ghostBtn{
  border:1px solid rgba(255,255,255,.12);
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  cursor:pointer;
}

.sidebar{
  grid-area:sidebar;
  padding: 14px 12px;
  border-right:1px solid var(--line);
  background: rgba(8,10,14,.55);
  backdrop-filter: blur(14px);
  display:flex;
  flex-direction:column;
  gap:8px;
}

.navItem{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 11px 12px;
  border-radius: 14px;
  color: var(--text);
  text-decoration:none;
  border:1px solid transparent;
  background: transparent;
}
.navItem:hover{
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
}
.navItem.active{
  background: rgba(209,31,47,.10);
  border-color: rgba(209,31,47,.25);
}
.navDot{
  width:10px;height:10px;border-radius:999px;
  background: rgba(255,255,255,.16);
}
.navItem.active .navDot{
  background: linear-gradient(180deg, var(--gold), var(--red));
  box-shadow: 0 0 0 4px rgba(209,31,47,.10);
}

.sidebarFoot{
  margin-top:auto;
  padding: 12px 10px;
}
.hint{
  font-size:12px;
  color: var(--muted);
  line-height:1.35;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  border-radius: 14px;
  padding: 10px 10px;
}

.main{
  grid-area:main;
  padding: 16px;
}

.view{
  max-width: 1100px;
  margin: 0 auto;
}

.card{
  border:1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding: 16px;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 980px){
  .shell{ grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .sidebar{ display:none; }
  .grid2{ grid-template-columns: 1fr; }
}

.h1{ font-size: 20px; font-weight: 700; margin: 0 0 6px 0; }
.p{ color: var(--muted); margin: 0; line-height: 1.45; }

.kpiRow{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 980px){ .kpiRow{ grid-template-columns: 1fr; } }

.kpi{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(15,18,26,.60);
  border-radius: var(--radius);
  padding: 14px;
}
.kpiLabel{ font-size: 12px; color: var(--muted); }
.kpiValue{ font-size: 24px; font-weight: 800; margin-top: 6px; letter-spacing: .2px; }
.kpiAccent{
  height: 2px;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(209,31,47,.0), rgba(209,31,47,.65), rgba(214,177,90,.65), rgba(31,122,74,.0));
  opacity: .9;
}

.row{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.input, .select{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  outline:none;
}
.btn{
  border:1px solid rgba(214,177,90,.35);
  background: rgba(214,177,90,.12);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  cursor:pointer;
}
.btn:hover{ background: rgba(214,177,90,.16); }
.badge{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--muted);
}
.badge.good{ border-color: rgba(31,122,74,.35); background: rgba(31,122,74,.12); color: rgba(233,236,243,.88); }
.badge.warn{ border-color: rgba(214,177,90,.35); background: rgba(214,177,90,.12); color: rgba(233,236,243,.88); }

.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 12px;
  overflow:hidden;
  border-radius: var(--radius);
  border:1px solid rgba(255,255,255,.10);
}
.table th, .table td{
  padding: 10px 10px;
  border-bottom:1px solid rgba(255,255,255,.07);
  text-align:left;
  font-size: 13px;
}
.table th{
  font-size:12px;
  color: var(--muted);
  background: rgba(255,255,255,.03);
}
.table tr:last-child td{ border-bottom:none; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.right{ text-align:right; }

.toast{
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: rgba(15,18,26,.92);
  border: 1px solid rgba(255,255,255,.12);
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-width: 360px;
  z-index: 99;
}

.rtl{ direction: rtl; }
.rtl .row{ justify-content:flex-start; }
.rtl .right{ text-align:left; }


/* --- Partner portal: simple key/value list --- */
.kvList{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.kv{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.kv .k{
  color: var(--muted);
  font-size: 12px;
}
.kv .v{
  font-weight: 600;
}
/* --- Login UI additions --- */
.input{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  outline: none;
}
.input:focus{
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.08);
}
.label{
  font-size: 12px;
  opacity: .85;
  margin-bottom: 6px;
}
.help{
  font-size: 12px;
  opacity: .8;
  margin-top: 8px;
}
.help.subtle{ opacity: .65; }
.row{
  display:flex;
  gap:10px;
  margin-top: 12px;
  align-items:center;
}
.row.spaceBetween{
  justify-content: space-between;
}
.btn{
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  cursor: pointer;
}
.btn.primary{
  background: rgba(255,255,255,.12);
}
.btn.danger{
  border-color: rgba(255,80,80,.35);
  background: rgba(255,80,80,.10);
}
.link{
  color: rgba(255,255,255,.9);
  text-decoration: underline;
  opacity: .9;
}
.muted{ opacity: .65; }

/* tabs */
.tabs{
  display:flex;
  gap:8px;
  margin: 14px 0 10px 0;
}
.tabBtn{
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.9);
  cursor:pointer;
}
.tabBtn.active{
  background: rgba(255,255,255,.14);
}
.tabPanel{ margin-top: 8px; }

/* mini stats in ledger */
.miniStats{
  display:flex;
  gap:18px;
  margin: 10px 0 14px 0;
  font-size: 12px;
  opacity: .85;
}

/* shell auth state: lock sidebar when logged out */
body:not(.isAuthed) .sidebar .nav{
  opacity: .55;
  pointer-events: none;
}
body:not(.isAuthed) #logoutBtn{
  opacity: .5;
  pointer-events: none;
}
