
:root{
  --bg:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --card:#ffffff;
  --line:#e2e8f0;
  --shadow: 0 10px 24px rgba(2,6,23,.06);
  --radius: 16px;

  --primary:#0ea5e9;   /* sky */
  --primary2:#0284c7;
  --success:#16a34a;
  --warning:#f59e0b;
  --danger:#ef4444;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: "Cascadia Code", "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color:var(--text);
  background: var(--bg);
  min-height:100vh;
}
.container{max-width:1080px; margin:0 auto; padding:24px 14px 56px;}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px;
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}


.logo{
  width:38px; height:38px; border-radius:12px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 10px 18px rgba(14,165,233,.22);
  display:flex; align-items:center; justify-content:center;
}
.logo svg{width:20px; height:20px; color:white}

.brand h1{font-size:15px; margin:0; letter-spacing:.2px}
.brand .sub{font-size:12px; color:var(--muted); margin-top:2px}

.nav{display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.nav a, .nav button.linkbtn{
  display:inline-flex; align-items:center; gap:8px;
  padding:9px 10px;
  border-radius: 12px;
  border:1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-decoration:none;
  cursor:pointer;
  font-weight:600;
  font-size:13px;
}
.nav a:hover, .nav button.linkbtn:hover{
  background:#f8fafc;
  border-color: #eef2f7;
  color: var(--text);
}
.nav .active{
  background:#f1f5f9;
  border-color:#e2e8f0;
  color: var(--text);
}

.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:14px;
  margin-top:14px;
}

.card{
  grid-column: span 12;
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
}

.card h2{margin:0 0 6px; font-size:18px}
.card h3{margin:0 0 10px; font-size:14px; color:#0b1220}

.muted{color:var(--muted)}
.row{display:flex; flex-wrap:wrap; gap:10px; align-items:center}

.kv{display:grid; grid-template-columns: 160px 1fr; gap:8px; font-size:14px}
.kv b{color:var(--text)}

hr.sep{border:none; border-top:1px solid var(--line); margin:12px 0}

input, select{
  width:100%;
  padding:11px 12px;
  border-radius: 14px;
  background: #ffffff;
  border:1px solid var(--line);
  color:var(--text);
  outline:none;
}
input:focus, select:focus{
  border-color: rgba(14,165,233,.55);
  box-shadow: 0 0 0 3px rgba(14,165,233,.12)
}
label{display:block; font-size:13px; color:var(--muted); margin:10px 0 6px}

button{
  border:none;
  padding:10px 13px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color:white;
  cursor:pointer;
  font-weight:700;
  box-shadow: 0 10px 18px rgba(14,165,233,.18);
}
button:hover{filter:brightness(1.03)}
button.secondary{
  background:#ffffff;
  color: var(--text);
  border:1px solid var(--line);
  box-shadow:none;
}
button.danger{
  background: linear-gradient(135deg, var(--danger), #dc2626);
  box-shadow: 0 10px 18px rgba(239,68,68,.14);
}

.alert{
  padding:12px 12px;
  border-radius: 14px;
  border:1px solid #fecaca;
  background: #fff1f2;
  color: #9f1239;
  font-size:14px;
}

.alert.danger{
  border:1px solid #fecaca;
  background: #fff1f2;
  color: #9f1239;
}
.alert.success{
  border:1px solid #bbf7d0;
  background:#f0fdf4;
  color:#166534;
}

.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: 16px;
  border:1px solid var(--line);
}
.table th, .table td{
  padding:10px 10px;
  border-bottom:1px solid #eef2f7;
  text-align:right;
  font-size:13px;
  vertical-align: top;
}
.table th{color:#334155; background:#f8fafc}
.table tr:hover td{background:#fbfdff}

.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius: 999px;
  font-size:12px;
  border:1px solid var(--line);
  background: #f8fafc;
  color:#334155;
}
.badge.ok{border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.08); color:#14532d}
.badge.warn{border-color: rgba(245,158,11,.30); background: rgba(245,158,11,.10); color:#7c2d12}
.badge.ban{border-color: rgba(239,68,68,.30); background: rgba(239,68,68,.10); color:#7f1d1d}
/* alias */
.badge.danger{border-color: rgba(239,68,68,.30); background: rgba(239,68,68,.10); color:#7f1d1d}

.chips{display:flex; flex-wrap:wrap; gap:8px; margin-top:8px}
.chip{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 10px;
  border-radius: 999px;
  border:1px solid var(--line);
  background: #f8fafc;
  font-size:13px;
}

.icon{
  width:18px; height:18px; display:inline-block;
  color: currentColor;
}

@media (min-width: 860px){
  .span6{grid-column: span 6;}
  .span4{grid-column: span 4;}
  .span8{grid-column: span 8;}
}


/* Modal */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index: 50;
}
.modal{
  width: 100%;
  max-width: 520px;
  background: #fff;
  border:1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(2,6,23,.18);
  padding:16px;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.modal-head h3{margin:0; font-size:15px}
.modal-close{
  width:38px; height:38px;
  border-radius: 12px;
  background:#fff;
  border:1px solid var(--line);
  box-shadow:none;
  color: var(--muted);
}
.modal-close:hover{background:#f8fafc; color: var(--text)}
.modal-actions{display:flex; gap:10px; margin-top:12px}
.modal-actions button{flex:1}


/* Miner cards */
.miner-card{ padding-top:14px; }
.miner-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  direction:ltr; /* name on the left, actions on the right */
}
.miner-name{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.miner-title{ font-weight:700; font-size:18px; letter-spacing:.2px; }
.miner-sub{ font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:220px; direction:ltr; }
.miner-right{ display:flex; align-items:center; gap:10px; }
.status-dot{
  display:inline-block;

  width:12px; height:12px; border-radius:999px;
  border:2px solid var(--line);
  box-shadow: 0 0 0 4px rgba(2,6,23,.04) inset;
}
.status-dot.on{ background:#16a34a; border-color:#16a34a; }
.status-dot.off{ background:#dc2626; border-color:#dc2626; }

/* Key/Value: labels left, values right */
.kv-pairs{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px 10px;
  direction:ltr; /* so label is left column visually */
}
.kv-pairs .k{
  color: var(--muted);
  text-align:left;
  font-size:12px;
}
.kv-pairs .v{
  text-align:right;
  font-size:13px;
  direction:ltr;
}


/* Top nav responsive */
.hamburger{
  display:none;
  width:44px; height:44px;
  border-radius:14px;
  background:#fff;
  border:1px solid var(--line);
  padding:10px;
}
.hamburger span{
  display:block;
  height:2px;
  background: var(--text);
  border-radius:2px;
  margin:5px 0;
}

@media (max-width: 820px){
  .topbar{
    flex-wrap:wrap;
    gap:10px;
  }
  .hamburger{ display:inline-flex; align-items:center; justify-content:center; }
  .nav{
    width:100%;
    display:none;
    padding-top:8px;
    border-top:1px solid var(--line);
  }
  .nav.open{ display:flex; flex-wrap:wrap; }
}

/* Miner cards layout consistent on mobile/desktop */
.miner-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  direction:ltr;
}
.miner-left{
  display:flex;
  align-items:center;
  gap:8px; /* dot close to name */
  min-width:0;
}
.miner-title{
  font-weight:700;
  font-size:18px;
}
.miner-action-btn{
  margin-left:auto;
}

/* KV pairs: labels left, values right (also on mobile) */
.kv-pairs{
  direction:ltr;
  grid-template-columns: 110px 1fr;
}
.kv-pairs .k{ text-align:left; }
.kv-pairs .v{ text-align:right; }

@media (max-width: 520px){
  .kv-pairs{ grid-template-columns: 92px 1fr; }
  .miner-action-btn{ padding-left:12px; padding-right:12px; }
}


/* Buttons – cleaner, modern */
button, .secondary{
  border-radius:12px;
  padding:8px 14px;
  font-weight:600;
}
button{
  background:#2E63C7;
  color:#fff;
}
button.secondary{
  background:#f3f6ff;
  color:#2E63C7;
}
button:hover{ opacity:.9 }

/* Hamburger icon */
.hamburger{
  border:none;
  background:transparent;
}
.hamburger svg{
  width:26px;
  height:26px;
  stroke:#2E63C7;
  stroke-width:2.5;
}

/* Footer */
.site-footer{
  margin-top:40px;
  padding:20px 0;
  border-top:1px solid var(--line);
  display:flex;
  justify-content:center;
  gap:16px;
}
.site-footer a svg{
  width:22px;
  height:22px;
  fill:#2E63C7;
}


/* Brand */


.brand-text{ font-weight:800; letter-spacing:.2px; color: var(--primary); font-size:18px; }

/* Buttons use primary */
button{
  background: var(--primary);
  border: 1px solid rgba(46,99,199,.15);
  box-shadow: 0 6px 18px rgba(46,99,199,.18);
}
button.secondary{
  background: rgba(46,99,199,.08);
  color: var(--primary);
  border: 1px solid rgba(46,99,199,.18);
  box-shadow: none;
}
button:hover{ opacity:1; filter: brightness(0.98); }

/* Footer clean */
.site-footer{
  background:#fff;
}
.footer-inner{
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.copyright{
  color: var(--muted);
  font-size: 13px;
}
.footer-right{ display:flex; align-items:center; gap:10px; }
.social{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  border-radius: 12px;
  border:1px solid rgba(15,23,42,.10);
  color: var(--primary);
  background:#fff;
}
.social:hover{ background: rgba(46,99,199,.06); }
.social svg{ width:18px; height:18px; stroke: currentColor; stroke-width:2; fill:none; }

/* Mobile footer sizing */
@media (max-width:520px){
  
  .brand-text{ font-size:16px; }
  .footer-inner{ flex-direction:column; align-items:flex-start; }
  .social{ width:34px; height:34px; }
  .social svg{ width:18px; height:18px; stroke: currentColor; stroke-width:2; fill:none; }
}

/* Brand (refined) */
.brand{ display:flex; align-items:center; gap:10px; flex:0 0 auto; }
.brand-logo{ height:30px; width:auto; display:block; }
.brand-text{ font-weight:800; letter-spacing:.2px; color: var(--primary); font-size:16px; line-height:1; }
@media (max-width:520px){
  .brand-logo{ height:28px; }
  .brand-text{ font-size:15px; }
}

.social{ text-decoration:none; }
.footer-right{ gap:12px; }

/* Panel title clean */
.panel-title{
  display:block;
  font-weight:800;
  font-size:20px;
  color:#111;
  margin-bottom:12px;
}

/* Topbar layout (no page caption) */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.nav a{
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  padding:8px 10px;
  border-radius: 12px;
  color: var(--text);
  border:1px solid transparent;
}
.nav a.active{
  background: rgba(46,99,199,.08);
  border-color: rgba(46,99,199,.18);
  color: var(--primary);
  font-weight:700;
}

/* Fixed header & footer */
.site-header{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.site-header .topbar{
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
}

.site-footer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  text-align: center;
}
.footer-icons{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  margin-bottom:6px;
}
.site-footer .social{
  width:38px;
  height:38px;
  border-radius: 12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(46,99,199,.18);
  background: rgba(46,99,199,.06);
  color: var(--primary);
  text-decoration:none;
}
.site-footer .social i{
  font-size: 18px;
}
.footer-copy{
  font-size: 12px;
  color: var(--muted);
}

/* Make room for fixed header/footer */
body{
  padding-top: 74px;
  padding-bottom: 86px;
}
@media (max-width:520px){
  body{ padding-top: 70px; padding-bottom: 92px; }
  .site-footer .social{ width:36px; height:36px; }
  .site-footer .social i{ font-size: 17px; }
}

/* Footer stacking */
.site-footer{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
}
.footer-icons{ margin-bottom:2px; }
.footer-copy{ width:100%; text-align:center; }



/* Inputs consistent */
.input, input, select, textarea{
  font-family: inherit;
}
.input{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  outline:none;
}
.input:focus{
  border-color: rgba(46,99,199,.35);
  box-shadow: 0 0 0 4px rgba(46,99,199,.10);
}

/* Modal font consistency */
/* Icons spacing RTL: icon before text */
button i, .nav a i{
  margin-left:8px;
  margin-right:0;
}

/* Global: English only */
html{ direction:ltr; }
body{
  font-family: "Cascadia Code", "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Hamburger color same as primary */
.hamburger svg{
  stroke: var(--primary);
}

/* Badges (status chips) */
.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius: 999px;
  border:1px solid rgba(15,23,42,.10);
  background:#fff;
  font-weight:600;
  font-size:13px;
}
.badge.success{
  background: rgba(34,197,94,.10);
  border-color: rgba(34,197,94,.25);
  color: #15803d;
}
.badge.info{
  background: rgba(46,99,199,.10);
  border-color: rgba(46,99,199,.25);
  color: var(--primary);
}
.badge.warn{
  background: rgba(245,158,11,.12);
  border-color: rgba(245,158,11,.28);
  color: #b45309;
}

.badge.danger{
  background: rgba(239,68,68,.10);
  border-color: rgba(239,68,68,.25);
  color: #b91c1c;
}

/* Footer always stacked */
.site-footer{ display:flex; flex-direction:column !important; }
.footer-icons{ width:100%; justify-content:center; }
.footer-copy{ display:block; width:100%; }

/* Icon spacing (LTR) */
button i, .nav a i{ margin-right:8px; margin-left:0; }

.modal button i{ margin-right:8px; }

/* Modal typography (do NOT override Font Awesome font) */
.modal{ font-family: inherit; }
.modal label, .modal input, .modal textarea, .modal select{ font-family: inherit; }

/* Ensure Font Awesome renders inside modals even if other rules touch fonts */
.modal .fa, .modal i[class^="fa-"], .modal i[class*=" fa-"]{
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
}

/* Admin mobile fixes */
.table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table{
  min-width: 760px;
}
@media (max-width: 700px){
  .table-wrap table{ min-width: 640px; }
  td, th{ white-space: nowrap; }
  td:last-child{ white-space: normal; }
  .actions-col form{ display:flex; flex-direction:column; gap:8px; min-width: 130px; }
  .actions-col button{ width:100%; }
  .badge{ white-space: nowrap; }
}
/* If actions column has no class, apply to any form inside table cells */
@media (max-width:700px){
  table td form{ display:flex; flex-direction:column; gap:8px; }
  table td form select{ width:100%; }
}

/* Admin: user line layout */
.user-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.user-badges{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.user-actions{ flex:0 0 auto; }
.user-kv{
  max-width: 520px;
}
.user-divider{
  height:1px;
  background: var(--line);
  margin: 14px 0;
}
@media (max-width:700px){
  .user-row{ flex-wrap:wrap; }
  .user-actions button{ width:auto; }
}

/* Admin user card layout v2 */
.user-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.user-kv{ margin-top:10px; }
.user-actions-bottom{
  margin-top:12px;
  display:flex;
  justify-content:flex-end;
}
@media (max-width:700px){
  .user-top{ flex-wrap:wrap; }
  .user-actions-bottom button{ width:100%; }
}

/* Miner edit mode */
button.danger{ background:#dc2626; color:#fff; }
button:disabled, .secondary:disabled{ opacity:.5; cursor:not-allowed; }
button:disabled:hover{ opacity:.5; }

.miner-card{ position:relative; }
.miner-select{ display:none; width:18px; height:18px; margin:0; cursor:pointer; }
.miner-select:disabled{ cursor:not-allowed; opacity:.45; }
#minersPanel.edit-mode .miner-select{ display:inline-block; }
/* In edit mode, replace Actions button with checkbox */
#minersPanel.edit-mode .miner-action-btn{ display:none; }
