:root {
  --bg-page: #f4f6fb;
  --bg-card: #ffffff;
  --border: #e6eaf2;

  --text: #0b1220;
  --muted: #5b6476;
  --soft: #7a859a;

  --brand: #0b1f3b;
  --brand-2: #163a66;
  --accent: #2b69c9;

  --danger: #b42318;

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --shadow: 0 16px 40px rgba(11, 31, 59, 0.08);
  --shadow-soft: 0 10px 22px rgba(11, 31, 59, 0.06);

  --ring: 0 0 0 4px rgba(43, 105, 201, 0.18);
}

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

html, body { min-height: 100%; }

body {
  margin: 0;
  background: radial-gradient(900px 450px at 20% -10%, rgba(43,105,201,0.10), transparent 60%),
              radial-gradient(900px 450px at 90% 0%, rgba(11,31,59,0.08), transparent 55%),
              var(--bg-page);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
}

.titleblock { display: grid; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(11,31,59,0.06);
  color: var(--brand);
  border: 1px solid rgba(11,31,59,0.12);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(22,58,102,0.12);
}

.page-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

.topbar-right {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--soft);
  font-weight: 600;
}

.control { position: relative; }

textarea,
input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fbfcff;
  color: var(--text);
  font-size: 14px;
  outline: none;
  padding: 11px 12px;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
  font-weight: 400;
}

textarea::placeholder,
input::placeholder { color: rgba(91, 100, 118, 0.75); }

textarea:hover,
input:hover { border-color: rgba(11,31,59,0.25); }

textarea:focus-visible,
input:focus-visible {
  border-color: rgba(43,105,201,0.55);
  box-shadow: var(--ring);
  background: #ffffff;
}

textarea { resize: vertical; }

.tabs {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.9);
  box-shadow: var(--shadow-soft);
}

.tab {
  height: 36px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.tab:hover { background: rgba(11,31,59,0.06); color: var(--brand); }

.tab.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

.tab:active { transform: translateY(1px); }

.wrap {
  max-width: 980px;
  margin: 22px auto 72px;
  padding: 0 16px;
}

.card {
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11,31,59,0.03), transparent);
}

.card-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-header p {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 400;
}

.card-body { padding: 16px 18px 18px; }

.form { display: none; }
.form.active { display: block; }

.lbl { display: grid; gap: 7px; margin-bottom: 12px; }

.lbl > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--soft);
  font-weight: 600;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  padding: 0 18px;
  height: 40px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.btn.primary {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(11,31,59,0.18);
}

.btn.primary:hover { background: var(--brand-2); }
.btn.primary:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--ring); }

.hint {
  font-size: 12.5px;
  color: var(--muted);
  min-height: 18px;
  font-weight: 400;
}

.hint.ok { color: var(--brand-2); font-weight: 600; }
.hint.err { color: var(--danger); font-weight: 600; }

.small { color: var(--muted); font-size: 12px; font-weight: 400; }

.mini {
  margin-top: 10px;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fbfcff;
  color: var(--text);
  font-size: 13px;
  display: none;
  font-weight: 400;
}

.mini.show { display: block; }

.worklist { display: grid; gap: 10px; }
.workitem { min-height: 54px; }

select[data-cselect] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: 0;
  top: 0;
}

.cselect { position: relative; width: 100%; }

.cselect-btn {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: #fbfcff;
  color: var(--text);
  padding: 0 44px 0 14px;
  font-size: 14px;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease, transform .12s ease;
}

.cselect-btn .value {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 400;
}

.cselect-btn .chev {
  position: absolute;
  right: 16px;
  width: 10px;
  height: 10px;
  opacity: 0.65;
  transform: rotate(45deg);
  border-right: 2px solid var(--brand-2);
  border-bottom: 2px solid var(--brand-2);
}

.cselect-btn:hover {
  border-color: rgba(11,31,59,0.25);
  background: #ffffff;
}

.cselect-btn:active { transform: translateY(1px); }

.cselect.open .cselect-btn,
.cselect-btn:focus-visible {
  border-color: rgba(43,105,201,0.55);
  box-shadow: var(--ring);
  background: #ffffff;
}

.cselect-menu {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  margin-top: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(11,31,59,0.14);
  overflow: hidden;
  display: none;
}

.cselect.open .cselect-menu { display: block; }

.cselect-search {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11,31,59,0.03), transparent);
}

.cselect-search input {
  height: 38px;
  border-radius: 999px;
  padding: 0 12px;
  font-weight: 400;
}

.cselect-options {
  max-height: 260px;
  overflow: auto;
  padding: 6px;
}

.cselect-opt {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  transition: background .12s ease, transform .12s ease;
}

.cselect-opt:hover { background: rgba(11,31,59,0.06); }
.cselect-opt[aria-selected="true"] { background: rgba(11,31,59,0.10); font-weight: 400; }
.cselect-opt:active { transform: translateY(1px); }

.cselect-empty {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

/* NUEVO: VIATICOS SIMPLE (como Trabajo) */
.viaticolist { display: grid; gap: 10px; }

.viatico-row {
  display: grid;
  grid-template-columns: 1fr 160px 38px;
  gap: 10px;
  align-items: center;
}

.viatico-row input {
  height: 44px;
}

.viatico-x {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(11,31,59,0.10);
  background: rgba(11,31,59,0.06);
  cursor: pointer;
}

.viatico-x:hover { background: rgba(11,31,59,0.10); }

@media (max-width: 820px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-left { min-width: unset; }
  .topbar-right { width: 100%; justify-content: flex-start; }
  .grid2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }

  .viatico-row {
    grid-template-columns: 1fr 1fr 38px;
  }
}
