/* ============================================================
   Sole · Design System compartido (subdominios intranet/*, ayuda)
   Paleta SoleCenter: gris cálido + naranja. Tokens + app shell.

   El naranja es el color de acento, no de relleno: se reserva para
   el botón principal de cada pantalla y para el elemento activo.
   ============================================================ */

:root {
  /* Paleta — equivalente en hexadecimal de los RGB() de SoleCenter */
  --c-bg:        #f5f4f1;
  --c-surface:   #ffffff;
  --c-surface-2: #f1efeb;
  --c-border:    #e7e4df;
  --c-border-strong: #dad7d1;
  --c-text:      #2b2a28;
  --c-text-soft: #6b6a66;
  --c-muted:     #93918b;

  --c-primary:     #e0611c;
  --c-primary-600: #c24e14;
  --c-primary-100: #fdeee4;
  --c-accent:      #e0611c;

  --c-success:  #0f6e56;
  --c-success-bg:#e1f5ee;
  --c-warning:  #854f0b;
  --c-warning-bg:#faeeda;
  --c-danger:   #a32d2d;
  --c-danger-bg: #fcebeb;
  --c-info:     #1d6a8c;
  --c-info-bg:  #e4f0f6;

  /* Barra lateral: clara, como el resto de SoleCenter. Se separa del
     contenido por un borde, no por un bloque oscuro. */
  --c-sidebar-bg:        #fbfaf8;
  --c-sidebar-text:      #57564f;
  --c-sidebar-strong:    #2b2a28;
  --c-sidebar-border:    #e7e4df;
  --c-sidebar-hover:     #f1efeb;
  --c-sidebar-active-bg: #fdeee4;
  --c-sidebar-active-fg: #c24e14;

  --c-velo: rgba(43, 42, 40, .45);

  /* Geometría */
  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(43,42,40,.06), 0 1px 3px rgba(43,42,40,.05);
  --shadow:    0 4px 16px rgba(43,42,40,.08);
  --shadow-lg: 0 18px 50px rgba(43,42,40,.22);

  --sidebar-w: 248px;
  --header-h:  62px;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-primary); text-decoration: none; }
h1,h2,h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* ---------- App shell ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--c-sidebar-bg);
  color: var(--c-sidebar-text);
  border-right: 1px solid var(--c-sidebar-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px; font-size: 17px; font-weight: 700;
  color: var(--c-sidebar-strong);
  border-bottom: 1px solid var(--c-sidebar-border);
}
.sidebar-brand .logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--c-primary);
  display: grid; place-items: center; color: #fff; font-size: 16px;
}
.sidebar-nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-section { color: var(--c-muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin: 2px 0; border-radius: var(--radius-sm);
  color: var(--c-sidebar-text); cursor: pointer; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; opacity: .85; }
.nav-item:hover { background: var(--c-sidebar-hover); color: var(--c-sidebar-strong); }
.nav-item.active { background: var(--c-sidebar-active-bg); color: var(--c-sidebar-active-fg); font-weight: 600; }
.nav-item.active i { opacity: 1; }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--c-sidebar-border); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--c-primary); color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}
.user-chip .meta { line-height: 1.2; }
.user-chip .meta small { color: var(--c-muted); display: block; font-size: 11px; }
.logout-btn {
  margin-top: 12px; width: 100%; cursor: pointer;
  background: var(--c-surface); color: var(--c-sidebar-text);
  border: 1px solid var(--c-border-strong);
  padding: 8px; border-radius: var(--radius-sm); font: inherit;
}
.logout-btn:hover { background: var(--c-sidebar-hover); color: var(--c-sidebar-strong); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--header-h); background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumb { color: var(--c-text-soft); font-weight: 500; }
.content { padding: 24px; flex: 1; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 22px; }
.page-sub { color: var(--c-text-soft); font-size: 13px; margin-top: 2px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card + .card { margin-top: 16px; }

/* ---------- KPI / stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.stat .label { color: var(--c-text-soft); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 8px; letter-spacing: -.02em; }
.stat .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--c-primary-100); color: var(--c-primary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 15px; font: inherit; font-weight: 600; line-height: 1;
  transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-600); }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border); }
.btn-secondary:hover { background: var(--c-surface-2); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-ghost { background: transparent; color: var(--c-text-soft); }
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-icon { padding: 7px 9px; }

/* ---------- Inputs ---------- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--c-text-soft); margin-bottom: 6px; }
.form-control, .input {
  width: 100%; padding: 9px 12px; font: inherit;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: var(--c-surface); color: var(--c-text); transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .input:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-100);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 0 14px; }
.search {
  position: relative; display: inline-flex; align-items: center;
}
.search i { position: absolute; left: 12px; color: var(--c-muted); font-size: 13px; }
.search input { padding-left: 32px; min-width: 260px; }

.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; }
.switch input { width: 18px; height: 18px; accent-color: var(--c-primary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; }
table.data thead th {
  color: var(--c-text-soft); font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .03em; border-bottom: 1px solid var(--c-border); background: var(--c-surface-2);
  position: sticky; top: 0; cursor: default;
}
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--c-text); }
table.data tbody tr { border-bottom: 1px solid var(--c-border); }
table.data tbody tr:hover { background: var(--c-surface-2); }
table.data tbody tr:last-child { border-bottom: 0; }
.actions-cell { display: flex; gap: 6px; justify-content: flex-end; }
.empty-row { text-align: center; color: var(--c-muted); padding: 40px 0; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-warning { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-danger  { background: var(--c-danger-bg);  color: var(--c-danger); }
.badge-info    { background: var(--c-info-bg);    color: var(--c-info); }
.badge-muted   { background: var(--c-surface-2);  color: var(--c-text-soft); border: 1px solid var(--c-border); }
.badge-primary { background: var(--c-primary-100);color: var(--c-primary-600); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--c-velo);
  display: grid; place-items: center; padding: 24px; z-index: 50;
  animation: fade .15s ease;
}
.modal {
  background: var(--c-surface); border-radius: var(--radius-lg); width: 100%;
  max-width: 720px; max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.wide { max-width: 920px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--c-border); }
.modal-title { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--c-border); }
.close-btn { background: 0; border: 0; font-size: 22px; line-height: 1; color: var(--c-muted); cursor: pointer; }
.close-btn:hover { color: var(--c-text); }

/* Tabs dentro de modal/página */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-border); margin-bottom: 18px; }
.tab { padding: 9px 14px; cursor: pointer; font-weight: 600; color: var(--c-text-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--c-text); }
.tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); margin: 6px 0 12px; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--c-surface); border: 1px solid var(--c-border); border-left: 4px solid var(--c-info);
  border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow);
  min-width: 260px; animation: slidein .2s ease; font-weight: 500;
}
.toast-success { border-left-color: var(--c-success); }
.toast-error   { border-left-color: var(--c-danger); }
.toast-info    { border-left-color: var(--c-info); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, var(--c-primary-100), var(--c-bg)); }
.login-card { background: var(--c-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; padding: 34px 30px; }
.login-logo { display: flex; align-items: center; gap: 11px; font-size: 20px; font-weight: 750; margin-bottom: 4px; }
.login-logo .logo { width: 38px; height: 38px; border-radius: 10px; background: var(--c-primary); display: grid; place-items: center; color: #fff; }
.login-sub { color: var(--c-text-soft); margin-bottom: 24px; font-size: 13px; }

/* ---------- Utils ---------- */
.spinner { width: 26px; height: 26px; border: 3px solid var(--c-border); border-top-color: var(--c-primary); border-radius: 50%; animation: spin .7s linear infinite; margin: 50px auto; }
.muted { color: var(--c-muted); }
.text-soft { color: var(--c-text-soft); }
.text-right { text-align: right; }
.flex { display: flex; } .between { justify-content: space-between; } .items-center { align-items: center; } .gap { gap: 10px; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.hidden { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; width: var(--sidebar-w); }
  .sidebar.open { transform: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
