:root{
  --bg:#04111c;
  --panel:#071b2a;
  --panel2:#0a2234;
  --line:#1c4059;
  --text:#edf6fc;
  --muted:#7892a7;
  --blue:#39a8ff;
  --teal:#22dab5;
  --red:#ff6c78;
}

*{box-sizing:border-box}

html,body{
  margin:0;
  min-height:100%;
  background:var(--bg);
  color:var(--text);
  font-family:Segoe UI,Tahoma,Arial,sans-serif;
}

body{overflow-x:hidden}

a{text-decoration:none;color:inherit}
button,input{font:inherit}

/* ================= LOGIN ================= */

.login-body{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  background:
    radial-gradient(circle at 18% 30%,rgba(44,121,255,.18),transparent 32%),
    radial-gradient(circle at 80% 75%,rgba(34,218,181,.08),transparent 28%),
    #04111c;
}

.login-brand{
  position:fixed;
  top:28px;
  left:34px;
  direction:ltr;
}

.login-brand b{
  display:block;
  color:var(--teal);
  font-size:25px;
  letter-spacing:2px;
}

.login-brand small{
  display:block;
  margin-top:5px;
  color:var(--muted);
  font-size:10px;
  letter-spacing:1.7px;
}

.login-card{
  width:min(440px,100%);
  padding:35px 32px;
  border:1px solid #28516c;
  border-radius:20px;
  background:rgba(7,25,40,.95);
  box-shadow:0 20px 70px rgba(0,0,0,.35);
}

.login-logo{
  width:68px;
  height:68px;
  margin:0 auto 14px;
  display:grid;
  place-items:center;
  border-radius:17px;
  border:1px solid #258477;
  color:var(--teal);
  font-size:30px;
  font-weight:700;
  background:#092438;
}

.login-card h1{
  margin:8px 0;
  text-align:center;
  color:var(--teal);
  letter-spacing:5px;
  font-size:29px;
  font-weight:600;
}

.login-card p{
  margin-bottom:25px;
  text-align:center;
  color:var(--muted);
  font-size:12px;
}

.login-card label{
  display:block;
  margin:15px 0 7px;
  font-size:12px;
  color:#c9d9e4;
}

.login-card input{
  width:100%;
  height:49px;
  padding:0 13px;
  border:1px solid var(--line);
  border-radius:10px;
  outline:0;
  background:#071824;
  color:var(--text);
}

.login-card input:focus{
  border-color:var(--blue);
  box-shadow:0 0 0 3px rgba(57,168,255,.10);
}

.primary,
.login-submit{
  border:1px solid #2776ab;
  background:linear-gradient(90deg,#16bdbd,#347eff,#623dff);
  color:white;
  cursor:pointer;
}

.login-submit{
  width:100%;
  height:50px;
  margin-top:22px;
  border-radius:10px;
}

.login-error{
  padding:10px;
  border:1px solid #7d3a45;
  border-radius:9px;
  color:#ffabb3;
  background:#35171e;
}

/* ================= MAIN SHELL ================= */

.shell{
  min-height:100vh;
  display:flex;
  direction:ltr;
}

.sidebar{
  width:126px;
  min-width:126px;
  height:100vh;
  position:sticky;
  top:0;
  overflow-y:auto;
  direction:rtl;
  border-right:1px solid var(--line);
  background:#061521;
}

.brand{
  height:82px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  border-bottom:1px solid var(--line);
}

.brand b{
  color:var(--teal);
  font-size:17px;
}

.brand small{
  margin-top:5px;
  color:var(--muted);
  font-size:7px;
}

.sidebar nav{padding:8px}

.nav-item{
  min-height:48px;
  margin-bottom:5px;
  padding:5px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  border-radius:8px;
  color:#829bac;
  font-size:10px;
}

.nav-icon{font-size:18px}

.nav-item:hover,
.nav-item.active{
  background:#0b293b;
  color:#fff;
}

.nav-item.active{
  border:1px solid #22516d;
  color:#55b8ff;
}

.main{
  flex:1;
  min-width:0;
  direction:rtl;
}

.topbar{
  min-height:62px;
  display:flex;
  align-items:center;
  gap:13px;
  padding:8px 17px;
  position:sticky;
  top:0;
  z-index:50;
  direction:ltr;
  border-bottom:1px solid var(--line);
  background:#061724;
}

.xray-status{
  display:flex;
  align-items:center;
  gap:7px;
  white-space:nowrap;
  padding:7px 11px;
  border:1px solid var(--line);
  border-radius:18px;
  font-size:11px;
}

.xray-status i{
  width:7px;
  height:7px;
  border-radius:50%;
}

.xray-status.ok i{
  background:var(--teal);
  box-shadow:0 0 8px var(--teal);
}

.xray-status.bad i{background:var(--red)}

.xray-tools{
  flex:1;
  display:grid;
  grid-template-columns:repeat(7,minmax(85px,1fr));
  min-width:0;
}

.xray-tools form{margin:0}

.xray-tools a,
.xray-tools button{
  width:100%;
  height:40px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  border:0;
  border-left:1px solid var(--line);
  background:transparent;
  color:#a6bac8;
  font-size:12px;
  font-weight:400;
  cursor:pointer;
}

.xray-tools a:hover,
.xray-tools button:hover{
  background:#0b2839;
  color:#fff;
}

.mobile-menu{display:none}

.content{
  width:100%;
  max-width:1800px;
  margin:auto;
  padding:18px;
}

.page-head{
  margin-bottom:15px;
}

.page-head small{
  color:var(--teal);
  font-size:9px;
}

.page-head h1{
  margin:4px 0;
  font-size:22px;
  font-weight:500;
}

.metric-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
}

.metric-card,
.panel,
.action-card,
.backup-card,
.empty-page{
  min-width:0;
  border:1px solid var(--line);
  border-radius:12px;
  background:linear-gradient(180deg,#081c2a,#061723);
}

.metric-card{
  min-height:190px;
  padding:16px;
}

.metric-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  color:#8ca5b7;
  font-size:11px;
}

.metric-title b{color:var(--blue)}

.metric-card strong{
  display:block;
  margin-top:32px;
  font-size:34px;
  font-weight:500;
}

.metric-card small{
  display:block;
  margin-top:7px;
  color:var(--muted);
}

.panel-grid{
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:12px;
  margin-top:12px;
}

.panel{padding:16px}

.traffic-values{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:15px;
}

.traffic-values div,
.kv{
  border-bottom:1px solid #133247;
  padding:12px;
}

.graph-placeholder{
  height:130px;
  margin-top:12px;
  display:grid;
  place-items:center;
  border:1px dashed #234c66;
  border-radius:9px;
  color:#315c74;
}

.section-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.filter-input{
  width:min(280px,100%);
  height:40px;
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#071824;
  color:white;
}

.table-wrap{
  overflow:auto;
  border:1px solid var(--line);
  border-radius:11px;
}

.data-table{
  width:100%;
  min-width:720px;
  border-collapse:collapse;
}

.data-table th,
.data-table td{
  padding:13px 14px;
  text-align:right;
  border-bottom:1px solid #133247;
}

.data-table th{
  color:#7896aa;
  font-size:10px;
}

.pill{
  padding:4px 8px;
  border-radius:12px;
  background:#102a3b;
  font-size:9px;
}

.pill.green{
  color:#51e4c2;
  background:rgba(34,218,181,.08);
}

.backup-list{
  display:grid;
  gap:9px;
}

.backup-card{
  padding:13px;
  display:grid;
  grid-template-columns:minmax(0,1fr) 110px 230px;
  gap:12px;
  align-items:center;
  direction:ltr;
}

.backup-name b,
.backup-name small{
  display:block;
}

.backup-name small{
  color:var(--muted);
  margin-top:5px;
}

.backup-actions{
  display:flex;
  gap:6px;
}

button,
.backup-actions a{
  min-height:37px;
  padding:7px 11px;
  border:1px solid #24516d;
  border-radius:8px;
  background:#0b2940;
  color:white;
}

.action-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.action-card{padding:18px}

.log-box{
  max-height:500px;
  overflow:auto;
  direction:ltr;
  text-align:left;
  padding:12px;
  border-radius:8px;
  background:#020a11;
  color:#a5c0d2;
  white-space:pre-wrap;
}

.empty-page{
  min-height:430px;
  display:grid;
  place-items:center;
  text-align:center;
  padding:30px;
}

.overlay{display:none}

#toast{
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translateX(-50%);
  z-index:1000;
}

/* ================= MOBILE ================= */

@media(max-width:700px){

  .sidebar{
    position:fixed;
    left:0;
    top:0;
    z-index:100;
    width:260px;
    min-width:260px;
    transform:translateX(-105%);
    transition:.2s;
    box-shadow:12px 0 35px rgba(0,0,0,.4);
  }

  .sidebar.open{transform:translateX(0)}

  .sidebar .brand{
    align-items:flex-start;
    padding:0 15px;
  }

  .nav-item{
    flex-direction:row;
    justify-content:flex-start;
    padding:0 12px;
    font-size:12px;
  }

  .nav-icon{
    width:28px;
    text-align:center;
  }

  .topbar{
    height:58px;
    min-height:58px;
    padding:6px 8px;
    gap:6px;
    overflow:hidden;
  }

  .mobile-menu{
    display:block;
    flex:0 0 38px;
    width:38px;
    height:38px;
    padding:0;
  }

  .xray-status{
    flex:0 0 auto;
    font-size:9px;
    padding:6px 8px;
  }

  .xray-tools{
    display:flex;
    overflow-x:auto;
    scrollbar-width:none;
  }

  .xray-tools::-webkit-scrollbar{display:none}

  .xray-tools a,
  .xray-tools button{
    flex:0 0 72px;
    height:36px;
    font-size:10px;
  }

  .xray-tools span{display:none}

  .content{padding:9px}

  .metric-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
  }

  .metric-card{
    min-height:140px;
    padding:10px;
  }

  .metric-card strong{
    margin-top:20px;
    font-size:25px;
  }

  .panel-grid{
    grid-template-columns:1fr;
    gap:8px;
  }

  .section-bar{
    flex-direction:column;
    align-items:stretch;
  }

  .filter-input{width:100%}

  .action-grid{grid-template-columns:1fr}

  .backup-card{
    grid-template-columns:1fr;
  }

  .backup-actions{
    flex-wrap:wrap;
  }

  .backup-actions a,
  .backup-actions button{
    flex:1;
    text-align:center;
  }

  .overlay{
    position:fixed;
    inset:0;
    z-index:90;
    background:rgba(0,0,0,.58);
  }

  .overlay.show{display:block}

  .login-body{padding:15px}

  .login-brand{
    top:14px;
    left:15px;
  }

  .login-card{
    padding:24px 18px;
    border-radius:15px;
  }
}

/* ==================================================
   BOLAMAJ V3 GLOBAL THEME + LANGUAGE CONTROLS
   ================================================== */

html{
  color-scheme:dark;
}

html[data-theme="light"]{
  color-scheme:light;

  --bg:#edf4f9;
  --panel:#ffffff;
  --panel2:#f5f9fc;
  --line:#c9d9e5;
  --text:#152536;
  --muted:#657d90;
  --blue:#177ed1;
  --teal:#009f89;
  --red:#d94856;
}

html[data-theme="light"] body,
html[data-theme="light"] .login-body{
  background:
    radial-gradient(circle at 18% 30%,rgba(44,121,255,.10),transparent 32%),
    radial-gradient(circle at 80% 75%,rgba(34,218,181,.07),transparent 28%),
    #edf4f9!important;
}

html[data-theme="light"] .login-card,
html[data-theme="light"] .sidebar,
html[data-theme="light"] .topbar,
html[data-theme="light"] .metric-card,
html[data-theme="light"] .panel,
html[data-theme="light"] .action-card,
html[data-theme="light"] .backup-card,
html[data-theme="light"] .empty-page{
  background:#ffffff!important;
}

html[data-theme="light"] .login-card input,
html[data-theme="light"] .filter-input{
  background:#f5f9fc!important;
  color:#152536!important;
}

.global-controls{
  display:flex;
  align-items:center;
  direction:ltr;
  gap:7px;
  z-index:2000;
}

.login-controls{
  position:fixed;
  top:25px;
  right:30px;
}

.dashboard-controls{
  flex:0 0 auto;
}

.ui-menu{
  position:relative;
}

.ui-menu-btn{
  min-width:86px;
  height:38px;
  min-height:38px;
  padding:0 11px;

  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;

  border:1px solid var(--line);
  border-radius:18px;

  background:var(--panel2);
  color:var(--text);

  font-size:11px;
  font-weight:400;

  cursor:pointer;
}

.ui-menu-btn:hover{
  border-color:var(--blue);
}

.ui-dropdown{
  display:none;

  position:absolute;
  top:calc(100% + 7px);
  right:0;

  min-width:155px;
  padding:6px;

  border:1px solid var(--line);
  border-radius:11px;

  background:var(--panel);
  box-shadow:0 15px 40px rgba(0,0,0,.28);

  z-index:3000;
}

.ui-menu.open .ui-dropdown{
  display:block;
}

.ui-dropdown button{
  width:100%;
  min-height:38px;

  display:flex;
  align-items:center;

  border:0;
  border-radius:7px;

  padding:7px 10px;

  background:transparent;
  color:var(--text);

  font-size:11px;
  text-align:left;

  cursor:pointer;
}

.ui-dropdown button:hover{
  background:rgba(53,167,255,.12);
}

html[dir="ltr"] body{
  direction:ltr;
}

html[dir="ltr"] .main,
html[dir="ltr"] .content,
html[dir="ltr"] .data-table{
  direction:ltr;
}

html[dir="ltr"] .data-table th,
html[dir="ltr"] .data-table td{
  text-align:left;
}

/* MOBILE */
@media(max-width:700px){

  .login-controls{
    top:12px;
    right:12px;
  }

  .login-brand{
    top:72px!important;
  }

  .ui-menu-btn{
    min-width:50px;
    width:auto;
    height:36px;
    min-height:36px;
    padding:0 9px;
    font-size:10px;
  }

  .login-controls .control-text{
    display:none;
  }

  .dashboard-controls{
    flex:0 0 auto;
  }

  .dashboard-controls .ui-menu-btn{
    min-width:42px;
  }

  .dashboard-controls .control-text{
    display:none;
  }

  .ui-dropdown{
    position:fixed;
    top:62px;
    right:8px;
    width:min(190px,calc(100vw - 16px));
  }
}

/* ===== LIVE CHARTS ===== */

.mini-chart{
  width:100%;
  height:48px;
  margin-top:14px;
}

.mini-chart canvas,
.network-chart-box canvas{
  width:100%!important;
  height:100%!important;
  display:block;
}

.network-chart-box{
  width:100%;
  height:170px;
  margin-top:12px;
  border:1px solid var(--line);
  border-radius:9px;
  padding:6px;
  background:
    linear-gradient(rgba(30,73,101,.14) 1px,transparent 1px),
    linear-gradient(90deg,rgba(30,73,101,.14) 1px,transparent 1px);
  background-size:30px 30px;
}

.kv{
  gap:22px!important;
}

.kv span,
.kv b{
  display:block;
}

@media(max-width:700px){

  .mini-chart{
    height:40px;
    margin-top:9px;
  }

  .network-chart-box{
    height:135px;
  }

  .kv{
    gap:12px!important;
  }
}

/* ===== SYSTEM INFORMATION ===== */

.system-info-grid{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:9px;
  margin-top:12px;
}

.system-info-grid article{
  min-width:0;
  min-height:82px;

  padding:13px;

  border:1px solid var(--line);
  border-radius:10px;

  background:var(--panel);
}

.system-info-grid small{
  display:block;
  color:var(--muted);
  font-size:9px;
}

.system-info-grid b{
  display:block;

  margin-top:11px;

  overflow:hidden;
  text-overflow:ellipsis;

  font-size:14px;
  font-weight:500;

  direction:ltr;
}

@media(max-width:1000px){
  .system-info-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
}

@media(max-width:700px){

  .system-info-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px;
  }

  .system-info-grid article{
    min-height:70px;
    padding:10px;
  }

  .system-info-grid b{
    font-size:12px;
  }
}

/* ==================================================
   BOLAMAJ V3 MODULE SYSTEM
   ================================================== */

.v3-summary-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:9px;
  margin-bottom:12px;
}

.v3-info-card{
  min-width:0;
  min-height:92px;
  padding:13px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--panel);
}

.v3-info-card small{
  display:block;
  color:var(--muted);
  font-size:9px;
}

.v3-info-card b{
  display:block;
  margin-top:10px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:16px;
  font-weight:500;
}

.v3-info-card span{
  display:block;
  margin-top:6px;
  color:var(--muted);
  font-size:9px;
}

.v3-panel{
  width:100%;
  padding:16px;
  margin-bottom:12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--panel);
}

.v3-panel h2{
  margin:0 0 14px;
  font-size:17px;
  font-weight:500;
}

.v3-panel p{
  color:var(--muted);
  font-size:11px;
  line-height:1.9;
}

.v3-panel-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}

.v3-panel-head small,
.v3-panel-head span{
  color:var(--muted);
  font-size:9px;
}

.v3-row{
  min-height:48px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:18px;
  border-bottom:1px solid var(--line);
  font-size:11px;
}

.v3-row:last-child{
  border-bottom:0;
}

.v3-row span{
  color:var(--muted);
}

.v3-row b{
  font-weight:500;
}

.v3-muted{
  color:var(--muted);
  text-align:center!important;
}

.v3-settings-tabs{
  display:flex;
  gap:6px;
  overflow-x:auto;
  margin-bottom:12px;
  scrollbar-width:none;
}

.v3-settings-tabs::-webkit-scrollbar{
  display:none;
}

.v3-settings-tabs span{
  flex:0 0 auto;
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:8px;
  color:var(--muted);
  font-size:10px;
}

.v3-settings-tabs span.active{
  color:var(--blue);
  border-color:var(--blue);
  background:rgba(53,167,255,.08);
}

.v3-metrics-chart{
  width:100%;
  height:280px;
  border:1px solid var(--line);
  border-radius:9px;
}

.v3-metrics-chart canvas{
  width:100%!important;
  height:100%!important;
}

html[data-theme="light"] .v3-info-card,
html[data-theme="light"] .v3-panel{
  background:#fff;
}


/* MOBILE */

@media(max-width:700px){

  .v3-summary-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px;
  }

  .v3-info-card{
    min-height:78px;
    padding:10px;
  }

  .v3-info-card b{
    font-size:13px;
  }

  .v3-panel{
    padding:12px;
    border-radius:10px;
  }

  .v3-panel h2{
    font-size:14px;
  }

  .v3-panel-head{
    align-items:flex-start;
    flex-direction:column;
  }

  .v3-row{
    min-height:44px;
    gap:10px;
  }

  .v3-metrics-chart{
    height:190px;
  }
}

/* ===== V3 BACKUP CENTER ===== */

.v3-backup-list{
  display:grid;
  gap:9px;
}

.v3-backup-card{
  width:100%;
  min-height:76px;

  display:grid;
  grid-template-columns:minmax(0,1fr) 110px 300px;
  align-items:center;

  gap:12px;

  padding:12px 14px;

  border:1px solid var(--line);
  border-radius:11px;

  background:var(--panel);

  direction:ltr;
}

.v3-backup-main{
  min-width:0;
}

.v3-backup-main b{
  display:block;

  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;

  font-size:12px;
  font-weight:500;
}

.v3-backup-main small{
  display:block;

  margin-top:5px;

  color:var(--muted);

  font-size:10px;
}

.v3-backup-size{
  color:var(--muted);
  font-size:11px;
}

.v3-backup-actions{
  display:flex;
  justify-content:flex-end;
  align-items:center;

  gap:6px;
}

.v3-backup-actions form{
  margin:0;
}

.v3-backup-actions a,
.v3-backup-actions button{
  min-height:35px;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  padding:0 10px;

  border:1px solid #24516d;
  border-radius:7px;

  background:#0b2940;
  color:#dcecf7;

  font-size:10px;
  text-decoration:none;

  cursor:pointer;
}

.v3-backup-actions .danger{
  color:#ffafb7;
  border-color:#643640;
  background:#25141a;
}

@media(max-width:700px){

  .v3-backup-card{
    grid-template-columns:1fr;

    gap:8px;

    padding:11px;
  }

  .v3-backup-size{
    padding-top:7px;

    border-top:1px solid var(--line);
  }

  .v3-backup-actions{
    width:100%;

    justify-content:stretch;

    flex-wrap:wrap;
  }

  .v3-backup-actions form,
  .v3-backup-actions a{
    flex:1;
  }

  .v3-backup-actions button,
  .v3-backup-actions a{
    width:100%;
  }
}

/* ===== V3 BACKUP CENTER ===== */

.v3-backup-list{
  display:grid;
  gap:9px;
}

.v3-backup-card{
  width:100%;
  min-height:76px;

  display:grid;
  grid-template-columns:minmax(0,1fr) 110px 300px;
  align-items:center;

  gap:12px;

  padding:12px 14px;

  border:1px solid var(--line);
  border-radius:11px;

  background:var(--panel);

  direction:ltr;
}

.v3-backup-main{
  min-width:0;
}

.v3-backup-main b{
  display:block;

  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;

  font-size:12px;
  font-weight:500;
}

.v3-backup-main small{
  display:block;

  margin-top:5px;

  color:var(--muted);

  font-size:10px;
}

.v3-backup-size{
  color:var(--muted);
  font-size:11px;
}

.v3-backup-actions{
  display:flex;
  justify-content:flex-end;
  align-items:center;

  gap:6px;
}

.v3-backup-actions form{
  margin:0;
}

.v3-backup-actions a,
.v3-backup-actions button{
  min-height:35px;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  padding:0 10px;

  border:1px solid #24516d;
  border-radius:7px;

  background:#0b2940;
  color:#dcecf7;

  font-size:10px;
  text-decoration:none;

  cursor:pointer;
}

.v3-backup-actions .danger{
  color:#ffafb7;
  border-color:#643640;
  background:#25141a;
}

@media(max-width:700px){

  .v3-backup-card{
    grid-template-columns:1fr;

    gap:8px;

    padding:11px;
  }

  .v3-backup-size{
    padding-top:7px;

    border-top:1px solid var(--line);
  }

  .v3-backup-actions{
    width:100%;

    justify-content:stretch;

    flex-wrap:wrap;
  }

  .v3-backup-actions form,
  .v3-backup-actions a{
    flex:1;
  }

  .v3-backup-actions button,
  .v3-backup-actions a{
    width:100%;
  }
}

/* ==================================================
   BOLAMAJ V3 APPEARANCE SETTINGS
   ================================================== */

:root{
  --ui-font:Segoe UI,Tahoma,Arial,sans-serif;
  --ui-scale:1;
}

html{
  font-size:calc(16px * var(--ui-scale));
}

body,
button,
input,
select,
textarea{
  font-family:var(--ui-font);
}

.appearance-settings{
  width:100%;
}

.settings-intro{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:20px 22px;
  margin-bottom:14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:linear-gradient(135deg,#092235,#071824);
}

.settings-intro small{
  color:var(--teal);
  font-size:9px;
  letter-spacing:1px;
}

.settings-intro h2{
  margin:6px 0 4px;
  font-size:21px;
  font-weight:500;
}

.settings-intro p{
  margin:0;
  color:var(--muted);
  font-size:12px;
}

.settings-reset{
  min-height:40px;
  padding:0 15px;
  border:1px solid var(--line);
  border-radius:9px;
  background:#0a2233;
  color:#a9c0cf;
  cursor:pointer;
}

.settings-reset:hover{
  color:#fff;
  border-color:#2c7fb2;
}

.appearance-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.appearance-card{
  min-width:0;
  padding:20px;
  border:1px solid var(--line);
  border-radius:14px;
  background:linear-gradient(180deg,#081d2c,#061723);
}

.appearance-icon{
  width:43px;
  height:43px;
  display:grid;
  place-items:center;
  margin-bottom:15px;
  border:1px solid #225a78;
  border-radius:11px;
  background:#0b2a3d;
  color:#49b6ff;
  font-size:17px;
}

.appearance-title h3{
  margin:0;
  font-size:17px;
  font-weight:500;
}

.appearance-title p{
  margin:5px 0 18px;
  color:var(--muted);
  font-size:11px;
}

.choice-grid,
.font-choice-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
}

.language-settings{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.choice-grid button,
.font-choice-grid button,
.language-settings button{
  min-height:76px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:7px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#071a28;
  color:#9eb4c3;
  cursor:pointer;
  transition:.15s ease;
}

.choice-grid button:hover,
.font-choice-grid button:hover,
.language-settings button:hover{
  border-color:#2c82b7;
  background:#0a2639;
  color:#fff;
}

.choice-grid button.selected,
.font-choice-grid button.selected,
.language-settings button.selected{
  border-color:#26a9ff;
  background:#0b3047;
  color:#fff;
  box-shadow:inset 0 0 0 1px rgba(38,169,255,.15);
}

.choice-grid button b,
.font-choice-grid button b,
.language-settings button b{
  font-size:18px;
  font-weight:500;
}

.choice-grid button span,
.font-choice-grid button span,
.language-settings button span{
  font-size:11px;
}

.font-tahoma{
  font-family:Tahoma,sans-serif !important;
}

.font-arial{
  font-family:Arial,sans-serif !important;
}

.settings-note{
  margin-top:14px;
  padding:13px 15px;
  border:1px solid rgba(32,211,175,.25);
  border-radius:10px;
  background:rgba(32,211,175,.05);
  color:#8da9b9;
  font-size:11px;
}

.settings-note span{
  color:var(--teal);
  margin-inline-end:6px;
}

/* MOBILE */
@media(max-width:760px){

  .settings-intro{
    align-items:flex-start;
    flex-direction:column;
    padding:16px;
  }

  .settings-reset{
    width:100%;
  }

  .appearance-grid{
    grid-template-columns:1fr;
  }

  .appearance-card{
    padding:16px;
  }

  .choice-grid,
  .font-choice-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  .choice-grid button,
  .font-choice-grid button{
    min-height:68px;
    padding:5px;
  }

  .appearance-title h3{
    font-size:16px;
  }
}

@media(max-width:420px){

  .choice-grid,
  .font-choice-grid{
    gap:5px;
  }

  .choice-grid button span,
  .font-choice-grid button span{
    font-size:9px;
  }
}


/* =====================================================
   XRAY COMMAND BAR
   ===================================================== */

.xray-commandbar{
 display:flex;
 flex:1;
 align-items:center;
 min-width:0;
 height:46px;
 direction:ltr;
}

.xray-commandbar form{
 margin:0;
 flex:1;
}

.xray-version-chip,
.xcmd{
 height:42px;
 min-height:42px;
 border:0;
 border-right:1px solid var(--line);
 border-radius:0;
 background:transparent;
 color:#a8bac8;
 cursor:pointer;
}

.xray-version-chip{
 flex:0 0 auto;
 min-width:175px;
 display:flex;
 align-items:center;
 justify-content:center;
 gap:7px;
 border:1px solid var(--line);
 border-radius:18px;
 margin-right:8px;
 font-size:11px;
}

.xray-version-chip i{
 width:7px;
 height:7px;
 border-radius:50%;
}

.xray-version-chip.ok i{
 background:var(--teal);
 box-shadow:0 0 8px var(--teal);
}

.xray-version-chip.bad i{
 background:var(--red);
}

.xray-version-chip b{
 font-weight:400;
 color:#8497a6;
}

.xcmd{
 width:100%;
 display:flex;
 align-items:center;
 justify-content:center;
 gap:7px;
 font-size:12px;
}

.xcmd:hover{
 color:#fff;
 background:#091f2e;
}

.xcmd.restart{
 color:#54a9ff;
}

.xcmd.stop{
 color:#b6b6b6;
}


/* =====================================================
   XRAY MODAL
   ===================================================== */

.modal-open{
 overflow:hidden;
}

.xmodal-backdrop{
 display:none;
 position:fixed;
 inset:0;
 z-index:5000;
 align-items:center;
 justify-content:center;
 padding:20px;
 background:rgba(0,0,0,.66);
 backdrop-filter:blur(2px);
}

.xmodal-backdrop.show{
 display:flex;
}

.xmodal{
 width:min(860px,96vw);
 max-height:88vh;
 display:flex;
 flex-direction:column;
 overflow:hidden;
 border:1px solid #30353d;
 border-radius:13px;
 background:#171a1f;
 box-shadow:0 25px 80px rgba(0,0,0,.55);
 direction:ltr;
}

.xmodal-head{
 min-height:54px;
 display:flex;
 align-items:center;
 justify-content:space-between;
 padding:0 20px;
}

.xmodal-head h2{
 margin:0;
 font-size:16px;
 font-weight:600;
}

.xmodal-close{
 width:34px;
 min-height:34px;
 border:0;
 background:transparent;
 color:#7f858c;
 font-size:28px;
}

.xmodal-body{
 overflow:auto;
 padding:0 20px 20px;
}

.xnotice{
 padding:13px;
 margin-bottom:12px;
 border-radius:8px;
 font-size:12px;
 line-height:1.6;
}

.xnotice.warn{
 border:1px solid #74570c;
 background:#352708;
 color:#e8d59e;
}

.xnotice.danger{
 border:1px solid #74333d;
 background:#361a20;
 color:#ffb5bc;
}

.xcurrent{
 display:flex;
 justify-content:space-between;
 padding:12px;
 border:1px solid #33383f;
 border-radius:8px 8px 0 0;
}

.xversion-list{
 border:1px solid #33383f;
 border-top:0;
 border-radius:0 0 8px 8px;
}

.xversion-row{
 min-height:47px;
 display:flex;
 align-items:center;
 justify-content:space-between;
 padding:0 16px;
 border-bottom:1px solid #30343a;
}

.xversion-row:last-child{
 border-bottom:0;
}

.xmodal-actions{
 display:flex;
 justify-content:flex-end;
 gap:8px;
 margin-top:14px;
}

.xprimary{
 background:#1268d9!important;
 border-color:#287ee9!important;
}

.xlog-toolbar{
 display:flex;
 align-items:center;
 gap:8px;
 margin-bottom:14px;
 flex-wrap:wrap;
}

.xlog-toolbar select{
 min-height:36px;
 border:1px solid #3b4048;
 border-radius:5px;
 background:#16191e;
 color:#ddd;
 padding:0 10px;
}

.xlog-toolbar label{
 display:flex;
 align-items:center;
 gap:5px;
 font-size:11px;
}

.xlog-output{
 height:390px;
 overflow:auto;
 margin:0;
 padding:12px;
 border:1px solid #373c44;
 border-radius:7px;
 background:#24282e;
 color:#e2e6eb;
 font:11px/1.65 Consolas,monospace;
 white-space:pre-wrap;
 text-align:left;
 direction:ltr;
}

.xconfig-editor{
 height:390px;
 overflow:auto;
 padding:14px;
 border:1px solid #39404a;
 border-radius:7px;
 background:#050505;
 color:#d6dce4;
 font:11px/1.55 Consolas,monospace;
 white-space:pre;
 direction:ltr;
 text-align:left;
}

.xbackup-box{
 border:1px solid #343940;
 border-radius:8px;
 overflow:hidden;
}

.xbackup-box article{
 min-height:104px;
 display:flex;
 justify-content:space-between;
 align-items:center;
 gap:20px;
 padding:16px 22px;
 border-bottom:1px solid #343940;
}

.xbackup-box article:last-child{
 border-bottom:0;
}

.xbackup-box h3{
 margin:0 0 7px;
 font-size:14px;
}

.xbackup-box p{
 max-width:620px;
 margin:0;
 color:#8e9299;
 line-height:1.7;
 font-size:12px;
}

.xicon-action{
 width:38px;
 height:38px;
 display:grid;
 place-items:center;
 flex:0 0 38px;
 border-radius:7px;
 background:#1268d9;
 color:white;
}

.xhistory-tabs{
 display:flex;
 gap:6px;
 overflow-x:auto;
 border-bottom:1px solid #343940;
 margin-bottom:24px;
}

.xhistory-tabs button{
 min-height:40px;
 border:0;
 border-radius:0;
 background:transparent;
 color:#c5c8cd;
 white-space:nowrap;
}

.xhistory-tabs button.active{
 color:#2684ff;
 border-bottom:2px solid #2684ff;
}

.xhistory-chart{
 height:330px;
 padding:15px;
 border:1px solid #343940;
 border-radius:12px;
 background:#1d222a;
}

.xhistory-chart canvas{
 width:100%!important;
 height:100%!important;
}

.xmetric-tabs{
 display:grid;
 grid-template-columns:repeat(5,1fr);
 gap:8px;
}

.xmetric-tabs div{
 min-height:100px;
 padding:14px;
 border:1px solid #363b43;
 border-radius:8px;
 background:#1d222a;
}

.xmetric-tabs small{
 display:block;
 color:#8c9299;
 font-size:9px;
}

.xmetric-tabs b{
 display:block;
 margin-top:16px;
 font-size:17px;
 font-weight:500;
}

.xmetric-empty,
.xempty,
.xloading{
 padding:30px;
 text-align:center;
 color:#858b93;
}


/* ================= MOBILE ================= */

@media(max-width:700px){

 .xray-commandbar{
  overflow-x:auto;
  scrollbar-width:none;
 }

 .xray-commandbar::-webkit-scrollbar{
  display:none;
 }

 .xray-commandbar form{
  flex:0 0 auto;
 }

 .xray-version-chip{
  flex:0 0 130px;
  min-width:130px;
  margin-right:3px;
  font-size:9px;
 }

 .xray-version-chip span{
  display:none;
 }

 .xcmd{
  flex:0 0 58px;
  width:58px;
 }

 .xcmd span{
  display:none;
 }

 .xmodal-backdrop{
  padding:0;
  align-items:flex-end;
 }

 .xmodal{
  width:100vw;
  max-width:none;
  max-height:92vh;
  border-radius:15px 15px 0 0;
 }

 .xmodal-head{
  padding:0 14px;
 }

 .xmodal-body{
  padding:0 12px 16px;
 }

 .xlog-output,
 .xconfig-editor{
  height:55vh;
  font-size:10px;
 }

 .xhistory-chart{
  height:240px;
  padding:8px;
 }

 .xmetric-tabs{
  grid-template-columns:repeat(2,minmax(0,1fr));
 }

 .xbackup-box article{
  padding:13px;
 }

}

/* =========================================================
   BOLAMAJ V3 - DEEP BLACK THEME
   ========================================================= */

html[data-theme="dark"]{
  --bg:#050607;
  --panel:#0d0f12;
  --panel2:#111419;
  --line:#242a31;
  --text:#f0f2f4;
  --muted:#818992;

  --blue:#2c8cff;
  --teal:#17d7b0;
  --red:#ff5f6d;
}

html[data-theme="dark"] body{
  background:#050607 !important;
}

html[data-theme="dark"] .main{
  background:#050607;
}

html[data-theme="dark"] .sidebar{
  background:#080a0d !important;
  border-color:#20252b !important;
}

html[data-theme="dark"] .topbar{
  background:#080a0d !important;
  border-color:#20252b !important;
}

html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .system-info-grid article,
html[data-theme="dark"] .v3-panel,
html[data-theme="dark"] .v3-info-card{
  background:#0d0f12 !important;
  border-color:#242a31 !important;
}

html[data-theme="dark"] .network-chart-box{
  background:
    linear-gradient(rgba(65,75,86,.11) 1px,transparent 1px),
    linear-gradient(90deg,rgba(65,75,86,.11) 1px,transparent 1px),
    #0a0c0f !important;

  border-color:#222831 !important;
}


/* =========================================================
   DASHBOARD - DESKTOP COMPACT
   ========================================================= */

@media(min-width:701px){

  body.dashboard-compact .content{
    padding:10px 14px 12px !important;
    max-width:1800px;
  }

  body.dashboard-compact .page-head{
    display:none !important;
    margin:0 !important;
    padding:0 !important;
  }


  /* ---- hardware row ---- */

  body.dashboard-compact .metric-grid{
    gap:10px !important;
  }

  body.dashboard-compact .metric-card{
    min-height:148px !important;
    height:148px;
    padding:12px 14px !important;
    border-radius:10px !important;
    overflow:hidden;
  }

  body.dashboard-compact .metric-title{
    font-size:10px !important;
  }

  body.dashboard-compact .metric-card strong{
    margin-top:13px !important;
    font-size:30px !important;
    line-height:1 !important;
  }

  body.dashboard-compact .metric-card > small{
    margin-top:6px !important;
    font-size:10px !important;
  }

  body.dashboard-compact .mini-chart{
    height:34px !important;
    margin-top:9px !important;
  }


  /* ---- network/system row ---- */

  body.dashboard-compact .panel-grid{
    grid-template-columns:minmax(0,2.25fr) minmax(255px,.75fr) !important;
    gap:10px !important;
    margin-top:10px !important;
  }

  body.dashboard-compact .panel{
    padding:12px 14px !important;
    border-radius:10px !important;
  }

  body.dashboard-compact .panel-head h2{
    margin:3px 0 2px !important;
    font-size:18px !important;
  }

  body.dashboard-compact .panel-head small{
    font-size:9px !important;
  }

  body.dashboard-compact .traffic-values{
    gap:8px !important;
    margin-top:5px !important;
  }

  body.dashboard-compact .traffic-values div{
    padding:7px 8px !important;
  }

  body.dashboard-compact .traffic-values small{
    font-size:9px !important;
  }

  body.dashboard-compact .traffic-values b{
    font-size:11px !important;
  }

  body.dashboard-compact .network-chart-box{
    height:172px !important;
    margin-top:6px !important;
    padding:4px !important;
    border-radius:8px !important;
  }


  /* ---- system card beside network ---- */

  body.dashboard-compact .kv{
    min-height:38px;
    padding:6px 4px !important;

    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:14px !important;
  }

  body.dashboard-compact .kv span{
    font-size:10px !important;
    color:var(--muted);
  }

  body.dashboard-compact .kv b{
    margin:0 !important;
    font-size:11px !important;
    text-align:left;
    direction:ltr;
  }


  /* ---- IPv4 / Process / TCP... ---- */

  body.dashboard-compact .system-info-grid{
    grid-template-columns:repeat(6,minmax(0,1fr)) !important;
    gap:8px !important;
    margin-top:10px !important;
  }

  body.dashboard-compact .system-info-grid article{
    min-height:57px !important;
    height:57px;
    padding:8px 10px !important;
    border-radius:9px !important;
  }

  body.dashboard-compact .system-info-grid small{
    font-size:8px !important;
  }

  body.dashboard-compact .system-info-grid b{
    margin-top:5px !important;
    font-size:11px !important;
    line-height:1.1 !important;
  }

}


/* =========================================================
   DASHBOARD - TABLET
   ========================================================= */

@media(min-width:701px) and (max-width:1050px){

  body.dashboard-compact .metric-card{
    height:142px;
    min-height:142px !important;
  }

  body.dashboard-compact .panel-grid{
    grid-template-columns:minmax(0,1.7fr) minmax(240px,.8fr) !important;
  }

  body.dashboard-compact .network-chart-box{
    height:158px !important;
  }

  body.dashboard-compact .system-info-grid{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }

  body.dashboard-compact .system-info-grid article{
    height:auto;
    min-height:56px !important;
  }

}


/* =========================================================
   DASHBOARD - MOBILE
   ========================================================= */

@media(max-width:700px){

  body.dashboard-compact .content{
    padding:7px !important;
  }

  body.dashboard-compact .page-head{
    display:none !important;
  }

  body.dashboard-compact .metric-grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:6px !important;
  }

  body.dashboard-compact .metric-card{
    min-height:124px !important;
    height:124px;
    padding:9px !important;
    border-radius:9px !important;
  }

  body.dashboard-compact .metric-title{
    font-size:9px !important;
  }

  body.dashboard-compact .metric-card strong{
    margin-top:11px !important;
    font-size:23px !important;
  }

  body.dashboard-compact .metric-card > small{
    margin-top:5px !important;
    font-size:8px !important;
  }

  body.dashboard-compact .mini-chart{
    height:31px !important;
    margin-top:7px !important;
  }


  /*
   * موبایل عمداً تک‌ستونه:
   * نمودار Network له نمی‌شود.
   */
  body.dashboard-compact .panel-grid{
    grid-template-columns:1fr !important;
    gap:7px !important;
    margin-top:7px !important;
  }

  body.dashboard-compact .panel{
    padding:10px !important;
  }

  body.dashboard-compact .panel-head h2{
    font-size:15px !important;
    margin:2px 0 !important;
  }

  body.dashboard-compact .traffic-values{
    margin-top:5px !important;
    gap:5px !important;
  }

  body.dashboard-compact .traffic-values div{
    padding:6px !important;
  }

  body.dashboard-compact .network-chart-box{
    height:138px !important;
    margin-top:5px !important;
  }


  body.dashboard-compact .kv{
    min-height:37px;
    padding:6px 3px !important;

    display:flex;
    justify-content:space-between;
    align-items:center;

    gap:10px !important;
  }

  body.dashboard-compact .kv span{
    font-size:9px !important;
  }

  body.dashboard-compact .kv b{
    font-size:10px !important;
    margin:0 !important;
  }


  body.dashboard-compact .system-info-grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:6px !important;
    margin-top:7px !important;
  }

  body.dashboard-compact .system-info-grid article{
    min-height:55px !important;
    height:auto !important;
    padding:8px !important;
  }

  body.dashboard-compact .system-info-grid small{
    font-size:8px !important;
  }

  body.dashboard-compact .system-info-grid b{
    margin-top:5px !important;
    font-size:10px !important;
  }

}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media(max-width:390px){

  body.dashboard-compact .metric-card{
    min-height:118px !important;
    height:118px;
  }

  body.dashboard-compact .metric-card strong{
    font-size:21px !important;
  }

  body.dashboard-compact .network-chart-box{
    height:125px !important;
  }

}

/* ==================================================
   BOLAMAJ V3 DB BACKUP
   ================================================== */

.db-backup-center{
  display:grid;
  gap:14px;
  max-width:900px;
}

.db-backup-card{
  display:grid;
  grid-template-columns:52px 1fr auto;
  gap:14px;
  align-items:center;

  padding:18px;

  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;

  background:#0b1118;
}

.db-backup-icon{
  width:46px;
  height:46px;

  display:grid;
  place-items:center;

  border-radius:11px;

  background:#101b25;

  font-size:23px;
  font-weight:700;
}

.db-backup-copy h2{
  margin:0 0 4px;
  font-size:17px;
}

.db-backup-copy p{
  margin:0;
  opacity:.68;
  line-height:1.7;
}

.db-backup-button{
  text-decoration:none;
  white-space:nowrap;
}

.db-restore-form{
  display:flex;
  align-items:center;
  gap:10px;
}

.db-restore-form input[type=file]{
  max-width:260px;
}

/* MOBILE */

@media(max-width:700px){

  .db-backup-center{
    width:100%;
  }

  .db-backup-card{
    grid-template-columns:44px 1fr;
    align-items:start;
    padding:14px;
  }

  .db-backup-icon{
    width:40px;
    height:40px;
    font-size:20px;
  }

  .db-backup-button,
  .db-restore-form{
    grid-column:1 / -1;
    width:100%;
  }

  .db-backup-button{
    box-sizing:border-box;
    text-align:center;
  }

  .db-restore-form{
    flex-direction:column;
    align-items:stretch;
  }

  .db-restore-form input[type=file]{
    max-width:none;
    width:100%;
  }

  .db-restore-form button{
    width:100%;
  }

}


/* ==================================================
   BOLAMAJ V3 DB BACKUP
   ================================================== */

.db-backup-center{
  display:grid;
  gap:14px;
  max-width:900px;
}

.db-backup-card{
  display:grid;
  grid-template-columns:52px 1fr auto;
  gap:14px;
  align-items:center;

  padding:18px;

  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;

  background:#0b1118;
}

.db-backup-icon{
  width:46px;
  height:46px;

  display:grid;
  place-items:center;

  border-radius:11px;

  background:#101b25;

  font-size:23px;
  font-weight:700;
}

.db-backup-copy h2{
  margin:0 0 4px;
  font-size:17px;
}

.db-backup-copy p{
  margin:0;
  opacity:.68;
  line-height:1.7;
}

.db-backup-button{
  text-decoration:none;
  white-space:nowrap;
}

.db-restore-form{
  display:flex;
  align-items:center;
  gap:10px;
}

.db-restore-form input[type=file]{
  max-width:260px;
}

/* MOBILE */

@media(max-width:700px){

  .db-backup-center{
    width:100%;
  }

  .db-backup-card{
    grid-template-columns:44px 1fr;
    align-items:start;
    padding:14px;
  }

  .db-backup-icon{
    width:40px;
    height:40px;
    font-size:20px;
  }

  .db-backup-button,
  .db-restore-form{
    grid-column:1 / -1;
    width:100%;
  }

  .db-backup-button{
    box-sizing:border-box;
    text-align:center;
  }

  .db-restore-form{
    flex-direction:column;
    align-items:stretch;
  }

  .db-restore-form input[type=file]{
    max-width:none;
    width:100%;
  }

  .db-restore-form button{
    width:100%;
  }

}

