/* ============ GaeliKA GrantOps · Identidad corporativa GaeliKA (Light Blue) ============ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
  --blue: #4FA3D1;          /* Azul Claro GaeliKA */
  --blue-soft: rgba(79, 163, 209, .12);
  --blue-softer: rgba(79, 163, 209, .07);
  --green: #6BC46D;         /* Verde Innovación */
  --green-soft: rgba(107, 196, 109, .14);
  --deep: #1F4E79;          /* Azul profundo */
  --gray: #4A4A4A;          /* Gris técnico */
  --light: #E9EEF2;         /* Gris claro */
  --muted: #8b9aa7;
  --danger: #c0392b;
  --danger-soft: rgba(192, 57, 43, .1);
  --warn: #d98e04;
  --warn-soft: rgba(217, 142, 4, .12);
  --radius: 12px;
  --shadow: 0 1px 3px rgba(31, 78, 121, .08), 0 4px 14px rgba(31, 78, 121, .06);
  --shadow-lg: 0 6px 24px rgba(31, 78, 121, .14);
  --font: 'Montserrat', 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--gray);
  background: #f6f9fb;
  font-size: 14.5px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }

/* ================= layout ================= */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--deep) 0%, #173d5f 100%);
  color: #d7e6f2; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand img { width: 42px; height: 42px; object-fit: contain; background:#fff; border-radius: 10px; padding: 3px; }
.sidebar .brand .t { font-weight: 700; font-size: 15.5px; color: #fff; letter-spacing: .3px; }
.sidebar .brand .t .ka { color: var(--green); }
.sidebar .brand .t small { display: block; font-weight: 500; font-size: 10.5px; color: var(--blue); letter-spacing: 1.4px; text-transform: uppercase; }

.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav .sec { font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px; color: rgba(215,230,242,.45); margin: 14px 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 12px; margin: 2px 0; border-radius: 9px;
  color: #d7e6f2; font-weight: 500; font-size: 13.5px; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a svg { width: 17px; height: 17px; stroke: currentColor; opacity: .8; flex-shrink: 0; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.on { background: var(--blue); color: #fff; font-weight: 600; box-shadow: 0 2px 10px rgba(79,163,209,.4); }
.nav a .badge-n {
  margin-left: auto; background: var(--green); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 7px;
}
.sidebar .foot { padding: 14px 18px; font-size: 11px; color: rgba(215,230,242,.45); border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 30px; background: #fff; border-bottom: 1px solid var(--light);
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 19px; font-weight: 600; color: var(--deep); margin: 0; }
.userchip { display: flex; align-items: center; gap: 10px; }
.userchip .av {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue);
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.userchip .nm { font-weight: 600; font-size: 13px; color: var(--deep); line-height: 1.2; }
.userchip .rl { font-size: 11px; color: var(--muted); }
.userchip a.out { color: var(--muted); font-size: 12px; margin-left: 8px; }

.content { padding: 26px 30px 60px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ================= componentes ================= */
.card {
  background: #fff; border: 1px solid var(--light); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px;
}
.card > h2 { font-size: 15px; color: var(--deep); margin: 0 0 14px; font-weight: 600; display:flex; align-items:center; gap:8px;}
.card > h2 .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.kpi { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--deep); }
.kpi .v.green { color: var(--green); }
.kpi .v.blue { color: var(--blue); }
.kpi .v.red { color: var(--danger); }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 500; }

/* botones */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--blue); color: #fff; border: none; cursor: pointer;
  font-family: var(--font); font-weight: 600; font-size: 13px;
  padding: 9px 18px; border-radius: 9px; text-decoration: none;
  transition: filter .15s, transform .05s; line-height: 1.2;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.green { background: var(--green); }
.btn.ghost { background: #fff; color: var(--deep); border: 1px solid var(--light); font-weight: 500; }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--light); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* formularios */
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--deep); margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d5dee6; border-radius: 9px;
  font-family: var(--font); font-size: 13.5px; color: var(--gray); background: #fff;
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft);
}
textarea { resize: vertical; min-height: 80px; }
.frow { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.factions { margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input[type=file] { font-size: 12.5px; }
input[type=file]::file-selector-button {
  font-family: var(--font); font-weight: 600; font-size: 12px; color: var(--deep);
  background: var(--light); border: none; border-radius: 7px; padding: 7px 13px; margin-right: 10px; cursor: pointer;
}

/* tablas (según manual: cabecera azul 15%, texto azul profundo) */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  background: var(--blue-soft); color: var(--deep); font-weight: 600;
  text-align: left; padding: 9px 12px; white-space: nowrap;
}
.tbl th:first-child { border-radius: 8px 0 0 8px; }
.tbl th:last-child { border-radius: 0 8px 8px 0; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--light); vertical-align: middle; }
.tbl tr:nth-child(even) td { background: #fafcfd; }
.tbl tr:hover td { background: var(--blue-softer); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { white-space: nowrap; text-align: right; }

/* badges de estado */
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; white-space: nowrap;
}
.b-pendiente { background: var(--light); color: var(--gray); }
.b-en_revision, .b-en_curso, .b-abierta { background: var(--blue-soft); color: var(--deep); }
.b-cumplida, .b-completada, .b-respondida, .b-activo, .b-ok { background: var(--green-soft); color: #3e8e41; }
.b-riesgo, .b-danger { background: var(--danger-soft); color: var(--danger); }
.b-presentada { background: var(--warn-soft); color: var(--warn); }
.b-cerrada, .b-cerrado { background: var(--light); color: var(--muted); }
.b-ia { background: var(--green-soft); color: #3e8e41; border: 1px dashed var(--green); }

/* barras de progreso */
.prog { background: var(--light); border-radius: 999px; height: 8px; overflow: hidden; }
.prog > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .4s; }
.prog.warn > span { background: var(--warn); }
.prog.over > span { background: var(--danger); }

/* alertas / avisos */
.alert-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border-radius: 9px; margin-bottom: 8px; font-size: 13px; border: 1px solid transparent;
}
.alert-item.danger { background: var(--danger-soft); border-color: rgba(192,57,43,.2); color: #8e2b20; }
.alert-item.warn { background: var(--warn-soft); border-color: rgba(217,142,4,.25); color: #8a5a03; }
.alert-item a { font-weight: 600; }

.callout { border-left: 3px solid var(--blue); background: var(--blue-softer); padding: 12px 16px; border-radius: 8px; font-size: 13px; }
.callout.green { border-color: var(--green); background: var(--green-soft); }

/* flash */
.flash {
  position: fixed; top: 18px; right: 18px; z-index: 200; max-width: 420px;
  background: #fff; border: 1px solid var(--light); border-left: 4px solid var(--green);
  box-shadow: var(--shadow-lg); border-radius: 10px; padding: 13px 40px 13px 16px;
  font-size: 13px; color: var(--gray); animation: slidein .25s ease;
}
.flash.error { border-left-color: var(--danger); }
.flash .x { position: absolute; top: 8px; right: 10px; cursor: pointer; color: var(--muted); font-size: 16px; border: none; background: none; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* pestañas de proyecto */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--light); margin-bottom: 20px; }
.tabs a {
  padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--muted);
  border-radius: 9px 9px 0 0; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tabs a:hover { color: var(--blue); }
.tabs a.on { color: var(--blue); border-bottom-color: var(--blue); background: var(--blue-softer); }

/* login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f6f9fb 0%, var(--light) 60%, #e2f2e3 100%); padding: 20px;
}
.login-card {
  width: 400px; max-width: 100%; background: #fff; border-radius: 18px;
  box-shadow: var(--shadow-lg); padding: 38px 36px 30px; text-align: center;
  border-top: 4px solid var(--blue);
}
.login-card img.logo { width: 150px; margin-bottom: 6px; }
.login-card h1 { font-size: 19px; color: var(--deep); margin: 4px 0 2px; }
.login-card .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 22px; }
.login-card form { text-align: left; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 11px; font-size: 14px; }
.login-card .err { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 6px; }
.login-foot { margin-top: 20px; font-size: 11px; color: var(--muted); }

/* calendario */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: 6px; text-align: left; }
.cal td { border: 1px solid var(--light); vertical-align: top; height: 96px; padding: 5px 6px; font-size: 12px; }
.cal td.dim { background: #fafbfc; color: #c3ccd4; }
.cal td .d { font-weight: 600; color: var(--deep); font-size: 12px; }
.cal td.today { background: var(--blue-softer); box-shadow: inset 0 0 0 2px var(--blue); border-radius: 4px; }
.cal .ev { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 5px; font-size: 10.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cal .ev.info { background: var(--blue-soft); color: var(--deep); }
.cal .ev.phase { background: var(--green-soft); color: #3e8e41; }
.cal .ev.danger { background: var(--danger-soft); color: var(--danger); }
.cal .ev.project { background: var(--warn-soft); color: var(--warn); }

/* chat asistente */
.chat-box { display: flex; flex-direction: column; height: calc(100vh - 250px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 6px 4px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 78%; padding: 11px 15px; border-radius: 14px; font-size: 13.5px; }
.msg.user { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--light); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg.assistant p:first-child { margin-top: 0; } .msg.assistant p:last-child { margin-bottom: 0; }
.msg.typing { color: var(--muted); font-style: italic; }
.chat-form { display: flex; gap: 10px; margin-top: 14px; }
.chat-form textarea { flex: 1; min-height: 46px; max-height: 130px; }

/* hilo de consultas */
.thread .qmsg { display: flex; gap: 12px; margin-bottom: 16px; }
.thread .qmsg .av { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 13px; }
.thread .qmsg .av.adm { background: var(--green); }
.thread .qmsg .av.usr { background: var(--blue); }
.thread .qmsg .bub { background: #fff; border: 1px solid var(--light); border-radius: 12px; padding: 12px 16px; flex: 1; box-shadow: var(--shadow); }
.thread .qmsg .who { font-size: 12px; font-weight: 600; color: var(--deep); margin-bottom: 4px; }
.thread .qmsg .who .when { font-weight: 400; color: var(--muted); }

/* informe markdown */
.mdreport { font-size: 13.5px; }
.mdreport h3 { color: var(--blue); font-size: 14px; margin: 16px 0 8px; }
.mdreport ul { padding-left: 20px; margin: 6px 0; }
.mdreport li { margin: 4px 0; }
.mdreport hr { border: none; border-top: 1px solid var(--light); margin: 14px 0; }
.mdreport em { color: var(--muted); font-size: 12px; }
.mdreport table { border-collapse: collapse; margin: 8px 0; }
.mdreport th, .mdreport td { border: 1px solid var(--light); padding: 5px 10px; font-size: 12.5px; }
.mdreport th { background: var(--blue-soft); color: var(--deep); }

/* detalles plegables */
details.box { border: 1px solid var(--light); border-radius: 10px; margin-bottom: 10px; background: #fff; }
details.box > summary {
  cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 13px; color: var(--deep);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::before { content: "▸"; color: var(--blue); transition: transform .15s; }
details.box[open] > summary::before { transform: rotate(90deg); }
details.box .inner { padding: 4px 16px 16px; border-top: 1px solid var(--light); }

/* misceláneo */
.muted { color: var(--muted); font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 13px; }
.empty .big { font-size: 30px; display: block; margin-bottom: 8px; }
.pill-kpis { display: flex; gap: 24px; flex-wrap: wrap; }
.hr { border: none; border-top: 1px solid var(--light); margin: 16px 0; }
.right { text-align: right; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.projcard { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.projcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.projcard h3 { margin: 0 0 4px; font-size: 15px; color: var(--deep); }
.projcard .prg { font-size: 12px; color: var(--blue); font-weight: 600; }
.iconbtn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 15px; padding: 3px 6px; border-radius: 6px; }
.iconbtn:hover { background: var(--light); color: var(--deep); }
code.k { background: var(--light); border-radius: 5px; padding: 2px 7px; font-size: 12.5px; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .nav { display: flex; flex-wrap: wrap; padding: 8px; }
  .nav .sec { display: none; }
  .sidebar .foot { display: none; }
  .content { padding: 18px 14px 50px; }
  .topbar { padding: 12px 16px; }
}
@media print {
  .sidebar, .topbar, .flash, .factions, .tabs { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; }
}
