:root{
  --bg:#ffffff;
  --panel:#f7f7f9;
  --panel2:#ffffff;
  --text:#111216;
  --muted:#5b6270;
  --line:#e7e8ee;
  --brand:#e30613;
  --brand2:#ff3b3b;
  --ok:#11b981;
  --warn:#f59e0b;
  --bad:#ef4444;
  --radius:18px;
  --shadow:0 10px 28px rgba(15,17,21,.08);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color:var(--text);
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(227,6,19,.08), transparent 50%),
    radial-gradient(700px 450px at 90% 10%, rgba(227,6,19,.06), transparent 55%),
    linear-gradient(180deg,#fff,#fff);
  min-height:100vh;
  overflow-x:hidden; /* sin scroll horizontal */
}

header{
  position:sticky; top:0; z-index:10;
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}

.wrap{max-width:1200px; margin:0 auto; padding:16px;}
.topbar{display:flex; gap:14px; align-items:center; justify-content:space-between; flex-wrap:wrap;}

.brand{display:flex; gap:12px; align-items:center;}
.logo{
  width:44px; height:44px; border-radius:14px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  display:grid; place-items:center; color:#fff; font-weight:900;
  box-shadow: var(--shadow);
}
.titles h1{margin:0; font-size:18px; letter-spacing:.2px;}
.titles .sub{margin-top:2px; font-size:12px; color:var(--muted);}

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

.btn{
  border:1px solid var(--line);
  background:#fff;
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  font-weight:900;
  color:var(--text);
}
.btn:hover{filter:brightness(.98)}
.btn.primary{
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color:#fff;
  border-color: rgba(227,6,19,.25);
}
.btn.ghost{background:transparent}

.pill{
  border:1px solid var(--line);
  background: var(--panel2);
  padding:8px 10px;
  border-radius:999px;
  font-size:12px;
  color:var(--muted);
  display:inline-flex; align-items:center; gap:8px;
}

.notice{
  background:#111;
  color:#fff;
  padding:10px 12px;
  font-size:12px;
  letter-spacing:.2px;
  text-align:center;
}

.card{
  background: var(--panel2);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card .hd{
  padding:14px;
  border-bottom:1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--panel));
  display:flex; gap:10px; align-items:center; justify-content:space-between;
  flex-wrap:wrap;
}
.card .bd{padding:14px;}
.muted{color:var(--muted)}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}
@media(max-width:980px){ .grid2{grid-template-columns:1fr} }

.field label{
  display:block;
  font-weight:900;
  font-size:12px;
  margin:0 0 6px;
  color:#111;
  letter-spacing:.3px;
  text-transform:uppercase;
}
input,select,textarea{
  border:1px solid var(--line);
  background:#fff;
  padding:12px 12px;
  border-radius:14px;
  outline:none;
  font: inherit;
  color: var(--text);
  width:100%;
}
input:focus, select:focus, textarea:focus{
  border-color: rgba(227,6,19,.5);
  box-shadow: 0 0 0 3px rgba(227,6,19,.12);
}
.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}

.tableWrap{overflow:auto; border-radius:16px; border:1px solid var(--line);}
table{width:100%; border-collapse:collapse; font-size:13px;}
th, td{padding:10px 10px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top;}
th{font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.35px;}

.badge{
  display:inline-flex; align-items:center; gap:8px;
  font-weight:900; white-space:nowrap;
}
.dot{width:10px;height:10px;border-radius:999px;background:var(--ok); box-shadow:0 0 0 4px rgba(17,185,129,.14);}
.dot.low{background:var(--warn); box-shadow:0 0 0 4px rgba(245,158,11,.14);}
.dot.bad{background:var(--bad); box-shadow:0 0 0 4px rgba(239,68,68,.14);}

.deptGrid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap:12px;
}
.deptCard{
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.deptCard:hover{border-color: rgba(227,6,19,.45); background: rgba(227,6,19,.04);}
.deptLeft{display:flex; gap:12px; align-items:center; min-width:0;}
.deptIcon{
  width:44px; height:44px; border-radius:14px;
  background: rgba(227,6,19,.08);
  border:1px solid rgba(227,6,19,.18);
  display:grid; place-items:center;
  font-size:22px;
}
.deptName{font-weight:900; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.deptMeta{font-size:12px; color:var(--muted); margin-top:2px}

.modalBack{
  position:fixed; inset:0; background:rgba(0,0,0,.35);
  display:none; align-items:center; justify-content:center;
  padding:16px; z-index:50;
}
.modal{
  width:min(820px, 100%);
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal .mhd{padding:14px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; gap:10px;}
.modal .mbd{padding:14px;}
.small{font-size:12px}