:root{
  --bg: #0b0d10;
  --panel: #12161b;
  --panel2: #0f1317;
  --text: #e6e6e6;
  --muted: #a7b0bb;
  --border: #232a32;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --radius: 16px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

:root[data-theme='light']{
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel2: #f1f3f6;
  --text: #14161a;
  --muted: #506070;
  --border: #dfe6ee;
  --shadow: 0 10px 30px rgba(0,0,0,0.10);
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font);
  line-height:1.25;
}

.app{min-height:100%;}

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  display:flex;
  gap:16px;
  align-items:center;
  justify-content:space-between;
  padding:16px 18px;
  background:linear-gradient(to bottom, rgba(0,0,0,0.35), rgba(0,0,0,0.05));
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}

.brand__title{font-size:20px; font-weight:700; letter-spacing:0.2px;}
.brand__meta{margin-top:2px; font-size:13px; color:var(--muted); display:flex; gap:10px; align-items:center;}
.dot{opacity:0.6;}

.actions{display:flex; gap:10px; align-items:center;}

.btn{
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
  border-radius:999px;
  padding:9px 12px;
  font-size:13px;
  cursor:pointer;
}
.btn:hover{filter:brightness(1.05);} 
.btn--ghost{background:transparent;}

.content{max-width:1200px; margin:0 auto; padding:18px;}

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

.card{
  background:linear-gradient(180deg, var(--panel), var(--panel2));
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:14px 14px 12px;
  box-shadow:var(--shadow);
}
.card__label{font-size:12px; color:var(--muted);}
.card__value{font-size:22px; font-weight:750; margin-top:10px;}
.card__hint{font-size:12px; color:var(--muted); margin-top:6px;}

.panel{
  margin-top:14px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.panel__header{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  padding:12px;
  border-bottom:1px solid var(--border);
  background:var(--panel2);
}

.tabs{display:flex; gap:8px; flex-wrap:wrap;}
.tab{
  border:1px solid var(--border);
  background:transparent;
  color:var(--text);
  border-radius:999px;
  padding:8px 10px;
  font-size:13px;
  cursor:pointer;
}
.tab.is-active{background:var(--panel);}

.panel__tools{display:flex; gap:10px; align-items:center;}
.search{
  width: min(460px, 60vw);
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
  border-radius:12px;
  padding:9px 10px;
  font-size:13px;
}

.panel__body{padding:0;}
.tablewrap{width:100%; overflow:auto;}

table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
th,td{padding:10px 12px; border-bottom:1px solid var(--border); white-space:nowrap;}
th{position:sticky; top:0; background:var(--panel2); text-align:left; font-size:12px; color:var(--muted);}
tr:hover td{background:rgba(127,127,127,0.06);} 

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(127,127,127,0.08);
  font-size:12px;
}

.footer{margin-top:14px; padding:10px 2px 2px; color:var(--muted); font-size:12px;}

@media (max-width: 900px){
  .cards{grid-template-columns:repeat(2, minmax(0,1fr));}
}
@media (max-width: 520px){
  .cards{grid-template-columns:1fr;}
  .search{width:100%;}
  .panel__header{flex-direction:column; align-items:stretch;}
  .panel__tools{width:100%;}
}

/* Dashboard 3 enhanced views */
.panel__body .tablewrap { overflow-x:auto; }
.panel__body .table { min-width:100%; }
.panel__body td, .panel__body th { padding:11px 13px; }
.panel__body .comment-cell { white-space:normal; min-width:240px; max-width:560px; }
.panel__body a { color:var(--text); text-decoration:underline; text-underline-offset:3px; }
.panel__body .empty { padding:22px 18px; color:var(--muted); }

/* Reflector links — improved dark theme contrast */
[data-theme="dark"] a[href*="xlx"],
[data-theme="dark"] a[href*="http"] {
    color: #55C7FF;
}

[data-theme="dark"] a[href*="xlx"]:hover,
[data-theme="dark"] a[href*="http"]:hover {
    color: #A5E5FF;
    text-decoration: underline;
}

/* High contrast external links in dark mode */
:root:not([data-theme="light"]) #view td a[href^="http"] {
    color: #55C7FF !important;
}

:root:not([data-theme="light"]) #view td a[href^="http"]:hover {
    color: #A5E5FF !important;
    text-decoration: underline;
}
/* XLX3 Reflectors: status pills (all themes). */
#view .reflector-status {
  color: #55C7FF !important;
  font-weight: 700;
  border: 1px solid transparent;
  min-width: 52px;
}
#view .reflector-status--up {
  background-color: #135b36 !important;
  border-color: #298e59;
}
#view .reflector-status--down {
  background-color: #842634 !important;
  border-color: #c34b5d;
}

/* Reflector UP/DOWN indicators */
#view .badge.xlx-status-up {
    background: #166534 !important;
    color: #55C7FF !important;
    border: 1px solid #22C55E;
}

#view .badge.xlx-status-down {
    background: #991B1B !important;
    color: #55C7FF !important;
    border: 1px solid #EF4444;
}


/* XLX3: grouped Module header and alternating rows, both colour themes */
#view .xlx-modules-table { border-collapse: separate; border-spacing: 0; min-width: 920px; }
#view .xlx-modules-table th,
#view .xlx-modules-table td { text-align: center; border-right: 1px solid var(--border); }
#view .xlx-modules-table th:last-child,
#view .xlx-modules-table td:last-child { border-right: 0; }
#view .xlx-modules-table thead th { font-weight: 700; color: var(--text); vertical-align: middle; }
#view .xlx-modules-table thead .xlx-module-groups th { background: #202d3b; }
#view .xlx-modules-table thead .xlx-module-subgroups th { background: #192634; }
#view .xlx-modules-table tbody tr:nth-child(odd) td { background: #13191f; }
#view .xlx-modules-table tbody tr:nth-child(even) td { background: #1b2530; }
#view .xlx-modules-table tbody tr:hover td { background: #29394a; }
:root[data-theme="light"] #view .xlx-modules-table thead .xlx-module-groups th { background: #d5e9ef; }
:root[data-theme="light"] #view .xlx-modules-table thead .xlx-module-subgroups th { background: #e3f2f5; }
:root[data-theme="light"] #view .xlx-modules-table tbody tr:nth-child(odd) td { background: #ffffff; }
:root[data-theme="light"] #view .xlx-modules-table tbody tr:nth-child(even) td { background: #eef6f7; }
:root[data-theme="light"] #view .xlx-modules-table tbody tr:hover td { background: #dceff4; }
/* Refresh is active and visually responsive */
#refreshBtn { background: var(--panel); }
#refreshBtn:disabled { opacity: .7; cursor: wait; }

/* XLX3 table contrast refinement v3.0.8 — CSS only. */
/* Every table in Users, Nodes, Peers, Modules and Reflectors */
#view table.table tbody tr:nth-child(odd) > td { background-color: #111820; }
#view table.table tbody tr:nth-child(even) > td { background-color: #202d3b; }
#view table.table tbody tr:hover > td { background-color: #304458; }
#view table.table thead th { background-color: #243548; }
/* Modules grouping has a distinct stronger header shade */
#view table.xlx-modules-table thead tr.xlx-module-groups > th { background-color: #304458; }
#view table.xlx-modules-table thead tr.xlx-module-subgroups > th { background-color: #243548; }
/* Light theme equivalent */
:root[data-theme='light'] #view table.table tbody tr:nth-child(odd) > td { background-color: #ffffff; }
:root[data-theme='light'] #view table.table tbody tr:nth-child(even) > td { background-color: #e7f0f5; }
:root[data-theme='light'] #view table.table tbody tr:hover > td { background-color: #cfe4ed; }
:root[data-theme='light'] #view table.table thead th { background-color: #e0edf3; }
:root[data-theme='light'] #view table.xlx-modules-table thead tr.xlx-module-groups > th { background-color: #c8e0ea; }
:root[data-theme='light'] #view table.xlx-modules-table thead tr.xlx-module-subgroups > th { background-color: #dcebf2; }
