:root{
  --bg:#0b1220;
  --panel:#0f1a2e;
  --card:#121f36;
  --muted:#9fb0d0;
  --text:#e7eeff;
  --line:rgba(255,255,255,.09);
  --accent:#6ea8ff;
  --danger:#ff5d5d;
  --ok:#3ddc97;
  --warn:#ffd166;
  --shadow: 0 20px 50px rgba(0,0,0,.35);
  --radius: 16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 700px at 15% 10%, rgba(110,168,255,.16), transparent 60%),
              radial-gradient(900px 600px at 85% 20%, rgba(61,220,151,.10), transparent 55%),
              var(--bg);
  color:var(--text);
}

.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; 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(--line);
}

.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:42px;height:42px;border-radius:14px;
  display:grid;place-items:center;
  background: linear-gradient(135deg, rgba(110,168,255,.35), rgba(61,220,151,.25));
  border:1px solid rgba(255,255,255,.14);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  font-weight:800;
}
.title{font-weight:800; letter-spacing:.2px}
.subtitle{color:var(--muted); font-size:12px; margin-top:2px}
.top-actions{display:flex; gap:10px; flex-wrap:wrap}

.layout{
  display:grid;
  grid-template-columns: 260px 1fr;
  gap:18px;
  padding:18px;
  max-width: 1200px;
  margin:0 auto;
}

.sidebar{
  position:sticky; top:74px;
  align-self:start;
  background: rgba(15,26,46,.75);
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding:10px;
  box-shadow: var(--shadow);
}

.navbtn{
  width:100%;
  background: transparent;
  border:1px solid transparent;
  color: var(--text);
  padding:12px 12px;
  border-radius: 14px;
  text-align:left;
  cursor:pointer;
  display:flex; gap:10px; align-items:center;
  font-weight:650;
}
.navbtn:hover{background: rgba(255,255,255,.05); border-color: var(--line)}
.navbtn.active{
  background: rgba(110,168,255,.14);
  border-color: rgba(110,168,255,.25);
}

.content{
  background: rgba(15,26,46,.55);
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding:18px;
  box-shadow: var(--shadow);
  min-height: calc(100vh - 120px);
}

.viewhead{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}
h2{margin:0 0 4px 0}
p{margin:0;color:var(--muted)}

.filters{
  display:grid;
  grid-template-columns: 1fr 220px;
  gap:12px;
  margin: 14px 0;
}
.field label{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-bottom:6px;
}
.field input,.field select, .field textarea{
  width:100%;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid var(--line);
  outline:none;
  background: rgba(18,31,54,.85);
  color: var(--text);
}
.field textarea{min-height:90px; resize:vertical}

.tablewrap{
  overflow:auto;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(18,31,54,.65);
}
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width: 900px;
}
.table thead th{
  text-align:left;
  font-size:12px;
  color: var(--muted);
  padding:12px 12px;
  border-bottom:1px solid var(--line);
  background: rgba(18,31,54,.9);
}
.table tbody td{
  padding:12px 12px;
  border-bottom:1px solid rgba(255,255,255,.06);
  vertical-align:top;
}
.table tbody tr:hover{background: rgba(255,255,255,.03)}
.right{text-align:right}

.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius: 999px;
  border:1px solid var(--line);
  font-size:12px;
  color: var(--text);
  background: rgba(255,255,255,.04);
}
.dot{width:8px;height:8px;border-radius:50%; background: var(--muted)}
.dot.ok{background: var(--ok)}
.dot.warn{background: var(--warn)}
.dot.danger{background: var(--danger)}
.dot.accent{background: var(--accent)}

.btn{
  border:none;
  padding:10px 12px;
  border-radius: 14px;
  cursor:pointer;
  font-weight:700;
  color:#081022;
  background: linear-gradient(135deg, rgba(110,168,255,1), rgba(61,220,151,1));
  box-shadow: 0 14px 30px rgba(0,0,0,.25);
}
.btn:hover{filter:brightness(1.05)}
.btn:active{transform: translateY(1px)}
.btn.ghost{
  background: rgba(255,255,255,.05);
  color: var(--text);
  border:1px solid var(--line);
  box-shadow:none;
}
.btn.danger{
  background: rgba(255,93,93,.18);
  color: #ffd9d9;
  border:1px solid rgba(255,93,93,.35);
  box-shadow:none;
}
.iconbtn{
  background: transparent;
  color: var(--text);
  border:1px solid transparent;
  cursor:pointer;
  border-radius: 12px;
  padding:8px 10px;
}
.iconbtn:hover{background: rgba(255,255,255,.06); border-color: var(--line)}

.hidden{display:none !important}

.modal{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:grid; place-items:center;
  padding:18px;
}
.modal-card{
  width:min(980px, 100%);
  background: rgba(18,31,54,.92);
  border:1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 14px;
  border-bottom:1px solid var(--line);
}
.modal-head h3{margin:0}
.modal-actions{
  display:flex; justify-content:flex-end; gap:10px;
  padding:14px;
  border-top:1px solid var(--line);
}
.grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:12px;
  padding:14px;
}
@media (max-width: 940px){
  .layout{grid-template-columns: 1fr}
  .sidebar{position:relative; top:0}
  .table{min-width: 760px}
}
@media (max-width: 700px){
  .grid{grid-template-columns:1fr}
  .filters{grid-template-columns:1fr}
  .table{min-width: 0}
}

.card{
  border:1px solid var(--line);
  border-radius: 16px;
  background: rgba(18,31,54,.70);
  padding:14px;
}
.row{display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap}
.grow{flex:1}
.seg-results{margin-top:12px; display:grid; gap:10px;}
.result-item{
  border:1px solid var(--line);
  border-radius: 14px;
  padding:12px;
  background: rgba(255,255,255,.03);
}
.kv{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:6px 12px;
  margin-top:8px;
  color: var(--muted);
  font-size: 13px;
}
.kv b{color: var(--text)}
.small{font-size:12px;color:var(--muted)}

/* Tabla -> Cards en mobile */
@media (max-width: 700px){
  .tablewrap{border:none; background:transparent}
  .table thead{display:none}
  .table, .table tbody, .table tr, .table td{display:block; width:100%}
  .table tbody tr{
    border:1px solid var(--line);
    border-radius: 14px;
    padding:10px;
    margin-bottom:10px;
    background: rgba(255,255,255,.03);
  }
  .table tbody td{
    border:none;
    padding:6px 4px;
    position:relative;
    padding-left: 120px;
    min-height: 28px;
  }
  .table tbody td::before{
    content: attr(data-label);
    position:absolute;
    left: 4px;
    top: 6px;
    color: var(--muted);
    font-size: 12px;
    width: 110px;
  }
  .table tbody td.right{
    padding-left: 4px;
    text-align:left;
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    padding-top:10px;
  }
  .table tbody td.right::before{content:""}
}
