/* ===========================================================
   Wire Remnants - hoja de estilos
   Mobile-first, pensada para iPhone. Paleta suave (sin negro ni
   blanco puros de fondo), materiales translúcidos y modo oscuro
   automático. Todas las pantallas usan estas mismas variables.
   =========================================================== */

/* ---------- Variables: tema claro (valores por defecto) ---------- */

:root {
  color-scheme: light dark;

  /* Superficies y texto */
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --card-pressed: #F2F2F4;
  --text: #1D1D1F;
  --text-muted: #6E6E73;
  --border: rgba(0, 0, 0, 0.08);
  --separator: rgba(60, 60, 67, 0.16);

  /* Acentos (iguales en claro y oscuro) */
  --accent: #007AFF;
  --accent-pressed: #0062CC;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --success: #30D158;
  --warning: #FF9F0A;
  --danger: #FF453A;
  --danger-pressed: #D93A31;
  --on-accent: #FFFFFF;

  /* Rellenos y materiales translúcidos */
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --glass: rgba(245, 245, 247, 0.72);
  --glass-toast: rgba(255, 255, 255, 0.78);
  --blur: blur(30px) saturate(180%);
  --overlay: rgba(0, 0, 0, 0.4);
  --skeleton: rgba(120, 120, 128, 0.14);
  --skeleton-shine: rgba(255, 255, 255, 0.6);

  /* Sombras (siempre suaves) */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.15);

  /* Íconos dibujados desde CSS (lupa del campo de búsqueda) */
  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E");

  /* Medidas */
  --radius-card: 20px;
  --radius-control: 14px;
  --radius-modal: 28px;
  --radius-toast: 16px;
  --pad: 20px;
  --gap: 12px;
  --control-h: 52px;
  --bar-h: 58px;

  /* Movimiento */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t: 200ms var(--ease);
  --t-press: 150ms var(--ease);
}

/* ---------- Variables: tema oscuro ---------- */

/* Según el sistema, salvo que en Settings se haya forzado el tema claro
   (app.js marca el tema activo en <html data-theme>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --card: #1E1E1E;
    --card-pressed: #262626;
    --text: #F5F5F7;
    --text-muted: #98989D;
    --border: rgba(255, 255, 255, 0.08);
    --separator: rgba(84, 84, 88, 0.5);

    --accent-soft: rgba(0, 122, 255, 0.2);

    --fill: rgba(120, 120, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.36);
    --glass: rgba(18, 18, 18, 0.72);
    --glass-toast: rgba(44, 44, 46, 0.78);
    --skeleton: rgba(120, 120, 128, 0.2);
    --skeleton-shine: rgba(255, 255, 255, 0.08);

    --shadow-card: none;
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.3);

    --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398989D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E");
  }
}

/* Tema oscuro forzado desde Settings (aunque el sistema esté en claro).
   Mismos valores que el bloque de arriba. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #121212;
  --card: #1E1E1E;
  --card-pressed: #262626;
  --text: #F5F5F7;
  --text-muted: #98989D;
  --border: rgba(255, 255, 255, 0.08);
  --separator: rgba(84, 84, 88, 0.5);

  --accent-soft: rgba(0, 122, 255, 0.2);

  --fill: rgba(120, 120, 128, 0.24);
  --fill-strong: rgba(120, 120, 128, 0.36);
  --glass: rgba(18, 18, 18, 0.72);
  --glass-toast: rgba(44, 44, 46, 0.78);
  --skeleton: rgba(120, 120, 128, 0.2);
  --skeleton-shine: rgba(255, 255, 255, 0.08);

  --shadow-card: none;
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.3);

  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398989D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E");
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* ---------- Reset mínimo ---------- */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

/* El atributo hidden gana siempre (varios componentes usan display:flex) */
[hidden] {
  display: none !important;
}

/* Texto solo para lectores de pantalla */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Todo lo que se toca: cursor de mano y texto no seleccionable */
a,
button,
label,
select,
summary,
[role="button"] {
  cursor: pointer;
}

a,
button,
svg,
.btn,
.icon-btn,
.pill-btn,
.back-btn,
.quick-btn,
.bottom-bar,
.lang-switch,
.seg-toggle,
.segmented,
.fab,
.switch-row,
.check-row {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

svg {
  flex-shrink: 0;
}

/* Foco visible solo con teclado: contorno sutil */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid rgba(0, 122, 255, 0.5);
  outline-offset: 2px;
}

::selection {
  background: rgba(0, 122, 255, 0.24);
}

/* Listas horizontales: se desplazan sin mostrar la barra */
.h-scroll {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.h-scroll::-webkit-scrollbar {
  display: none;
}

/* ---------- Contenedor de cada pantalla ---------- */

.page {
  padding: calc(20px + env(safe-area-inset-top)) var(--pad) calc(var(--bar-h) + 40px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
  animation: fade-in 250ms var(--ease);
}

/* En pantallas sin bottom bar el relleno inferior es menor */
.page--no-bar {
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

/* ---------- Tipografía ---------- */

/* Título de pantalla */
h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.1;
  margin: 0 0 20px;
}

/* Etiqueta de sección: pequeña, en mayúsculas y apagada */
h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 32px 0 12px;
}

p {
  margin: 0 0 14px;
  font-size: 17px;
}

.muted {
  color: var(--text-muted);
  font-size: 15px;
}

/* Número grande (pies, totales) */
.metric {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  margin: 0 0 6px;
}

/* Total de cables en la tarjeta de inventario del inicio */
.metric--home {
  font-size: 56px;
  font-weight: 700;
}

/* Deja aire arriba para que el selector de idioma no tape el título */
.page--with-lang h1 {
  margin-top: 40px;
}

/* ---------- Selector de idioma (arriba a la derecha) ---------- */

.lang-switch {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: var(--pad);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 0.5px solid var(--border);
  border-radius: 999px;
}

.lang-switch__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 6px 12px;
  border-radius: 999px;
  min-height: 30px;
  cursor: pointer;
  transition: background var(--t), color var(--t), transform var(--t-press);
}

.lang-switch__btn:active {
  transform: scale(0.94);
}

.lang-switch__btn.is-active {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------- Formularios ---------- */

.field {
  margin-bottom: 20px;
}

.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 8px 4px;
}

.input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 16px;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.3;
  color: var(--text);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
}

.input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* Foco: borde de 2px en el color de acento (1px de borde + 1px de anillo) */
.input:focus,
.input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.input:disabled {
  opacity: 0.4;
}

.input--pin {
  letter-spacing: 0.4em;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
}

/* Campo de búsqueda con lupa a la izquierda */
.input--search {
  padding-left: 46px;
  background-image: var(--icon-search);
  background-repeat: no-repeat;
  background-position: 16px center;
  background-size: 20px 20px;
}

.input--search::-webkit-search-decoration,
.input--search::-webkit-search-results-button,
.input--search::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

/* Campo de pies: número grande y centrado */
.input--feet {
  height: 64px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.input--feet::placeholder {
  opacity: 0.5;
}

.input--large {
  height: 56px;
  min-height: 56px;
  font-size: 18px;
}

/* Sin flechas en los campos numéricos */
.input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Sin la flecha que el navegador agrega a los campos con autocompletado */
.input[list]::-webkit-calendar-picker-indicator {
  display: none !important;
}

/* Selector con flecha propia */
.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 20px;
  width: 9px;
  height: 9px;
  margin-top: -7px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 44px;
  text-overflow: ellipsis;
  cursor: pointer;
}

.textarea {
  display: block;
  height: auto;
  min-height: 84px;
  padding: 14px 16px;
  line-height: 1.4;
  resize: vertical;
}

/* Casilla con texto (por ejemplo "Activo" en el usuario) */
.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-weight: 600;
  cursor: pointer;
}

.check-row input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.check-row input:disabled + span {
  color: var(--text-muted);
}

/* Interruptor estilo iOS */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  font-weight: 600;
  cursor: pointer;
}

.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 999px;
  background: var(--fill-strong);
  cursor: pointer;
  transition: background var(--t);
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
  transition: transform var(--t), width var(--t);
}

.switch:active::after {
  width: 31px;
}

.switch:checked {
  background: var(--success);
}

.switch:checked::after {
  transform: translateX(20px);
}

.switch:checked:active::after {
  transform: translateX(16px);
}

/* Selector de dos opciones con radios ocultos (rol del usuario) */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  background: var(--fill);
  border-radius: 12px;
}

.segmented__option {
  position: relative;
  display: block;
  cursor: pointer;
}

.segmented__option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.segmented__option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  transition: background var(--t), box-shadow var(--t), color var(--t);
}

.segmented__option input:checked + span {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.segmented__option input:focus-visible + span {
  outline: 2px solid rgba(0, 122, 255, 0.5);
  outline-offset: 2px;
}

.segmented__option input:disabled + span {
  opacity: 0.4;
}

/* Toggle segmentado con botones (By location / By name) */
.seg-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  margin-bottom: 20px;
  background: var(--fill);
  border-radius: 12px;
}

.seg-toggle__btn {
  appearance: none;
  min-height: 38px;
  padding: 6px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t), color var(--t), transform var(--t-press);
}

.seg-toggle__btn:active {
  transform: scale(0.97);
}

.seg-toggle__btn.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ---------- Botones ---------- */

.btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--control-h);
  padding: 12px 20px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  border: 0;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: transform var(--t-press), background var(--t), color var(--t), opacity var(--t);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn--primary:active {
  background: var(--accent-pressed);
}

.btn--primary:disabled {
  background: var(--accent);
}

.btn--secondary {
  background: var(--fill);
  color: var(--accent);
}

.btn--secondary:active {
  background: var(--fill-strong);
}

.btn--secondary:disabled {
  background: var(--fill);
}

.btn--danger {
  background: var(--danger);
  color: var(--on-accent);
}

.btn--danger:active {
  background: var(--danger-pressed);
}

.btn--danger:disabled {
  background: var(--danger);
}

.btn + .btn {
  margin-top: var(--gap);
}

/* Enlaces con aspecto de botón */
a.btn {
  text-decoration: none;
  text-align: center;
}

/* Botones grandes para las acciones principales */
.btn--large {
  min-height: 56px;
  font-size: 18px;
}

/* Botón compacto: no ocupa todo el ancho */
.btn--small {
  width: auto;
  min-height: 36px;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 15px;
}

.btn__icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: block;
}

/* Botón redondo con ícono */
.icon-btn {
  appearance: none;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--accent);
  cursor: pointer;
  transition: transform var(--t-press), background var(--t);
}

.icon-btn:active {
  transform: scale(0.94);
  background: var(--fill-strong);
}

.icon-btn--accent {
  background: var(--accent);
  color: var(--on-accent);
}

.icon-btn--accent:active {
  background: var(--accent-pressed);
}

.icon-btn__icon {
  width: 24px;
  height: 24px;
  display: block;
}

/* Botón pequeño tipo píldora (por ejemplo "Edit" en el detalle) */
.pill-btn {
  appearance: none;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  color: var(--accent);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--t-press), background var(--t), opacity var(--t);
}

.pill-btn:active {
  transform: scale(0.97);
  background: var(--fill-strong);
}

.pill-btn:disabled {
  opacity: 0.4;
}

/* Botón "Atrás": alineado con el selector de idioma */
.back-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin: -8px 0 12px -10px;
  padding: 0 14px 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--t-press), opacity var(--t), background var(--t);
}

.back-btn:active {
  transform: scale(0.97);
  background: var(--fill);
}

.back-btn__icon {
  width: 24px;
  height: 24px;
  display: block;
}

/* Enlace de texto con ícono (por ejemplo "View full inventory") */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin: -8px 0 16px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--t);
}

.text-link:active {
  opacity: 0.6;
}

.text-link__icon {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform var(--t);
}

.text-link:active .text-link__icon {
  transform: translateX(3px);
}

/* ---------- Mensajes ---------- */

.message {
  min-height: 22px;
  font-size: 15px;
  line-height: 1.4;
  margin: 12px 0 0;
}

.message:empty {
  min-height: 0;
  margin: 0;
}

.message--error {
  color: var(--danger);
  font-weight: 500;
}

.message--success {
  color: var(--success);
  font-weight: 500;
}

/* ---------- Estados vacíos: ícono grande arriba y texto centrado ---------- */

.message.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 56px 24px;
  color: var(--text-muted);
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  animation: rise-in 320ms var(--ease) backwards;
}

/* El ícono se pinta con una máscara para heredar el color del texto */
.empty-state::before {
  content: "";
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  background-color: currentColor;
  opacity: 0.55;
  -webkit-mask: var(--empty-icon) center / contain no-repeat;
  mask: var(--empty-icon) center / contain no-repeat;
  /* Por defecto: caja vacía */
  --empty-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='0.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8.5 12 13 3 8.5 12 4z'/%3E%3Cpath d='M3 8.5v7L12 20l9-4.5v-7'/%3E%3Cline x1='12' y1='13' x2='12' y2='20'/%3E%3C/svg%3E");
}

.empty-state--search::before {
  --empty-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='0.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E");
}

.empty-state--pin::before {
  --empty-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='0.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-6.5-5.6-6.5-11a6.5 6.5 0 0 1 13 0c0 5.4-6.5 11-6.5 11z'/%3E%3Ccircle cx='12' cy='10' r='2.4'/%3E%3C/svg%3E");
}

.empty-state--users::before {
  --empty-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='0.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20c0-3.6 2.9-6 6.5-6s6.5 2.4 6.5 6'/%3E%3Cpath d='M16 4.6a3.5 3.5 0 0 1 0 6.8'/%3E%3Cpath d='M18 14.3c2.1.8 3.5 2.8 3.5 5.7'/%3E%3C/svg%3E");
}

.empty-state--clock::before,
.history__item.muted::before {
  --empty-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='0.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpolyline points='12 7.5 12 12 15 14'/%3E%3C/svg%3E");
}

/* Versión compacta para usar dentro de una tarjeta */
.message.empty-state--compact,
.card--list .message.empty-state--compact {
  gap: 10px;
  margin: 0;
  padding: 20px 12px 28px;
  font-size: 15px;
}

/* ---------- Tarjetas ---------- */

.card {
  display: block;
  position: relative;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: var(--gap);
  color: var(--text);
  text-decoration: none;
}

.card h2 {
  margin-top: 0;
}

/* Tarjeta que se puede tocar */
.card--link {
  transition: transform var(--t-press), background var(--t);
}

.card--link:active {
  transform: scale(0.98);
  background: var(--card-pressed);
}

/* Flecha discreta arriba a la derecha: indica que la tarjeta lleva a otra pantalla */
.card--link::after {
  content: "";
  position: absolute;
  top: 21px;
  right: 22px;
  width: 8px;
  height: 8px;
  border-top: 1.5px solid var(--text-muted);
  border-right: 1.5px solid var(--text-muted);
  opacity: 0.6;
  transform: rotate(45deg);
}

/* Tarjeta con una lista dentro: las filas llegan hasta los bordes */
.card--list {
  padding-bottom: 6px;
}

.card--list .message {
  margin: 0 0 14px;
}

/* Aviso con acción (por ejemplo "no hay ubicaciones todavía") */
.notice {
  padding: 20px;
  margin-bottom: 20px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.notice__text {
  margin: 0 0 14px;
  color: var(--text-muted);
}

/* ---------- Filas de lista (dentro de tarjetas y acordeones) ---------- */

.list-row,
.acc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  color: var(--text);
  text-decoration: none;
  transition: background var(--t), opacity var(--t);
}

/* Fila dentro de una tarjeta */
.list-row {
  padding: 12px 0;
  border-top: 0.5px solid var(--separator);
}

.list-row:active {
  opacity: 0.55;
}

.list-row__main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.list-row__title {
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.list-row__sub {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
}

.list-row__value {
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.list-row__value--warning {
  color: var(--warning);
}

/* Fila de un sobrante dentro del acordeón */
.acc-row {
  padding: 14px 20px;
}

.acc-row + .acc-row,
.accordion__body .message + .acc-row {
  border-top: 0.5px solid var(--separator);
}

.acc-row:active {
  background: var(--fill);
}

.acc-row__name {
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.acc-row__feet {
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Fila de acción al final del panel ("Add cable") */
.acc-row--action {
  justify-content: center;
  min-height: 52px;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Esqueletos de carga (shimmer) ---------- */

.skeleton-list {
  margin-top: 12px;
  animation: fade-in 200ms var(--ease);
}

.skeleton {
  position: relative;
  height: 76px;
  margin-bottom: var(--gap);
  border-radius: var(--radius-card);
  background: var(--skeleton);
  overflow: hidden;
}

/* Brillo que cruza de izquierda a derecha */
.skeleton::after,
.panel-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s ease-in-out infinite;
}

/* Cada bloque arranca un poco después que el anterior */
.skeleton:nth-child(2)::after {
  animation-delay: 120ms;
}

.skeleton:nth-child(3)::after {
  animation-delay: 240ms;
}

/* Número grande de una tarjeta mientras carga */
.skeleton--metric {
  width: 55%;
  height: 68px;
  margin: 4px 0 34px;
  border-radius: var(--radius-control);
}

/* Filas dentro de una tarjeta mientras cargan */
.skeleton-list--rows {
  margin-top: 0;
}

.skeleton-list--rows .skeleton {
  height: 44px;
  border-radius: var(--radius-control);
}

/* Alturas iguales a las tarjetas reales de cada pantalla (sin saltos al cargar) */
.skeleton-list--results .skeleton {
  height: 112px;
}

.skeleton-list--stock .skeleton {
  height: 92px;
}

.skeleton-list--accordion .skeleton {
  height: 78px;
}

.skeleton-list--accordion,
.skeleton-list--stock {
  margin-top: 0;
}

.skeleton-list--users .skeleton {
  height: 72px;
}

/* Detalle: nombre, ubicación y el número grande de pies */
.skeleton-list--detail {
  margin-top: 4px;
}

.skeleton-list--detail .skeleton {
  border-radius: 10px;
}

.skeleton-list--detail .skeleton:nth-child(1) {
  width: 72%;
  height: 32px;
  margin-bottom: 10px;
}

.skeleton-list--detail .skeleton:nth-child(2) {
  width: 40%;
  height: 18px;
  margin-bottom: 34px;
}

.skeleton-list--detail .skeleton:nth-child(3) {
  width: 62%;
  height: 68px;
  border-radius: var(--radius-control);
}

/* Formulario: tres campos con su etiqueta */
.skeleton-list--form .skeleton {
  height: 56px;
  margin: 26px 0 22px;
  border-radius: var(--radius-control);
}

/* Panel de un acordeón mientras carga: dos filas dibujadas con fondos */
.accordion__body .panel-skeleton {
  position: relative;
  height: 112px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-size: 0;
  color: transparent;
  background:
    linear-gradient(var(--skeleton), var(--skeleton)) left 20px top 20px / 52% 16px no-repeat,
    linear-gradient(var(--skeleton), var(--skeleton)) right 20px top 20px / 56px 16px no-repeat,
    linear-gradient(var(--separator), var(--separator)) left 20px top 56px / calc(100% - 40px) 0.5px no-repeat,
    linear-gradient(var(--skeleton), var(--skeleton)) left 20px top 76px / 38% 16px no-repeat,
    linear-gradient(var(--skeleton), var(--skeleton)) right 20px top 76px / 44px 16px no-repeat;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

/* ---------- Aparición escalonada de listas (50ms por elemento) ---------- */

.stagger > *,
.accordion__body > .acc-row {
  animation: rise-in 320ms var(--ease) backwards;
}

.stagger > :nth-child(2),
.accordion__body > .acc-row:nth-child(2) { animation-delay: 50ms; }
.stagger > :nth-child(3),
.accordion__body > .acc-row:nth-child(3) { animation-delay: 100ms; }
.stagger > :nth-child(4),
.accordion__body > .acc-row:nth-child(4) { animation-delay: 150ms; }
.stagger > :nth-child(5),
.accordion__body > .acc-row:nth-child(5) { animation-delay: 200ms; }
.stagger > :nth-child(6),
.accordion__body > .acc-row:nth-child(6) { animation-delay: 250ms; }
.stagger > :nth-child(7),
.accordion__body > .acc-row:nth-child(7) { animation-delay: 300ms; }
.stagger > :nth-child(8),
.accordion__body > .acc-row:nth-child(8) { animation-delay: 350ms; }
.stagger > :nth-child(9),
.accordion__body > .acc-row:nth-child(9) { animation-delay: 400ms; }
.stagger > :nth-child(10),
.accordion__body > .acc-row:nth-child(10) { animation-delay: 450ms; }
.stagger > :nth-child(n + 11),
.accordion__body > .acc-row:nth-child(n + 11) { animation-delay: 500ms; }

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Bottom bar fija (vidrio esmerilado) ---------- */

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  height: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding: 0 max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-top: 0.5px solid var(--separator);
}

.bottom-bar__item {
  flex: 1 1 0;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: var(--bar-h);
  text-decoration: none;
  color: var(--text-muted);
  opacity: 0.6;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  transition: color var(--t), opacity var(--t), transform var(--t-press);
}

.bottom-bar__item:active {
  transform: scale(0.92);
}

.bottom-bar__item.is-active {
  color: var(--accent);
  opacity: 1;
  font-weight: 600;
}

.bottom-bar__icon {
  width: 22px;
  height: 22px;
  display: block;
}

/* ---------- Botones flotantes (FAB) ---------- */

.fab {
  position: fixed;
  right: max(var(--pad), calc(50% - 240px + var(--pad)));
  bottom: calc(var(--bar-h) + 16px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.24);
  transition: transform var(--t-press), background var(--t);
  animation: fab-in 250ms var(--ease) backwards;
}

.fab:active {
  transform: scale(0.94);
  background: var(--accent-pressed);
}

.fab__icon {
  width: 24px;
  height: 24px;
  display: block;
}

/* FAB secundario: gris translúcido, 48px, encima del principal */
.fab--secondary {
  right: max(calc(var(--pad) + 4px), calc(50% - 240px + var(--pad) + 4px));
  bottom: calc(var(--bar-h) + 16px + 56px + 14px + env(safe-area-inset-bottom));
  width: 48px;
  height: 48px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 0.5px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.fab--secondary:active {
  background: var(--fill-strong);
}

@keyframes fab-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- Modales ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(72px + env(safe-area-inset-top)) var(--pad) calc(var(--pad) + env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Fondo oscurecido y desenfocado */
.modal__backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: fade-in 250ms var(--ease);
}

/* El panel queda en la parte alta para que el teclado del teléfono no lo tape */
.modal__panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 24px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  transform-origin: center top;
  animation: modal-in 250ms var(--ease);
}

/* Modales con formulario largo: panel centrado; si no cabe, se desplaza */
.modal--center {
  padding-top: calc(24px + env(safe-area-inset-top));
}

.modal--center .modal__panel {
  margin: auto;
  transform-origin: center;
}

/* Subtítulo: 22px semibold */
.modal__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-transform: none;
  color: var(--text);
  margin: 0 0 20px;
}

.modal__hint {
  margin: 8px 0 0 4px;
}

.modal__panel .field {
  margin-bottom: 16px;
}

.modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-top: 16px;
}

/* Texto en una sola línea aunque sea largo ("Save changes") */
.modal__actions .btn {
  padding: 12px 8px;
  font-size: 16px;
}

.modal__actions .btn + .btn {
  margin-top: 0;
}

.modal__actions + .btn {
  margin-top: var(--gap);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- Toast (aviso breve, material translúcido) ---------- */

/* Entra desde arriba y se desvanece al salir */
.toast {
  position: fixed;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top));
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100% - 2 * var(--pad));
  padding: 14px 20px;
  background: var(--glass-toast);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-toast);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0;
  transform: translate(-50%, -24px) scale(0.96);
  pointer-events: none;
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}

/* Punto de color: verde si salió bien, rojo si es un error */
.toast::before {
  content: "";
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
}

.toast--error::before {
  background: var(--danger);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---------- Encabezados con botón a la derecha ---------- */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

/* Deja aire arriba para que el selector de idioma no tape el encabezado */
.page--with-lang .page-head {
  margin-top: 40px;
}

.page--with-lang .page-head h1 {
  margin: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 14px;
}

.section-head h2 {
  margin: 0;
}

/* ---------- Login ---------- */

.login {
  padding-top: calc(88px + env(safe-area-inset-top));
}

/* Distintivo de la app: un rollo de cable */
.login__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin-bottom: 24px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 18px rgba(0, 122, 255, 0.22);
}

.login__mark svg {
  width: 36px;
  height: 36px;
  display: block;
}

.login__title {
  margin: 0 0 6px;
}

.login__subtitle {
  font-size: 17px;
  margin: 0 0 32px;
}

.login .btn {
  margin-top: 8px;
}

/* ---------- Home ---------- */

.home-head {
  margin-bottom: 20px;
}

.home-head h1 {
  margin-bottom: 4px;
}

.home-head__greeting {
  min-height: 24px;
  font-size: 17px;
  margin: 0;
}

/* Barra de búsqueda (enlace con aspecto de campo) */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control-h);
  padding: 0 16px;
  margin-bottom: var(--gap);
  background: var(--fill);
  border-radius: var(--radius-control);
  color: var(--text-muted);
  font-size: 17px;
  text-decoration: none;
  transition: transform var(--t-press), background var(--t);
}

.search-bar:active {
  transform: scale(0.98);
  background: var(--fill-strong);
}

.search-bar__icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: block;
}

/* Campo de solo lectura: toda la barra funciona como un botón */
.search-bar__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-bar__input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.search-bar {
  cursor: pointer;
}

.home-summary {
  margin: 2px 0 0;
  line-height: 1.4;
}

/* Stock por tipo de cable: un grupo por nombre */
.type-row {
  display: block;
  padding: 14px 0;
  border-top: 0.5px solid var(--separator);
  color: var(--text);
  text-decoration: none;
  transition: opacity var(--t);
}

.type-row:active {
  opacity: 0.55;
}

.type-row__name {
  display: block;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.type-row__feet {
  display: block;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.type-row__meta {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* Enlace al final de una tarjeta ("View full inventory →") */
.card__more {
  display: block;
  padding: 14px 0;
  border-top: 0.5px solid var(--separator);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--t);
}

.card__more:active {
  opacity: 0.55;
}

.card__more::after {
  content: " \2192";
}

/* Accesos rápidos: botones cuadrados con ícono y texto */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}

/* Con solo dos accesos (rol 'consulta') ocupan todo el ancho */
.action-grid--two {
  grid-template-columns: repeat(2, 1fr);
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 92px;
  padding: 14px 4px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform var(--t-press), background var(--t);
}

.action-btn:active {
  transform: scale(0.97);
  background: var(--card-pressed);
}

.action-btn__icon {
  width: 24px;
  height: 24px;
  display: block;
  color: var(--accent);
}

/* ---------- Búsqueda ---------- */

/* Dos accesos grandes bajo el campo de búsqueda */
.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin: 12px 0 24px;
}

.quick-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 100px;
  padding: 18px 20px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: transform var(--t-press), background var(--t);
}

.quick-link:active {
  transform: scale(0.97);
  background: var(--card-pressed);
}

.quick-link__icon {
  width: 24px;
  height: 24px;
  display: block;
  color: var(--accent);
}

.result-list {
  margin-top: 12px;
}

/* Tarjeta de resultado: nombre y pies a la izquierda, ubicación a la derecha */
.result-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: var(--gap);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--t-press), background var(--t);
}

.result-card:active {
  transform: scale(0.98);
  background: var(--card-pressed);
}

/* Resultado que se elige (botón en vez de enlace) */
.result-card--button {
  appearance: none;
  width: 100%;
  font-family: inherit;
  font-size: 17px;
  text-align: left;
  cursor: pointer;
}

.result-card__main {
  min-width: 0;
}

.result-card__name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-muted);
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

/* Ubicación exacta dentro de la zona (solo si existe) */
.result-card__detail {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.result-card__feet {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

/* Ubicación como etiqueta discreta */
.result-card__zone {
  flex: 0 0 auto;
  max-width: 45%;
  margin-bottom: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-align: right;
  overflow-wrap: anywhere;
}

.result-card__zone:empty {
  display: none;
}

/* ---------- Detalle de sobrante ---------- */

.detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail__name {
  min-width: 0;
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.detail__zone {
  margin: 0 0 28px;
}

/* Ubicación exacta dentro de la zona (solo si existe) */
.detail__zone--with-detail {
  margin-bottom: 2px;
}

.detail__detail {
  margin: 0 0 28px;
  overflow-wrap: anywhere;
}

.detail__label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 4px;
}

/* El dato protagonista de la pantalla */
.detail__feet {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin: 0 0 14px;
}

.detail__meta {
  margin: 0 0 2px;
}

.detail__badge {
  display: inline-block;
  margin: 16px 0 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 159, 10, 0.16);
  color: var(--warning);
  font-size: 13px;
  font-weight: 600;
}

.detail__actions {
  margin-top: 28px;
}

/* Historial de movimientos */
.history {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history__item {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px 20px;
  margin-bottom: var(--gap);
}

/* Historial vacío: ícono arriba y texto centrado */
.history__item.muted {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  text-align: center;
}

.history__item.muted::before {
  content: "";
  width: 48px;
  height: 48px;
  background-color: currentColor;
  opacity: 0.55;
  -webkit-mask: var(--empty-icon) center / contain no-repeat;
  mask: var(--empty-icon) center / contain no-repeat;
}

.history__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.history__type {
  font-weight: 600;
}

.history__feet {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.history__meta {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
}

.history__note {
  font-size: 15px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid var(--separator);
  overflow-wrap: anywhere;
}

/* ---------- Stock ---------- */

/* Tarjeta de stock: nombre y total de pies a la izquierda, rollos a la derecha */
.stock-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: var(--gap);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--t-press), background var(--t);
}

.stock-card:active {
  transform: scale(0.98);
  background: var(--card-pressed);
}

.stock-card__main {
  min-width: 0;
}

.stock-card__name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.stock-card__feet {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0;
}

.stock-card__rolls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Contador de rollos */
.stock-card__count {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.stock-card__label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---------- Acordeón (inventario y ubicaciones) ---------- */

.accordion {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--gap);
  overflow: hidden;
}

.accordion__head {
  display: flex;
  align-items: center;
}

.accordion__toggle {
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 16px 20px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: opacity var(--t), background var(--t);
}

.accordion__toggle:active {
  opacity: 0.55;
}

.accordion__toggle:disabled {
  cursor: default;
  opacity: 1;
}

.accordion__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.accordion__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.accordion__meta {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.35;
}

.accordion__note {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.accordion__chevron {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  opacity: 0.7;
  transition: transform 250ms var(--ease);
}

.accordion.is-open .accordion__chevron {
  transform: rotate(180deg);
}

/* Botón de acción dentro del encabezado (editar ubicación) */
.accordion__action {
  width: 40px;
  height: 40px;
  margin-right: 16px;
}

.accordion__action .icon-btn__icon {
  width: 20px;
  height: 20px;
}

/* Ubicación inactiva: apagada, pero se puede editar para reactivarla */
.accordion.is-muted .accordion__title,
.accordion.is-muted .accordion__meta {
  color: var(--text-muted);
}

.accordion.is-muted .accordion__toggle {
  opacity: 0.7;
}

.accordion__body {
  border-top: 0.5px solid var(--separator);
  animation: fade-in 200ms var(--ease);
}

.accordion__body .message {
  margin: 0;
  padding: 18px 20px;
  text-align: center;
}

/* ---------- Settings ---------- */

/* Fila de un dato dentro de una tarjeta: etiqueta a la izquierda, valor a la derecha */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 0;
  border-top: 0.5px solid var(--separator);
}

.settings-row__label {
  color: var(--text-muted);
  font-size: 15px;
}

.settings-row__value {
  min-width: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.settings-card .btn {
  margin-top: 8px;
}

/* Preferencia con un selector debajo (idioma, tema) */
.settings-pref {
  padding: 12px 0 4px;
  border-top: 0.5px solid var(--separator);
}

.settings-pref__label {
  display: block;
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 15px;
}

.settings-pref .seg-toggle {
  margin-bottom: 8px;
}

.seg-toggle--three {
  grid-template-columns: 1fr 1fr 1fr;
}

.settings-text {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 15px;
}

.settings-logout {
  margin-top: 28px;
}

/* El usuario de la sesión aparece en la lista pero no se puede tocar */
.user-row:disabled {
  cursor: default;
  opacity: 1;
}

.user-row:disabled:active {
  transform: none;
  background: var(--card);
}

/* ---------- Settings: lista de usuarios ---------- */

.user-row {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 14px 20px;
  margin-bottom: var(--gap);
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  text-align: left;
  cursor: pointer;
  transition: transform var(--t-press), background var(--t);
}

.user-row:active {
  transform: scale(0.98);
  background: var(--card-pressed);
}

.user-row__main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.user-row__name {
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.user-row__you {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.user-row__role {
  color: var(--text-muted);
  font-size: 15px;
}

.user-row__status {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.user-row__status.is-active {
  background: rgba(48, 209, 88, 0.16);
  color: var(--success);
}

.user-row.is-inactive .user-row__name {
  color: var(--text-muted);
}

/* ---------- Pantalla "Add cable" ---------- */

.add-form .field {
  margin-bottom: 24px;
}

.add-form .btn--large {
  margin-top: 8px;
}

/* ---------- Pantalla "Sacar cable" ---------- */

.take {
  margin-top: 24px;
  animation: rise-in 320ms var(--ease) backwards;
}

/* Subtítulo: 22px semibold */
.take__name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.take__zone {
  margin: 0 0 12px;
}

/* El dato protagonista de la pantalla */
.take__feet {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin: 0 0 28px;
}

.take__actions {
  margin-top: 16px;
}

/* Botones rápidos de pies: una fila de 5 */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.quick-btn {
  appearance: none;
  min-height: 48px;
  padding: 8px 2px;
  background: var(--fill);
  border: 0;
  border-radius: var(--radius-control);
  color: var(--accent);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--t-press), background var(--t), opacity var(--t);
}

.quick-btn:active {
  transform: scale(0.97);
  background: var(--fill-strong);
}

.quick-btn:disabled {
  color: var(--text-muted);
  opacity: 0.4;
  cursor: default;
  transform: none;
}

/* ---------- Dispositivos con puntero: realce al pasar por encima ---------- */

@media (hover: hover) {
  .card--link:hover,
  .result-card:hover,
  .stock-card:hover,
  .user-row:hover,
  .action-btn:hover,
  .quick-link:hover {
    background: var(--card-pressed);
  }

  .acc-row:hover {
    background: var(--fill);
  }

  .btn--secondary:hover:not(:disabled),
  .pill-btn:hover:not(:disabled),
  .quick-btn:hover:not(:disabled),
  .icon-btn:not(.icon-btn--accent):hover,
  .search-bar:hover {
    background: var(--fill-strong);
  }

  .btn--primary:hover:not(:disabled),
  .icon-btn--accent:hover,
  .fab:not(.fab--secondary):hover {
    background: var(--accent-pressed);
  }

  .btn--danger:hover:not(:disabled) {
    background: var(--danger-pressed);
  }

  .bottom-bar__item:hover {
    opacity: 1;
  }
}

/* ---------- Pantallas muy angostas (iPhone SE y similares) ---------- */

@media (max-width: 360px) {
  .metric,
  .detail__feet,
  .take__feet {
    font-size: 56px;
  }

  .action-grid {
    gap: 8px;
  }

  .quick-btn {
    font-size: 15px;
  }
}

/* ---------- Menos movimiento si el sistema lo pide ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
