/* ──────────────────────────────────────────────
   Gestión POs — Dark Modern Design
   ────────────────────────────────────────────── */

/* ── Reset & Base ──────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Colors */
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2128;
  --surface3: #21262d;
  --border: #30363d;
  --border-soft: #21262d;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;

  --accent: #58a6ff;
  --accent-dim: rgba(88, 166, 255, 0.12);
  --green: #3fb950;
  --green-dim: rgba(63, 185, 80, 0.12);
  --yellow: #e3b341;
  --yellow-dim: rgba(227, 179, 65, 0.12);
  --red: #f85149;
  --red-dim: rgba(248, 81, 73, 0.12);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 9999px;

  /* Transitions */
  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Mobile Tokens */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --cockpit-h: 72px;
}

/* ── Light Theme Overrides ────────────────── */
.light-theme {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --surface3: #f1f5f9;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --accent: #2563eb;
  --accent-dim: rgba(37, 99, 235, 0.1);
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.1);
  --yellow: #f59e0b;
  --yellow-dim: rgba(245, 158, 11, 0.1);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.1);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px -4px rgba(0, 0, 0, 0.12);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #161b22;
  border-bottom: 1px solid var(--border-soft);
  transition: all var(--t-base);
  display: flex;
  flex-direction: column;
}

.light-theme .app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-level-1 {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

@media (max-width: 768px) {
  .header-level-1 {
    padding: 0 16px;
    height: 64px;
  }
}

.header-level-2 {
  max-width: 1400px;
  width: 100%;
  margin: 4px auto;
  padding: 6px 24px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 768px) {
  .header-level-2 {
    padding: 8px 16px 12px;
    gap: 12px;
  }
  .search-filters {
    gap: 8px;
    width: 100%;
  }
  .search-box {
    flex: 1 !important;
    width: auto !important;
  }
  .filter-select {
    width: 130px !important;
    flex-shrink: 0;
  }
}

.search-filters {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  height: 40px;
  border-radius: var(--r-md);
  padding: 0 12px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all var(--t-base);
}

.filter-select:focus {
  border-color: var(--accent);
  background: var(--surface3);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 8px rgba(88, 166, 255, 0.3));
}

.header-brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
  transition: color var(--t-base);
}

.light-theme .header-brand h1 {
  color: var(--text-primary);
}

/* Global Progress Bar Below Header */
.global-progress-container {
  width: 100%;
  height: 4px;
  background: var(--yellow-dim);
  overflow: hidden;
}

.global-progress-bar {
  height: 100%;
  background: var(--yellow);
  width: 0%;
  box-shadow: 0 0 15px var(--yellow);
  transition: width 0.4s cubic-bezier(0.1, 0.7, 0.1, 1);
  position: relative;
}

.is-syncing-global .global-progress-bar::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: bar-shine 2s infinite;
}

@keyframes bar-shine {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.data-value {
  font-weight: 600;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

.highlight-item {
  background: var(--surface3);
  padding: 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

.calculation-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.rate-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  width: 100%;
  max-width: 160px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.rate-input:focus { border-color: var(--accent); outline: none; }

.brand-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.2px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* ── MFA Banner ─────────────────────────────── */
.mfa-banner {
  background: rgba(10, 132, 255, 0.15); border-bottom: 1px solid rgba(10, 132, 255, 0.3);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: 12px 20px; animation: slideDownMFA 0.3s ease-out;
}
.mfa-content {
  max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.mfa-icon {
  width: 32px; height: 32px; background: rgba(10, 132, 255, 0.2); 
  border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #0a84ff;
}
.mfa-icon svg { width: 18px; height: 18px; }
.mfa-text { font-size: 0.95rem; font-weight: 600; color: #fff; }
.mfa-code { 
  display: inline-block; background: #0a84ff; color: #fff; padding: 2px 10px; 
  border-radius: 6px; font-weight: 800; font-size: 1.2rem; margin-left: 6px;
  box-shadow: 0 0 15px rgba(10, 132, 255, 0.4); border: 1px solid rgba(255,255,255,0.2);
}
.mfa-screenshot {
  height: 44px;
  width: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 6px 18px rgba(10, 132, 255, 0.2);
  margin-left: auto;
}
.light-theme .mfa-screenshot {
  border-color: rgba(37, 99, 235, 0.25);
}
@keyframes slideDownMFA { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.search-box {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 12px;
  height: 40px;
  transition: all var(--t-base);
  width: 280px;
}

.search-box:focus-within {
  width: 240px;
  border-color: var(--accent);
  background: var(--surface3);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.search-box svg { color: var(--text-muted); margin-right: 8px; }
.search-box input {
  background: transparent; border: none;
  color: var(--text-primary); font-size: 0.85rem; width: 100%; outline: none;
}
.search-box input::placeholder { color: var(--text-muted); }

.search-clear {
  background: rgba(248, 81, 73, 0.15); border: none; padding: 5px; cursor: pointer; color: #f85149;
  display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all 0.2s; flex-shrink: 0;
}
.search-clear:hover { background: #f85149; color: white; transform: scale(1.1); }
.search-clear svg { width: 14px; height: 14px; }

/* ── Sync Info ──────────────────────────────── */
.sync-info {
  display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-secondary);
  padding: 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  height: 40px; box-sizing: border-box;
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); flex-shrink: 0; }
.auth-status {
  display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface3); color: var(--text-muted); transition: all var(--t-base); margin-right: 4px;
}
.auth-status.authenticated { color: #3fb950; background: rgba(63, 185, 80, 0.15); box-shadow: 0 0 10px rgba(63, 185, 80, 0.3); border: 1px solid rgba(63, 185, 80, 0.3); }
.sync-dot.syncing { background: var(--accent); animation: pulse-dot 1s ease infinite; }
.sync-dot.error { background: var(--red); box-shadow: 0 0 6px var(--red); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; border-radius: var(--r-md);
  font-family: inherit; font-size: 0.85rem; font-weight: 500; cursor: pointer; border: none;
  height: 40px; transition: all var(--t-fast); white-space: nowrap; -webkit-user-select: none; user-select: none;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: #ffffff; font-weight: 600; box-shadow: 0 4px 12px var(--accent-dim); }
.btn-primary:hover { background: #79b8ff; box-shadow: 0 0 24px rgba(88, 166, 255, 0.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost { background: var(--surface2); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface3); color: var(--text-primary); border-color: var(--border); }

.btn-danger { background: rgba(248, 81, 73, 0.1); color: #f85149; border: 1px solid rgba(248, 81, 73, 0.2); }
.btn-danger:hover { background: #f85149; color: white; box-shadow: 0 0 15px rgba(248, 81, 73, 0.4); }

.btn-confirm-delete {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid var(--yellow) !important;
  animation: pulse-yellow 0.8s ease infinite;
}

@keyframes pulse-yellow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
}

.btn-icon { padding: 7px; border-radius: var(--r-sm); background: transparent; color: var(--text-muted); border: 1px solid transparent; }
.btn-icon:hover { background: var(--surface3); color: var(--text-primary); border-color: var(--border); }
.btn-icon svg { width: 16px; height: 16px; }

.btn:disabled, .btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; filter: grayscale(0.6); }

/* ── Stats Bar ──────────────────────────────── */
.stats-bar { max-width: 1400px; margin: 0 auto; padding: 16px 24px; display: flex; align-items: center; gap: 0; }
.stat-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 28px; cursor: pointer;
  transition: all var(--t-fast); border-radius: var(--r-md); border: 1px solid transparent;
}
.stat-item:hover { background: var(--surface2); }
.stat-item.active-filter { background: var(--surface3); border-color: var(--border); box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1); }
.stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat-ok { color: var(--green); }
.stat-warning { color: var(--yellow); }
.stat-danger { color: var(--red); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-sep { width: 1px; height: 32px; background: var(--border); }

/* ── Main Layout & Empty State ──────────────── */
.main-content { max-width: 1400px; margin: 0 auto; padding: 24px 24px 48px; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 40px; text-align: center; background: var(--surface);
  border: 1px dashed var(--border); border-radius: var(--r-xl); margin-top: 20px;
}
.empty-icon {
  width: 80px; height: 80px; background: var(--surface2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
  margin-bottom: 24px; border: 1px solid var(--border);
}
.empty-icon svg { width: 40px; height: 40px; }
.empty-state h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.empty-state p { color: var(--text-secondary); max-width: 400px; margin-bottom: 32px; font-size: 0.95rem; }

/* ── PO Grid ────────────────────────────────── */
.po-grid { display: flex; flex-direction: column; gap: 40px; align-items: stretch; }
.client-group { display: flex; flex-direction: column; gap: 20px; }

.group-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 4px;
}

.client-logo-wrapper {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.client-logo {
  max-width: 28px;
  max-height: 28px;
  object-fit: contain;
}

.group-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.group-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .group-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 16px 16px calc(var(--cockpit-h) + 32px);
  }
  .group-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .client-group {
    gap: 12px;
  }
  .group-header {
    margin-bottom: 4px;
  }
}

/* ── PO Card ────────────────────────────────── */
.po-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  padding: 16px 20px; transition: all var(--t-base); position: relative; overflow: hidden;
  cursor: pointer; box-shadow: var(--shadow-md);
}

.po-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--border);
  transition: all var(--t-base);
  z-index: 5;
}

.po-card.status-ok::before { 
  background: var(--green); 
  box-shadow: 0 0 15px rgba(63, 185, 80, 0.5);
}
.po-card.status-warning::before { 
  background: var(--yellow); 
  box-shadow: 0 0 15px rgba(227, 179, 65, 0.5);
}
.po-card.status-danger::before { 
  background: var(--red); 
  box-shadow: 0 0 20px rgba(248, 81, 73, 0.7);
}
.po-card.status-danger {
  animation: pulse-border-full 2.5s ease-in-out infinite;
}
.po-card.status-pending::before { background: var(--text-muted); }

@keyframes pulse-border-full {
  0%, 100% { border-color: var(--border-soft); }
  50% { border-color: rgba(248, 81, 73, 0.6); }
}

.po-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3); background: var(--surface2); }



/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-ok {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.2);
}

.badge-warning {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid rgba(227, 179, 65, 0.2);
}

.badge-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.2);
}

.badge-pending {
  background: var(--surface3);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-syncing {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(88, 166, 255, 0.2);
}

.badge-error {
  background: rgba(248, 81, 73, 0.1);
  color: #f85149;
  border: 1px dotted #f85149;
}

.badge-cancelled {
  background: rgba(210, 153, 34, 0.1);
  color: var(--yellow);
  border: 1px dashed rgba(227, 179, 65, 0.3);
}

.btn-sync-card {
  opacity: 0.6; padding: 6px; border-radius: 50%; background: var(--surface2); transition: all 0.3s ease;
}
.btn-sync-card:hover:not(:disabled) {
  opacity: 1; transform: rotate(45deg); background: var(--surface3); color: var(--accent);
}
.btn-sync-card.is-syncing {
  opacity: 1; color: var(--accent); background: var(--accent-dim); cursor: default;
}
.btn-sync-card svg { width: 14px; height: 14px; }

/* Efecto de pulsación para la tarjeta entera cuando sincroniza */
.po-card.syncing {
  animation: card-pulse 2s infinite ease-in-out;
  border-color: var(--accent);
}

@keyframes card-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0); }
  50% { box-shadow: 0 0 15px 2px rgba(88, 166, 255, 0.2); }
}

.card-syncing-overlay { display: none; } /* Eliminado */

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }
@keyframes pulse-cancelled {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
}
.po-card.sync-cancelled {
  border: 1.5px dashed var(--yellow-muted) !important;
}
.po-card.sync-cancelled .po-number-badge {
  color: var(--yellow);
  background: rgba(227, 179, 65, 0.05);
}
.po-card.sync-cancelled .badge-cancelled {
  animation: pulse-cancelled 2.5s infinite ease-in-out;
}

.card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-badges { margin-left: auto; }
.po-number-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  background: var(--accent-dim); border: 1px solid rgba(88, 166, 255, 0.2); border-radius: var(--r-sm);
  font-size: 0.8rem; font-weight: 700; color: var(--accent); white-space: nowrap;
}
.copy-btn {
  background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 2px;
  display: flex; align-items: center; transition: color 0.2s;
}
.copy-btn:hover { color: var(--accent); }
.copy-btn svg { width: 14px; height: 14px; }

.card-body-compact { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.card-alias-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.card-alias-input {
  background: transparent; border: none; color: var(--text-primary); font-size: 1.15rem; font-weight: 700;
  flex: 1; min-width: 0; outline: none; padding: 2px 0; border-bottom: 1px solid transparent; transition: border 0.2s;
  overflow: hidden; text-overflow: ellipsis;
}
.card-alias-input:focus { border-bottom-color: var(--accent); }

.btn-sync-card {
  opacity: 0.6; padding: 6px; border-radius: 50%; background: var(--surface2);
}
.btn-sync-card:hover {
  opacity: 1; transform: rotate(45deg); background: var(--surface3); color: var(--accent);
}
.btn-sync-card svg { width: 14px; height: 14px; }

.price-input-wrapper {
  width: 100%;
  display: flex;
}
.card-client-meta { font-size: 0.75rem; color: var(--text-muted); }

.inline-edit-input {
  background: transparent; border: none; color: var(--text-primary); border-bottom: 1px solid transparent;
  padding: 0; margin-left: 4px; outline: none; transition: all 0.2s; font-family: inherit; font-size: inherit;
  width: auto; min-width: 100px;
}
.inline-edit-input:focus { border-bottom-color: var(--accent); background: var(--surface3); }

.progress-section { margin-bottom: 12px; }
.progress-track { height: 8px; background: rgba(0,0,0,0.2); border-radius: 4px; overflow: hidden; }
.progress-bar { 
  height: 100%; border-radius: 4px; 
  transition: width 0.8s cubic-bezier(0.1, 0.7, 0.1, 1);
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  position: relative;
}

.progress-bar.bar-ok { 
  background: linear-gradient(90deg, #238636, var(--green)) !important;
  box-shadow: 0 0 10px rgba(63, 185, 80, 0.2);
}
.progress-bar.bar-warning { 
  background: linear-gradient(90deg, #9e6a03, var(--yellow)) !important;
  box-shadow: 0 0 10px rgba(227, 179, 65, 0.2);
}
.progress-bar.bar-danger { 
  background: linear-gradient(90deg, #b91c1c, var(--red)) !important;
  box-shadow: 0 0 10px rgba(248, 81, 73, 0.3);
  animation: glow-bar 1.5s ease-in-out infinite;
}

@keyframes glow-bar {
  0%, 100% { box-shadow: 0 0 8px rgba(248, 81, 73, 0.3); }
  50% { box-shadow: 0 0 16px rgba(248, 81, 73, 0.6); }
}

.card-expanded-content {
  display: none; margin-top: 12px; padding-top: 16px; border-top: 1px dashed var(--border);
  animation: fadeIn 0.3s ease;
}
.po-card.is-expanded .card-expanded-content { display: block; }

.card-data-wrapper {
  background: var(--surface3);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 16px;
}
.card-data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 0; }
.data-item { display: flex; flex-direction: column; gap: 2px; }
.data-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.data-value { font-size: 0.95rem; font-weight: 600; }

.card-notes-section {
  margin-top: 12px; padding: 14px 16px; background: var(--surface3);
  border: 1px solid var(--border-soft); border-radius: var(--r-md);
}
.notes-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; display: block; }
.notes-textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--text-primary);
  border-radius: var(--r-sm); padding: 8px 10px; font-size: 0.85rem; font-family: inherit; resize: vertical;
  min-height: 50px; outline: none; transition: border-color 0.2s;
}
.notes-textarea:focus { border-color: var(--accent); }

.card-extra-details {
  margin-top: 12px; padding: 14px 16px; background: var(--surface3);
  border: 1px solid var(--border-soft); border-radius: var(--r-md);
  font-size: 0.82rem; display: flex; flex-direction: column; gap: 8px;
}
.extra-item { color: var(--text-secondary); display: flex; flex-direction: column; gap: 3px; }
.extra-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Chevron indicator */
.card-chevron {
  width: 18px; height: 18px; color: var(--text-muted); transition: transform 0.3s ease;
  flex-shrink: 0;
}
.po-card.is-expanded .card-chevron { transform: rotate(180deg); }

/* Edit hint icon */
.edit-hint {
  display: inline-flex; color: var(--text-muted); opacity: 0.4; margin-left: 4px;
  transition: opacity 0.2s;
}
.extra-item:hover .edit-hint, .card-alias-row:hover .edit-hint { opacity: 0.8; }

.card-footer {
  margin-top: 16px; display: flex; justify-content: space-between; align-items: center;
}
.card-meta { font-size: 0.7rem; color: var(--text-muted); }
.card-actions { display: flex; gap: 8px; }

/* ── Modals ────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,0.7);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  width: 100%; max-width: 600px; max-height: 94vh; 
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal-header h2 { font-size: 1.25rem; font-weight: 700; }
.modal-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; display: flex; align-items: center; transition: color 0.2s; }
.modal-close:hover { color: var(--red); }
.modal-close svg { width: 20px; height: 20px; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: 12px; flex-shrink: 0; }
.modal-footer.bg-soft { background: var(--surface2); }

.modal-sm { max-width: 400px; }
.modal-sm .modal-header, 
.modal-sm .modal-body, 
.modal-sm .modal-footer { padding: 16px 20px; }

.danger-icon-large {
  color: var(--danger);
  background: var(--danger-dim);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}
.text-lg { font-size: 1.15rem; }

/* Source Selector in Modal */
.source-selector { display: flex; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px; margin-bottom: 24px; gap: 4px; }
.source-opt { 
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; 
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; border-radius: calc(var(--r-md) - 2px); transition: all 0.2s;
}
.source-opt svg { width: 16px; height: 16px; opacity: 0.7; }
.source-opt:hover { background: var(--surface3); color: var(--text-primary); }
.source-opt.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px var(--accent-dim); }
.source-opt.active svg { opacity: 1; }

.source-microsoft .manual-only-fields { display: none !important; }
.source-manual .manual-only-fields { display: block !important; }

.source-manual .ms-only-fields { display: none !important; }
.source-microsoft .ms-only-fields { display: block !important; }

.modal-hint { 
  display: flex; align-items: center; gap: 10px; padding: 12px; margin-bottom: 20px;
  background: var(--accent-dim); border: 1px solid rgba(88, 166, 255, 0.2); border-radius: var(--r-md);
  color: var(--accent); font-size: 0.85rem; line-height: 1.4;
}
.modal-hint svg { flex-shrink: 0; }

.combo-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.required { color: var(--red); margin-left: 2px; }

.form-row { display: flex; gap: 20px; margin-bottom: 20px; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.form-group input, .form-group select {
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px 14px; color: var(--text-primary); font-family: inherit; font-size: 0.9rem; outline: none;
}
.form-group input:focus { border-color: var(--accent); }

/* ── User Menu ────────────────────────────── */
.user-menu { position: relative; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--green));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; border: 2px solid var(--border);
  overflow: hidden; flex-shrink: 0; transition: all var(--t-fast);
}
.user-avatar:hover { border-color: var(--accent); transform: scale(1.05); }
.user-photo {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.user-avatar span { font-size: 0.8rem; font-weight: 700; color: #fff; }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); z-index: 100; padding: 8px 0;
}
.user-dropdown-info { padding: 12px 16px; display: flex; flex-direction: column; }
.user-dropdown-info strong { font-size: 0.9rem; color: var(--text-primary); }
.user-dropdown-info small { font-size: 0.75rem; color: var(--text-muted); }
.user-dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  color: var(--text-secondary); text-decoration: none; font-size: 0.85rem;
}
.user-dropdown-item:hover { background: var(--surface2); color: var(--text-primary); }


/* ── Utility ────────────────────────────────── */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Login Screen ────────────────────────────── */
.login-screen { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 48px 40px; text-align: center; max-width: 420px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-brand { margin-bottom: 32px; }
.login-brand h1 { font-size: 1.5rem; margin-bottom: 8px; }
.login-subtitle { font-size: 0.85rem; color: var(--text-muted); }
.btn-microsoft-login {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
  padding: 14px 24px; border-radius: var(--r-md); background: #fff; color: #1a1a1a;
  font-weight: 600; text-decoration: none; border: 1px solid #d1d5db; margin-bottom: 20px;
}
.btn-microsoft-login:hover { background: #f3f4f6; }

.login-dev-options { margin: 10px 0 20px 0; padding: 12px; background: var(--surface2); border-radius: var(--r-md); border: 1px solid var(--border); }
.dev-checkbox-container { display: block; cursor: pointer; }
.dev-checkbox-container input { position: absolute; opacity: 0; height: 0; width: 0; }
.dev-checkbox-inner { display: flex; align-items: center; gap: 12px; }
.dev-checkbox-check {
  width: 20px; height: 20px; background: var(--bg); border: 2px solid var(--border); border-radius: 4px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: 0.2s;
}
.dev-checkbox-check svg { width: 14px; height: 14px; color: #fff; transform: scale(0); transition: 0.2s; }
.dev-checkbox-container input:checked ~ .dev-checkbox-inner .dev-checkbox-check { background: var(--accent); border-color: var(--accent); }
.dev-checkbox-container input:checked ~ .dev-checkbox-inner .dev-checkbox-check svg { transform: scale(1); }
.dev-checkbox-label { display: flex; flex-direction: column; text-align: left; }
.dev-checkbox-label strong { font-size: 0.85rem; }
.dev-checkbox-label span { font-size: 0.75rem; color: var(--text-muted); }
.login-footer { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

/* ─── Vistas (Grid vs Compact vs Table) ────────────────────────────── */
.view-toggles { display: flex; background: var(--surface2); padding: 3px; border-radius: var(--r-md); border: 1px solid var(--border); gap: 2px; height: 40px; box-sizing: border-box; }
.view-btn { padding: 0 8px !important; color: var(--text-secondary); border-radius: calc(var(--r-md) - 2px) !important; height: 100%; }
.view-btn.active { background: var(--accent-dim) !important; color: var(--accent) !important; }

/* Table View Styles */
.group-grid.view-table { grid-template-columns: 1fr; gap: 12px; }
.view-table .po-card { display: flex; flex-wrap: wrap; flex-direction: row; align-items: center; padding: 16px 28px; gap: 32px; min-height: 80px; }
.view-table .card-header { flex: 0 0 320px; margin: 0; display: flex; align-items: center; gap: 16px; }
.view-table .po-number-badge { width: 170px; flex-shrink: 0; }
.view-table .card-badges { flex: 1; display: flex; align-items: center; }
.view-table .card-body-compact { flex: 0.5; margin: 0; min-width: 150px; }
.view-table .progress-section { flex: 1.5; margin: 0; min-width: 200px; }
.view-table .card-expanded-content { flex: 0 0 100%; border-top: 1px dashed var(--border); margin-top: 12px; padding-top: 24px; animation: slideDown 0.3s ease-out; }
.view-table .card-data-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; margin-bottom: 24px; }
.view-table .data-item { background: var(--surface3); padding: 14px 20px; border-radius: var(--r-md); border: 1px solid var(--border-soft); box-shadow: var(--shadow-sm); }
.view-table .card-extra-details { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; background: rgba(0,0,0,0.15); padding: 20px; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Compact View Styles */
.group-grid.view-compact { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.view-compact .po-card { padding: 12px; min-height: 0; }
.view-compact .card-meta { display: none !important; }
.view-compact .card-footer { margin-top: 8px; justify-content: flex-end; }

/* ── MSInvoice Session Setup ─────────────── */
.session-status {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: 0.85rem; margin-top: 8px;
}
.session-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.session-indicator.session-ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.session-indicator.session-warn { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.session-indicator.session-missing { background: var(--red); box-shadow: 0 0 8px var(--red); }

.setup-command-box {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md);
  margin-top: 6px; overflow-x: auto;
}
.setup-command-box code { font-family: monospace; font-size: 0.8rem; color: var(--accent); white-space: nowrap; flex: 1; }

/* ── SETTINGS MODAL SPECIFICS ── */
.settings-section { margin-bottom: 14px; }
.settings-section h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 8px; color: var(--accent); border-bottom: 1px solid var(--border-soft); padding-bottom: 6px; }
.setting-item { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.setting-item:last-child { border-bottom: none; }
.settings-hint { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 8px; }
.sync-hours-list { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.sync-hour-input { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 10px; color: var(--text-primary); font-family: monospace; font-size: 0.9rem; }

/* Settings Tabbed Layout */
.settings-layout { display: flex; gap: 0; padding: 0 !important; }
.settings-tabs {
  display: flex; flex-direction: column; gap: 2px; padding: 16px 8px;
  border-right: 1px solid var(--border-soft); background: var(--surface2);
  min-width: 120px; border-radius: 0 0 0 var(--r-lg);
  overflow-y: auto;
}
.settings-tab {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: transparent; border: none; border-radius: var(--r-sm);
  color: var(--text-muted); font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: all var(--t-fast); text-align: left;
  font-family: inherit; white-space: nowrap;
}
.settings-tab:hover { background: var(--surface3); color: var(--text-primary); }
.settings-tab.active {
  background: var(--accent-dim); color: var(--accent); font-weight: 600;
}
.settings-tab svg { flex-shrink: 0; }
.settings-panels { flex: 1; padding: 16px 24px; min-height: 280px; overflow-y: auto; }
.settings-tab-panel { display: none; animation: fadeIn 0.2s ease; }
.settings-tab-panel.active { display: block; }

#settingsModal .modal { max-width: 680px; }

/* Alerts tab: stack radio options vertically and give form fields room */
.setting-item.flex-col { flex-direction: column; align-items: flex-start; }
.setting-item.flex-col .radio-label { display: flex; align-items: flex-start; gap: 6px; font-size: 0.85rem; }
.setting-item.flex-col .radio-label input[type="radio"] { margin-top: 3px; flex-shrink: 0; }
#daysThresholdSettings .form-row { display: flex; flex-direction: column; gap: 14px; }
#daysThresholdSettings .form-group { width: 100%; }
#daysThresholdSettings .input-with-label { display: flex; align-items: center; gap: 8px; }
#daysThresholdSettings .input-with-label input { max-width: 120px; }

/* Import styles */
.import-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: 16px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-base);
  background: var(--surface);
  color: var(--text-muted);
}
.import-dropzone:hover, .import-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: inset 0 0 10px var(--accent-dim);
}
.import-dropzone.dragover svg {
  transform: translateY(-3px);
  opacity: 1;
}
.import-dropzone svg {
  width: 24px; height: 24px; margin-bottom: 6px; opacity: 0.6;
  transition: transform 0.3s ease;
}
.import-drop-content {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.import-dropzone.has-file {
  border-color: var(--success);
  background: var(--success-dim);
  color: var(--success);
}
.import-dropzone.has-file svg {
  color: var(--success); opacity: 1;
}
.import-drop-content p {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hidden-file-input { display: none; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.p-16 { padding: 16px; }
.import-dropzone #importDropText {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 20px;
}
.import-client-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
}
.import-client-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 4px;
}
.import-client-item:hover {
  background: var(--surface2);
}
.import-client-item input {
  margin: 0;
}


/* ── VERSION BADGE ── */
.version-badge-bottom {
  position: fixed;
  bottom: 15px;
  left: 15px;
  font-family: monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(225, 29, 72, 0.9);
  padding: 4px 10px;
  border-radius: 4px;
  z-index: 9999;
  pointer-events: none;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  display: block;
}

/* ── HEADER STABILITY ── */
.header-brand h1, .brand-sub { white-space: nowrap !important; }
.header-brand { flex-shrink: 0 !important; }
.btn-sync-all { width: 170px !important; justify-content: center; }

/* ── TOAST MESSAGES (Estilo ESTABLE Mejorado) ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 40000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 0.83rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
  animation: toast-in 0.3s ease both;
  max-width: 340px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-width: 1.5px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.toast.toast-success {
  background: rgba(45, 164, 78, 0.15);
  border-color: rgba(63, 185, 80, 0.5);
  box-shadow: 0 8px 32px rgba(63, 185, 80, 0.15);
}

.toast.toast-error {
  background: rgba(248, 81, 73, 0.15);
  border-color: rgba(248, 81, 73, 0.5);
  box-shadow: 0 8px 32px rgba(248, 81, 73, 0.15);
}

.toast.toast-info {
  background: rgba(88, 166, 255, 0.15);
  border-color: rgba(88, 166, 255, 0.5);
  box-shadow: 0 8px 32px rgba(88, 166, 255, 0.15);
}

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Danger Zone */
.danger-zone {
  border: 1.5px solid rgba(248, 81, 73, 0.35);
  border-radius: var(--r-md);
  padding: 14px 16px;
  background: var(--red-dim);
  margin-top: 12px;
}
.danger-zone h4 {
  color: var(--red);
  margin: 0 0 4px 0;
  font-size: 0.9rem;
  font-weight: 700;
}
.danger-zone .settings-hint {
  color: var(--red);
  opacity: 0.75;
  margin-bottom: 6px;
}
.danger-zone .setting-item {
  border: none;
  padding: 6px 0 0 0;
  margin-top: 4px;
  border-top: 1px solid rgba(248, 81, 73, 0.15);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.3);
  font-weight: 600;
}
.btn-danger-ghost:hover {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 12px rgba(248, 81, 73, 0.4);
}
.debug-img-container {
  margin: 15px 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #000;
}
.debug-img-container img {
  width: 100%;
  display: block;
}
 
/* ── About Section ─────────────────────────── */
.about-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface2);
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-soft);
}
.about-brand h2 { font-size: 1.5rem; letter-spacing: -0.02em; font-weight: 800; }
.about-description { font-size: 0.9rem; line-height: 1.6; color: var(--text-secondary); }
 
.version-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 12px;
}
.version-item {
  position: relative;
  padding-left: 24px;
  padding-bottom: 16px;
  border-left: 2px solid var(--border);
}
.version-item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}
.version-item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--surface);
  transition: all 0.3s ease;
}
.version-item.is-current::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.version-dot-wrapper {
  display: flex;
  flex-direction: column;
}
.version-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
  font-family: monospace;
}
.version-desc {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-top: 2px;
  font-weight: 500;
}
.version-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
 
.my-16 { margin-top: 16px; margin-bottom: 16px; }
.mt-12 { margin-top: 12px; }
.mt-24 { margin-top: 24px; }
.m-0 { margin: 0; }
.justify-center { justify-content: center; }
 
/* ── Archive System ─────────────────────────── */
.archive-overlay {
  position: fixed; inset: 0; z-index: 600; background: rgba(0,0,0,0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px); display: none; transition: opacity 0.3s ease;
}
.archive-overlay.open { display: block; }

.archive-panel {
  position: fixed; top: 0; right: -500px; bottom: 0; width: 480px; max-width: 90vw;
  background: var(--surface); border-left: 1px solid var(--border); z-index: 601;
  box-shadow: -10px 0 30px rgba(0,0,0,0.4); display: flex; flex-direction: column;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.archive-panel.open { right: 0; }

.archive-header {
  padding: 24px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.archive-header h2 { font-size: 1.25rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.archive-header h2 svg { color: var(--text-muted); }
 
.archive-search-wrapper {
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}
.archive-search-wrapper .search-box {
  width: 100%;
}
 
.archive-body {
  flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px;
}

.archive-empty {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.archive-empty svg { width: 48px; height: 48px; margin-bottom: 20px; opacity: 0.3; }

.archived-card {
  background: var(--surface2); border: 1px solid var(--border-soft); border-radius: var(--r-md);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: all 0.2s;
}
.archived-card:hover { border-color: var(--border); background: var(--surface3); }

.archived-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.archived-title { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.archived-meta { font-size: 0.75rem; color: var(--text-muted); text-align: right; }

.archived-actions { display: flex; gap: 8px; margin-top: 4px; border-top: 1px solid var(--border-soft); padding-top: 10px; }

/* Cancel individual sync styles */
.btn-sync-card.is-syncing:hover {
  background: var(--red-dim) !important;
  color: var(--red) !important;
  transform: rotate(90deg);
}

/* ── Mobile Optimization & Cockpit ────────── */
@media (max-width: 768px) {
  .header-actions {
    display: none !important; /* Move to cockpit on mobile */
  }
  .view-toggles {
    display: none !important;
  }
  .user-menu {
    margin-left: auto;
  }
  .stats-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 12px;
    gap: 8px;
  }
  .stat-sep { display: none; }
  .stat-item {
    padding: 12px 8px;
    background: var(--surface2);
    border: 1px solid var(--border-soft);
  }
  
  .po-card {
    padding: 16px;
  }
  .card-alias-input {
    font-size: 1.05rem;
  }
  .card-data-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .search-box {
    width: 100% !important;
  }
  .client-logo-wrapper {
    width: 36px;
    height: 36px;
  }
  .group-title {
    font-size: 1.15rem;
  }
}

/* ── Mobile Control Bar (Cockpit) ─────────── */
.mobile-cockpit {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--cockpit-h) + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.2);
  z-index: 400;
  padding-bottom: var(--safe-bottom);
  align-items: center;
  justify-content: space-around;
  padding-left: 12px;
  padding-right: 12px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.light-theme .mobile-cockpit {
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
  background: rgba(255, 255, 255, 0.9);
}

@media (max-width: 768px) {
  .mobile-cockpit {
    display: flex;
  }
  
  /* Settings Mobile Fix */
  .settings-layout {
    flex-direction: column !important;
  }
  .settings-tabs {
    flex-direction: row !important;
    width: 100% !important;
    overflow-x: auto;
    border-right: none !important;
    border-bottom: 1px solid var(--border-soft);
    padding: 8px !important;
    gap: 8px;
    flex-shrink: 0;
  }
  .settings-tab {
    flex-direction: column;
    gap: 4px;
    padding: 8px !important;
    height: auto !important;
    font-size: 0.65rem !important;
    min-width: 80px;
    justify-content: center;
  }
  .settings-tab svg {
    width: 20px !important;
    height: 20px !important;
  }
  .settings-panels {
    padding: 16px !important;
  }
  .settings-section h3 {
    font-size: 1rem;
  }
}

.cockpit-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--t-fast);
  width: auto;
  min-width: 60px;
  padding: 8px 4px;
}

.cockpit-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s;
  color: var(--text-primary);
}

.cockpit-btn span {
  font-style: normal;
}

.cockpit-btn:active svg {
  transform: scale(0.9);
}

.cockpit-btn-main {
  width: 56px;
  height: 56px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--accent-dim);
  border: none;
  transform: translateY(-20px);
  transition: all var(--t-base);
  z-index: 401;
}

.cockpit-btn-main:active {
  transform: translateY(-16px) scale(0.95);
}

.cockpit-btn-main svg {
  width: 28px;
  height: 28px;
  color: #fff;
}
