/**
 * WID LegacyGuard - Responsive Stylesheet
 * Version: 4.0.5
 * 
 * Mobile-first responsive design with CSS custom properties for theming.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES (Theme Variables)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Colors - can be overridden by config.js */
  --wid-primary: #1d4ed8;
  --wid-primary-hover: #1e40af;
  --wid-accent: #3b82f6;
  --wid-danger: #b91c1c;
  --wid-danger-hover: #991b1b;
  --wid-success: #22c55e;
  --wid-warning: #f59e0b;
  --wid-background: #0b1220;
  --wid-surface: #020617;
  --wid-border: #111827;
  --wid-border-light: #334155;
  --wid-text: #f9fafb;
  --wid-text-muted: #9ca3af;
  --wid-text-subtle: #6b7280;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;

  /* Z-index scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 900;
  --z-modal: 1000;
  --z-toast: 1100;

  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;

  /* Touch target minimum */
  --touch-target: 44px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--wid-background);
  color: var(--wid-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
}

/* Prevent horizontal scroll */
html, body {
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--wid-text);
}

h1 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-md);
}

h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-sm);
}

h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-sm);
}

h4 {
  font-size: var(--text-base);
  margin-bottom: var(--space-xs);
}

p {
  margin-bottom: var(--space-md);
}

a {
  color: var(--wid-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--wid-primary);
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--wid-surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--wid-border);
}

.muted {
  color: var(--wid-text-muted);
  font-size: var(--text-sm);
}

.subtle {
  color: var(--wid-text-subtle);
  font-size: var(--text-xs);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.font-mono { font-family: var(--font-mono); }

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.wrap {
  width: 100%;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: var(--space-md);
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.header h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
}

.header-logo {
  height: 36px;
  width: auto;
}

/* Grid system */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Responsive grid - mobile first */
@media (max-width: 640px) {
  .grid, .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Flex row */
.row {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  align-items: center;
}

.row > * {
  flex: 1;
  min-width: 200px;
}

@media (max-width: 480px) {
  .row > * {
    min-width: 100%;
  }
}

/* Row variants */
.row-tight { gap: var(--space-sm); }
.row-loose { gap: var(--space-xl); }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.row-center { justify-content: center; }
.row-nowrap { flex-wrap: nowrap; }

/* Stack (vertical flex) */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.stack-tight { gap: var(--space-sm); }
.stack-loose { gap: var(--space-xl); }

/* Spacers */
.spacer-sm { height: var(--space-sm); }
.spacer-md { height: var(--space-md); }
.spacer-lg { height: var(--space-lg); }
.spacer-xl { height: var(--space-xl); }

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--wid-surface);
  border: 1px solid var(--wid-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.card-sm {
  padding: var(--space-md);
}

.card-lg {
  padding: var(--space-xl);
}

.card-flat {
  background: transparent;
  border: none;
  padding: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.card-header h2,
.card-header h3 {
  margin: 0;
}

.card-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--wid-border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */

label {
  display: block;
  font-size: var(--text-sm);
  color: var(--wid-text-muted);
  margin-bottom: var(--space-xs);
}

input, select, textarea {
  width: 100%;
  padding: var(--space-md);
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--wid-text);
  background: var(--wid-surface);
  border: 1px solid var(--wid-border-light);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: var(--touch-target);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--wid-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.2);
}

input::placeholder, textarea::placeholder {
  color: var(--wid-text-subtle);
}

input:disabled, select:disabled, textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* Input with icon */
.input-group {
  position: relative;
}

.input-group input {
  padding-left: 40px;
}

.input-group .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wid-text-subtle);
}

/* Field wrapper */
.field {
  margin-bottom: var(--space-md);
}

.field:last-child {
  margin-bottom: 0;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.field-inline input {
  flex: 1;
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: auto;
  margin-right: var(--space-sm);
}

/* Number input - prevent spinners on mobile causing issues */
input[type="number"] {
  -moz-appearance: textfield;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-base);
  font-family: inherit;
  font-weight: 500;
  color: #fff;
  background: var(--wid-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  min-height: var(--touch-target);
  text-decoration: none;
}

button:hover, .btn:hover {
  background: var(--wid-primary-hover);
}

button:active, .btn:active {
  transform: scale(0.98);
}

button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Button variants */
.secondary, button.secondary {
  background: var(--wid-border);
  border: 1px solid var(--wid-border-light);
  color: var(--wid-text);
}

.secondary:hover, button.secondary:hover {
  background: var(--wid-border-light);
}

.danger, button.danger {
  background: var(--wid-danger);
}

.danger:hover, button.danger:hover {
  background: var(--wid-danger-hover);
}

.success, button.success {
  background: var(--wid-success);
}

.warning, button.warning {
  background: var(--wid-warning);
  color: #000;
}

.ghost, button.ghost {
  background: transparent;
  color: var(--wid-text);
}

.ghost:hover, button.ghost:hover {
  background: var(--wid-border);
}

/* Button sizes */
.small, button.small {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  min-height: 36px;
}

.large, button.large {
  padding: var(--space-lg) var(--space-xl);
  font-size: var(--text-lg);
  min-height: 52px;
}

/* Button group */
.btn-group {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .btn-group {
    flex-direction: column;
  }
  
  .btn-group button,
  .btn-group .btn {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LISTS
   ═══════════════════════════════════════════════════════════════════════════ */

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--wid-surface);
  border: 1px solid var(--wid-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-fast);
}

.list li:hover {
  border-color: var(--wid-border-light);
}

.list li.selected {
  border-color: var(--wid-primary);
  background: rgba(29, 78, 216, 0.15);
}

.list li:last-child {
  margin-bottom: 0;
}

/* Scrollable list */
.list-scroll {
  max-height: 400px;
  overflow-y: auto;
  padding-right: var(--space-sm);
}

/* Custom scrollbar */
.list-scroll::-webkit-scrollbar {
  width: 6px;
}

.list-scroll::-webkit-scrollbar-track {
  background: var(--wid-border);
  border-radius: 3px;
}

.list-scroll::-webkit-scrollbar-thumb {
  background: var(--wid-border-light);
  border-radius: 3px;
}

/* List item content */
.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .list li {
    flex-direction: column;
    align-items: stretch;
  }
  
  .list-item-actions {
    justify-content: flex-end;
    margin-top: var(--space-sm);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BANNERS & ALERTS
   ═══════════════════════════════════════════════════════════════════════════ */

.banner {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--wid-border-light);
  background: var(--wid-surface);
  margin: var(--space-sm) 0;
  color: var(--wid-text);
}

.banner.ok, .banner.success {
  border-color: var(--wid-success);
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.banner.warn, .banner.warning {
  border-color: var(--wid-warning);
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.banner.danger, .banner.error {
  border-color: var(--wid-danger);
  background: rgba(185, 28, 28, 0.15);
  color: #f87171;
}

.banner.info {
  border-color: var(--wid-accent);
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES & PILLS
   ═══════════════════════════════════════════════════════════════════════════ */

.pill, .badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--wid-border);
  border: 1px solid var(--wid-border-light);
  color: var(--wid-text-muted);
}

.badge-success {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--wid-success);
  color: var(--wid-success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--wid-warning);
  color: var(--wid-warning);
}

.badge-danger {
  background: rgba(185, 28, 28, 0.2);
  border-color: var(--wid-danger);
  color: var(--wid-danger);
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--wid-accent);
  color: var(--wid-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════ */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  z-index: var(--z-modal);
}

.modal.hidden {
  display: none !important;
}

.modal .backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
}

.modal .modal-card {
  position: relative;
  width: 100%;
  max-width: var(--container-md);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  z-index: var(--z-modal);
  animation: modal-enter 0.2s ease-out;
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-header h2 {
  margin: 0;
}

.modal-close {
  padding: var(--space-sm);
  background: transparent;
  border: none;
  color: var(--wid-text-muted);
  cursor: pointer;
  min-height: auto;
}

.modal-close:hover {
  color: var(--wid-text);
  background: transparent;
}

.modal-footer {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .modal-footer {
    flex-direction: column-reverse;
  }
  
  .modal-footer button {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 1px solid var(--wid-border);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--wid-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  min-height: var(--touch-target);
}

.tab:hover {
  color: var(--wid-text);
}

.tab.active {
  color: var(--wid-primary);
  border-bottom-color: var(--wid-primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS & STATUS
   ═══════════════════════════════════════════════════════════════════════════ */

.progress {
  height: 8px;
  background: var(--wid-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--wid-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

.progress-bar.success { background: var(--wid-success); }
.progress-bar.warning { background: var(--wid-warning); }
.progress-bar.danger { background: var(--wid-danger); }

/* Status indicator */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wid-text-muted);
}

.status-dot.active { background: var(--wid-success); }
.status-dot.warning { background: var(--wid-warning); }
.status-dot.danger { background: var(--wid-danger); }
.status-dot.pending { 
  background: var(--wid-warning);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHECKLIST
   ═══════════════════════════════════════════════════════════════════════════ */

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--wid-border);
}

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

.checklist-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--wid-border);
  color: var(--wid-text-muted);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.checklist-item.complete .checklist-icon {
  background: var(--wid-success);
  color: #fff;
}

.checklist-item.incomplete .checklist-icon {
  background: var(--wid-border);
}

.checklist-content {
  flex: 1;
}

.checklist-title {
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.checklist-desc {
  font-size: var(--text-sm);
  color: var(--wid-text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DIVIDERS
   ═══════════════════════════════════════════════════════════════════════════ */

hr {
  border: none;
  border-top: 1px solid var(--wid-border);
  margin: var(--space-lg) 0;
}

hr.thin {
  margin: var(--space-md) 0;
}

hr.thick {
  border-top-width: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */

.hidden { display: none !important; }
.invisible { visibility: hidden; }

.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-w-0 { min-width: 0; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.relative { position: relative; }
.absolute { position: absolute; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.border { border: 1px solid var(--wid-border); }
.border-t { border-top: 1px solid var(--wid-border); }
.border-b { border-bottom: 1px solid var(--wid-border); }

.p-0 { padding: 0; }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

.m-0 { margin: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.break-words {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Hide on mobile */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
}

/* Hide on tablet and up */
@media (min-width: 641px) {
  .hide-desktop { display: none !important; }
}

/* Show only on mobile */
.show-mobile {
  display: none !important;
}

@media (max-width: 640px) {
  .show-mobile { display: block !important; }
  .show-mobile.flex { display: flex !important; }
  .show-mobile.inline-flex { display: inline-flex !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
  body {
    background: #fff;
    color: #000;
  }
  
  .card {
    background: #fff;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
  
  button, .btn, .no-print {
    display: none !important;
  }
  
  a {
    color: #000;
    text-decoration: underline;
  }
  
  .banner {
    border: 1px solid #999;
    background: #f5f5f5;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   VIEWS (Page Sections)
   ═══════════════════════════════════════════════════════════════════════════ */

.view {
  animation: view-enter 0.2s ease-out;
}

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

.view.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPECIAL COMPONENTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* QR Code container */
.qr-container {
  display: inline-block;
  padding: var(--space-md);
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px dashed var(--wid-border-light);
}

.qr-container svg {
  display: block;
}

/* Video container (for QR scanner) */
.video-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--wid-text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 500;
  margin-bottom: var(--space-sm);
  color: var(--wid-text);
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--wid-border);
  border-top-color: var(--wid-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-xl);
  color: var(--wid-text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DISCOVERY KIT COMPONENTS
   ═══════════════════════════════════════════════════════════════════════════ */

.discovery-card {
  border: 2px dashed var(--wid-border-light);
  background: transparent;
}

.discovery-card.complete {
  border-color: var(--wid-success);
  border-style: solid;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALIVE CHECK COMPONENTS
   ═══════════════════════════════════════════════════════════════════════════ */

.alive-status {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  background: var(--wid-surface);
  border: 1px solid var(--wid-border);
}

.alive-status.ok {
  border-color: var(--wid-success);
}

.alive-status.pending {
  border-color: var(--wid-warning);
}

.alive-status.escalate {
  border-color: var(--wid-danger);
}

.alive-countdown {
  font-size: var(--text-2xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════════
   VAULT SELECTOR
   ═══════════════════════════════════════════════════════════════════════════ */

.vault-selector {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--wid-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.vault-selector select {
  flex: 1;
  margin: 0;
  min-height: 36px;
}

.vault-selector button {
  min-height: 36px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LICENSE BADGE
   ═══════════════════════════════════════════════════════════════════════════ */

.license-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-sm);
  background: var(--wid-border);
  color: var(--wid-text-muted);
}

.license-badge.personal {
  background: rgba(59, 130, 246, 0.2);
  color: var(--wid-accent);
}

.license-badge.family {
  background: rgba(34, 197, 94, 0.2);
  color: var(--wid-success);
}

.license-badge.professional {
  background: rgba(245, 158, 11, 0.2);
  color: var(--wid-warning);
}

.license-badge.enterprise {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPLASH SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */

.splash-screen {
  position: fixed;
  inset: 0;
  background: var(--wid-background);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  animation: splashFadeIn 0.8s ease-out;
}

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

.splash-lock-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 2rem;
}

.splash-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(29, 78, 216, 0.3);
  border-color: var(--wid-primary);
  opacity: 0.3;
  animation: splashPulse 2s ease-in-out infinite;
}

.splash-ring:nth-child(2) {
  inset: -10px;
  animation-delay: 0.5s;
  opacity: 0.2;
}

.splash-ring:nth-child(3) {
  inset: -20px;
  animation-delay: 1s;
  opacity: 0.1;
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.05); opacity: 0.5; }
}

.splash-shield {
  position: absolute;
  inset: 10px;
  background: linear-gradient(135deg, var(--wid-primary) 0%, var(--wid-primary-hover) 100%);
  border-radius: 50%;
  box-shadow: 
    0 0 30px rgba(29, 78, 216, 0.4),
    0 0 60px rgba(29, 78, 216, 0.2),
    inset 0 2px 10px rgba(255, 255, 255, 0.1);
}

.splash-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  animation: splashBounce 2s ease-in-out infinite;
}

@keyframes splashBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.splash-brand {
  margin-bottom: 0.5rem;
}

.splash-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-tagline {
  font-size: 1rem;
  color: var(--wid-text-muted);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.splash-loader {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.splash-loader-bar {
  width: 200px;
  height: 3px;
  background: var(--wid-border);
  border-radius: 3px;
  overflow: hidden;
}

.splash-loader-progress {
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, var(--wid-primary), var(--wid-accent), var(--wid-primary));
  background-size: 200% 100%;
  border-radius: 3px;
  animation: splashLoading 1.5s ease-in-out infinite;
}

@keyframes splashLoading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.splash-loader-text {
  font-size: 0.75rem;
  color: var(--wid-text-subtle);
  letter-spacing: 0.05em;
}

.splash-footer {
  position: absolute;
  bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--wid-text-subtle);
}

#splashCompany {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--wid-border-light);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  left: 1rem;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  pointer-events: none;
}

@media (min-width: 640px) {
  .toast-container {
    left: auto;
    width: 400px;
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--wid-surface);
  border: 1px solid var(--wid-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease-out;
  pointer-events: auto;
  max-width: 100%;
}

.toast.removing {
  animation: toastSlideOut 0.3s ease-in forwards;
}

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

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

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.875rem;
  color: var(--wid-text-muted);
}

.toast-close {
  background: none;
  border: none;
  color: var(--wid-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--wid-text);
}

.toast.success {
  border-color: var(--wid-success);
}

.toast.success .toast-icon {
  color: var(--wid-success);
}

.toast.error {
  border-color: var(--wid-danger);
}

.toast.error .toast-icon {
  color: var(--wid-danger);
}

.toast.warning {
  border-color: var(--wid-warning);
}

.toast.warning .toast-icon {
  color: var(--wid-warning);
}

.toast.info {
  border-color: var(--wid-accent);
}

.toast.info .toast-icon {
  color: var(--wid-accent);
}
