*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:   #1E3A5F;
  --navy2:  #162D4A;
  --orange: #F97316;
  --slate:  #64748B;
  --light:  #F1F5F9;
  --white:  #FFFFFF;
  --border: #E2E8F0;
  --text:   #1E293B;
  --muted:  #94A3B8;
  --sw: 220px;
  --hh: 58px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--light);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

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

/* ═══════════════════ HEADER ═══════════════════ */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--hh);
  background: var(--navy);
  display: flex; align-items: center; gap: 12px; padding: 0 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.logo { font-weight: 900; font-size: 17px; color: #fff; letter-spacing: -.5px; white-space: nowrap; }
.logo span { color: var(--orange); }
.hd { width: 1px; height: 22px; background: rgba(255,255,255,.15); flex-shrink: 0; }
.header-sub { font-size: 11px; color: rgba(255,255,255,.45); font-weight: 600; letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; }
.header-nav { display: flex; gap: 2px; margin-left: 4px; }
.hn {
  padding: 5px 11px; border-radius: 7px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.55); transition: all .12s;
}
.hn:hover { background: rgba(255,255,255,.1); color: #fff; }
.hn.on { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rol-switch { display: flex; gap: 2px; background: rgba(255,255,255,.08); border-radius: 8px; padding: 3px; }
.rs { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.45); transition: all .12s; text-transform: uppercase; letter-spacing: .4px; }
.rs:hover { color: rgba(255,255,255,.8); }
.rs.on { background: var(--orange); color: #fff; }
.header-user { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border-radius: 8px; padding: 5px 12px; }
.hu-name { font-size: 13px; font-weight: 600; color: #fff; }
.rbadge { font-size: 10px; font-weight: 700; letter-spacing: .5px; padding: 2px 7px; border-radius: 20px; text-transform: uppercase; }
.r-admin      { background: rgba(249,115,22,.25); color: #FB923C; }
.r-gestor     { background: rgba(99,102,241,.25);  color: #818CF8; }
.r-trabajador { background: rgba(16,185,129,.25);  color: #34D399; }

/* ═══════════════════ LAYOUT ═══════════════════ */
.app-body { display: flex; margin-top: var(--hh); min-height: calc(100vh - var(--hh)); }
.sidebar {
  width: var(--sw); flex-shrink: 0;
  background: var(--navy2);
  position: fixed; top: var(--hh); left: 0; bottom: 0;
  overflow-y: auto; padding: 12px 0;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent;
}
.main { margin-left: var(--sw); flex: 1; padding: 26px 30px 40px; }

/* SIDEBAR NAV */
.snav-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: rgba(255,255,255,.3); padding: 12px 14px 4px;
}
.snav {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.55); transition: all .12s; position: relative;
}
.snav:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.snav.on { background: rgba(249,115,22,.14); color: #fff; font-weight: 700; }
.snav.on::before {
  content: ''; position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 3px; background: var(--orange); border-radius: 0 3px 3px 0;
}
.nbadge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.7);
  padding: 1px 7px; border-radius: 20px;
}

/* ═══════════════════ AVATAR ═══════════════════ */
.av {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ═══════════════════ PAGE HEADER ═══════════════════ */
.ph { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.ph-title { font-size: 21px; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.ph-sub   { font-size: 13px; color: var(--slate); margin-top: 2px; }

/* ═══════════════════ BUTTONS ═══════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; transition: all .12s;
  text-decoration: none; white-space: nowrap;
}
.btn-p  { background: var(--orange); color: #fff; }
.btn-p:hover  { background: #EA6C0A; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(249,115,22,.3); }
.btn-g  { background: transparent; color: var(--slate); border: 1.5px solid var(--border); }
.btn-g:hover  { border-color: var(--slate); color: var(--text); background: var(--white); }
.btn-ok { background: #D1FAE5; color: #065F46; }
.btn-ok:hover { background: #059669; color: #fff; }
.btn-del{ background: #FEE2E2; color: #DC2626; }
.btn-del:hover{ background: #DC2626; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.ibt {
  width: 30px; height: 30px; border-radius: 7px; border: none; cursor: pointer;
  background: var(--light); color: var(--slate); display: inline-flex;
  align-items: center; justify-content: center; font-size: 14px; transition: all .12s;
}
.ibt:hover { background: var(--border); color: var(--text); }

/* ═══════════════════ STATS ═══════════════════ */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 22px; }
.stat {
  background: var(--white); border-radius: 11px; padding: 16px 18px;
  border: 1.5px solid var(--border); position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat.s1::before { background: #EF4444; }
.stat.s2::before { background: #F59E0B; }
.stat.s3::before { background: #94A3B8; }
.stat.s4::before { background: #10B981; }
.stat-n { font-size: 28px; font-weight: 900; font-family: 'JetBrains Mono', monospace; color: var(--text); letter-spacing: -1px; }
.stat-l { font-size: 11px; color: var(--slate); font-weight: 600; margin-top: 2px; text-transform: uppercase; letter-spacing: .4px; }

/* ═══════════════════ FILTER BAR ═══════════════════ */
.fbar { display: flex; gap: 7px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.fb {
  padding: 6px 13px; border-radius: 20px; border: 1.5px solid var(--border);
  font-size: 12px; font-weight: 600; cursor: pointer; background: var(--white);
  color: var(--slate); transition: all .12s; font-family: inherit;
}
.fb:hover { border-color: var(--navy); color: var(--navy); }
.fb.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.searchbox {
  margin-left: auto; display: flex; align-items: center; gap: 7px;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
}
.searchbox input {
  border: none; outline: none; font-size: 13px; font-family: inherit;
  color: var(--text); width: 160px; background: transparent;
}
.searchbox input::placeholder { color: var(--muted); }

/* ═══════════════════ OBJECTIVE CARDS ═══════════════════ */
.ocard {
  background: var(--white); border-radius: 11px;
  border: 1.5px solid var(--border);
  display: flex; margin-bottom: 8px; overflow: hidden;
  transition: border .15s, box-shadow .15s;
}
.ocard:hover { border-color: #CBD5E1; box-shadow: 0 3px 12px rgba(0,0,0,.06); }
.ocard.open  { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,.09); }
.ostripe { width: 4px; flex-shrink: 0; }
.obody { flex: 1; padding: 14px 16px; min-width: 0; }

/* Card top row */
.otop { display: flex; align-items: flex-start; gap: 10px; }
.otitle {
  font-size: 14px; font-weight: 700; color: var(--text);
  flex: 1; line-height: 1.4; cursor: pointer;
  background: none; border: none; text-align: left; padding: 0; font-family: inherit;
}
.oacts { display: flex; gap: 5px; flex-shrink: 0; }

/* Meta tags */
.ometa { display: flex; align-items: center; gap: 7px; margin-top: 7px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; padding: 2px 9px;
  border-radius: 20px; white-space: nowrap;
}
.te-urgente     { background: #FEE2E2; color: #DC2626; }
.te-en_progreso { background: #FEF3C7; color: #D97706; }
.te-pendiente   { background: #F1F5F9; color: #64748B; }
.te-finalizado  { background: #D1FAE5; color: #059669; }
.te-revision    { background: #EDE9FE; color: #7C3AED; }
.tp-urgente { background: #FEE2E2; color: #DC2626; }
.tp-alta    { background: #FEF3C7; color: #D97706; }
.tp-media   { background: #EFF6FF; color: #1D4ED8; }
.tp-baja    { background: #F0FDF4; color: #166534; }
.tcat { background: #F1F5F9; color: var(--slate); }
.tmeta { font-size: 12px; color: var(--slate); display: flex; align-items: center; gap: 4px; }
.tdate { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }

/* ── Detail panel (hidden until .open) */
.odetail {
  display: none;
  border-top: 1.5px solid var(--light);
  margin-top: 12px; padding-top: 14px;
}
.ocard.open .odetail { display: block; }

.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.dfull { grid-column: 1 / -1; }
.df label {
  font-size: 10px; font-weight: 700; color: var(--muted);
  letter-spacing: .6px; text-transform: uppercase;
  display: block; margin-bottom: 4px;
}
.df p { font-size: 13px; color: var(--text); line-height: 1.55; white-space: pre-line; }

/* Comments */
.csect { border-top: 1.5px solid var(--light); padding-top: 13px; margin-top: 13px; }
.clabel { font-size: 11px; font-weight: 700; color: var(--slate); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.citem { display: flex; gap: 9px; margin-bottom: 9px; padding: 11px; background: var(--light); border-radius: 9px; }
.cav { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; }
.cbody { flex: 1; min-width: 0; }
.chead { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.cauthor { font-size: 12px; font-weight: 700; color: var(--text); }
.cdate { font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--muted); }
.ctext { font-size: 13px; color: var(--slate); line-height: 1.5; }

.addcom { display: flex; gap: 7px; margin-top: 11px; }
.addcom input {
  flex: 1; padding: 8px 13px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 13px; font-family: inherit;
  outline: none; color: var(--text); background: var(--white); transition: border .12s;
}
.addcom input:focus { border-color: var(--orange); }

/* ═══════════════════ INCIDENCIAS ═══════════════════ */
.icard {
  background: var(--white); border-radius: 11px; border: 1.5px solid var(--border);
  padding: 16px; margin-bottom: 9px; border-left: 4px solid #EF4444;
}
.icard.resuelta { border-left-color: #10B981; opacity: .7; }
.ihead { display: flex; gap: 12px; }
.iico { font-size: 20px; flex-shrink: 0; padding-top: 2px; }
.ibody { flex: 1; }
.ititle { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.imeta { font-size: 12px; color: var(--slate); display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 7px; }
.idesc { font-size: 13px; color: var(--slate); line-height: 1.55; margin-bottom: 9px; }
.ibadge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.ib-j { background: #EDE9FE; color: #7C3AED; }
.ib-s { background: #D1FAE5; color: #059669; }
.iacts { display: flex; gap: 7px; margin-top: 11px; align-items: center; flex-wrap: wrap; }

/* ═══════════════════ DASHBOARD EXTRAS ═══════════════════ */
.dgblock { background: var(--white); border-radius: 11px; border: 1.5px solid var(--border); padding: 18px; }
.dg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.dbt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--slate); margin-bottom: 12px; }
.pitem { margin-bottom: 11px; }
.plabel { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.plabel b { font-weight: 600; }
.plabel span { font-family: 'JetBrains Mono', monospace; color: var(--muted); }
.pbar { height: 6px; background: var(--light); border-radius: 99px; overflow: hidden; }
.pfill { height: 100%; border-radius: 99px; }
.urg-item {
  display: block; padding: 9px 11px; background: #FEF2F2;
  border-radius: 8px; border-left: 3px solid #EF4444;
  margin-bottom: 7px; transition: background .12s;
}
.urg-item:hover { background: #FEE2E2; }
.urg-item b { font-size: 13px; color: #991B1B; display: block; }
.urg-item small { font-size: 11px; color: #DC2626; }
.fecha-row { display: flex; align-items: center; gap: 11px; padding: 9px 11px; background: var(--light); border-radius: 8px; margin-bottom: 7px; }
.fecha-lbl { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; white-space: nowrap; min-width: 55px; }
.fecha-txt { font-size: 12px; font-weight: 600; }
.fecha-sub { font-size: 11px; color: var(--muted); }

/* ═══════════════════ MODAL ═══════════════════ */
.mover {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 16px;
}
.mover.on { display: flex; }
.modal {
  background: var(--white); border-radius: 14px;
  width: 100%; max-width: 620px; max-height: 92vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.22);
  animation: mup .18s ease;
}
@keyframes mup { from{transform:translateY(16px);opacity:0} to{transform:translateY(0);opacity:1} }
.mhdr { padding: 18px 22px 0; display: flex; align-items: center; justify-content: space-between; }
.mtitle { font-size: 16px; font-weight: 800; }
.mclose { width: 30px; height: 30px; border-radius: 7px; border: none; cursor: pointer; background: var(--light); font-size: 17px; display: flex; align-items: center; justify-content: center; }
.mclose:hover { background: var(--border); }
.mbody { padding: 18px 22px; }
.mfoot { padding: 14px 22px; border-top: 1.5px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* FORMS */
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fg { margin-bottom: 13px; }
.fg label { display: block; font-size: 11px; font-weight: 700; color: var(--slate); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.fg input, .fg select, .fg textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 13px; font-family: inherit;
  outline: none; color: var(--text); background: var(--white); transition: border .12s;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--orange); }
.fg textarea { resize: vertical; min-height: 80px; }

/* ═══════════════════ TABLE ═══════════════════ */
.dtable { width: 100%; border-collapse: collapse; }
.dtable th { background: var(--light); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--slate); padding: 11px 14px; text-align: left; border-bottom: 1.5px solid var(--border); }
.dtable td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.dtable tr:last-child td { border-bottom: none; }
.dtable tr:hover td { background: #FAFBFC; }

/* ═══════════════════ EMPTY ═══════════════════ */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .ei { font-size: 44px; margin-bottom: 10px; }
.empty p { font-size: 14px; font-weight: 500; }

/* ═══════════════════ TOAST ═══════════════════ */
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy); color: #fff; padding: 11px 16px;
  border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 9px; min-width: 240px;
  animation: tin .25s ease;
}
@keyframes tin { from{transform:translateY(14px);opacity:0} to{transform:translateY(0);opacity:1} }

/* ═══════════════════ MISC ═══════════════════ */
.alert { padding: 11px 15px; border-radius: 8px; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.alert-ok  { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-err { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.card-wrap { background: var(--white); border-radius: 11px; border: 1.5px solid var(--border); overflow: hidden; }

/* ── Header icon buttons */
.header-icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,.08);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; text-decoration: none; transition: background .12s;
  flex-shrink: 0;
}
.header-icon-btn:hover { background: rgba(255,255,255,.16); }
