/* Intranet Cool Carriers — colores y tipografía del Manual de uso de marca (oct. 2020)
   Azul RGB 49,84,161 (Pantone 2945 C) · Celeste RGB 44,159,218 (Pantone 2995 C) · Helvetica */
:root {
  --azul: #3154a1;
  --azul-osc: #233d78;
  --azul-noche: #172a55;
  --celeste: #2c9fda;
  --celeste-suave: #e3f2fb;
  --bg: #f2f6fb;
  --surface: #ffffff;
  --fg: #1c2433;
  --muted: #5b6577;
  --line: #d9e1ec;
  --ok: #1d7a4a;
  --ok-suave: #e2f4ea;
  --warn: #9a5b00;
  --warn-suave: #fdf0dc;
  --err: #b3261e;
  --err-suave: #fbe4e2;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; }
a { color: var(--azul); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--celeste); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Botones y formularios ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid var(--azul); background: var(--surface); color: var(--azul); padding: 8px 16px; border-radius: 6px; text-decoration: none; font-weight: 700; cursor: pointer; font-size: .92rem; white-space: nowrap; }
.btn:hover { background: var(--celeste-suave); }
.btn.primary { background: var(--azul); color: #fff; }
.btn.primary:hover { background: var(--azul-osc); border-color: var(--azul-osc); }
.btn.link { border-color: transparent; background: none; padding: 6px 8px; }
.btn.small { padding: 5px 11px; font-size: .84rem; }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn.danger:hover { background: var(--err-suave); }
.btn:disabled { opacity: .55; cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: .84rem; font-weight: 700; }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, .field input, .field select, .field textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 0; width: 100%; }
.field textarea { min-height: 90px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.check { display: flex; gap: 8px; align-items: center; font-size: .92rem; }
.msg { padding: 11px 14px; border-radius: 6px; font-size: .92rem; border-left: 4px solid var(--celeste); background: var(--celeste-suave); }
.msg.ok { border-color: var(--ok); background: var(--ok-suave); }
.msg.err { border-color: var(--err); background: var(--err-suave); }

/* ---------- Pantalla de acceso ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.2fr 1fr; }
.login-photo { position: relative; background: var(--azul-noche); overflow: hidden; }
.login-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 40% 55%; }
.login-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(23,42,85,.88), rgba(23,42,85,.15) 60%); }
.login-photo .claim { position: absolute; z-index: 1; left: 48px; right: 48px; bottom: 48px; color: #fff; }
.login-photo .claim h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.1; max-width: 18ch; }
.login-photo .claim p { color: #dbe6f8; margin: 10px 0 0; max-width: 46ch; }
.login-box { background: var(--surface); display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(20px, 5vw, 72px); gap: 22px; }
.login-box .logo { height: 64px; width: auto; align-self: flex-start; }
.login-box h1 { font-size: 1.5rem; color: var(--azul); }
.login-box p { margin: 0; color: var(--muted); }
.login-box form { display: flex; flex-direction: column; gap: 14px; }
.login-box .alt { border-top: 1px solid var(--line); padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.login-box .small { font-size: .84rem; color: var(--muted); }

/* ---------- Estructura de la app ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.side { background: var(--azul-noche); color: #c9d6ee; display: flex; flex-direction: column; gap: 4px; padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { height: 50px; width: auto; margin: 0 8px 22px; align-self: flex-start; }
.side .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: #8ea3c9; padding: 14px 10px 6px; font-weight: 700; }
.nav { display: flex; align-items: center; gap: 10px; color: #dbe6f8; text-decoration: none; padding: 9px 12px; border-radius: 6px; font-weight: 600; font-size: .94rem; }
.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav[aria-current="page"] { background: var(--azul); color: #fff; box-shadow: inset 3px 0 0 var(--celeste); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side .me { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 10px 0; font-size: .85rem; display: flex; flex-direction: column; gap: 8px; }
.side .me b { color: #fff; display: block; overflow-wrap: anywhere; }
.side .me .btn { border-color: rgba(255,255,255,.35); color: #fff; background: transparent; align-self: flex-start; }
.side .me .btn:hover { background: rgba(255,255,255,.08); }
.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 64px; display: flex; flex-direction: column; gap: 22px; }
.page-title { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-title h1 { font-size: 1.6rem; color: var(--azul); }
.page-title p { margin: 4px 0 0; color: var(--muted); }
.topbar { display: none; }

/* ---------- Componentes ---------- */
.voyages { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 720px), 1fr)); gap: 16px; align-items: start; }
.voyage h2 { font-size: 1.05rem; }
@media (max-width: 560px) { .voyages { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel h2 { font-size: 1.08rem; color: var(--azul); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi { padding: 12px 14px; } .kpi b { font-size: 1.35rem; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--celeste); border-radius: var(--radius); padding: 16px 18px; }
.kpi span { display: block; color: var(--muted); font-size: .84rem; font-weight: 600; }
.kpi b { display: block; font-size: 1.85rem; font-weight: 800; color: var(--azul); line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: .8rem; }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .input { width: auto; flex: 0 1 auto; }
.toolbar .search { flex: 1 1 220px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--azul); border-color: var(--celeste); }

.tablebox { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-height: 70vh; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: #eaf0f8; font-weight: 700; color: var(--azul-osc); z-index: 1; }
th.sortable { cursor: pointer; user-select: none; }
td.num, th.num { text-align: right; }
td select.input { min-width: 170px; }
tr:hover td { background: #f6f9fd; }
tfoot td { font-weight: 800; background: #f6f9fd; position: sticky; bottom: 0; }
.diff-neg { color: var(--err); font-weight: 700; }
.diff-pos { color: var(--ok); font-weight: 700; }
.stats { color: var(--muted); font-size: .84rem; }

.list { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); align-items: start; }
.item:first-child { border-top: 0; padding-top: 0; }
.item .t { font-weight: 700; color: var(--fg); overflow-wrap: anywhere; }
.item .d { color: var(--muted); font-size: .92rem; margin-top: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; font-size: .8rem; color: var(--muted); }
.chip { font-size: .74rem; padding: 2px 9px; border-radius: 99px; background: var(--bg); color: var(--muted); font-weight: 600; }
.chip.blue { background: var(--celeste-suave); color: var(--azul); }
.chip.warn { background: var(--warn-suave); color: var(--warn); }
.chip.ok { background: var(--ok-suave); color: var(--ok); }
.acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.pending { max-width: 560px; margin: 12vh auto; text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; padding: 0 16px; }
.pending img { height: 64px; width: auto; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; background: var(--azul-noche); color: #fff; padding: 11px 18px; border-radius: 6px; font-size: .92rem; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.demo-bar { background: var(--warn-suave); color: var(--warn); font-size: .84rem; padding: 7px 16px; text-align: center; font-weight: 600; }
.demo-bar button { margin-left: 8px; }

@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-photo { min-height: 34vh; }
  .login-photo .claim { left: 20px; right: 20px; bottom: 20px; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .topbar img { height: 38px; width: auto; }
  .main { padding: 20px 16px 56px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; }
  .acts { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
