/* sucursales/includes/sucursales.css — diseño del módulo de Sucursales. */
*{ box-sizing: border-box; }
body{ margin: 0; font-family: 'Inter', system-ui, 'Segoe UI', sans-serif; background: #F4F5F7; color: #1F2430; font-size: 14px; }
a{ color: var(--s-color); }
:root{ --s-line: #E4E6EB; --s-soft: #6B7280; --s-bg: #F4F5F7; }

.s-side{ position: fixed; inset: 0 auto 0 0; width: 250px; background: var(--s-color); color: #fff; display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease; }
.s-brand{ display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.14); }
.s-brand img{ width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.s-brand-mark{ width: 44px; height: 44px; border-radius: 10px; background: #fff; color: var(--s-color); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem; }
.s-brand strong{ display: block; font-size: 0.9rem; line-height: 1.2; }
.s-brand span{ font-size: 0.76rem; opacity: .8; }
.s-suc-actual{ margin: 14px 14px 4px; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.14); display: flex; flex-direction: column; gap: 6px; }
.s-suc-label{ font-size: 0.66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.s-suc-actual select{ width: 100%; padding: 7px 8px; border-radius: 8px; border: none; font: inherit; font-weight: 600; }
.s-rol{ align-self: flex-start; font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.2); }
.s-menu{ flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.s-menu a{ display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #fff; text-decoration: none; font-weight: 600; opacity: .88; }
.s-menu a span{ width: 22px; text-align: center; }
.s-menu a:hover{ background: rgba(255,255,255,.1); opacity: 1; }
.s-menu a.is-activo{ background: rgba(255,255,255,.2); opacity: 1; }
.s-menu-sec{ margin: 12px 12px 4px; font-size: 0.64rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .6; }
.s-side-pie{ border-top: 1px solid rgba(255,255,255,.14); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.s-usuario{ display: flex; align-items: center; gap: 10px; }
.s-usuario strong{ display: block; font-size: 0.84rem; }
.s-usuario span{ font-size: 0.72rem; opacity: .75; }
.s-avatar{ width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.78rem; flex: 0 0 34px; }
.s-salir{ display: block; text-align: center; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.18); color: #fff; text-decoration: none; font-weight: 600; font-size: 0.84rem; }
.s-salir:hover{ background: rgba(0,0,0,.28); }

.s-main{ margin-left: 250px; padding: 22px 28px 48px; min-height: 100vh; }
.s-top{ display: flex; align-items: center; gap: 12px; margin-bottom: 18px; min-height: 46px; }
.s-top h1{ margin: 0; font-size: 1.5rem; font-weight: 800; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Buscador global: entre el título y los botones, en la misma línea. */
.s-top-buscar{ flex: 0 1 380px; min-width: 220px; }
.s-top-buscar .nbg{ width: 100%; flex: none; min-width: 0; }
.s-top-buscar .nbg-caja{ height: 42px; border-radius: 12px; background: #fff; border-color: var(--s-line); }
.s-top-buscar .nbg-caja:focus-within{ border-color: var(--s-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-color) 16%, transparent); }
.s-top-acciones{ display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.s-top-acciones .s-btn{ height: 42px; white-space: nowrap; }
@media (max-width: 1100px){
  .s-top{ flex-wrap: wrap; }
  .s-top h1{ flex: 1 1 calc(100% - 60px); }
  .s-top-buscar{ order: 3; flex: 1 1 100%; }
  .s-top-acciones{ order: 2; }
}
.s-volver{ flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--s-line); background: #fff; color: var(--s-color, #8B1A1A); border-radius: 10px; padding: 8px 14px; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; transition: background .15s, border-color .15s; }
.s-volver:hover{ background: var(--s-bg, #F4F6F8); border-color: var(--s-color, #8B1A1A); }
.s-burger{ display: none; border: 1px solid var(--s-line); background: #fff; border-radius: 10px; padding: 6px 10px; font-size: 1.1rem; cursor: pointer; }

.s-card{ background: #fff; border: 1px solid var(--s-line); border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.s-card-tab{ border-top: 3px solid var(--s-color); }
.s-card h2{ margin: 0 0 14px; font-size: 1.05rem; color: var(--s-color); padding-bottom: 10px; border-bottom: 1px solid var(--s-line); display: flex; align-items: center; gap: 8px; }
.s-card h2 .s-badge{ margin-left: auto; }
.s-grid{ display: grid; gap: 14px; }
.s-g2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
.s-g3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
.s-g4{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
.s-span2{ grid-column: span 2; }
.s-span-all{ grid-column: 1 / -1; }

.s-campo{ display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; font-weight: 600; color: #374151; }
.s-campo input, .s-campo select, .s-campo textarea, .s-input{
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--s-line); background: #fff; color: #1F2430;
  font: inherit; font-weight: 400; font-size: 0.88rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
.s-campo input:focus, .s-campo select:focus, .s-campo textarea:focus, .s-input:focus{ border-color: var(--s-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-color) 15%, transparent); }
.s-campo input[readonly]{ background: var(--s-bg); color: var(--s-soft); }
.s-campo textarea{ resize: vertical; min-height: 64px; }
.s-req{ color: var(--s-color); }
.s-check{ display: flex; align-items: center; gap: 8px; font-size: 0.84rem; font-weight: 500; cursor: pointer; }
.s-check input{ width: 16px; height: 16px; accent-color: var(--s-color); }

.s-btn{ display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--s-line); background: #fff; color: #1F2430; font: inherit; font-weight: 600; font-size: 0.86rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.s-btn:hover{ background: var(--s-bg); }
.s-btn-primario{ background: var(--s-color); border-color: var(--s-color); color: #fff; }
.s-btn-primario:hover{ background: var(--s-color); filter: brightness(1.1); }
.s-btn-verde{ background: #1E9E5A; border-color: #1E9E5A; color: #fff; }
.s-btn-verde:hover{ background: #1E9E5A; filter: brightness(1.08); }
.s-btn-chico{ padding: 5px 10px; font-size: 0.78rem; border-radius: 8px; }
.s-btn:disabled{ opacity: .5; cursor: not-allowed; }
.s-btn-x{ width: 30px; height: 30px; padding: 0; border-radius: 8px; background: #C62828; border-color: #C62828; color: #fff; font-weight: 800; }

.s-tabla-wrap{ overflow-x: auto; border-radius: 10px; border: 1px solid var(--s-line); }
.s-tabla{ width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.s-tabla th{ background: var(--s-color); color: #fff; text-align: left; font-size: 0.74rem; font-weight: 700; padding: 10px 12px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.s-tabla td{ padding: 10px 12px; border-bottom: 1px solid var(--s-line); vertical-align: middle; }
.s-tabla tbody tr:hover{ background: color-mix(in srgb, var(--s-color) 4%, transparent); }
.s-num{ text-align: right; white-space: nowrap; }
.s-codigo{ font-family: ui-monospace, Consolas, monospace; font-size: 0.76rem; padding: 2px 6px; border-radius: 5px; background: var(--s-bg); color: var(--s-soft); }
.s-precio{ color: var(--s-color); font-weight: 700; }
.s-suave{ color: var(--s-soft); font-size: 0.78rem; }
.s-badge{ display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--s-color); color: #fff; font-size: 0.74rem; font-weight: 800; }
.s-chip{ display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: var(--s-bg); color: var(--s-soft); }
.s-chip-ok{ background: rgba(30,158,90,.12); color: #1E9E5A; }
.s-chip-rojo{ background: rgba(198,40,40,.1); color: #C62828; }
.s-chip-color{ background: color-mix(in srgb, var(--s-color) 12%, transparent); color: var(--s-color); }

.s-flash{ padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; font-size: 0.86rem; }
.s-flash-ok{ background: #E3F5EA; color: #1E7A48; border: 1px solid #BFE6CD; }
.s-flash-error{ background: #FDE8E8; color: #B42318; border: 1px solid #F6C6C6; }
.s-vacio{ text-align: center; padding: 32px 16px; color: var(--s-soft); }
.s-vacio span{ display: block; font-size: 2rem; margin-bottom: 8px; }

.s-tabs{ display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: #fff; border: 1px solid var(--s-line); margin-bottom: 16px; flex-wrap: wrap; }
.s-tabs a{ padding: 8px 14px; border-radius: 9px; text-decoration: none; color: var(--s-soft); font-weight: 600; font-size: 0.84rem; }
.s-tabs a.is-activo{ background: var(--s-color); color: #fff; }

.s-modal{ position: fixed; inset: 0; background: rgba(17,24,39,.45); display: none; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 100; overflow-y: auto; }
.s-modal.abierto{ display: flex; }
.s-modal-caja{ background: #fff; border-radius: 16px; width: 100%; max-width: 560px; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.s-modal-caja h3{ margin: 0 0 16px; font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center; }
.s-modal-cerrar{ border: none; background: var(--s-bg); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 1.1rem; }
.s-modal-acciones{ display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--s-line); }

@media (max-width: 1100px){ .s-g4{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px){
  .s-side{ transform: translateX(-100%); }
  .s-side.abierto{ transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .s-main{ margin-left: 0; padding: 16px; }
  .s-burger{ display: inline-block; }
  .s-g2, .s-g3, .s-g4{ grid-template-columns: 1fr; }
  .s-span2{ grid-column: auto; }
}

/* Celulares: nada se sale de la pantalla; tablas con desplazamiento lateral. */
@media (max-width: 760px){
  html, body{ max-width: 100%; overflow-x: hidden; }
  .s-g2, .s-g3, .s-g4{ grid-template-columns: minmax(0, 1fr); }
  .s-chip{ white-space: nowrap; }
  .s-tabla-wrap{ overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .s-tabs{ overflow-x: auto; flex-wrap: nowrap; }
  .s-tabs a{ flex-shrink: 0; }
  input, select, textarea{ font-size: 16px; max-width: 100%; }
  .f-acciones{ gap: 8px; }
  .f-acciones .s-btn{ flex: 1 1 auto; justify-content: center; }
  .s-modal-caja{ width: 100vw !important; max-width: 100vw !important; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; }
  .s-modal{ align-items: flex-end !important; padding: 0 !important; }
}
