:root {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --panel2: #f7f2f5;
  --line: #e5e3e8;
  --txt: #20222a;
  --muted: #7a7d88;
  --accent: #cc0467;       /* magenta de marca (logo Bedoya) */
  --accent2: #a60353;      /* magenta oscuro hover/active */
  --accent-soft: #fbe7f1;  /* magenta muy suave para fondos */
  --green: #1a9c4e;
  --red: #d92d20;
  --amber: #c77700;
  --shadow: 0 4px 18px rgba(40,10,30,.10);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--txt); font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; background: #fff; border: 1px solid var(--line);
  color: var(--txt); border-radius: 6px; padding: 7px 9px; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- Login ---- */
#login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fdeef6 0%, #f3f4f7 60%);
}
.login-box {
  background: var(--panel); padding: 36px; border-radius: 14px; width: 350px;
  box-shadow: var(--shadow); border: 1px solid var(--line); text-align: center;
}
.login-box img.logo { width: 210px; max-width: 80%; margin: 4px auto 6px; display: block; }
.login-box p { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-box input { width: 100%; margin-bottom: 12px; }
.login-box button { width: 100%; }

/* ---- Layout ---- */
#app { display: none; min-height: 100vh; }
header {
  display: flex; align-items: center; gap: 22px; padding: 0 22px; height: 60px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 6px rgba(40,10,30,.04);
}
header .brand img { height: 30px; display: block; }
nav { display: flex; gap: 4px; flex: 1; }
nav a {
  padding: 8px 14px; border-radius: 7px; color: var(--muted); text-decoration: none;
  font-weight: 500; font-size: 13.5px;
}
nav a:hover { color: var(--accent); background: var(--accent-soft); }
nav a.active { color: #fff; background: var(--accent); }
header .user { color: var(--muted); font-size: 13px; font-weight: 600; }
main { padding: 22px; max-width: 1500px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

h2.title { margin: 0 0 16px; font-size: 19px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
label.fld { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }

.btn { background: var(--accent); color: #fff; border: none; border-radius: 7px; padding: 8px 14px; font-weight: 600; }
.btn:hover { background: var(--accent2); }
.btn.sec { background: #fff; border: 1px solid var(--line); color: var(--txt); }
.btn.sec:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid transparent; padding: 4px 8px; }
.btn.danger:hover { background: rgba(217,45,32,.10); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }

/* ---- Cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; margin-bottom: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; box-shadow: var(--shadow); }
.card .lbl { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
.card .val { font-size: 26px; font-weight: 700; margin-top: 6px; color: var(--accent); }
.card .val.green { color: var(--green); }
.card .val.red { color: var(--red); }
.card .val.amber { color: var(--amber); }

/* ---- Tables ---- */
.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 72vh; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { position: sticky; top: 0; background: var(--panel2); z-index: 2; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
tbody tr:hover { background: var(--accent-soft); }
td.num, th.num { text-align: right; }
tfoot td { font-weight: 700; background: var(--panel2); position: sticky; bottom: 0; }
table input { padding: 4px 6px; border-radius: 5px; }
table input.mes { width: 56px; text-align: right; }
table input.ing { width: 80px; text-align: right; }
.pill { padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.pend-pos { color: var(--red); font-weight: 700; }
.pend-zero { color: var(--muted); }
.tipo-trabajo { background: var(--accent-soft); color: var(--accent); }
.tipo-seguro { background: rgba(26,156,78,.14); color: var(--green); }
.tipo-colaboracion { background: rgba(199,119,0,.14); color: var(--amber); }

/* ---- Modal ---- */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(30,10,25,.45); z-index: 50; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.show { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: 480px; max-width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 12px 40px rgba(40,10,30,.25); }
.modal h3 { margin: 0; padding: 18px 20px; border-bottom: 1px solid var(--line); font-size: 16px; }
.modal .body { padding: 20px; display: grid; gap: 12px; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.modal input, .modal select, .modal textarea { width: 100%; }

#toast { position: fixed; bottom: 24px; right: 24px; background: var(--green); color: #fff; padding: 12px 18px; border-radius: 8px; font-weight: 600; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: .25s; z-index: 100; }
#toast.show { opacity: 1; transform: translateY(0); }
#toast.err { background: var(--red); }
.muted { color: var(--muted); }
.dirty { box-shadow: 0 0 0 2px var(--amber) inset; }
