/* No external libs. Clean, fast UI. */
:root{
  --bg:#0b1220;
  --panel:#0f1a2e;
  --card:#101f3a;
  --border:rgba(255,255,255,.08);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.65);
  --primary:#00b67a;
  --danger:#ff4d4d;
  --shadow: 0 12px 30px rgba(0,0,0,.35);
  --radius:18px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 10% 0%, rgba(0,182,122,.15), transparent 50%),
              radial-gradient(1000px 700px at 90% 10%, rgba(0,51,78,.45), transparent 55%),
              var(--bg);
  color:var(--text);
}

a{color:inherit; text-decoration:none}

.topbar{
  position:sticky; top:0;
  display:flex; gap:12px; align-items:center; justify-content:space-between;
  padding:14px 18px;
  background: rgba(11,18,32,.72);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
  z-index:10;
}

.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:42px; height:42px; border-radius:14px;
  background: linear-gradient(135deg, rgba(0,182,122,.25), rgba(0,182,122,.05));
  border:1px solid rgba(0,182,122,.35);
  display:grid; place-items:center;
  font-weight:800;
}
.title{font-weight:800; letter-spacing:.2px}
.subtitle{color:var(--muted); font-size:12px}

.actions{display:flex; gap:10px; flex-wrap:wrap}
.btn{
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  box-shadow: none;
}
.btn:hover{border-color:rgba(255,255,255,.16)}
.btn.primary{
  background: linear-gradient(135deg, rgba(0,182,122,.35), rgba(0,182,122,.10));
  border-color: rgba(0,182,122,.45);
}
.btn.danger{
  background: rgba(255,77,77,.12);
  border-color: rgba(255,77,77,.35);
}
.btn.small{padding:8px 10px; border-radius:12px; font-size:13px}

.layout{
  display:grid;
  grid-template-columns: 1.05fr .95fr;
  gap:14px;
  padding:14px;
}
@media (max-width: 980px){
  .layout{grid-template-columns:1fr; }
  .detail{min-height:auto}
}

.panel{
  background: rgba(15,26,46,.78);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.panel-head{
  padding:16px 16px 10px 16px;
  display:flex; align-items:flex-end; justify-content:space-between;
  gap:12px;
  border-bottom:1px solid var(--border);
}
.panel-head h2{margin:0; font-size:18px}
.muted{color:var(--muted); font-size:12px}

.cards{
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap:10px;
  padding:12px 16px;
}
@media (max-width: 980px){
  .cards{grid-template-columns: repeat(2, minmax(0,1fr));}
}
@media (max-width: 430px){
  .cards{grid-template-columns: 1fr;}
}
.kpi{
  background: rgba(16,31,58,.72);
  border:1px solid var(--border);
  border-radius:16px;
  padding:12px;
}
.kpi .label{color:var(--muted); font-size:12px}
.kpi .value{font-size:22px; font-weight:800; margin-top:6px}

.filters{
  display:grid;
  grid-template-columns: 1.2fr .9fr .9fr auto;
  gap:10px;
  padding: 8px 16px 14px 16px;
  border-bottom:1px solid var(--border);
}
@media (max-width: 980px){
  .filters{grid-template-columns: 1fr 1fr; }
}
.input{
  width:100%;
  padding:10px 12px;
  background: rgba(255,255,255,.03);
  border:1px solid var(--border);
  border-radius:14px;
  color:var(--text);
  outline:none;
}
.input:focus{border-color: rgba(0,182,122,.45)}

.list-head{
  display:flex; justify-content:space-between; align-items:center;
  padding: 12px 16px 8px 16px;
}
.list{padding: 0 6px 10px 6px; max-height: calc(100vh - 280px); overflow:auto}
@media (max-width:980px){ .list{max-height: 50vh} }
.row{
  display:grid;
  grid-template-columns: 1.3fr .85fr .9fr .55fr;
  gap:10px;
  padding:12px 10px;
  margin:6px 8px;
  border:1px solid var(--border);
  background: rgba(16,31,58,.50);
  border-radius:16px;
  cursor:pointer;
}
.row:hover{border-color: rgba(255,255,255,.16)}
.row.active{border-color: rgba(0,182,122,.55); background: rgba(0,182,122,.10)}
.cell-title{font-weight:800}
.pill{
  display:inline-flex; align-items:center; justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  font-size:12px;
  color: var(--muted);
  max-width: 100%;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.pill.ok{border-color: rgba(0,182,122,.45); color: rgba(255,255,255,.88)}
.pill.warn{border-color: rgba(255,196,0,.35); color: rgba(255,255,255,.88)}

.detail{min-height: calc(100vh - 86px);}
.empty-state{
  padding:30px 18px;
}
.empty-title{font-size:18px; font-weight:800; margin-bottom:6px}

.detail-wrap{padding:16px}
.detail-head{
  display:flex; justify-content:space-between; gap:12px; align-items:flex-start;
  padding-bottom:12px; border-bottom:1px solid var(--border);
}
.detail-actions{display:flex; gap:10px; flex-wrap:wrap}
.detail-head h2{margin:0}
.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
  padding-top:12px;
}
@media (max-width:520px){ .grid{grid-template-columns: 1fr;} }
.field label{display:block; color:var(--muted); font-size:12px; margin-bottom:6px}
textarea.input{resize:vertical; min-height: 100px}

.split{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top:10px;
}
@media (max-width:980px){ .split{grid-template-columns: 1fr;} }
.card{
  background: rgba(16,31,58,.72);
  border:1px solid var(--border);
  border-radius: 18px;
  padding:12px;
}
.card-head{
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding-bottom:8px; border-bottom:1px solid var(--border);
}
.card-title{font-weight:800}
.script{
  white-space:pre-wrap;
  padding:10px 0;
  color: rgba(255,255,255,.88);
  line-height: 1.45;
}
.checks{display:grid; gap:8px}
.check{display:flex; gap:10px; align-items:center; color: rgba(255,255,255,.85)}
.logs{display:grid; gap:10px; padding-top:10px}
.log{
  border:1px solid var(--border);
  border-radius:16px;
  padding:10px;
  background: rgba(255,255,255,.03);
}
.log .t{font-weight:800; font-size:13px}
.log .d{color:var(--muted); font-size:12px; margin-top:4px}
.footer-actions{
  display:flex; justify-content:space-between; align-items:center;
  gap:10px; margin-top:12px; padding-top:12px; border-top:1px solid var(--border);
}

/* Modal */
.modal{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:grid; place-items:center;
  padding:16px;
  z-index:50;
}
.modal-card{
  width:min(780px, 100%);
  background: rgba(15,26,46,.92);
  border:1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal-head{
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:14px 16px;
  border-bottom:1px solid var(--border);
}
.modal-title{font-weight:800; font-size:16px}
.modal-actions{padding: 0 16px 16px 16px; display:flex; justify-content:flex-end; gap:10px}

/* Auth (login) */
.auth{
  display:grid;
  place-items:center;
  padding: 28px 16px;
}
.auth-card{
  width: min(520px, 100%);
  background: rgba(15,26,46,.78);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.auth-head{
  display:grid;
  gap:6px;
  padding-bottom:10px;
  border-bottom:1px solid var(--border);
}
.auth-block{padding-top:12px; display:grid; gap:10px;}
.auth-actions{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end;}

.link{
  margin-top:10px;
  border:0;
  background:transparent;
  color: rgba(0,182,122,.9);
  cursor:pointer;
  padding:0;
  text-align:left;
}
.link:hover{ text-decoration: underline; }

.auth-msg{
  margin-top:12px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  background: rgba(255,255,255,.03);
  color: var(--muted);
  white-space:pre-wrap;
}

code{
  background: rgba(255,255,255,.06);
  padding:2px 6px;
  border-radius:8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  font-size: 12px;
}

/* Make native select dropdowns readable across browsers */
select.input{
  appearance: none;
  -webkit-appearance: none;
  background-color: #0f1a2e !important;
  color: rgba(255,255,255,.92) !important;
  color-scheme: dark;
}
select.input option,
select.input optgroup{
  background-color: #0f1a2e !important;
  color: rgba(255,255,255,.92) !important;
}
