/* =========================================================
   SolarHub UI — consolidated app.css (dark dashboard)
   Keep sections + comments, remove duplicates/conflicts
   ========================================================= */

/* =========================
   1) Variables / Theme
   ========================= */
:root{
  --bg0:#0b1020;
  --bg1:#0a0f1a;

  --card:#121a2b;
  --card2:#0f1729;
  --stroke:rgba(255,255,255,.10);

  --text:#e9eefc;
  --muted:rgba(233,238,252,.62);

  --brand:#7c5cff;
  --brand2:#22d3ee;

  --ok:#22c55e;
  --bad:#fb7185;

  --shadow: 0 10px 40px rgba(0,0,0,.35);
  --r:18px;

  --pad:16px;
  --max:1140px;
}

/* =========================
   2) Base / Reset
   ========================= */
*{ box-sizing:border-box; }
html, body{ height:100%; }
a{ color:inherit; text-decoration:none; }

.muted{ color:var(--muted); }
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* =========================
   3) Background (no seams on mobile / short pages)
   - Put background on html, body transparent
   ========================= */
html, body{ min-height:100svh; }

html{
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(124,92,255,.20), transparent 60%),
    radial-gradient(900px 500px at 90% 20%, rgba(34,211,238,.14), transparent 60%),
    radial-gradient(900px 600px at 40% 95%, rgba(34,197,94,.08), transparent 60%),
    linear-gradient(180deg,var(--bg0),var(--bg1));
  background-repeat:no-repeat;
  background-size:cover;
}

body{
  margin:0;
  color:var(--text);
  font:15px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Arial;
  background:transparent;
}

/* =========================
   4) Container
   ========================= */
.container{
  max-width:var(--max);
  margin:0 auto;
  padding:16px var(--pad) 24px; /* bottom-nav removed */
}

/* =========================
   5) Header / Topbar
   ========================= */
.header{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(11,16,32,.72);
  border-bottom:1px solid var(--stroke);
  backdrop-filter: blur(10px);
}
.header-inner{
  max-width:var(--max);
  margin:0 auto;
  padding:12px var(--pad);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:850;
  letter-spacing:.2px;
}
.brand .dot{
  width:12px;
  height:12px;
  border-radius:999px;
  background:linear-gradient(135deg,var(--brand),var(--brand2));
  box-shadow:0 0 0 6px rgba(124,92,255,.12);
}

/* =========================
   6) Navigation (desktop)
   ========================= */
.nav{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.nav a{
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  padding:9px 12px;
  border-radius:12px;
  cursor:pointer;
  font:inherit;
  white-space:nowrap;
}
.nav a:hover{
  color:var(--text);
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.08);
}
.nav .active{
  color:var(--text);
  background:rgba(124,92,255,.18);
  border-color:rgba(124,92,255,.28);
}

/* logout button (same style as nav links) */
.navbtn{
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  padding:9px 12px;
  border-radius:12px;
  cursor:pointer;
  font:inherit;
  white-space:nowrap;
}
.navbtn:hover{
  color:var(--text);
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.08);
}

/* =========================
   7) Navigation (mobile)
   - TOP menu only
   - no scroll, can wrap (your current choice)
   ========================= */
@media (max-width: 900px){
  .header-inner{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }

  .nav{
    display:flex;
    flex-wrap:wrap;          /* wrap allowed */
    overflow:visible;
    gap:8px;
    justify-content:flex-start;
    max-width:100%;
    padding-bottom:0;
  }

  .nav a, .navbtn, .nav form{
    flex:0 0 auto;
  }

  .nav a, .navbtn{
    padding:8px 10px;
    font-size:13px;
    border-radius:12px;
  }
}

@media (max-width: 420px){
  .nav a, .navbtn{
    padding:7px 8px;
    font-size:12px;
  }
}

/* bottom-nav is not used */
.bottom-nav{ display:none !important; }

/* =========================
   8) Layout grids
   ========================= */
.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}

/* used in settings.html */
.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}

/* backward compatibility (if any old templates still use .grid2) */
.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}

@media (max-width: 900px){
  .grid, .grid-2, .grid2{ grid-template-columns:1fr; }
}

/* =========================
   9) Cards / Typography / HR
   ========================= */
.card{
  border:1px solid var(--stroke);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:16px;
}
.card h1{ margin:0 0 10px; font-size:22px; }
.card h2{ margin:0 0 10px; font-size:18px; }
.card .sub{
  margin-top:-4px;
  margin-bottom:10px;
  color:var(--muted);
  font-size:13px;
}

.hr{
  height:1px;
  background:rgba(255,255,255,.08);
  margin:14px 0;
}

/* utility vertical stack */
.stack{
  display:flex;
  flex-direction:column;
  gap:14px;
}

/* =========================
   10) Forms
   ========================= */
.form{ display:grid; gap:10px; }
label{ color:var(--muted); font-size:12px; }

input{
  width:100%;
  max-width:100%;
  padding:11px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.16);
  color:var(--text);
  outline:none;
}
input:focus{
  border-color: rgba(124,92,255,.45);
  box-shadow:0 0 0 4px rgba(124,92,255,.14);
}

.row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
@media (max-width:900px){
  .row{ grid-template-columns:1fr; }
}

/* =========================
   11) Buttons
   ========================= */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:11px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
  font:inherit;
  white-space:nowrap;
}
.btn:hover{ background:rgba(255,255,255,.09); }

.btn.primary{
  border-color: rgba(124,92,255,.35);
  background:linear-gradient(135deg, rgba(124,92,255,.38), rgba(34,211,238,.18));
}
.btn.danger{
  border-color: rgba(251,113,133,.35);
  background: rgba(251,113,133,.12);
  color:#fecaca;
}
.btn.small{
  padding:9px 10px;
  border-radius:12px;
  font-size:13px;
}

/* =========================
   12) Alerts
   ========================= */
.alert{
  margin-bottom:12px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(251,113,133,.35);
  background: rgba(251,113,133,.12);
  color:#fecaca;
}
.alert.ok{
  border-color: rgba(34,197,94,.30);
  background: rgba(34,197,94,.10);
  color:#bbf7d0;
}

/* =========================
   13) KPI blocks (dashboard)
   ========================= */
.kpi{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
@media (max-width:900px){
  .kpi{ grid-template-columns:1fr 1fr; gap:10px;}
}
.k{
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.14);
  border-radius:14px;
  padding:12px;
}
.k .t{ color:var(--muted); font-size:12px; }
.k .v{
  margin-top:6px;
  font-weight:900;
  font-size:26px;
  letter-spacing:-.4px;
}
.k .u{
  font-size:13px;
  color:var(--muted);
  font-weight:700;
  margin-left:6px;
}
.k .s{
  margin-top:8px;
  color:var(--muted);
  font-size:13px;
  word-break:break-word;
}

/* =========================
   14) Miner blocks (one card per miner)
   ========================= */
.list{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:12px;
}

.miner{
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.14);
  border-radius:16px;
  overflow:hidden;
}

.mhead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 14px 10px;
}
.mtitle{
  font-weight:900;
  letter-spacing:.1px;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.mhost{
  padding:0 14px 12px;
  color:var(--muted);
  font-size:13px;
  word-break:break-word;
}

.mactions{
  display:flex;
  align-items:center;
  gap:10px;
}

/* status chip (not button-looking) */
.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04);
  color:var(--muted);
  white-space:nowrap;
}
.chip .dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:#64748b;
}
.chip.ok{
  border-color:rgba(34,197,94,.25);
  background:rgba(34,197,94,.10);
  color:#bbf7d0;
}
.chip.ok .dot{ background:var(--ok); }
.chip.off{
  border-color:rgba(251,113,133,.25);
  background:rgba(251,113,133,.10);
  color:#fecaca;
}
.chip.off .dot{ background:var(--bad); }

/* rows inside miner */
.mkv{
  padding:0 14px 14px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
@media (max-width:900px){
  .mkv{ grid-template-columns:1fr 1fr; gap:10px;}
}
.mitem{
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.03);
  border-radius:14px;
  padding:12px;
}
.mitem .t{ color:var(--muted); font-size:12px; }
.mitem .v{
  margin-top:6px;
  font-weight:900;
  font-size:18px;
}

/* error bar */
.merr{
  border-top:1px solid rgba(255,255,255,.08);
  background:rgba(251,113,133,.10);
  padding:10px 14px;
  color:#fecaca;
  font-size:13px;
  word-break:break-word;
}

/* =========================
   15) Logs
   ========================= */
.logbox{
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.16);
  border-radius:16px;
  padding:12px;
  max-height:520px;
  overflow:auto;
  white-space:pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:13px;
}

/* =========================
   16) Auth (login page)
   ========================= */
.auth{
  min-height: calc(100vh - 120px);
  display:grid;
  place-items:center;
  padding:24px 0;
}
.auth-card{
  width: min(560px, 100%);
  border:1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

/* ===== Mobile: remove bottom white/gray band ===== */
html, body{
  height:auto !important;
  min-height:100dvh !important;   /* dVH стабильнее на мобилках */
  background-color:#0a0f1a !important;
}

body{
  background:transparent !important;
}

/* на всякий: чтобы ничего не "вылезало" снизу */
.container{
  padding-bottom:24px !important;
}

/* =========================
   Miner: compact list block
   ========================= */
.mlist{
  padding:0 14px 14px;
}
.mtable{
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.10);
  border-radius:14px;
  overflow:hidden;
}
.mrow{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
}
.mrow + .mrow{
  border-top:1px solid rgba(255,255,255,.08);
}
.mkey{
  color:var(--muted);
  font-size:12px;
}
.mval{
  font-weight:900;
  text-align:right;
}
.mlink{
  color:var(--text);
  text-decoration:none;
  border-bottom:1px dashed rgba(255,255,255,.22);
}
.mlink:hover{
  border-bottom-color: rgba(255,255,255,.55);
}

.miner2{
  padding:14px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  box-shadow: 0 10px 30px rgba(0,0,0,.20) inset;
  margin-top: 12px;
}

.m2-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.m2-title{
  font-weight:700;
  letter-spacing:.2px;
}

.m2-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.m2-host{
  margin-top:6px;
  color: rgba(238,242,255,.68);
  font-size: 13px;
}

.m2-grid{
  margin-top:12px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}

.m2-item{
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}

.m2-item .t{
  color: rgba(238,242,255,.68);
  font-size:12px;
  margin-bottom:6px;
}

.m2-item .v{
  font-size:20px;
  font-weight:700;
}

.m2-err{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
  color: rgba(255,220,220,.95);
  font-size:13px;
}

@media (max-width: 720px){
  .m2-grid{ grid-template-columns: 1fr; }
  .m2-item .v{ font-size:18px; }
}
/* ===== Miner "RUNNING" highlight (ok + work_mode==0) ===== */
:root{
  --run:#f59e0b;                /* amber */
  --run2:rgba(245,158,11,.22);  /* soft amber */
}

/* оранжевая окантовка + чуть ярче фон у бейджа, когда майнер работает */
.chip.ok.run{
  border-color: rgba(245,158,11,.70);
  background: rgba(245,158,11,.14);
  color: #ffe7c2;
  box-shadow: 0 0 0 3px rgba(245,158,11,.10);
}

/* точка тоже оранжевая */
.chip.ok.run .dot{
  background: var(--run);
}

/* шапка (summary) при "работает" — как на фото: теплый акцент */
details.miner.running > summary.mhead{
  border-bottom: 1px solid rgba(245,158,11,.25);
  background:
    linear-gradient(90deg,
      rgba(245,158,11,.10),
      rgba(245,158,11,.04),
      rgba(255,255,255,0)
    );
}

/* слегка подсветим сам контейнер майнера, чтобы выделялся */
details.miner.running{
  border-color: rgba(245,158,11,.30);
}

/* при наведении — чуть ярче */
details.miner.running > summary.mhead:hover{
  background:
    linear-gradient(90deg,
      rgba(245,158,11,.14),
      rgba(245,158,11,.06),
      rgba(255,255,255,0)
    );
}

.page-settings{
  padding-top: 2px;
}

.settings-form-wrap{
  margin:0;
}

.settings-grid{
  align-items:start;
}

.settings-right{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.settings-card h2{
  margin:0 0 14px;
}

.settings-form{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.settings-form label{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin:0;
}

.settings-form input,
.settings-form select{
  display:block;
  width:100%;
  max-width:100%;
  min-height:44px;
  padding:11px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.16);
  color:var(--text);
  outline:none;
  appearance:none;
  -webkit-appearance:none;
}

.settings-form input:focus,
.settings-form select:focus{
  border-color: rgba(124,92,255,.45);
  box-shadow:0 0 0 4px rgba(124,92,255,.14);
}

.settings-actions{
  display:flex;
  justify-content:flex-end;
  margin-top:14px;
}

@media (max-width:900px){
  .settings-actions{
    justify-content:stretch;
  }

  .settings-actions .btn{
    width:100%;
  }
}

.card-head-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.mode-box-inline{
  display:flex;
  align-items:flex-start;
  justify-content:flex-end;
  flex:0 0 auto;
}

.mode-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:32px;
  padding:6px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.4px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:#dbe4ff;
  white-space:nowrap;
  box-shadow:none;
}

.mode-chip-stack{
  display:inline-flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  min-height:44px;
  padding:6px 14px 7px;
  text-align:center;
}

.mode-chip-top{
  display:block;
  font-size:10px;
  line-height:1;
  font-weight:600;
  letter-spacing:.3px;
  color:rgba(233,238,252,.62);
}

.mode-chip-main{
  display:block;
  font-size:13px;
  line-height:1.05;
  font-weight:800;
  letter-spacing:.3px;
}

@media (max-width: 640px){
  .card-head-row{
    gap:10px;
  }

  .mode-box-inline{
    margin-left:8px;
  }

  .mode-chip-stack{
    min-height:40px;
    padding:5px 12px 6px;
  }

  .mode-chip-top{
    font-size:9px;
  }

  .mode-chip-main{
    font-size:12px;
  }
}

.logs-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.logs-filter{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.logs-filter select{
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.logs-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.logbox{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
}

.section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
  flex-wrap:wrap;
}

.help-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 14px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  color: var(--text);
  text-decoration:none;
  font-weight:600;
  transition:.18s ease;
}

.help-link:hover{
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.18);
}

.help-card h1{
  margin:0 0 8px;
}

.help-head{
  margin-bottom:18px;
}

.help-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:16px;
}

.help-block{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  border-radius:18px;
  padding:18px;
}

.help-block h2{
  margin:0 0 12px;
  font-size:20px;
}

.help-block p{
  margin:0 0 10px;
  line-height:1.6;
}

.help-list{
  display:grid;
  gap:10px;
  line-height:1.6;
}

.formula{
  margin:10px 0 12px;
  padding:14px 16px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background: rgba(124,92,255,.10);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height:1.6;
  word-break:break-word;
}

@media (max-width: 900px){
  .help-grid{
    grid-template-columns: 1fr;
  }

  .section-head{
    align-items:flex-start;
  }
}