/* =============================================
   DESIGN SYSTEM — Industrial Dashboard
   ============================================= */

:root {
  /* Core palette — Dark (default) */
  --bg-deep: #0c1017;
  --bg-surface: #131921;
  --bg-card: #1a2233;
  --bg-elevated: #212d40;
  --bg-hover: #253347;

  /* Borders */
  --border: #2a3a50;
  --border-subtle: #1e2d42;
  --border-focus: var(--amber);

  /* Text */
  --text-primary: #e8ecf1;
  --text-secondary: #8899ad;
  --text-muted: #5a6d82;
  --text-inverse: #0c1017;

  /* Accents */
  --amber: #f0a500;
  --amber-dim: rgba(240, 165, 0, 0.15);
  --amber-glow: rgba(240, 165, 0, 0.08);
  --teal: #2dd4a8;
  --teal-dim: rgba(45, 212, 168, 0.12);
  --coral: #f0566a;
  --coral-dim: rgba(240, 86, 106, 0.12);
  --blue: #5b9cf6;
  --blue-dim: rgba(91, 156, 246, 0.12);

  /* Spacing */
  --radius: 8px;
  --radius-lg: 12px;

  /* Fonts */
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Light theme */
[data-theme="light"] {
  --bg-deep: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #f5f6f8;
  --bg-hover: #ebedf0;

  --border: #d8dde4;
  --border-subtle: #e8ecf0;

  --text-primary: #1a2233;
  --text-secondary: #4a5568;
  --text-muted: #8899ad;
  --text-inverse: #ffffff;

  --amber: #d69400;
  --amber-dim: rgba(214, 148, 0, 0.12);
  --amber-glow: rgba(214, 148, 0, 0.06);
  --teal: #0d9e7e;
  --teal-dim: rgba(13, 158, 126, 0.1);
  --coral: #dc3545;
  --coral-dim: rgba(220, 53, 69, 0.1);
  --blue: #3b7dd8;
  --blue-dim: rgba(59, 125, 216, 0.1);
}

/* =============================================
   RESET & BASE
   ============================================= */

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

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Subtle noise texture overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

.hidden { display: none !important; }

/* =============================================
   HEADER
   ============================================= */

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

/* Logo images */
.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-img { display: block; }
.logo-dark { display: block; }
.logo-light { display: none; }
[data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: block; }

.header-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

.header-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-subtitle {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--amber);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-dim);
}

.theme-icon--light { display: none; }
.theme-icon--dark { display: block; }
[data-theme="light"] .theme-icon--light { display: block; }
[data-theme="light"] .theme-icon--dark { display: none; }

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: rgba(45, 212, 168, 0.08);
  border: 1px solid rgba(45, 212, 168, 0.2);
  border-radius: 999px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse-dot 2s ease-in-out infinite;
}

.live-text {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.1em;
}

.clock {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  min-width: 6ch;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(45, 212, 168, 0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(45, 212, 168, 0); }
}

/* =============================================
   TABS
   ============================================= */

.tab-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.tab-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 0.25rem;
}

.tab-btn {
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.tab-btn.active {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

.tab-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* =============================================
   MAIN CONTENT
   ============================================= */

.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
  padding-bottom: 6rem;
  position: relative;
  z-index: 1;
}

/* =============================================
   CARDS
   ============================================= */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber-dim), transparent);
}

.card-form {
  max-width: 720px;
  margin: 0 auto;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.card-header--between {
  justify-content: space-between;
  flex-wrap: wrap;
}

.card-header-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-header-icon--retiro {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(240, 165, 0, 0.2);
}

.card-header-icon--devolucion {
  background: var(--teal-dim);
  color: var(--teal);
  border: 1px solid rgba(45, 212, 168, 0.2);
}

.card-header-icon--inventario {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(91, 156, 246, 0.2);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* =============================================
   FORMS
   ============================================= */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

.field {
  margin-bottom: 1.25rem;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field-optional {
  font-weight: 400;
  text-transform: none;
  color: var(--text-muted);
  letter-spacing: 0;
}

.input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

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

.input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

.input--sm {
  padding: 0.4375rem 0.625rem;
  font-size: 0.75rem;
}

textarea.input {
  resize: vertical;
  min-height: 2.5rem;
}

/* Select wrapper */
.select-wrap {
  position: relative;
}

.select-wrap select.input {
  padding-right: 2.25rem;
  cursor: pointer;
}

.select-arrow {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.select-wrap--sm { display: inline-block; }
.select-wrap--sm select.input { min-width: 8rem; }

/* Search input with icon */
.autocomplete-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.input-search {
  padding-left: 2.25rem;
}

.autocomplete-wrap--sm {
  display: inline-block;
}

.autocomplete-wrap--sm .input {
  min-width: 10rem;
}

/* =============================================
   DROPDOWN (Autocomplete)
   ============================================= */

.dropdown {
  position: absolute;
  z-index: 40;
  width: 100%;
  max-height: 17rem;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.dropdown::-webkit-scrollbar { width: 6px; }
.dropdown::-webkit-scrollbar-track { background: transparent; }
.dropdown::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.dropdown-item {
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border-subtle);
}

.dropdown-item:last-child { border-bottom: none; }

.dropdown-item:hover {
  background: var(--amber-glow);
}

.dropdown-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
}

.dropdown-item.disabled:hover {
  background: transparent;
}

/* =============================================
   CHIPS
   ============================================= */

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
  min-width: 0;
}

.chips-container:empty {
  margin-bottom: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.625rem;
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(240, 165, 0, 0.25);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  animation: chipIn 0.2s ease-out;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

.chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--amber);
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  opacity: 0.6;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.chip button:hover { opacity: 1; }

@keyframes chipIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* =============================================
   BUTTONS
   ============================================= */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-inverse);
  background: var(--amber);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  background: #d69400;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(240, 165, 0, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  border: 1px solid var(--border);
}

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

.btn-primary--teal:hover {
  background: #25b892;
  box-shadow: 0 4px 16px rgba(45, 212, 168, 0.3);
}

.btn-primary--teal:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-dim);
}

.form-actions {
  padding-top: 0.5rem;
}

/* =============================================
   INVENTORY TABLE
   ============================================= */

.inv-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -1.75rem;
  padding: 0 1.75rem;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.inv-table thead tr {
  border-bottom: 1px solid var(--border);
}

.inv-table th {
  padding: 0.625rem 0.875rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  white-space: nowrap;
}

.inv-table td {
  padding: 0.75rem 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.inv-table tbody tr {
  transition: background 0.1s;
}

.inv-table tbody tr:hover {
  background: var(--bg-hover);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* =============================================
   BADGES
   ============================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-montaje {
  background: var(--teal-dim);
  color: var(--teal);
  border: 1px solid rgba(45, 212, 168, 0.2);
}
.badge-montaje::before { background: var(--teal); }

.badge-uso {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(240, 165, 0, 0.2);
}
.badge-uso::before { background: var(--amber); }

.badge-mantenimiento {
  background: var(--coral-dim);
  color: var(--coral);
  border: 1px solid rgba(240, 86, 106, 0.2);
}
.badge-mantenimiento::before { background: var(--coral); }

/* =============================================
   TOAST
   ============================================= */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.125rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  color: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 26rem;
  backdrop-filter: blur(8px);
}

.toast-success {
  background: rgba(45, 212, 168, 0.9);
  border: 1px solid rgba(45, 212, 168, 0.5);
  color: var(--text-inverse);
}

.toast-error {
  background: rgba(240, 86, 106, 0.9);
  border: 1px solid rgba(240, 86, 106, 0.5);
}

@keyframes toastIn {
  from {
    transform: translateX(100%) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

/* =============================================
   ANIMATIONS
   ============================================= */

.animate-in {
  animation: fadeSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================
   FONT-MONO utility for app.js generated content
   ============================================= */

.font-mono { font-family: var(--font-mono); }
.text-gray-400 { color: var(--text-muted) !important; }
.text-gray-500 { color: var(--text-muted) !important; }
.text-red-400 { color: var(--coral) !important; }
.text-green-600 { color: var(--teal) !important; }
.text-xs { font-size: 0.7rem !important; }
.whitespace-nowrap { white-space: nowrap; }

/* =============================================
   ADMIN PANEL
   ============================================= */

.tab-btn--admin {
  margin-left: auto;
  color: var(--text-muted);
  opacity: 0.7;
}
.tab-btn--admin:hover { opacity: 1; }
.tab-btn--admin.active {
  color: var(--coral);
  border-bottom-color: var(--coral);
  opacity: 1;
}

.admin-subtabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.admin-subtab {
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.admin-subtab:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.admin-subtab.active {
  color: var(--amber);
  background: var(--amber-dim);
  border-color: rgba(240, 165, 0, 0.3);
}

.admin-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn--sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
}

.btn-toggle, .btn-delete {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-toggle:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.btn-delete {
  color: var(--coral);
  border-color: rgba(240, 86, 106, 0.3);
}

.btn-delete:hover {
  background: var(--coral-dim);
  border-color: var(--coral);
}

.admin-equipo-form {
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* =============================================
   CONFIRMATION MODAL
   ============================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.modal-body {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.modal-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.modal-list {
  list-style: none;
  margin-top: 0.75rem;
  padding: 0;
  max-height: 40vh;
  overflow-y: auto;
}

.modal-list li {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.modal-list li:last-child {
  border-bottom: none;
}

.modal-code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.125rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal-btn {
  padding: 0.5rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}

.modal-btn--cancel {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.modal-btn--cancel:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-btn--ok {
  background: var(--amber);
  color: var(--text-inverse);
}

.modal-btn--ok:hover {
  background: #d69400;
  box-shadow: 0 4px 12px rgba(240, 165, 0, 0.3);
}

.modal-btn--ok.modal-btn--teal {
  background: var(--teal);
}

.modal-btn--ok.modal-btn--teal:hover {
  background: #25b892;
  box-shadow: 0 4px 12px rgba(45, 212, 168, 0.3);
}

[data-theme="light"] .modal-btn--ok,
[data-theme="light"] .modal-btn--ok.modal-btn--teal {
  color: #fff;
}

/* =============================================
   EXPORT BUTTON
   ============================================= */

.inv-export-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.125rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: #1d7044;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export:hover {
  background: #166038;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 112, 68, 0.35);
}

.btn-export:active {
  transform: translateY(0);
}

/* =============================================
   PIN GATE CENTERED
   ============================================= */

.pin-gate-centered {
  max-width: 400px;
  margin: 15vh auto 0;
}

/* =============================================
   LIGHT THEME ADJUSTMENTS
   ============================================= */

[data-theme="light"] .noise-overlay { opacity: 0; }

[data-theme="light"] .card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .card::before {
  background: linear-gradient(90deg, transparent, rgba(214, 148, 0, 0.2), transparent);
}

[data-theme="light"] .dropdown {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .toast {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .btn-primary {
  color: #fff;
}

[data-theme="light"] .btn-primary:disabled {
  background: #d8dde4;
  color: #8899ad;
  border: 1px solid #c5ccd6;
}

[data-theme="light"] .btn-primary--teal {
  color: #fff;
}

[data-theme="light"] .btn-primary--teal:disabled {
  background: #d8dde4;
  color: #8899ad;
  border: 1px solid #c5ccd6;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
  .header-inner { padding: 0.75rem 1rem; }
  .tab-bar-inner { padding: 0 1rem; }
  .main-content { padding: 1rem; padding-bottom: 6rem; }
  .card { padding: 1.25rem; }

  /* Limit chips area so buttons remain reachable */
  .chips-container {
    max-height: 9rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap { margin: 0 -1.25rem; padding: 0 1.25rem; }
  .card-header--between { gap: 1rem; }
  .inv-filters { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .live-indicator { display: none; }

  /* Header: stack logo and title */
  .header-inner {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .header-left {
    gap: 0.625rem;
    flex: 1;
    min-width: 0;
  }
  .logo-img { height: 28px !important; }
  .header-divider { height: 22px; }
  .header-title { font-size: 0.85rem; }
  .header-subtitle { font-size: 0.55rem; }
  .header-right { gap: 0.75rem; }
  .clock { font-size: 0.65rem; }

  /* Inventory table: card layout on mobile */
  .table-wrap { overflow-x: visible; overflow-y: visible; }
  .inv-table thead { display: none; }
  .inv-table,
  .inv-table tbody,
  .inv-table tr,
  .inv-table td {
    display: block;
    width: 100%;
  }
  .inv-table tr {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
  }
  .inv-table td {
    padding: 0.125rem 0.875rem;
    border-bottom: none;
  }
  .inv-table td:nth-child(1) { /* Código */
    font-size: 0.7rem;
    color: var(--text-muted);
  }
  .inv-table td:nth-child(2) { /* Nombre */
    font-size: 0.9rem;
    font-weight: 600;
  }
  .inv-table td:nth-child(3) { /* Marca/Modelo */
    font-size: 0.75rem;
    color: var(--text-muted);
  }
  .inv-table td:nth-child(4) { /* Estado badge */
    padding-top: 0.375rem;
  }
  .inv-table td:nth-child(5),
  .inv-table td:nth-child(6) { /* Responsable, Ubicación */
    display: inline-block;
    width: auto;
    font-size: 0.75rem;
    padding-right: 0.25rem;
  }
  .inv-table td:nth-child(5)::before {
    content: "Resp: ";
    color: var(--text-muted);
    font-size: 0.65rem;
  }
  .inv-table td:nth-child(6)::before {
    content: "Ubic: ";
    color: var(--text-muted);
    font-size: 0.65rem;
  }
  .inv-table td:nth-child(7) { /* Updated */
    font-size: 0.65rem;
    color: var(--text-muted);
    padding-top: 0.25rem;
  }
}

@media (max-width: 480px) {
  .tab-btn { padding: 0.625rem 0.75rem; font-size: 0.75rem; }
  .tab-icon { display: none; }

  /* Hide title text on small screens, just show logo */
  .header-divider { display: none; }
  .header-title { display: none; }
  .header-subtitle { display: none; }
  .logo-img { height: 30px !important; }
  .header-right { margin-left: auto; }
  .clock { font-size: 0.6rem; }
}
