:root{
  --bg: #0b0b0b;
  --bg2:#0f0f0f;
  --surface:#111111;
  --surface2:#141414;
  --surface3:#1a1a1a;

  --text:#f3f3f3;
  --muted:#b8b8b8;
  --dim:#8a8a8a;

  --border:#242424;
  --border2:#2f2f2f;

  --shadow: 0 16px 40px rgba(0,0,0,.55);
  --shadow2: 0 24px 70px rgba(0,0,0,.62);

  --r:16px;
  --r2:24px;
  --ease:cubic-bezier(.2,.8,.2,1);

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;

  /* scrollbars */
  --sb-track: #0f0f0f;
  --sb-thumb: #2a2a2a;
  --sb-thumb-hover: #3a3a3a;
}

*{ box-sizing:border-box }
html,body{ height:100% }

body{
  margin:0;
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(900px 500px at 20% -10%, rgba(255,255,255,.06), transparent 60%),
              radial-gradient(700px 420px at 90% 10%, rgba(255,255,255,.04), transparent 60%),
              linear-gradient(180deg, var(--bg), #080808 55%, #070707);
  overflow:hidden;
}

/* scrollbars */
*{ scrollbar-width: thin; scrollbar-color: var(--sb-thumb) var(--sb-track); }
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-track{ background: var(--sb-track); }
*::-webkit-scrollbar-thumb{ background: var(--sb-thumb); border-radius:999px; border:2px solid var(--sb-track); }
*::-webkit-scrollbar-thumb:hover{ background: var(--sb-thumb-hover); }

/* typography helpers */
.mono{ font-family: var(--mono); }

/* layout */
.app{ height:100%; display:grid; grid-template-columns: 304px 1fr; }

.sidebar{
  padding: 18px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  position:relative;
}

.brand{
  display:flex; align-items:center; gap:12px;
  padding: 14px 14px;
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  box-shadow: var(--shadow);
}

.brandMark{
  width:44px; height:44px;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.9), rgba(255,255,255,.12) 55%, rgba(255,255,255,.02));
  border:1px solid rgba(255,255,255,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 10px 30px rgba(0,0,0,.55);
}

.brandText{ line-height:1.1 }
.brandName{ font-weight: 900; letter-spacing: .34em; font-size: 13px; }
.brandSub{ margin-top: 6px; color: var(--muted); font-size: 12px; }

.nav{ margin-top: 14px; display:flex; flex-direction:column; gap:8px; }

.navItem{
  width:100%;
  display:flex; align-items:center; gap:10px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor:pointer;
  text-align:left;
  transition: transform .15s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
  position:relative;
}

.navItem::before{
  content:"";
  position:absolute;
  left:8px;
  top:50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.70);
  opacity: 0;
  transition: opacity .18s var(--ease), height .18s var(--ease);
}

.navItem:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.03);
  border-color: var(--border);
}

.navItem.active{
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border-color: rgba(255,255,255,.16);
}

.navItem.active::before{ opacity:1; height: 22px; }

.dot{
  width:10px; height:10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.08);
}

.navSep{ height:1px; background: var(--border); margin:10px 6px; }

.sidebarFooter{
  position:absolute; left:18px; right:18px; bottom:18px;
  display:grid; grid-template-columns: 1fr 1fr; gap:10px;
}

.mini{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.015);
  padding: 10px;
}

.miniLabel{ color: var(--muted); font-size: 12px; }
.miniValue{ font-family: var(--mono); font-size: 12px; margin-top:6px; color: var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* status dot for mini status + top chips (monochrome) */
#miniStatus{ display:flex; align-items:center; gap:8px; }
#miniStatus::before,
.chipDot{
  content:"";
  width: 8px; height: 8px; border-radius:999px;
  background: rgba(255,255,255,.35);
  box-shadow: 0 0 0 4px rgba(255,255,255,.06);
}
#miniStatus.status-online::before,
.chipDot.status-online{ background: rgba(255,255,255,.92); box-shadow: 0 0 0 4px rgba(255,255,255,.10); }
#miniStatus.status-idle::before,
.chipDot.status-idle{ background: rgba(255,255,255,.55); box-shadow: 0 0 0 4px rgba(255,255,255,.08); }
#miniStatus.status-busy::before,
.chipDot.status-busy{ background: rgba(255,255,255,.78); box-shadow: 0 0 0 4px rgba(255,255,255,.10); }
#miniStatus.status-offline::before,
.chipDot.status-offline{ background: rgba(255,255,255,.26); box-shadow: 0 0 0 4px rgba(255,255,255,.05); }

.main{ height:100%; display:flex; flex-direction:column; min-height:0; }

.topbar{
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

.topLeft{ display:flex; flex-direction:column; gap:2px; }
.topLeftRow{ display:flex; align-items:center; gap:10px; }
.topLeftCol{ display:flex; flex-direction:column; gap:2px; }

.crumb{ font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: rgba(255,255,255,.86); }
.hint{ font-size: 12px; color: var(--muted); margin-top: 4px; }

.topRight{ display:flex; gap:10px; align-items:center; position:relative; }

.chip{
  display:inline-flex; align-items:center; gap:10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,.02);
  color: var(--text);
  cursor:pointer;
  transition: transform .15s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
.chip.subtle{ opacity:.92 }
.chip:hover{ transform: translateY(-1px); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.18); }

.iconBtn{
  display:inline-flex; align-items:center; justify-content:center;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,.02);
  color: var(--text);
  cursor:pointer;
  transition: transform .15s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
.iconBtn:hover{ transform: translateY(-1px); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.18); }

.k{ font-family: var(--mono); color: rgba(255,255,255,.85); font-size:12px; }

.badge{
  display:inline-flex; align-items:center; justify-content:center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.90);
  font-size: 12px;
  letter-spacing: .08em;
}

/* notification UI */
.notifWrap{ position:relative; }
.badge#notifBadge{
  position:absolute;
  top:-6px; right:-6px;
  height: 18px;
  padding: 0 6px;
  font-size: 11px;
  border-radius: 999px;
}

.notifPanel{
  position:absolute;
  right:0;
  top: 50px;
  width: min(420px, calc(100vw - 40px));
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  background: rgba(10,10,10,.95);
  box-shadow: var(--shadow2);
  overflow:hidden;
  z-index: 50;
}

.notifHead, .notifFoot{
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
}
.notifFoot{ border-bottom:none; border-top: 1px solid var(--border); align-items:center; }
.notifTitle{ font-weight: 850; letter-spacing: .02em; }
.notifSub{ color: var(--muted); font-size: 12px; margin-top:4px; }
.notifList{ max-height: 320px; overflow:auto; padding: 8px; }

/* main content */
.content{ padding: 20px; overflow:auto; height:100%; min-height:0; }

.view{ display:none; animation: fadeIn .22s var(--ease) both; min-height:0; }
.view.show{ display:block }

@keyframes fadeIn{ from{ opacity:0; transform: translateY(6px); } to{ opacity:1; transform: translateY(0); } }

.grid2{ display:grid; grid-template-columns: 1.15fr .85fr; gap:14px; }
.grid3{ display:grid; grid-template-columns: repeat(3, 1fr); gap:14px; }
.grid3.tight{ margin-top: 14px; }

.card{
  border: 1px solid var(--border);
  border-radius: var(--r2);
  background: rgba(255,255,255,.02);
  box-shadow: 0 8px 30px rgba(0,0,0,.38);
  padding: 16px;
}

.cardInset{
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255,255,255,.015);
  padding: 14px;
}

.cardTop{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:12px; }

.hero{ overflow:hidden; position:relative; }
.hero::before{
  content:"";
  position:absolute;
  inset:-1px;
  background: radial-gradient(800px 220px at 30% 0%, rgba(255,255,255,.06), transparent 55%);
  pointer-events:none;
}

.heroTop{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; position:relative; }
.title{ font-size: 22px; font-weight: 900; letter-spacing: .01em; }
.sub{ color: var(--muted); margin-top:6px; font-size: 13px; line-height: 1.45; }
.heroBadge{ display:flex; gap:8px; flex-wrap:wrap; }

.heroStats{ display:grid; grid-template-columns: repeat(4, 1fr); gap:10px; margin-top:14px; position:relative; }
.stat{ border:1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.012); padding: 12px; }
.statLabel{ color: var(--muted); font-size: 12px; }
.statValue{ margin-top:8px; font-weight: 900; letter-spacing: .02em; font-size: 18px; }

.heroActions{ display:flex; gap:10px; flex-wrap:wrap; margin-top: 14px; position:relative; }

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,.02);
  color: var(--text);
  cursor:pointer;
  transition: transform .15s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
  user-select:none;
}
.btn:hover{ transform: translateY(-1px); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.18); }
.btn:active{ transform: translateY(0) scale(.99); }

.btn.primary{
  background: rgba(255,255,255,.92);
  color: #0b0b0b;
  border-color: rgba(255,255,255,.92);
}
.btn.primary:hover{ background: rgba(255,255,255,.98); border-color: rgba(255,255,255,.98); }

.btn.ghost{ background: transparent; }
.btn.tiny{ padding: 8px 10px; border-radius: 12px; font-size: 12px; }
.btn.small{ padding: 8px 10px; border-radius: 999px; font-size: 13px; }

.btn:disabled{
  opacity:.45;
  cursor:not-allowed;
  transform:none !important;
}

.spark{ display:none; }

.divider{ height:1px; background: var(--border); margin: 14px 0; }

.titleSm{ font-weight: 850; letter-spacing: .03em; font-size: 13px; }
.subSm{ color: var(--muted); font-size: 12px; margin-top: 4px; }
.monoNoteSmall{ color: rgba(255,255,255,.85); font-size: 12px; line-height: 1.55; font-family: var(--mono); }

.kbd{
  display:inline-flex; align-items:center; justify-content:center;
  height: 22px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,.02);
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255,255,255,.88);
}

.bigNumber{ font-family: var(--mono); font-size: 22px; margin-top: 10px; opacity: .95; }

.meter{ height: 10px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--border); overflow:hidden; margin-top:10px; }
.meterBar{ height: 100%; width: 30%; background: rgba(255,255,255,.82); border-radius: 999px; }

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

/* inputs */
.search, .select, .input, input{
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,.02);
  color: var(--text);
  padding: 0 12px;
  outline: none;
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}

.select{ min-width: 160px; padding-right: 38px; appearance:none; -webkit-appearance:none; }

.search:focus, .select:focus, .input:focus, input:focus{
  border-color: rgba(255,255,255,.28);
  box-shadow: 0 0 0 4px rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
}

.select{
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,.72) 50%),
    linear-gradient(135deg, rgba(255,255,255,.72) 50%, transparent 50%);
  background-position: calc(100% - 18px) 16px, calc(100% - 12px) 16px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.select::-ms-expand{ display:none; }

/* tables */
.tableWrap{
  border: 1px solid var(--border);
  border-radius: var(--r2);
  background: rgba(255,255,255,.015);
  overflow:hidden;
}

.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}

.table thead th{
  text-align:left;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 12px;
  color: rgba(255,255,255,.80);
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody td{
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.90);
  vertical-align: top;
}

.table tbody tr:nth-child(2n) td{ background: rgba(255,255,255,.008); }
.table tbody tr:hover td{ background: rgba(255,255,255,.02); }

.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.02);
  font-size: 12px;
  font-family: var(--mono);
}
.pill .b{ width:8px; height:8px; border-radius:999px; background: rgba(255,255,255,.65); opacity:.9; }
.pill.ok{ border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.03); }
.pill.warn{ border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.02); }
.pill.bad{ border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.015); }
.pillText{ opacity:.92; }

.tableBtn{
  display:inline-flex; align-items:center; justify-content:center;
  height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,.02);
  color: var(--text);
  cursor:pointer;
  transition: transform .15s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
.tableBtn:hover{ transform: translateY(-1px); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.18); }

/* drawer + panels */
.drawer{
  border: 1px solid var(--border);
  border-radius: var(--r2);
  background: rgba(255,255,255,.02);
  padding: 14px;
}

.drawerTop{ display:flex; justify-content:space-between; gap:12px; align-items:flex-start; margin-bottom: 10px; }

.panel{
  border: 1px solid var(--border);
  border-radius: var(--r2);
  background: rgba(255,255,255,.02);
  padding: 14px;
}

.seg{
  display:inline-flex;
  border: 1px solid var(--border2);
  border-radius: 999px;
  background: rgba(255,255,255,.015);
  padding: 4px;
  gap: 4px;
}

.segBtn{
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,.82);
  cursor:pointer;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}

.segBtn:hover{ background: rgba(255,255,255,.03); }
.segBtn.active{
  background: rgba(255,255,255,.92);
  color: #0b0b0b;
  border-color: rgba(255,255,255,.92);
}

.modal{
  width: min(780px, calc(100vw - 40px));
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(12,12,12,.96);
  box-shadow: var(--shadow2);
  overflow:hidden;
}

.modalTop{
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.modalBody{ padding: 14px; }

/* toast */
.toast{
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(380px, calc(100vw - 36px));
  border-radius: var(--r2);
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(12,12,12,.92);
  box-shadow: var(--shadow2);
  padding: 12px;
  z-index: 90;
}

/* console */
.consoleWrap{
  border: 1px solid var(--border);
  border-radius: var(--r2);
  background: rgba(255,255,255,.015);
  overflow:hidden;
}

.consoleMeta{
  display:flex;
  gap: 10px;
  justify-content:space-between;
  align-items:center;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.01);
}

.consoleBox{
  height: calc(100vh - 280px);
  overflow:auto;
  padding: 10px;
  font-family: var(--mono);
  font-size: 12px;
}

.consoleLine{
  display:flex;
  gap: 10px;
  padding: 10px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  align-items:flex-start;
}

.consoleLine:hover{ background: rgba(255,255,255,.02); border-color: rgba(255,255,255,.10); }

.consoleTs{ opacity:.65; white-space:nowrap; min-width: 160px; }
.consoleLv{
  min-width: 64px;
  text-align:center;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  padding: 2px 8px;
  opacity: .92;
}
.consoleSrc{ opacity:.75; white-space:nowrap; min-width: 74px; }
.consoleMsg{ flex:1; word-break: break-word; white-space: pre-wrap; }

/* keep attribute hooks but monochrome */
.consoleLv[data-lv="ERROR"]{ border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.03); }
.consoleLv[data-lv="WARN"]{ border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.02); }
.consoleLv[data-lv="INFO"]{ border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.015); }
.consoleLv[data-lv="DEBUG"]{ border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.01); }

/* small helpers used in markup */
.panelHeader{ display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom: 12px; }
.panelTitle{ font-size: 18px; font-weight: 900; letter-spacing: .01em; }
.panelSub{ color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.45; }

/* responsive */
.sidebarBackdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 60;
}

@media (max-width: 980px){
  .app{ grid-template-columns: 1fr; }
  .sidebar{
    position: fixed;
    inset: 0 auto 0 0;
    width: 304px;
    transform: translateX(-105%);
    transition: transform .22s var(--ease);
    z-index: 70;
  }
  .sidebar.open{ transform: translateX(0); }
}

@media (max-width: 860px){
  .grid2{ grid-template-columns: 1fr; }
  .heroStats{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px){
  .content{ padding: 14px; }
  .topbar{ padding: 14px; }
  .iconBtn{ width: 38px; height: 38px; }
  .chip{ padding: 9px 10px; }
  .brand{ border-radius: 18px; }
}

/* momentum scroll */
.content, .tableWrap, .log, .consoleBox{ -webkit-overflow-scrolling: touch; }

/* reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; animation:none !important; scroll-behavior:auto !important; }
}
