:root {
  --rf-navy: #0F2D4A;
  --rf-orange: #FF7A00;
  --rf-teal: #00B4A6;
  --rf-bg: #E9EEF4;
  --rf-white: #FFFFFF;
  --rf-text: #0F2D4A;
  --rf-muted: #5A6B7D;
  --rf-border: #D3DCE6;
  --rf-danger: #D64545;
  --rf-radius: 14px;
  --rf-shadow: 0 10px 30px rgba(15, 45, 74, 0.08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

html, body {
  margin: 0;
  background: var(--rf-bg);
  color: var(--rf-text);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--rf-teal); text-decoration: none; }
a:hover { color: var(--rf-orange); }

.rf-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.rf-content { min-width: 0; display: flex; flex-direction: column; }
.rf-topbar { display: none; }
.rf-nav-scrim { display: none; }
.rf-nav-close { display: none; }
.rf-brand-row { display: flex; align-items: flex-start; justify-content: space-between; width: 100%; gap: .5rem; }
.rf-btn-salir {
  margin-top: .6rem;
  color: white !important;
  border-color: rgba(255,255,255,.25) !important;
}
.rf-nav {
  background: var(--rf-navy);
  color: white;
  padding: 1.25rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.rf-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .15rem;
  padding: .5rem .75rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: .75rem;
}
.rf-logo-nav {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: .55rem;
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.rf-brand strong { font-size: 1.35rem; letter-spacing: .02em; }
.rf-brand small { color: rgba(255,255,255,.7); font-size: .8rem; }
.rf-nav a {
  color: rgba(255,255,255,.88);
  padding: .7rem .85rem;
  border-radius: 10px;
  font-weight: 600;
}
.rf-nav a.active, .rf-nav a:hover {
  background: rgba(0, 180, 166, .18);
  color: white;
}
.rf-nav .rf-user {
  margin-top: auto;
  padding: .85rem;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .9rem;
  color: rgba(255,255,255,.8);
}
.rf-main { padding: 1.5rem 1.75rem 2.5rem; }
.rf-page-title:focus,
h1:focus,
h2:focus,
h3:focus {
  outline: none;
}
.rf-card {
  background: var(--rf-white);
  border: 1px solid var(--rf-border);
  border-radius: var(--rf-radius);
  box-shadow: var(--rf-shadow);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}
.rf-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  margin-bottom: 1rem;
}
.rf-toolbar input, .rf-toolbar select, .rf-card input, .rf-card select, .rf-card textarea {
  border: 1px solid var(--rf-border);
  border-radius: 10px;
  padding: .55rem .7rem;
  background: white;
  color: var(--rf-text);
  min-width: 0;
}
.rf-btn {
  border: 0;
  border-radius: 10px;
  padding: .55rem .95rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--rf-teal);
  color: white;
}
.rf-btn:hover { filter: brightness(1.05); }
.rf-btn.secondary { background: var(--rf-navy); }
.rf-btn.accent { background: var(--rf-orange); }
.rf-btn.ghost { background: transparent; color: var(--rf-navy); border: 1px solid var(--rf-border); }
.rf-btn.danger { background: var(--rf-danger); }
.rf-btn:disabled { opacity: .45; cursor: not-allowed; }

table.rf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
table.rf-table th, table.rf-table td {
  padding: .65rem .55rem;
  border-bottom: 1px solid var(--rf-border);
  text-align: left;
  vertical-align: middle;
}
table.rf-table th {
  color: var(--rf-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
table.rf-table tr:hover td { background: #f5f8fb; }
.rf-badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: var(--rf-bg);
  color: var(--rf-navy);
}
.rf-badge.on { background: rgba(0,180,166,.15); color: #067a72; }
.rf-badge.off { background: rgba(214,69,69,.12); color: #a33333; }
.rf-error { color: var(--rf-danger); font-weight: 600; margin: .5rem 0; }
.rf-ok { color: #067a72; font-weight: 600; margin: .5rem 0; }
.rf-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.rf-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.rf-stat {
  background: white;
  border-radius: var(--rf-radius);
  border: 1px solid var(--rf-border);
  padding: 1rem;
}
.rf-stat .label { color: var(--rf-muted); font-size: .85rem; }
.rf-stat .value { font-size: 1.45rem; font-weight: 800; color: var(--rf-navy); margin-top: .25rem; }
.rf-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(0,180,166,.18), transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(255,122,0,.16), transparent 30%),
    var(--rf-bg);
}
.rf-login-card {
  width: min(420px, 92vw);
  background: white;
  border-radius: 20px;
  box-shadow: var(--rf-shadow);
  padding: 2rem 1.75rem;
  border: 1px solid var(--rf-border);
  text-align: center;
}
.rf-logo {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 24px;
  margin: 0 auto 1rem;
  display: block;
}
.rf-login-card h1 { margin: 0 0 .25rem; color: var(--rf-navy); }
.rf-login-card p { margin: 0 0 1.25rem; color: var(--rf-muted); }
.rf-login-card label {
  display: block;
  font-weight: 600;
  margin: .75rem 0 .35rem;
  text-align: left;
}
.rf-login-card input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--rf-border);
  border-radius: 10px;
  padding: .7rem .8rem;
  text-align: left;
}
.rf-password {
  position: relative;
}
.rf-password input {
  padding-right: 4.5rem;
}
.rf-password-toggle {
  position: absolute;
  right: .45rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--rf-teal);
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  padding: .35rem .5rem;
  border-radius: 8px;
}
.rf-password-toggle:hover {
  color: var(--rf-orange);
  background: rgba(15, 45, 74, .04);
}
.rf-login-card .rf-btn { width: 100%; margin-top: 1.1rem; padding: .8rem; }
.rf-form-row { display: grid; gap: .35rem; margin-bottom: .75rem; }
.rf-muted { color: var(--rf-muted); }
.rf-right { text-align: right; }
.rf-row-active td { background: rgba(0, 180, 166, .1); }
.rf-dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.rf-chart-legend {
  display: flex;
  gap: 1.25rem;
  font-size: .9rem;
  color: var(--rf-muted);
  margin-bottom: .5rem;
}
.rf-dot {
  display: inline-block;
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  margin-right: .35rem;
  vertical-align: middle;
}
.rf-dot.teal { background: var(--rf-teal); }
.rf-dot.orange { background: var(--rf-orange); }
.rf-line-chart {
  width: 100%;
  max-height: 240px;
  background: linear-gradient(180deg, rgba(15,45,74,.03), transparent);
  border-radius: 12px;
}
.rf-line { stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.rf-line.teal { stroke: var(--rf-teal); }
.rf-line.orange { stroke: var(--rf-orange); }
.rf-chart-label { fill: var(--rf-muted); font-size: 10px; }
.rf-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 45, 74, .45);
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.rf-modal {
  width: min(560px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 45, 74, .28);
  border: 1px solid var(--rf-border);
}
.rf-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem .75rem;
  border-bottom: 1px solid var(--rf-border);
}
.rf-modal-head h3 { margin: 0 0 .25rem; color: var(--rf-navy); font-size: 1.15rem; }
.rf-modal-close {
  border: 0;
  background: transparent;
  color: var(--rf-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: .15rem .4rem;
  border-radius: 8px;
}
.rf-modal-close:hover { background: rgba(15, 45, 74, .06); color: var(--rf-navy); }
.rf-modal-body {
  padding: 1rem 1.2rem;
  overflow: auto;
}
.rf-modal-section {
  margin: 1rem 0 .5rem;
  font-size: .95rem;
  color: var(--rf-navy);
}
.rf-modal-section:first-child { margin-top: 0; }
.rf-modal-foot {
  padding: .85rem 1.2rem 1.1rem;
  border-top: 1px solid var(--rf-border);
  display: flex;
  justify-content: flex-end;
}
.rf-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rf-btn.ghost.accent-text { color: var(--rf-teal); }

@media (max-width: 900px) {
  .rf-shell {
    grid-template-columns: 1fr;
  }
  .rf-topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--rf-navy);
    color: white;
    padding: .65rem .85rem;
    box-shadow: 0 4px 16px rgba(15, 45, 74, .25);
  }
  .rf-menu-btn {
    border: 0;
    background: rgba(255,255,255,.12);
    color: white;
    font-size: 1.35rem;
    line-height: 1;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    cursor: pointer;
  }
  .rf-topbar-title {
    font-weight: 800;
    letter-spacing: .02em;
    flex: 1;
  }
  .rf-topbar-user {
    font-size: .8rem;
    opacity: .85;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .rf-nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    z-index: 60;
    transform: translateX(-105%);
    transition: transform .22s ease;
    overflow-y: auto;
    box-shadow: 8px 0 30px rgba(0,0,0,.25);
  }
  .rf-shell.nav-open .rf-nav { transform: translateX(0); }
  .rf-nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15, 45, 74, .45);
  }
  .rf-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: rgba(255,255,255,.12);
    color: white;
    font-size: 1.5rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    cursor: pointer;
  }
  .rf-logo-nav { width: 56px; height: 56px; }
  .rf-main { padding: 1rem 1rem 2rem; }
  .rf-page-title { font-size: 1.35rem; }
  .rf-grid-2, .rf-grid-3 { grid-template-columns: 1fr; }
  .rf-stat .value { font-size: 1.25rem; }
  .rf-toolbar { gap: .5rem; }
  .rf-toolbar .rf-btn,
  .rf-card .rf-btn { min-height: 2.6rem; }
  .rf-toolbar input,
  .rf-toolbar select { width: 100%; max-width: 100%; }
  table.rf-table { font-size: .88rem; min-width: 520px; }
  .rf-card {
    padding: .9rem;
  }
  .rf-modal-backdrop { padding: .5rem; align-items: flex-end; }
  .rf-modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
  .rf-login-card { width: min(420px, 94vw); padding: 1.5rem 1.15rem; }
  .rf-logo { width: 96px; height: 96px; }
  .rf-line-chart { max-height: 200px; }
}

@media (max-width: 480px) {
  .rf-topbar-user { display: none; }
  .rf-stat { padding: .85rem; }
  table.rf-table { min-width: 460px; }
}

#blazor-error-ui {
  background: #ffffe0; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
  display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.loading-progress { position: relative; display: block; width: 8rem; height: 8rem; margin: 20vh auto 0; }
.loading-progress circle { fill: none; stroke: var(--rf-teal); stroke-width: .6rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--rf-navy); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; transition: stroke-dasharray .05s ease-in-out; }
.loading-progress-text { text-align: center; font-weight: 700; color: var(--rf-navy); }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }
