/* OIS Design System - Global CSS
   Comprehensive design system for the OIS Component Library
   Following "Functional Elegance" design language with glassmorphism UI
   
   This file contains shared patterns identified across 200+ components
   to reduce duplication and ensure consistency.
*/

/* ==========================================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ========================================================================== */

:root {
  /* Brand Colors */
  --ois-primary-blue: #3498db;
  --ois-primary-blue-rgb: 52, 152, 219;
  --ois-task-green: #41b090;
  --ois-task-green-rgb: 65, 176, 144;
  --ois-secondary-green: #2ecc71;
  --ois-secondary-green-rgb: 46, 204, 113;
  --ois-secondary-green-dark: #27ae60;
  --ois-reproductive-pink: #db7093;
  --ois-reproductive-pink-rgb: 219, 112, 147;
  --ois-status-amber: #ff9800;
  --ois-status-amber-rgb: 255, 152, 0;
  --ois-warning-orange: #f39c12;
  --ois-warning-orange-alt: #e67e22;
  --ois-danger-red: #e74c3c;
  --ois-danger-red-alt: #c0392b;
  
  /* Semantic Colors */
  --ois-success: #48c78e;
  --ois-success-rgb: 72, 199, 142;
  --ois-danger: #f14668;
  --ois-danger-rgb: 241, 70, 104;
  --ois-warning: #ffdd57;
  --ois-warning-rgb: 255, 221, 87;
  --ois-info: #3e8ed0;
  --ois-info-rgb: 62, 142, 208;
  --ois-light: #f5f5f5;
  --ois-light-rgb: 245, 245, 245;
  
  /* Alternative Semantic Colors */
  --ois-danger-alt: #ff3860;
  --ois-danger-alt-rgb: 255, 56, 96;
  --ois-info-alt: #3e8ed0;
  --ois-info-alt-rgb: 62, 142, 208;
  
  /* Text Colors */
  --ois-text-primary: #2c3e50;
  --ois-text-secondary: #7f8c8d;
  --ois-text-white: #ffffff;
  --ois-text-white-rgb: 255, 255, 255;
  
  /* Background Colors */
  --ois-bg-dark: #22201f;
  --ois-bg-dark-rgb: 34, 32, 31;
  --ois-bg-light: #ffffff;
  --ois-bg-light-rgb: 255, 255, 255;
  --ois-bg-glass-light: rgba(255, 255, 255, 0.95);
  --ois-bg-glass-dark: rgba(34, 32, 31, 0.85);
  --ois-bg-glass-overlay: rgba(255, 255, 255, 0.1);
  --ois-bg-glass-subtle: rgba(34, 32, 31, 0.8);
  
  /* Border Radius Scale */
  --ois-radius-xs: 4px;
  --ois-radius-sm: 6px;
  --ois-radius-md: 8px;
  --ois-radius-lg: 12px;
  --ois-radius-xl: 20px;
  --ois-radius-pill: 50px;
  --ois-radius-circle: 50%;
  
  /* Shadow System */
  --ois-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --ois-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --ois-shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.08);
  --ois-shadow-xl: 0 8px 25px rgba(0, 0, 0, 0.15);
  --ois-shadow-interactive: 0 4px 8px rgba(0, 0, 0, 0.3);
  --ois-shadow-glass: 0 8px 25px rgba(0, 0, 0, 0.2), 0 0 1px rgba(255, 255, 255, 0.1);
  --ois-shadow-glass-elevated: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.2);
  
  /* Transitions */
  --ois-transition-fast: all 0.2s ease;
  --ois-transition-standard: all 0.3s ease;
  --ois-transition-slow: all 0.5s ease;
  --ois-transition-background: background 0.2s ease;
  --ois-transition-transform: transform 0.2s ease;
  --ois-transition-material: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  
  /* Typography Scale */
  --ois-text-xs: 0.65rem;
  --ois-text-sm: 0.75rem;
  --ois-text-base: 1rem;
  --ois-text-lg: 1.125rem;
  --ois-text-xl: 1.25rem;
  --ois-text-2xl: 1.5rem;
  
  /* Font Weights */
  --ois-font-normal: 400;
  --ois-font-medium: 500;
  --ois-font-semibold: 600;
  --ois-font-bold: 700;
  
  /* Z-Index Scale */
  --ois-z-dropdown: 100;
  --ois-z-overlay: 998;
  --ois-z-fab: 999;
  --ois-z-dropdown-high: 1000;
  --ois-z-modal: 10000;
  --ois-z-critical: 99999;
  
  /* Spacing Scale */
  --ois-space-xs: 0.25rem;
  --ois-space-sm: 0.5rem;
  --ois-space-md: 1rem;
  --ois-space-lg: 1.5rem;
  --ois-space-xl: 2rem;
  --ois-space-2xl: 3rem;
  
  /* Glassmorphism Effects */
  --ois-glass-blur: blur(8px);
  --ois-glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --ois-glass-border-strong: 1px solid rgba(255, 255, 255, 0.2);
}

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

@keyframes ois-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes ois-slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ois-slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes ois-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Animation Classes */
.ois-animate-fadeIn {
  animation: ois-fadeIn 0.3s ease;
}

.ois-animate-slideDown {
  animation: ois-slideDown 0.2s ease-out;
}

.ois-animate-slideUp {
  animation: ois-slideUp 0.2s ease-out;
}

.ois-animate-spin {
  animation: ois-spin 1s linear infinite;
}

.ois-animate-pulse {
  animation: ois-pulse 2s infinite;
}

.ois-animate-bounce {
  animation: ois-bounce 0.5s ease-in-out;
}

/* Flexbox Utilities */
.ois-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ois-flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ois-flex-start {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.ois-flex-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.ois-flex-column {
  display: flex;
  flex-direction: column;
}

.ois-flex-column-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Grid Utilities */
.ois-grid-auto-fit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--ois-space-lg);
}

.ois-grid-auto-fill {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--ois-space-md);
}

/* Glassmorphism Utilities */
.ois-glass-light {
  background-color: var(--ois-bg-glass-light);
  backdrop-filter: var(--ois-glass-blur);
  -webkit-backdrop-filter: var(--ois-glass-blur);
}

.ois-glass-dark {
  background-color: var(--ois-bg-glass-dark);
  backdrop-filter: var(--ois-glass-blur);
  -webkit-backdrop-filter: var(--ois-glass-blur);
}

.ois-glass-overlay {
  background-color: var(--ois-bg-glass-overlay);
  backdrop-filter: var(--ois-glass-blur);
  -webkit-backdrop-filter: var(--ois-glass-blur);
}

/* ==========================================================================
   SEMANTIC COLOR CLASSES
   ========================================================================== */

/* Status Colors - Tag Style */
.ois-status-success {
  background-color: rgba(var(--ois-success-rgb), 0.2);
  color: var(--ois-success);
  border: 1px solid rgba(var(--ois-success-rgb), 0.4);
}

.ois-status-danger {
  background-color: rgba(var(--ois-danger-rgb), 0.2);
  color: var(--ois-danger);
  border: 1px solid rgba(var(--ois-danger-rgb), 0.4);
}

.ois-status-warning {
  background-color: rgba(var(--ois-warning-rgb), 0.2);
  color: var(--ois-warning);
  border: 1px solid rgba(var(--ois-warning-rgb), 0.4);
}

.ois-status-info {
  background-color: rgba(var(--ois-info-rgb), 0.2);
  color: var(--ois-info);
  border: 1px solid rgba(var(--ois-info-rgb), 0.4);
}

.ois-status-light {
  background-color: rgba(96, 96, 96, 0.2);
  color: light-dark(#606060, #b6b3ab);
  border: 1px solid rgba(96, 96, 96, 0.4);
}

/* Status Colors - Button Style */
.ois-button-success {
  background-color: rgba(var(--ois-success-rgb), 0.7);
  border-color: rgba(var(--ois-success-rgb), 0.8);
  color: var(--ois-text-white);
}

.ois-button-danger {
  background-color: rgba(var(--ois-danger-alt-rgb), 0.7);
  border-color: rgba(var(--ois-danger-alt-rgb), 0.8);
  color: var(--ois-text-white);
}

.ois-button-warning {
  background-color: rgba(var(--ois-warning-rgb), 0.7);
  border-color: rgba(var(--ois-warning-rgb), 0.8);
  color: var(--ois-text-white);
}

.ois-button-info {
  background-color: rgba(var(--ois-info-rgb), 0.7);
  border-color: rgba(var(--ois-info-rgb), 0.8);
  color: var(--ois-text-white);
}

.ois-button-light {
  background-color: rgba(96, 96, 96, 0.3);
  border-color: rgba(96, 96, 96, 0.5);
  color: var(--ois-text-white);
}

/* Domain-Specific Theme Colors */
.ois-theme-tasks {
  --theme-color: var(--ois-task-green);
  --theme-color-rgb: var(--ois-task-green-rgb);
  --theme-color-50: rgba(var(--ois-task-green-rgb), 0.5);
  --theme-color-60: rgba(var(--ois-task-green-rgb), 0.6);
  --theme-color-70: rgba(var(--ois-task-green-rgb), 0.7);
  --theme-color-80: rgba(var(--ois-task-green-rgb), 0.8);
  --theme-color-90: rgba(var(--ois-task-green-rgb), 0.9);
}

.ois-theme-data {
  --theme-color: var(--ois-primary-blue);
  --theme-color-rgb: var(--ois-primary-blue-rgb);
  --theme-color-50: rgba(var(--ois-primary-blue-rgb), 0.5);
  --theme-color-60: rgba(var(--ois-primary-blue-rgb), 0.6);
  --theme-color-70: rgba(var(--ois-primary-blue-rgb), 0.7);
  --theme-color-80: rgba(var(--ois-primary-blue-rgb), 0.8);
  --theme-color-90: rgba(var(--ois-primary-blue-rgb), 0.9);
}

.ois-theme-reproductive {
  --theme-color: var(--ois-reproductive-pink);
  --theme-color-rgb: var(--ois-reproductive-pink-rgb);
  --theme-color-50: rgba(var(--ois-reproductive-pink-rgb), 0.5);
  --theme-color-60: rgba(var(--ois-reproductive-pink-rgb), 0.6);
  --theme-color-70: rgba(var(--ois-reproductive-pink-rgb), 0.7);
  --theme-color-80: rgba(var(--ois-reproductive-pink-rgb), 0.8);
  --theme-color-90: rgba(var(--ois-reproductive-pink-rgb), 0.9);
}

.ois-theme-alerts {
  --theme-color: var(--ois-danger-alt);
  --theme-color-rgb: var(--ois-danger-alt-rgb);
  --theme-color-50: rgba(var(--ois-danger-alt-rgb), 0.5);
  --theme-color-60: rgba(var(--ois-danger-alt-rgb), 0.6);
  --theme-color-70: rgba(var(--ois-danger-alt-rgb), 0.7);
  --theme-color-80: rgba(var(--ois-danger-alt-rgb), 0.8);
  --theme-color-90: rgba(var(--ois-danger-alt-rgb), 0.9);
}

/* ==========================================================================
   COMPONENT BASE CLASSES
   ========================================================================== */

/* Smart Badge System */
.ois-smart-badge {
  position: relative;
  display: inline-block;
}

.ois-smart-badge-button {
  position: relative;
  padding: 0.5rem 2.25rem 0.5rem 1rem;
  border-radius: var(--ois-radius-xl);
  border: 1px solid var(--theme-color-60);
  background-color: var(--theme-color-50);
  color: var(--ois-text-white);
  font-weight: var(--ois-font-medium);
  transition: var(--ois-transition-fast);
  box-shadow: var(--ois-shadow-sm);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: var(--ois-text-sm);
  line-height: 1.2;
}

.ois-smart-badge-button:hover {
  background-color: var(--theme-color-70);
  transform: translateY(-2px);
  box-shadow: var(--ois-shadow-interactive);
}

.ois-smart-badge-button:active {
  transform: scale(0.98);
  transition: var(--ois-transition-material);
}

.ois-smart-badge-value {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  font-size: var(--ois-text-xs);
  font-weight: var(--ois-font-bold);
  color: var(--ois-text-white);
  background-color: var(--theme-color-90);
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 5px;
  box-shadow: var(--ois-shadow-sm);
}

/* Glassmorphism Dropdown */
.ois-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background-color: var(--ois-bg-glass-dark);
  backdrop-filter: var(--ois-glass-blur);
  -webkit-backdrop-filter: var(--ois-glass-blur);
  border-radius: var(--ois-radius-lg);
  box-shadow: var(--ois-shadow-glass-elevated);
  z-index: var(--ois-z-dropdown);
  overflow: hidden;
  color: var(--ois-text-white);
  border: var(--ois-glass-border);
  animation: ois-slideDown 0.2s ease-out;
}

.ois-dropdown-left {
  left: 0;
  right: auto;
}

.ois-dropdown-center {
  left: 50%;
  transform: translateX(-50%);
  right: auto;
}

.ois-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: var(--ois-glass-border);
  background-color: rgba(var(--ois-bg-dark-rgb), 0.9);
}

.ois-dropdown-title {
  font-weight: var(--ois-font-semibold);
  font-size: var(--ois-text-base);
  color: var(--ois-text-white);
}

.ois-dropdown-close {
  background-color: rgba(var(--ois-text-white-rgb), 0.1);
  border: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: var(--ois-radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--ois-transition-fast);
  color: var(--ois-text-white);
}

.ois-dropdown-close:hover {
  background-color: rgba(255, 59, 59, 0.4);
  color: var(--ois-text-white);
  transform: rotate(90deg);
}

.ois-dropdown-content {
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

/* Card System */
.ois-card {
  background-color: var(--ois-bg-glass-dark);
  backdrop-filter: var(--ois-glass-blur);
  -webkit-backdrop-filter: var(--ois-glass-blur);
  border-radius: var(--ois-radius-lg);
  margin-bottom: var(--ois-space-lg);
  box-shadow: var(--ois-shadow-glass);
  border: var(--ois-glass-border);
  overflow: hidden;
  position: relative;
  color: var(--ois-text-white);
}

.ois-card-light {
  background-color: var(--ois-bg-glass-light);
  color: var(--ois-text-primary);
  border: 1px solid rgba(var(--ois-primary-blue-rgb), 0.1);
}

.ois-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: var(--ois-glass-border);
}

.ois-card-title {
  font-weight: var(--ois-font-semibold);
  font-size: var(--ois-text-lg);
  margin: 0;
}

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

.ois-card-footer {
  padding: 1rem 1.5rem;
  border-top: var(--ois-glass-border);
  background-color: rgba(var(--ois-bg-dark-rgb), 0.5);
}

/* Floating Action Button (FAB) */
.ois-fab {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: linear-gradient(135deg, #6750A4 0%, #7C4DFF 50%, #6200EA 100%);
  box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12), 0 3px 5px -1px rgba(0, 0, 0, 0.2);
  color: var(--ois-text-white);
  transition: var(--ois-transition-material);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  z-index: var(--ois-z-fab);
}

.ois-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
}

.ois-fab:active {
  transform: scale(0.95);
}

.ois-fab-mini {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.ois-fab-extended {
  width: auto;
  padding: 0 1rem;
  min-width: 56px;
}

/* Modal System */
.ois-modal {
  z-index: var(--ois-z-modal);
}

.ois-modal-background {
  background-color: var(--ois-bg-glass-dark);
  backdrop-filter: var(--ois-glass-blur);
  -webkit-backdrop-filter: var(--ois-glass-blur);
  animation: ois-fadeIn 0.3s ease;
}

.ois-modal-content {
  border-radius: var(--ois-radius-lg);
  box-shadow: var(--ois-shadow-xl);
  border: none;
  overflow: hidden;
  max-width: 90vw;
  max-height: 90vh;
  background: linear-gradient(135deg, light-dark(#f0f4f8, #202831) 0%, light-dark(#ffffff, #1b1a19) 100%);
}

.ois-modal-header {
  background: linear-gradient(135deg, light-dark(#f0f4f8, #202831) 0%, light-dark(#ffffff, #1b1a19) 100%);
  border-bottom: 1px solid rgba(var(--ois-primary-blue-rgb), 0.1);
  padding: 1.25rem;
  border-radius: var(--ois-radius-lg) var(--ois-radius-lg) 0 0;
}

.ois-modal-title {
  font-size: var(--ois-text-xl);
  font-weight: var(--ois-font-semibold);
  color: var(--ois-text-primary);
  margin: 0;
}

.ois-modal-body {
  padding: 1.5rem;
  color: var(--ois-text-primary);
}

.ois-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(var(--ois-primary-blue-rgb), 0.1);
  background-color: light-dark(#f8f9fa, #1e1e1c);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Button System */
.ois-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--ois-radius-md);
  border: 1px solid transparent;
  font-weight: var(--ois-font-medium);
  text-decoration: none;
  transition: var(--ois-transition-fast);
  cursor: pointer;
  font-size: var(--ois-text-sm);
  line-height: 1.5;
  position: relative;
  overflow: hidden;
}

.ois-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--ois-shadow-md);
}

.ois-button:active {
  transform: scale(0.98);
}

.ois-button-primary {
  background-color: var(--ois-primary-blue);
  color: var(--ois-text-white);
  border-color: var(--ois-primary-blue);
}

.ois-button-secondary {
  background-color: var(--ois-text-secondary);
  color: var(--ois-text-white);
  border-color: var(--ois-text-secondary);
}

.ois-button-outline {
  background-color: transparent;
  border-color: var(--ois-primary-blue);
  color: var(--ois-primary-blue);
}

.ois-button-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--ois-primary-blue);
}

.ois-button-sm {
  padding: 0.25rem 0.75rem;
  font-size: var(--ois-text-xs);
}

.ois-button-lg {
  padding: 0.75rem 1.5rem;
  font-size: var(--ois-text-base);
}

/* Form Elements */
.ois-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid light-dark(#e2e8f0, #3e4855);
  border-radius: var(--ois-radius-md);
  font-size: var(--ois-text-sm);
  transition: var(--ois-transition-fast);
  background-color: var(--ois-bg-light);
  color: var(--ois-text-primary);
}

.ois-input:focus {
  outline: none;
  border-color: var(--ois-primary-blue);
  box-shadow: 0 0 0 3px rgba(var(--ois-primary-blue-rgb), 0.1);
}

.ois-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid light-dark(#e2e8f0, #3e4855);
  border-radius: var(--ois-radius-md);
  font-size: var(--ois-text-sm);
  background-color: var(--ois-bg-light);
  color: var(--ois-text-primary);
  cursor: pointer;
}

.ois-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid light-dark(#e2e8f0, #3e4855);
  border-radius: var(--ois-radius-md);
  font-size: var(--ois-text-sm);
  resize: vertical;
  min-height: 100px;
  background-color: var(--ois-bg-light);
  color: var(--ois-text-primary);
}

/* ==========================================================================
   SCROLLBAR STANDARDIZATION
   ========================================================================== */

.ois-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--theme-color-60, var(--ois-primary-blue)) var(--ois-bg-glass-subtle);
}

.ois-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.ois-scrollbar::-webkit-scrollbar-track {
  background: var(--ois-bg-glass-subtle);
  border-radius: 10px;
}

.ois-scrollbar::-webkit-scrollbar-thumb {
  background: var(--theme-color-60, var(--ois-primary-blue));
  border-radius: 10px;
  transition: var(--ois-transition-background);
}

.ois-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--theme-color-80, var(--ois-primary-blue));
}

/* Light theme scrollbar */
.ois-scrollbar-light {
  scrollbar-width: thin;
  scrollbar-color: var(--ois-text-secondary) #f1f5f9;
}

.ois-scrollbar-light::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.ois-scrollbar-light::-webkit-scrollbar-track {
  background: light-dark(#f1f5f9, #1f2831);
  border-radius: 10px;
}

.ois-scrollbar-light::-webkit-scrollbar-thumb {
  background: var(--ois-text-secondary);
  border-radius: 10px;
  transition: var(--ois-transition-background);
}

.ois-scrollbar-light::-webkit-scrollbar-thumb:hover {
  background: var(--ois-text-primary);
}

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

/* Mobile First Approach */
@media (max-width: 480px) {
  .ois-dropdown {
    width: 280px;
  }
  
  .ois-modal-content {
    max-width: 95vw;
    max-height: 95vh;
  }
  
  .ois-fab {
    width: 48px;
    height: 48px;
  }
  
  .ois-card {
    margin-bottom: var(--ois-space-md);
  }
  
  .ois-card-header,
  .ois-card-content,
  .ois-card-footer {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .ois-dropdown {
    width: 300px;
  }
  
  .ois-grid-auto-fit {
    grid-template-columns: 1fr;
  }
  
  .ois-grid-auto-fill {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .ois-dropdown {
    width: 320px;
  }
  
  .ois-grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Focus management */
.ois-focus-visible:focus-visible {
  outline: 2px solid var(--ois-primary-blue);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .ois-card,
  .ois-dropdown,
  .ois-modal-content {
    border: 2px solid var(--ois-text-primary);
  }
  
  .ois-button {
    border: 2px solid currentColor;
  }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
  .ois-fab,
  .ois-dropdown,
  .ois-modal {
    display: none !important;
  }
  
  .ois-card {
    background-color: white !important;
    box-shadow: none !important;
    border: 1px solid #000 !important;
  }
}

/* Bottom sheet body scroll lock — applied to document.body by OISBottomSheet */
body.ois-sheet-active {
    overflow: hidden !important;
}
/* ==========================================================================
   FIELDS
   The labelled dates, dropdowns and search boxes of a filter bar. A page writes them as <label><span>Name</span>
   <input or select/></label> inside OISListDetail's toolbar or an OISFilterBar, and they are styled here once, so every
   filter looks and behaves the same: 36px tall, rounded, a small label above, and a focus ring in the area colour
   (--area-accent, set by each area's frame). Dates keep the browser's own calendar.
   ========================================================================== */
.old-toolbar > [class$="-filters"] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
}

:is(.old-toolbar, .ofb) label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--kora-text-secondary, #64748B);
}

:is(.old-toolbar, .ofb) :is(select, input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])) {
    width: 100%;
    max-width: none;
    height: 36px;
    padding: 0 12px;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--kora-text-primary, #0F172A);
    border: 1px solid var(--color-border-light, #E2E8F0);
    border-radius: 10px;
    background-color: var(--kora-surface, #fff);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

/* A field inside a label is stacked under its name, so any flex sizing the control brings from a row (the shared search
   box sets one) must not be read as a height. */
:is(.old-toolbar, .ofb) label > :is(input, select):is(.osb, [type], :not([type]), select) { flex: none; }

:is(.old-toolbar, .ofb) input::placeholder {
    color: var(--kora-text-secondary, #64748B);
    opacity: 0.85;
}

:is(.old-toolbar, .ofb) :is(select, input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])):hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--kora-text-secondary, #64748B) 55%, transparent);
}

:is(.old-toolbar, .ofb) select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

:is(.old-toolbar, .ofb) input[type="search"] {
    padding-left: 36px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>");
    background-repeat: no-repeat;
    background-position: 12px center;
}

:is(.old-toolbar, .ofb) input[type="date"] {
    padding-right: 10px;
    font-variant-numeric: tabular-nums;
}

:is(.old-toolbar, .ofb) input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.55;
    cursor: pointer;
}

:is(.old-toolbar, .ofb) input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

:is(.old-toolbar, .ofb) :is(select, input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])):focus,
:is(.old-toolbar, .ofb) :is(select, input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])):focus-visible {
    outline: 0;
    border-color: var(--area-accent, #00A386);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--area-accent, #00A386) 26%, transparent);
}

:is(.old-toolbar, .ofb) :is(select, input):disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: color-mix(in srgb, var(--kora-text-primary, #0F172A) 4%, var(--kora-surface, #fff));
}

/* In a filter bar the fields share the row: a search box takes the spare width, the rest are a fixed size. */
.ofb > label { flex: 0 1 150px; }
.ofb > label:has(input[type="search"]) { flex: 1 1 220px; }
.ofb > .otb { align-self: center; }

@media (max-width: 767.98px) {
    .ofb > label { flex: 1 1 calc(50% - 8px); }
    .ofb > label:has(input[type="search"]) { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
    :is(.old-toolbar, .ofb) :is(select, input) { transition: none; }
}

/* ==========================================================================
   FIELDS: EVERY FIELD
   The look of any raw text box, search box, date box, dropdown or text area in the app, so a field that nobody styled is no
   longer the browser's own box. It is written with :where(), which has no weight of its own, so any rule that styles a
   field on purpose (a component's own control, a borderless box inside a search bar) still wins, and a page needs no
   rule of its own to get the shared look. Checkboxes, radio buttons, ranges, files, colours and buttons are left alone.
   ========================================================================== */
:where(input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"], select:not([multiple], [size]), textarea) {
    box-sizing: border-box;
    height: 36px;
    padding: 0 12px;
    font: inherit;
    font-size: 0.875rem;
    color: var(--kora-text-primary, #0F172A);
    background-color: var(--kora-surface, #fff);
    border: 1px solid var(--color-border-light, #E2E8F0);
    border-radius: 10px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

:where(textarea) {
    height: auto;
    min-height: 84px;
    padding: 8px 12px;
    line-height: 1.45;
    resize: vertical;
}

:where(select:not([multiple], [size])) {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

:where(input[type="search"]) {
    padding-left: 36px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>");
    background-repeat: no-repeat;
    background-position: 12px center;
}

:where(input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"]) {
    padding-right: 10px;
    font-variant-numeric: tabular-nums;
}

:where(input[type="date"])::-webkit-calendar-picker-indicator { opacity: 0.55; cursor: pointer; }
:where(input[type="date"])::-webkit-calendar-picker-indicator:hover { opacity: 1; }

:where(input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"], textarea)::placeholder {
    color: var(--kora-text-secondary, #64748B);
    opacity: 0.85;
}

:where(input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"], select:not([multiple], [size]), textarea):hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--kora-text-secondary, #64748B) 55%, transparent);
}

:where(input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"], select:not([multiple], [size]), textarea):focus {
    outline: 0;
    border-color: var(--area-accent, #00A386);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--area-accent, #00A386) 26%, transparent);
}

:where(input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"], select:not([multiple], [size]), textarea):disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: color-mix(in srgb, var(--kora-text-primary, #0F172A) 4%, var(--kora-surface, #fff));
}

@media (prefers-reduced-motion: reduce) {
    :where(input, select, textarea) { transition: none; }
}

/* ==========================================================================
   DATA TABLE MARKS
   OISDataTable builds its badges, yes/no marks and clipped text in code (RenderTreeBuilder), so the elements carry no
   component scope and a scoped stylesheet can never reach them. They are styled here, under the table's own class so
   no other page's badges change. One chip: soft tint, 6px corners, a label in a deepened version of the same colour.
   ========================================================================== */
.ois-data-table .ois-badge,
.ois-data-table .ois-boolean-indicator {
    --chip: var(--kora-text-secondary, #64748B);
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--chip) 14%, transparent);
    color: color-mix(in srgb, var(--chip) 72%, var(--kora-text-primary, #0F172A));
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.ois-data-table .ois-badge-green,
.ois-data-table .ois-boolean-indicator.true { --chip: #27AE60; }
.ois-data-table .ois-badge-blue,
.ois-data-table .ois-badge-primary { --chip: #3498DB; }
.ois-data-table .ois-badge-amber { --chip: #F59E0B; }
.ois-data-table .ois-badge-pink { --chip: #E91E63; }
.ois-data-table .ois-badge-red,
.ois-data-table .ois-boolean-indicator.false { --chip: #E74C3C; }
.ois-data-table .ois-badge-secondary { --chip: #475569; }

.ois-data-table .ois-text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   AREA COLOURS
   One colour per area. An area's frame sets --area-accent to one of these (in its own stylesheet), and the side list,
   the lists and the tables inside it all take their selected, hover and focus colours from it. OISAreaAccent in
   Kora.Components names the same variables, so the colours are defined only here. Each is dark enough for the label
   colour derived from it to clear 4.5:1 on its own tint.
   ========================================================================== */
:root {
    --area-teal: #00A386;
    --area-sage: #5F9458;
    --area-ocean: #0E7FA3;
    --area-fern: #4F7942;
    --area-violet: #6C5CE7;
    --area-indigo: #5367C9;
    --area-clay: #BA6948;
    --area-ochre: #B7862F;
    --area-emerald: #2E8F6B;
    --area-steel: #3C6E97;
    --area-rose: #B5466B;
    --area-slate: #5B6B7F;
    --area-ink: #4B4F9A;
}

/* ==========================================================================
   PAGE HEAD PANEL
   A page's head (OISPageHead), its figure strip (OISFigureStrip), its tabs (OISPageTabs) and its filters (OISFilterBar) are siblings in the page
   frame (.ops), and the list or table panel that follows (OISListDetail, OISDataTable) is the body. When they follow
   one another they are drawn as ONE panel: head, figures, tabs, filters and body, with a hairline between each part. A part
   with nothing attached to it stays a panel on its own, so a page whose head is followed by a note or a form is
   unchanged.

   Each part is its own box, so the joins are made here: the gap to the part above is taken out with a negative top
   margin, the corners on the joined edges are squared, and the shadow is clipped on the joined edge so no seam shows.
   The body may sit directly in the frame or inside the page's own wrapper element, and a page whose body is neither of
   those (a map beside a list, say) marks it with the class ops-body.
   ========================================================================== */

/* Every part that has another part, or the body, attached below it: square bottom corners, no bottom border (the
   part below draws the hairline), and no shadow below. */
.ops > :is(.oph, .ofs, .opt, .ofb):is(
    :has(+ :is(.ofs, .opt, .ofb, .old, .ois-data-table, .ops-body)),
    :has(+ * > :is(.old, .ois-data-table, .ops-body))) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-width: 0;
    clip-path: inset(-32px -32px 0 -32px);
}

/* A figure strip, tabs or the filters right after another part: a later row of the same panel. */
.ops > :is(.oph, .ofs, .opt, .ofb) + :is(.ofs, .opt, .ofb) {
    margin-top: calc(-1 * var(--ops-gap, 16px));
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    clip-path: inset(0 -32px -32px -32px);
}

/* ...and when something follows it as well, it is a middle row: no shadow above or below. */
.ops > :is(.oph, .ofs, .opt, .ofb) + :is(.ofs, .opt, .ofb):is(
    :has(+ :is(.ofs, .opt, .ofb, .old, .ois-data-table, .ops-body)),
    :has(+ * > :is(.old, .ois-data-table, .ops-body))) {
    clip-path: inset(0 -32px 0 -32px);
}

/* The list or table after a part: the body of the panel, with square top corners. Its own border is the hairline under
   the part above. Its height gives back the room the head's padding now takes. */
.ops > :is(.oph, .ofs, .opt, .ofb) + :is(.old, .ois-data-table, .ops-body),
.ops > :is(.oph, .ofs, .opt, .ofb) + * > :is(.old, .ois-data-table, .ops-body) {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    clip-path: inset(0 -32px -32px -32px);
}

.ops > :is(.oph, .ofs, .opt, .ofb) + :is(.old, .ois-data-table, .ops-body),
.ops > :is(.oph, .ofs, .opt, .ofb) + :has(> :is(.old, .ois-data-table, .ops-body)) {
    margin-top: calc(-1 * var(--ops-gap, 16px));
}

.ops > :is(.oph, .ofs, .opt, .ofb) + .old,
.ops > :is(.oph, .ofs, .opt, .ofb) + * > .old {
    height: calc(100vh - var(--ld-offset, 220px) - 24px);
}

/* ==========================================================================
   ACTIONS: THREE TIERS (13 Nov 2026)
   Every action on a page is one of three things, all in the area's colour (--area-accent, Kora teal when none):
   1. The filled pill (ois-pill is-primary, OISPillButton Primary): the one main action of a block.
   2. The tinted pill (ois-pill, OISPillButton): the other actions of a block, a section's action at the right of its
      heading, Try again. ois-pill is-outline is the hairline form (pagers, More); ois-pill is-danger is the filled red
      pill that confirms an ending action; is-small for section heads, rows and pagers.
   3. The coloured word (ois-word, OISTextButton): row actions, toolbar words, Cancel, Keep it. Underlined on hover.
      ois-word is-bad (OISTextButton Bad) for ending actions such as Delete and Release.
   A link inside a sentence is an underlined coloured word. No icons, no accent lines, no new hex colours: the ink is
   the accent mixed into the page's text colour, so the same rule reads on light and dark pages.
   ========================================================================== */
.ois-word,
.ois-pill {
    --ois-ink: color-mix(in srgb, var(--area-accent, #00A386) 58%, var(--kora-text-primary, #0F172A));
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.35;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.ois-word {
    display: inline;
    padding: 1px 2px;
    margin: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--ois-ink);
}

.ois-word:hover:not(:disabled, [aria-disabled="true"]) { text-decoration: underline; text-underline-offset: 3px; }
.ois-word.is-bad { color: var(--sb-bad, #b91c1c); }

.ois-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1px solid transparent;
    border-radius: var(--kora-radius-pill, 9999px);
    background: color-mix(in srgb, var(--area-accent, #00A386) 14%, transparent);
    color: var(--ois-ink);
    transition: background-color 150ms ease, border-color 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.ois-pill:hover:not(:disabled, [aria-disabled="true"]) { background: color-mix(in srgb, var(--area-accent, #00A386) 24%, transparent); }

.ois-pill.is-primary {
    background: color-mix(in srgb, var(--area-accent, #00A386) 80%, black);
    color: white;
}

.ois-pill.is-primary:hover:not(:disabled, [aria-disabled="true"]) {
    background: color-mix(in srgb, var(--area-accent, #00A386) 80%, black);
    filter: brightness(1.06);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--area-accent, #00A386) 35%, transparent);
}

.ois-pill.is-outline {
    background: transparent;
    border-color: var(--color-border-medium, #CBD5E1);
    color: var(--kora-text-primary, #0F172A);
}

.ois-pill.is-outline:hover:not(:disabled, [aria-disabled="true"]) {
    background: color-mix(in srgb, var(--kora-text-primary, #0F172A) 6%, transparent);
    border-color: color-mix(in srgb, var(--kora-text-secondary, #64748B) 60%, transparent);
}

.ois-pill.is-danger {
    background: color-mix(in srgb, var(--sb-bad, #b91c1c) 76%, black);
    color: white;
}

.ois-pill.is-danger:hover:not(:disabled, [aria-disabled="true"]) {
    background: color-mix(in srgb, var(--sb-bad, #b91c1c) 76%, black);
    filter: brightness(1.08);
}

.ois-pill.is-small { padding: 4px 12px; font-size: 0.78rem; }
.ois-pill.is-outline.is-small { padding: 3px 12px; }

:is(.ois-word, .ois-pill):is(:disabled, [aria-disabled="true"]) { opacity: 0.45; cursor: default; }
:is(.ois-word, .ois-pill):focus-visible { outline: 2px solid var(--area-accent, #00A386); outline-offset: 2px; }

/* Under the Dark theme the tint needs a little more of the accent to read as a button on a dark panel. */
html.theme-dark .ois-pill:not(.is-primary, .is-outline, .is-danger) { background: color-mix(in srgb, var(--area-accent, #00A386) 22%, transparent); }
html.theme-dark .ois-pill:not(.is-primary, .is-outline, .is-danger):hover:not(:disabled, [aria-disabled="true"]) { background: color-mix(in srgb, var(--area-accent, #00A386) 32%, transparent); }

/* A phone: buttons are at least 40px tall, and a word gets an invisible press area of the same height. */
@media (max-width: 767.98px) {
    .ois-pill { min-height: 40px; }
    .ois-pill.is-small { min-height: 36px; padding-left: 14px; padding-right: 14px; }
    .ois-word { display: inline-block; padding: 10px 2px; margin: -10px 0; }
}

@media (prefers-reduced-motion: reduce) {
    .ois-pill { transition: none; }
}

/* A part that has a dialog or a menu open inside it is not clipped, or the dialog (fixed, but still painted inside the part) and the
   menu would be cut off at the part's edge. The faint shadow seam this lets through is covered by the dialog's backdrop. */
.ops > :is(.oph, .ofs, .opt, .ofb):has(.ois-modal, [role="menu"], [role="listbox"], [aria-expanded="true"]),
.ops > :is(.old, .ois-data-table, .ops-body):has(.ois-modal, [role="menu"], [role="listbox"], [aria-expanded="true"]) {
    clip-path: none;
}

/* ==========================================================================
   RECORD ROW ACTIONS
   The actions at the end of a record row are quiet words in the area's ink colour, whichever page supplies them.
   ========================================================================== */
.orw-actions :is(a, button):not(.osb) {
    color: color-mix(in srgb, var(--area-accent, #00A386) 58%, var(--kora-text-primary, #0F172A));
    font-weight: 600;
    text-decoration: none;
}

.orw-actions :is(a, button):not(.osb):hover { text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================================
   OIS TABLE (soft rows)
   The look of a table a page builds by hand: add class="ois-table" to the <table>. A header row of quiet labels over a
   hairline, soft rows with no lines between them, an accent wash on hover rounded at the row's two ends. Put the table in
   a white panel (or let it sit in one) for the full effect. Cells may still set their own alignment and width.
   ========================================================================== */
table.ois-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    background: transparent;
}

table.ois-table thead th {
    padding: 11px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    color: var(--kora-text-secondary, #64748B);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--color-border-light, #E2E8F0);
}

table.ois-table tbody td {
    padding: 10px 16px;
    vertical-align: middle;
    color: var(--kora-text-primary, #0F172A);
    background: transparent;
    border: 0;
    transition: background-color 150ms ease;
}

table.ois-table tbody tr:hover td { background: color-mix(in srgb, var(--area-accent, #00A386) 6%, transparent); }
table.ois-table tbody td:first-child { border-radius: 10px 0 0 10px; }
table.ois-table tbody td:last-child { border-radius: 0 10px 10px 0; }
table.ois-table .num, table.ois-table td.num, table.ois-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
    table.ois-table tbody td { transition: none; }
}

/* Stacked on phones (mobile UX, 9 Nov 2026): add the "--stack" modifier to an ois-table whose rows read as "what, when, then
   the detail". Under 768px each row is a block: the first cell at the left and the second at the right on one line,
   every further cell at full width below. Header labels go (each cell can carry its own as data-label, which is
   shown before its text). From tablet up it is the ordinary table. */
@media (max-width: 767.98px) {
    table.ois-table.ois-table--stack,
    table.ois-table.ois-table--stack tbody { display: block; }
    table.ois-table.ois-table--stack thead { display: none; }
    table.ois-table.ois-table--stack tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 4px 12px;
        padding: 12px 16px;
        border-top: 1px solid var(--color-border-light, #E2E8F0);
    }
    table.ois-table.ois-table--stack tbody tr:first-child { border-top: 0; }
    table.ois-table.ois-table--stack tbody td { display: block; padding: 0; border-radius: 0; min-width: 0; }
    table.ois-table.ois-table--stack tbody td:nth-child(2) {
        text-align: right;
        white-space: nowrap;
        color: var(--kora-text-secondary, #64748B);
        font-size: 0.8125rem;
        font-variant-numeric: tabular-nums;
    }
    table.ois-table.ois-table--stack tbody td:nth-child(n + 3) { grid-column: 1 / -1; }
    table.ois-table.ois-table--stack tbody td:empty { display: none; }
    table.ois-table.ois-table--stack tbody td[data-label]:not(:empty)::before {
        content: attr(data-label) ": ";
        color: var(--kora-text-secondary, #64748B);
    }
    table.ois-table.ois-table--stack tbody tr:hover td { background: transparent; }
    table.ois-table.ois-table--stack tbody tr:hover { background: color-mix(in srgb, var(--area-accent, #00A386) 6%, transparent); }
}

/* Cards on phones (11 Nov 2026, #457, #477, #429): add the "--cards" modifier to an ois-table whose rows end in a state
   (Clear, Warning, Due, In force). Under 768px each row is a card: the first cell at the top left, the cell marked
   "ois-cell-end" (the state or the main figure) at the top right, and every other cell at full width below, each led by
   its own data-label. A group heading row (a th spanning the row) stays a plain line. Nothing is ever off to the side,
   so no column needs a sideways swipe. From tablet up it is the ordinary table. */
@media (max-width: 767.98px) {
    table.ois-table.ois-table--cards,
    table.ois-table.ois-table--cards tbody { display: block; min-width: 0; width: 100%; }
    table.ois-table.ois-table--cards thead { display: none; }
    table.ois-table.ois-table--cards tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 4px 12px;
        padding: 12px 14px;
        border-top: 1px solid var(--color-border-light, #E2E8F0);
    }
    table.ois-table.ois-table--cards tbody tr:first-child { border-top: 0; }
    table.ois-table.ois-table--cards tbody :is(td, th) {
        display: block;
        grid-column: 1 / -1;
        padding: 0;
        border-radius: 0;
        min-width: 0;
        white-space: normal;
        text-align: left;
    }
    table.ois-table.ois-table--cards tbody td:first-child { grid-column: 1; grid-row: 1; }
    table.ois-table.ois-table--cards tbody td.ois-cell-end { grid-column: 2; grid-row: 1; text-align: right; }
    table.ois-table.ois-table--cards tbody td:empty { display: none; }
    table.ois-table.ois-table--cards tbody td[data-label]:not(:empty)::before {
        content: attr(data-label) ": ";
        color: var(--kora-text-secondary, #64748B);
    }
    table.ois-table.ois-table--cards tbody tr:hover td { background: transparent; }
    table.ois-table.ois-table--cards tbody tr:hover { background: color-mix(in srgb, var(--area-accent, #00A386) 6%, transparent); }
}

/* ==========================================================================
   OIS FORM COMPONENTS
   The five field components (text, number, select, date, text area) read their border, radius, padding and focus colours
   from the --form-input-* tokens in app.css. This block finishes the job where a component hard-codes its own value:
   the focus colour follows the area, the type is the same size as the list filters, labels are the quiet label used above
   every field in the app, and an open dropdown keeps its corners and takes the area colour.
   ========================================================================== */
.ois-form-field {
    --form-input-focus-edge: var(--area-accent, #00A386);
    --form-input-focus-ring: color-mix(in srgb, var(--area-accent, #00A386) 26%, transparent);
    --form-input-shadow-dark: var(--form-input-focus-ring);
    --form-input-shadow-light: var(--form-input-focus-edge);
}

.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-form-input-container,
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-select-display { min-height: var(--form-input-min-height, 2.25rem); }
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-form-input-container:hover:not(:focus-within) { border-color: color-mix(in srgb, var(--kora-text-secondary, #64748B) 55%, transparent); }
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-form-input,
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-select-display,
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-datepicker-input { font-size: 0.875rem; }
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-form-label.label-static,
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-form-label { font-size: 0.75rem; font-weight: 600; color: var(--kora-text-secondary, #64748B); }
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-select-display.is-open { border-color: var(--area-accent, #00A386); }
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-form-help-text { font-size: 0.75rem; color: var(--kora-text-secondary, #64748B); }
/* The input sits inside a container that already has the vertical padding, so it adds none of its own. */
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-form-input-container > .ois-form-input:not(.ois-select-display) { padding-top: 0; padding-bottom: 0; height: auto; min-height: 0; }
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-form-input,
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-datepicker-input { line-height: 1.4; }
.ois-form-field.ois-form-field.ois-form-field.ois-form-field .ois-datepicker-input { height: auto; min-height: 0; }

/* ==========================================================================
   PANEL, EMPTY STATE AND TAB SEARCH
   .ois-panel is the white panel of the app for a body that no component supplies (mark it ops-body to join a head above it);
   .ois-empty is the centred line inside it when there is nothing to show; the search box at the end of a tab row.
   ========================================================================== */
.ois-panel {
    background: var(--kora-surface, #fff);
    border: 1px solid var(--color-border-light, #E2E8F0);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 20px rgba(15, 23, 42, 0.07);
    overflow: hidden;
}

.ois-empty { margin: 0; padding: 40px 24px; text-align: center; color: var(--kora-text-secondary, #64748B); font-size: 0.9375rem; }
.ois-empty > :is(strong, b) { display: block; margin-bottom: 4px; color: var(--kora-text-primary, #0F172A); font-weight: 600; }
.ois-empty > span { display: block; }

.opt-trail .osb { width: 240px; max-width: 100%; }
@media (max-width: 767.98px) { .opt-trail .osb { width: 100%; } }

/* ==========================================================================
   SKELETON (17 Nov 2026)
   What a page draws while it waits for its records or an outside source: grey shapes where the content will be, so the
   page keeps its shape and nothing jumps when the content arrives. The shapes are a wash of the text colour, so the
   Light and Dark themes need no rules of their own. Lewis chose a soft shimmer, and a 200 ms wait before anything shows,
   so a quick load never flashes. The shared components (OISSkeleton and the Loading switch on the layout components)
   draw these classes; see docs/ui-layouts.md, "Loading".
   .ois-skel-wrap   the region standing in for content: invisible for 200 ms, then fades in. role="status" sits on it.
   .ois-skel        one shape; --line (text), --title, --value (a figure), --chip, --pill, --block (a chart or picture).
   ========================================================================== */
.ois-skel-wrap {
    animation: ois-skel-appear 160ms ease-out 200ms both;
}

.ois-skel {
    display: block;
    height: 12px;
    max-width: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--kora-text-primary, #0F172A) 6%, transparent) 0%,
        color-mix(in srgb, var(--kora-text-primary, #0F172A) 12%, transparent) 50%,
        color-mix(in srgb, var(--kora-text-primary, #0F172A) 6%, transparent) 100%);
    background-size: 200% 100%;
    animation: ois-skel-shimmer 1.4s linear infinite;
}

.ois-skel--line { height: 12px; }
.ois-skel--small { height: 10px; }
.ois-skel--title { height: 26px; border-radius: 8px; }
.ois-skel--value { height: 20px; width: 44px; }
.ois-skel--chip { display: inline-block; height: 22px; width: 72px; vertical-align: middle; }
.ois-skel--pill { display: inline-block; height: 34px; width: 112px; border-radius: 999px; vertical-align: middle; }
.ois-skel--block { height: 140px; border-radius: 10px; }

/* Words for screen readers only: what the shapes stand for ("Loading the animal record"). */
.ois-skel-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Rows: the soft rows of a record list or table, a long line over a short one with a date at the right. */
.ois-skel-rows { display: flex; flex-direction: column; padding: 6px 22px; }
.ois-skel-rows--flat { padding: 0; }
.ois-skel-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.ois-skel-row-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 7px; }
.ois-skel-row-end { flex: 0 0 64px; }

/* Text: a few lines of a paragraph or a list of facts. */
.ois-skel-text { display: grid; gap: 12px; }

/* Bars: the bar rows of an analytics part (a label, the bar on its track, a value). */
.ois-skel-bars { display: grid; gap: 14px; }
.ois-skel-bar { display: grid; grid-template-columns: minmax(80px, 160px) 1fr 40px; gap: 12px; align-items: center; }

/* A note that stays readable under the shapes, for a wait long enough to explain ("Asking Open-Meteo..."). */
.ois-skel-note { margin: 12px 0 0; color: var(--kora-text-secondary, #64748B); font-size: 0.8125rem; }

@keyframes ois-skel-appear {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ois-skel-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

@media (max-width: 767.98px) {
    .ois-skel-rows { padding: 4px 16px; }
    .ois-skel-bar { grid-template-columns: 90px 1fr 32px; }
}

/* Motion off: still shapes, and they appear after the same wait without fading. */
@media (prefers-reduced-motion: reduce) {
    .ois-skel { animation: none; }
    .ois-skel-wrap { animation-duration: 1ms; }
}
