@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600;700;800&display=swap');

:root{
  --bg:#0b0f17;
  --text:#e7edf6;
  --muted:#9aa7bb;
  --line:rgba(255,255,255,.08);
  --accent:#7c5cff;
  --accent2:rgba(124,92,255,.18);
  --shadow: 0 12px 30px rgba(0,0,0,.35);
  --radius:16px;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family:"Nunito Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 15% 5%, rgba(124,92,255,.20), transparent 55%),
    radial-gradient(900px 500px at 80% 10%, rgba(0,200,255,.12), transparent 45%),
    var(--bg);
  color:var(--text);
}
a{ color:inherit; }
code{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.app{ display:grid; grid-template-columns:280px 1fr; min-height:100vh; }
.sidebar{
  border-right:1px solid var(--line);
  padding:18px 14px;
  position:sticky; top:0; height:100vh;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 35%);
  display:flex; flex-direction:column;
  overflow:hidden;
}
.brand{
  display:flex; align-items:center; gap:12px;
  padding:10px 10px 14px;
  border-bottom:1px solid var(--line);
  margin-bottom:12px;
}
.logo{
  width:40px; height:40px;
  border-radius:12px;
  background: rgba(255,255,255,.03);
  display:grid; place-items:center;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.logo svg{ width:28px; height:28px; }
.logoFallback{ font-weight:900; color:var(--muted); }

.brand .t1{ font-weight:800; letter-spacing:.2px; }
.brand .t2{ font-size:12px; color:var(--muted); margin-top:2px; }

.nav{ padding:6px; overflow-y:auto; flex:1; }
.nav .item{ margin:6px 0; }
.nav a.top{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 12px;
  border-radius:12px;
  text-decoration:none;
  border:1px solid transparent;
}
.nav a.top:hover{ background:rgba(255,255,255,.03); border-color:var(--line); }
.nav .children{
  margin:6px 0 12px 10px;
  padding-left:10px;
  border-left:1px solid var(--line);
}
.nav .children a{
  display:block;
  padding:8px 10px;
  border-radius:10px;
  text-decoration:none;
  color:var(--muted);
  border:1px solid transparent;
  margin:4px 0;
}
.nav .children a:hover{ color:var(--text); background:rgba(255,255,255,.03); border-color:var(--line); }
.activeLink{ background:var(--accent2)!important; border-color:rgba(124,92,255,.35)!important; color:var(--text)!important; }

.main{ padding:22px 22px 40px; max-width:1200px; }
h1{ margin:0 0 14px; font-size:28px; }

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding:16px;
  box-shadow: var(--shadow);
}
.card + .card{ margin-top:14px; }
.card-h{ display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; font-weight:800; }
.badge{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
  color:var(--muted);
}
.grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.kpis{ display:grid; gap:10px; }
.kpi{
  display:flex; align-items:baseline; justify-content:space-between;
  padding:10px 12px;
  background: rgba(0,0,0,.15);
  border:1px solid var(--line);
  border-radius:14px;
}
.kpi-l{ color:var(--muted); }
.kpi-v{ font-weight:800; }

.muted{ color:var(--muted); }
.small{ font-size:12px; }
.row{ display:flex; gap:10px; align-items:center; margin:10px 0 12px; }
.pill{
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  padding:6px 10px;
  border-radius:999px;
  color:var(--muted);
  font-size:12px;
}
.spacer{ flex:1; }
.btn{
  text-decoration:none;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(124,92,255,.35);
  background: var(--accent2);
  color: var(--text);
  font-weight:800;
}
.btn:hover{ filter:brightness(1.08); }

.chip{
  text-decoration:none;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  color:var(--muted);
  font-weight:800;
  font-size:12px;
}
.chip:hover{ background:rgba(255,255,255,.04); color:var(--text); }
.chipActive{ background:var(--accent2); border-color:rgba(124,92,255,.35); color:var(--text); }

pre.log{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
  font-size:12px;
  line-height:1.5;
  padding:14px;
  border-radius:14px;
  background: rgba(0,0,0,.22);
  border:1px solid var(--line);
  max-height: 70vh;
  overflow:auto;
}

.table-wrap{ overflow:auto; border-radius:14px; border:1px solid var(--line); margin-top:12px; }
table{ width:100%; border-collapse:collapse; font-size:13px; }
th,td{ padding:10px 12px; border-bottom:1px solid var(--line); }
th{ text-align:left; color:var(--muted); font-weight:800; background:rgba(255,255,255,.02); }
tr:hover td{ background:rgba(255,255,255,.02); }

ul.filelist{ list-style:none; padding:0; margin:0; }
ul.filelist li a{
  display:block;
  padding:10px 12px;
  border-radius:12px;
  text-decoration:none;
  border:1px solid transparent;
  color:var(--muted);
}
ul.filelist li a:hover{ color:var(--text); border-color:var(--line); background:rgba(255,255,255,.03); }
ul.filelist li.active a{ background:var(--accent2); border-color:rgba(124,92,255,.35); color:var(--text); }

.md{ line-height:1.65; }
.md h1,.md h2,.md h3{ margin-top:18px; }
.md code{ background:rgba(255,255,255,.06); padding:2px 6px; border-radius:8px; border:1px solid var(--line); }
.md pre{ background:rgba(0,0,0,.22); padding:14px; border-radius:14px; border:1px solid var(--line); overflow:auto; }
.md a{ color:#b9a9ff; }
.md-fallback{ margin:0; white-space:pre-wrap; }

/* Markdown image rows */
.img-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:12px 0;
}
.img-row figure{
  margin:0;
  display:flex;
  flex-direction:column;
  align-items:center;
}
.img-row figure img{
  border-radius:8px;
  border:1px solid var(--line);
  display:block;
}
.img-row figcaption{
  font-size:11px;
  color:var(--muted);
  margin-top:5px;
  text-align:center;
  max-width:300px;
}

.split{
  margin-top:14px;
  display:grid;
  grid-template-columns: 1.25fr .75fr;
  gap:14px;
}
.subcard{
  background: rgba(0,0,0,.12);
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
}
.subh{ font-weight:900; margin:0 0 10px; }

.procGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}

@media (max-width: 980px){
  .app{ grid-template-columns:1fr; }
  .sidebar{ position:relative; height:auto; }
  .grid-2{ grid-template-columns:1fr; }
  .split{ grid-template-columns:1fr; }
  .procGrid{ grid-template-columns:1fr; }
}

/* ===== Status indicators (green / orange / red) ===== */
:root{
  --ok-bg: rgba(0, 255, 160, .10);
  --ok-bd: rgba(0, 255, 160, .28);
  --ok-tx: rgba(160, 255, 220, .95);

  --warn-bg: rgba(255, 190, 0, .10);
  --warn-bd: rgba(255, 190, 0, .28);
  --warn-tx: rgba(255, 230, 160, .95);

  --bad-bg: rgba(255, 70, 90, .10);
  --bad-bd: rgba(255, 70, 90, .30);
  --bad-tx: rgba(255, 190, 195, .95);
}

/* small dot */
.dot{
  width:10px;height:10px;border-radius:999px;
  display:inline-block; margin-right:8px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.06);
}

/* badge variants */
.badge.ok    { background: var(--ok-bg);   border-color: var(--ok-bd);   color: var(--ok-tx); }
.badge.warn  { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-tx); }
.badge.bad   { background: var(--bad-bg);  border-color: var(--bad-bd);  color: var(--bad-tx); }

/* dot variants */
.dot.ok   { background: rgba(0,255,160,.9);  border-color: rgba(0,255,160,.35); }
.dot.warn { background: rgba(255,190,0,.95); border-color: rgba(255,190,0,.35); }
.dot.bad  { background: rgba(255,70,90,.95); border-color: rgba(255,70,90,.40); }

/* KPI row variants */
.kpi.ok   { border-color: var(--ok-bd);   background: linear-gradient(180deg, var(--ok-bg), rgba(0,0,0,.12)); }
.kpi.warn { border-color: var(--warn-bd); background: linear-gradient(180deg, var(--warn-bg), rgba(0,0,0,.12)); }
.kpi.bad  { border-color: var(--bad-bd);  background: linear-gradient(180deg, var(--bad-bg), rgba(0,0,0,.12)); }

.kpi.ok .kpi-v   { color: var(--ok-tx); }
.kpi.warn .kpi-v { color: var(--warn-tx); }
.kpi.bad .kpi-v  { color: var(--bad-tx); }

/* Notes search bar */
.notesSearch{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.notesSearch input[type="text"]{
  flex:1;
  min-width: 220px;
  padding:12px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline:none;
  font-weight:700;
}
.notesSearch input[type="text"]::placeholder{
  color: rgba(154,167,187,.75);
}
.notesSearch input[type="text"]:focus{
  border-color: rgba(124,92,255,.45);
  box-shadow: 0 0 0 3px rgba(124,92,255,.12);
}

/* Notes page layout */
.notes-layout{
  grid-template-columns: minmax(160px, .28fr) minmax(0, 1.72fr);
}
.notes-viewer-header{
  gap: 10px;
}
.notes-viewer-actions{
  display:flex;
  align-items:center;
  gap:8px;
}
.chip-btn{
  cursor:pointer;
  font-family:inherit;
}

/* Notes markdown copy buttons */
.md pre.md-copyable{
  position:relative;
  padding-top:44px;
}
.md-copy-btn{
  position:absolute;
  top:10px;
  right:10px;
  text-decoration:none;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--muted);
  font-family:inherit;
  font-weight:800;
  font-size:12px;
  cursor:pointer;
  transition:color .15s, background .15s;
}
.md-copy-btn[data-state="copied"]{
  color:var(--green,#4caf50);
  border-color:var(--green,#4caf50);
}
.md-copy-btn[data-state="failed"]{
  color:#e74c3c;
  border-color:#e74c3c;
}
.md-copy-btn:hover{
  background:rgba(255,255,255,.06);
  color:var(--text);
}

/* Notes fullscreen mode */
body.notes-fullscreen .app{
  grid-template-columns:1fr;
}
body.notes-fullscreen .sidebar{
  display:none;
}
body.notes-fullscreen .main{
  max-width:none;
  padding:14px;
}
body.notes-fullscreen .notes-layout{
  grid-template-columns:1fr;
}
body.notes-fullscreen .notes-files-pane{
  display:none;
}
body.notes-fullscreen .notes-viewer-pane{
  min-height:calc(100vh - 28px);
}
body.notes-fullscreen .notes-viewer-pane .md{
  max-height:calc(100vh - 125px);
  overflow:auto;
}

@media (max-width: 980px){
  .notes-layout{
    grid-template-columns:1fr;
  }
}

/* Image modal */
.img-modal{
  position:fixed; inset:0; z-index:1000;
  background:rgba(0,0,0,.88);
  display:flex; align-items:center; justify-content:center;
  cursor:zoom-out;
}
.img-modal[hidden]{ display:none; }
.img-modal-img{
  max-width:90vw; max-height:90vh;
  object-fit:contain;
  border-radius:6px;
  box-shadow:0 8px 40px rgba(0,0,0,.6);
  cursor:default;
}
.img-modal-close{
  position:fixed; top:18px; right:22px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.15);
  color:#fff;
  font-size:24px; line-height:1;
  padding:4px 10px;
  border-radius:8px;
  cursor:pointer;
}
.img-modal-close:hover{ background:rgba(255,255,255,.16); }