/* =============================================================================
   AIsapiens/static/css/components.css

   PURPOSE:
   - Define reusable UI components: buttons, form controls, cards, modals,
     tables, badges, alerts, etc.
   - Use BEM‐style or semantic class names to avoid duplication.
   - Rely exclusively on CSS variables for colors, spacing, typography, and
     shadows (do not hard‐code hex values, px, or rems here).
   ============================================================================= */


/* ============================================================================
   0. REQUIRED VARIABLES
   ----------------------------------------------------------------------------
   // Colors (extend :root in base.css)
   --color-danger-dark:  #e05555;      // darker shade of --color-danger
   --color-info-dark:    #3a78c2;      // darker shade of --color-info
   --color-alert-error:  #dc3545;      // same as --accent-red
   --color-alert-warning:#ffc107;      // or define --color-warning
   --color-alert-info:   #17a2b8;      // or define --color-info
   --color-bg-hover:     #f3f4f6;      // already in base.css as --color-hover-bg
   --color-bg-lighter:   #f9f9f9;      // very light gray background
   --color-bg-header:    #f8f9fa;      // light header background for tables

   // Spacing (already in base.css)
   --space-xs, --space-sm, --space-md, --space-lg, --space-xl

   // Typography (already in base.css)
   --font-small, --font-medium, --font-large, --font-xlarge

   // Shadows (add if missing)
   --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
   --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);

   // Border Radius (add if missing)
   --border-radius-sm: 0.25rem;
   --border-radius:    0.5rem;
   --border-radius-lg: 1rem;
   ========================================================================= */


/* ============================================================================
   1. BUTTONS
   ----------------------------------------------------------------------------
   - Base ".btn" defines shared spacing, typography, and transition.
   - Variants (.btn‐primary, .btn‐secondary, .btn‐danger, .btn‐info, .btn‐success).
   - Small and icon buttons, command links, and special modes (edit/save).
   - Avoid duplicating properties; extend or override only what changes.
   ========================================================================= */

/* 1.1. Base Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  background-color: #4c6fff; /* FIXED: Default primary blue */
  color: #ffffff; /* FIXED: Always white text */
}
.btn:hover {
  transform: translateY(-1px);
}

/* 1.2. Button Size Modifiers */
.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}
.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.25rem;
}

/* 1.3. Button Variants */
/* Primary */
.btn-primary {
  background-color: #4c6fff;
  color: #ffffff !important;
  border-color: #4c6fff;
}
.btn-primary:hover {
  background-color: #2c52cc;
  color: #ffffff !important;
  border-color: #2c52cc;
}

/* Fix for links styled as buttons - prevent global link hover styles from overriding button styles */
a.btn:hover,
a.btn:focus {
  text-decoration: none !important;
  color: inherit !important;
}

a.btn-primary:hover,
a.btn-primary:focus {
  background-color: #2c52cc !important;
  color: #ffffff !important;
  text-decoration: none !important;
  border-color: #2c52cc !important;
}

a.btn-secondary:hover,
a.btn-secondary:focus {
  color: #ffffff !important;
}

a.btn-danger:hover,
a.btn-danger:focus {
  color: #ffffff !important;
}

a.btn-info:hover,
a.btn-info:focus {
  color: #ffffff !important;
}

a.btn-success:hover,
a.btn-success:focus {
  color: #ffffff !important;
}

/* Secondary */
.btn-secondary {
  background-color: #6c757d;
  color: #ffffff;  /* EMERGENCY FIX: Direct white color */
}
.btn-secondary:hover {
  background-color: #5a6268;
  color: #ffffff;
}

/* Danger */
.btn-danger {
  background-color: #ea4335;
  color: #ffffff !important;
  border-color: #ea4335;
}
.btn-danger:hover {
  background-color: #e05555;
  color: #ffffff !important;
  border-color: #e05555;
}

.modal-content .btn-danger {
  background-color: #ea4335;
  color: #ffffff !important;
  border-color: #ea4335;
}

/* Info */
.btn-info {
  background-color: #9334e6;
  color: #ffffff;
}
.btn-info:hover {
  background-color: #7c2dd6;
  color: #ffffff;
}

/* Success */
.btn-success {
  background-color: #3dd598;
  color: #ffffff;
}
.btn-success:hover {
  background-color: #2bb882;
  color: #ffffff;
}

/* 1.4. Specialized Buttons */

/* Run (override any primary, use !important to enforce) */
.btn-run {
  background-color: #28a745 !important;
  border-color: #28a745 !important;
  color: #ffffff;
}
.btn-run:hover,
.btn-run:focus {
  background-color: #218838 !important;
  border-color: #218838 !important;
}

/* Command‐style link as a button (useful for inline "actions") */
.btn-command {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: #4c6fff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
  text-decoration: none;
}
.btn-command:hover {
  color: #6c5dd3;
}
.btn-command i {
  font-size: 0.9em;
}
/* Remove default button styling for <button> elements */
button.btn-command {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* Icon‐only button (small square) */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs);
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  transition: background-color 0.2s ease;
}
.btn-icon:hover {
  background-color: var(--bg-hover);
}
.btn-icon i {
  font-size: var(--font-small);
}

/* Edit/Save toggle button (two‐state) */
.btn-edit-save {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-medium);
  font-weight: 500;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
/* Edit mode */
.btn-edit-save.edit-mode {
  background-color: var(--color-border);
  color: var(--text-secondary);
}
.btn-edit-save.edit-mode:hover {
  background-color: var(--bg-hover);
  transform: translateY(-1px);
}
/* Save mode */
.btn-edit-save.save-mode {
  background-color: var(--color-success);
  color: var(--color-text-inverse);
}
.btn-edit-save.save-mode:hover {
  background-color: var(--color-success-dark);
  transform: translateY(-1px);
}

/* 1.5 Reset‐password Button (special case) */
.reset-password {
  background-color: var(--primary);
  color: var(--color-text-inverse);
}
.reset-password:hover {
  background-color: var(--primary-dark);
}

.actions {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
}

.actions .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  min-width: auto;
}

.actions .btn-command,
.actions .btn-edit,
.actions .btn-delete {
  background: transparent;
  border: none;
  color: #4c6fff !important;
}

.actions .btn-command:hover,
.actions .btn-edit:hover,
.actions .btn-delete:hover {
  color: #6c5dd3 !important;
  background: transparent;
}


/* ============================================================================
   2. ALERTS & MESSAGES
   ----------------------------------------------------------------------------
   - .messages     : simple list of alert messages (color indicates status)
   - .message-container : collapsible container for messages
   - .message-list      : underlying <ul> inside .message-container
   - .flash-messages    : individual alert inside the list
   - .alert, .alert-success, .alert-error : standalone alert boxes
   ========================================================================= */

/* 2.1. Simple inline message list */
.messages {
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0;
  font-size: var(--font-large);
  color: var(--color-success);
}
.messages li + li {
  margin-top: var(--space-sm);
}

/* 2.2. Expandable message container */
.message-container {
  position: relative;      /* changed from absolute */
  width: 100%;
  margin: var(--space-xs) 0;
  background-color: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  box-sizing: border-box;
  font-size: var(--font-medium);
  display: block;
  min-height: 0;           /* start collapsed */
  padding: 0;
  transition: all 0.3s ease;
}
#message-container.has-content {
  margin: var(--space-md) 0;
  margin-bottom: 0;
  padding: var(--space-md);
  min-height: 3.125rem;    /* 50px */
  max-height: 300px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: var(--color-bg-lighter);
  background-color: var(--color-bg-light);
}

/* 2.3. Underlying list inside message container */
.message-list {
  list-style: none;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xs);
  font-size: var(--font-base);
}
.message-list li {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xs);
}
.message-list li:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

.message-list li.success { color: var(--color-success); }
.message-list li.error   { color: var(--color-alert-error); }
.message-list li.warning { color: var(--color-alert-warning); }
.message-list li.info    { color: var(--color-alert-info); }
.message-list li.skip    { color: var(--color-alert-skip); }

/* Optional: separate visual container, if you want box around message list */
.upload-messages ul,
.run-messages ul {
  background: #fcfcfc;
  border: 1px solid #ddd;
  border-radius: 0.25rem;
  padding: 0.5rem;
}

/* 2.4. Individual flash message styling (standalone) */
.flash-messages {
  padding: var(--space-xs) 0;
  margin-bottom: var(--space-xs);
  position: relative;
  font-size: var(--font-base);
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  color: var(--text-primary); /* default fallback */
}
.flash-messages:last-child {
  margin-bottom: 0;
}

.flash-messages.success {
  background-color: var(--color-alert-success-light);
  color: var(--color-success);
  border: 1px solid rgba(40, 167, 69, 0.2);
}
.flash-messages.error {
  background-color: var(--color-alert-error-light);
  color: var(--color-alert-error);
  border: 1px solid rgba(220, 53, 69, 0.2);
}
.flash-messages.warning {
  background-color: var(--color-alert-warning-light);
  color: var(--color-alert-warning);
  border: 1px solid rgba(255, 193, 7, 0.2);
}
.flash-messages.info {
  background-color: var(--color-alert-info-light);
  color: var(--color-alert-info);
  border: 1px solid rgba(23, 162, 184, 0.2);
}
.flash-messages.skip {
  background-color: var(--color-alert-skip-light);
  color: var(--color-alert-skip);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

/* 2.5. Download‐style flash message */
.flash-messages.download {
  background-color: var(--color-bg-lighter);
  padding: var(--space-sm);
  border-left: 0.25rem solid var(--color-success);
}
.flash-messages.download a {
  font-weight: bold;
  text-decoration: underline;
}

/* 2.6. Responsive tweaks for messages */
@media (max-width: var(--breakpoint-md)) {
  .message-container.has-content {
    max-height: 200px;
  }
  .flash-messages {
    font-size: var(--font-small);
  }
}

/* 2.7. Standalone alert boxes */
.alert {
  padding: var(--space-md);
  border-radius: var(--border-radius-sm);
  margin-bottom: var(--space-md);
  font-size: var(--font-medium);
}
.alert-success {
  background-color: var(--color-success-light);
  color: var(--color-success-dark);
}
.alert-error {
  background-color: var(--color-alert-error);
  color: var(--color-text-inverse);
}
.alert-warning {
  background-color: var(--color-alert-warning-light);
  color: var(--color-alert-warning);
}
.alert-info {
  background-color: var(--color-alert-info-light);
  color: var(--color-alert-info);
}

.alert-action {
  display: inline-block;
  font-weight: 600;
  margin-top: var(--space-xs);
  color: var(--color-accent-blue);
}
.alert-action:hover {
  text-decoration: underline;
}



/* ============================================================================
   3. FORM CONTROLS
   ----------------------------------------------------------------------------
   - .form-group  : wrapper with label + control spacing
   - .form-control: generic input/select/textarea styling
   - .form-hint   : small hint text below form controls
   - .form-section, .form-grid, .form-actions : form layout helpers
   - .info-row, .contact-info : alternate form‐row variants
   - .form-toggle, .radio-container : radio‐group styling
   ========================================================================= */

/* 3.1. Form Group & Label */
.form-group {
  margin-bottom: var(--space-md);
}
.form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
  color: var(--text-primary);
  font-size: var(--font-medium);
}
.form-group label[for*="required"]::after,
.form-group:has(input[required]) label::after {
  /* Required field indicator */
  content: " *";
  color: var(--color-accent-red);
}

/* 3.2. Generic Form Control (input, select, textarea) */
.form-control,
.form-group input,
.form-group select,
.form-group textarea {
  display: block;
  width: 100%;
  padding: var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-medium);
  background-color: var(--color-bg-white);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-blue);
  outline: none;
  box-shadow: 0 0 0 2px rgba(76, 111, 255, 0.1);
}

/* 3.3. Select Control with Custom Chevron */
.app-select {
  position: relative;
  display: inline-block;
  width: 100%;
}

.app-select select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  cursor: pointer;
}

.app-select::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #495057;
  pointer-events: none;
}

.app-select select:hover {
  border-color: #80bdff;
}

.app-select select:focus {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.app-select select option {
  padding: 0.5rem;
  font-size: 1rem;
}

.app-select select option.expiring-soon {
  color: #ffc107;
}

.app-select select option.expiring-warning {
  color: #dc3545;
}

/* 3.4. Form Layout Helpers - ENHANCED VISIBILITY */
.form-section {
  background: #f8f9fa;  /* Light grey background */
  border: 1px solid #dee2e6;  /* Visible border */
  border-radius: var(--border-radius-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);  /* Subtle shadow */
}
.form-section h4 {
  background: #ffffff;  /* White header background */
  border: 1px solid #dee2e6;
  border-radius: var(--border-radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)) var(--space-md) calc(-1 * var(--space-lg));
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: var(--font-large);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-md);
}

.form-actions .cancel-modal:not(.btn-danger) {
  background-color: #f1f1f1;
  color: #333;
}
.form-actions .btn-danger.cancel-modal {
  background-color: #ea4335 !important;
  color: white !important;
}

/* 3.5. Form Hint / Help Text */
.form-hint,
.form-help-text {
  display: block;
  margin-top: var(--space-xs);
  color: var(--text-muted);
  font-size: var(--font-small);
  font-style: italic;
}

/* 3.6. Info‐Row Variant (label + input / textarea) */
.info-row label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: var(--font-small);
}
.info-row input,
.info-row textarea {
  padding: var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-small);
  width: 100%;
  background-color: var(--color-bg-white);
  color: var(--text-primary);
}
.info-row input:focus,
.info-row textarea:focus {
  border-color: var(--accent-blue);
  outline: none;
  box-shadow: 0 0 0 2px rgba(76, 111, 255, 0.1);
}

/* 3.7. Contact‐Info Variant (inputs with "dark" styling) */
.contact-info label {
  color: #333 !important;  /* Force dark text for labels */
  font-weight: 600;
  margin-bottom: var(--space-xs);
  display: block;
}

/* Ensure labels are visible in dark theme containers */
.dark-theme .contact-info label,
.dark-theme .form-grid label,
.dark-theme .monitoring-card label {
  color: #333 !important;  /* Force dark text for labels in dark theme */
  font-weight: 600;
}

/* Stronger override for organization information labels */
.monitoring-card .form-grid label,
.monitoring-card .contact-info label,
.dashboard-container .form-grid label,
.dashboard-container .contact-info label,
.dark-theme .monitoring-card .form-grid label,
.dark-theme .monitoring-card .contact-info label {
  color: #000 !important;  /* Force black text for maximum visibility */
  font-weight: 600 !important;
  text-shadow: none !important;
  background: transparent !important;
}

/* Override any inherited white text */
label[for*="street"],
label[for*="postal"],
label[for*="city"],
label[for*="country"],
label[for*="fiscal"],
label[for*="vat"],
label[for*="contact"] {
  color: #000 !important;  /* Force black text for all form labels */
  font-weight: 600 !important;
}

/* Universal label override for settings forms */
.monitoring-card form label,
.monitoring-card .form-group label,
#orgForm label,
form[id*="org"] label {
  color: #000 !important;  /* Force black text */
  font-weight: 600 !important;
  text-shadow: none !important;
  background-color: transparent !important;
}

.contact-info input {
  width: 100%;
  padding: var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: var(--color-bg-darker);
  color: var(--text-primary);
  transition: all 0.2s ease;
}
.contact-info input:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}
.contact-info input:not(:disabled) {
  background-color: var(--color-bg-white) !important;
  color: var(--color-text-primary) !important;
  border: 3px solid var(--color-accent-blue) !important;
  box-shadow: 0 0 0 3px rgba(76, 111, 255, 0.1) !important;
}
.contact-info input:focus {
  border-color: var(--color-accent-blue) !important;
  box-shadow: 0 0 0 2px rgba(76, 111, 255, 0.2) !important;
  outline: none;
}

/* Stronger override for enabled inputs inside .contact-info */
.contact-info .form-control:not(:disabled) {
  background-color: var(--color-bg-white) !important;
  color: var(--color-text-primary) !important;
  border: 3px solid var(--color-accent-blue) !important;
  box-shadow: 0 0 0 4px rgba(76, 111, 255, 0.2) !important;
}

/* Stronger focus state */
.contact-info .form-control:not(:disabled):focus {
  background-color: var(--color-bg-white) !important;
  color: var(--color-text-primary) !important;
  border: 3px solid var(--color-accent-blue) !important;
  box-shadow: 0 0 0 5px rgba(76, 111, 255, 0.3) !important;
  outline: none !important;
}

/* 3.8. Radio‐Toggle / Form Toggle */
.form-toggle {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid #e9ecef;  /* Light grey borders */
}
.radio-container {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  font-size: var(--font-small);
  color: var(--text-primary);
}
.radio-container input[type="radio"] {
  margin: 0;
  cursor: pointer;
}


/* ============================================================================
   4. CARDS & PANELS
   ----------------------------------------------------------------------------
   - .app-card         : generic card container
   - .app-card-header  : header flex container inside a card
   - .card--auth       : authentication / login card styling
   - .monitoring-card  : card for monitoring metrics
   - .save-indicator   : floating "Saving…" overlay
   ========================================================================= */

/* 4.1. Generic Card */
.app-card {
  background: var(--color-bg-white);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.app-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* 4.2. Card Header Flex */
.app-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}
.app-card-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--font-xlarge);
}

/* 4.3. Authentication Card (Login / Signup) */
.card--auth {
  background: var(--color-bg-white);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.card--auth h2 {
  margin-bottom: var(--space-lg);
  font-size: var(--font-large);
  color: var(--text-secondary);
}
.card--auth .logo {
  width: 120px;
  margin-bottom: var(--space-lg);
}
.card--auth form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.card--auth .aux-links {
  margin-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
}
.card--auth .aux-links a {
  color: var(--text-muted);
  font-size: var(--font-small);
}
.card--auth .aux-links a:hover {
  color: var(--accent-green);
}

/* 4.4. Monitoring Card (specialized card for dashboard metrics) - ENHANCED VISIBILITY */
.monitoring-card {
  background: #f8f9fa;  /* Light grey background for better separation */
  color: var(--color-text-primary);
  border-radius: var(--border-radius-lg);
  padding: var(--space-lg);  /* More padding for better spacing */
  width: 100%;
  margin-bottom: var(--space-lg);
  border: 2px solid #dee2e6;  /* Thicker, more visible border */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);  /* Enhanced shadow for depth */
}



.monitoring-card h3 {
  color: var(--color-text-primary);
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-large);
  text-align: center;
  border-bottom: 2px solid #dee2e6;  /* Stronger bottom border */
  padding-bottom: var(--space-sm);
  background: #ffffff;  /* White background for header */
  margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)) var(--space-md) calc(-1 * var(--space-lg));  /* Extend to card edges */
  padding: var(--space-md) var(--space-lg);  /* Add horizontal padding */
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;  /* Rounded top corners only */
}
.monitoring-card h4 {
  color: var(--color-text-primary);
  margin: var(--space-md) 0;
  font-size: var(--font-medium);
  text-align: center;
}

/* 4.5. Save Indicator (fixed overlay) */
.save-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: var(--color-text-inverse);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--border-radius-sm);
  z-index: 1000;
  font-size: var(--font-medium);
}
.save-indicator i {
  margin-right: var(--space-sm);
}


/* ============================================================================
   5. TABLES
   ----------------------------------------------------------------------------
   - .table-container  : wrapper with horizontal overflow
   - .metrics-table    : generic metrics table (dark theme)
   - .apps-table       : specialized application table
   - .users-table      : generic users table
   - .overview-table   : white‐background overview table
   - .applications-table: card‐style applications list on dashboard
   - .subscription-table: generic subscription listing
   ========================================================================= */

/* 5.1. Table Container (enables horizontal scroll) - ENHANCED VISIBILITY */
.table-container {
  overflow-x: auto;
  margin-top: var(--space-lg);
  background: #f8f9fa;  /* Light grey background */
  border: 2px solid #dee2e6;  /* Visible border */
  border-radius: var(--border-radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);  /* Enhanced shadow */
  padding: var(--space-sm);  /* Add padding around content */
}

/* 5.2. Metrics Table (centered text, clean white theme) */
.metrics-table {
  width: 100%;
  text-align: center;
  color: var(--color-text-primary);
  border-collapse: collapse;
  background: #ffffff;  /* Clean white background */
  border: 1px solid #dee2e6;  /* Visible border */
  border-radius: var(--border-radius-sm);
}
.metrics-table th,
.metrics-table td {
  padding: var(--space-md);
  text-align: center;
  border-bottom: 1px solid #e9ecef;  /* Light grey borders */
  font-size: var(--font-small);
  color: var(--color-text-primary);  /* Dark text */
}
.metrics-table th {
  font-weight: 600;
  background: #f8f9fa;  /* Light grey header */
  text-transform: uppercase;
  font-size: var(--font-small);
  letter-spacing: 0.5px;
  color: var(--color-text-primary);  /* Dark text */
  border-bottom: 2px solid #dee2e6;  /* Stronger header border */
}

/* 5.3. Applications Table (dark theme, card style) */
.apps-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: var(--space-md);
  background: var(--colorbg-darker);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 0.75rem; /* Smaller font size to fit better */
}
.apps-table th,
.apps-table td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
  font-size: 0.75rem; /* Smaller font size */
}
.apps-table th {
  background: var(--color-bg-header);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem; /* Even smaller for headers */
  letter-spacing: 0.5px;
}
.apps-table td.numeric {
  font-family: monospace;
  text-align: right;
  font-size: 0.75rem; /* Smaller font for numeric values */
}
.apps-table tbody tr:last-child td {
  border-bottom: none;
}
.apps-table tbody tr:hover {
  background: var(--bg-hover);
}

/* Vertical separators between columns */
.apps-table td:not(:last-child),
.apps-table th:not(:last-child) {
  border-right: 1px solid var(--border-color);
}

/* REMOVED: Old dark theme apps-table definitions that caused white text on white background */

/* REMOVED: Old dark theme apps-table styles that caused white text on white background */

/* Utility: badge inside cell - FIXED: Dark text for visibility */
.status-badge.active {
  background-color: #d4edda;  /* Light green background */
  color: #155724;  /* Dark green text */
  border: 1px solid #c3e6cb;
}
.status-badge.inactive {
  background-color: #f8d7da;  /* Light red background */
  color: #721c24;  /* Dark red text */
  border: 1px solid #f5c6cb;
}

/* REMOVED: Dark theme apps-table styling that caused white text issues */

/* 5.4. Users Table (light header) */
.users-table {
  table-layout: fixed;
  width: 100%;
}
.users-table th,
.users-table td {
  padding: var(--space-sm);
  text-align: left;
  font-size: var(--font-small);
  border-bottom: 1px solid var(--border-color);
}
.users-table th {
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--color-bg-header);
}
.users-table td {
  color: var(--text-primary);
}

/* 5.5. Overview Table (white card style) - ENHANCED VISIBILITY */
.overview-table {
  width: 100%;
  background: #ffffff;  /* Pure white background */
  border: 2px solid #dee2e6;  /* Strong border */
  border-radius: var(--border-radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);  /* Enhanced shadow for depth */
  overflow: hidden;
  margin-bottom: var(--space-lg);  /* Add spacing below */
}
.overview-table th {
  background: var(--color-bg-header);
  padding: var(--space-md);
  text-align: left;
  font-size: var(--font-large);
  color: var(--text-dark);
  border-bottom: 1px solid #e9ecef;
}
.overview-table td {
  padding: var(--space-lg);
  vertical-align: top;
  width: 50%;
}
.overview-table .metric {
  margin-bottom: var(--space-md);
}
.overview-table .metric:last-child {
  margin-bottom: 0;
}
.overview-table .value {
  display: block;
  font-size: var(--font-xlarge);
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: var(--space-xs);
}
.overview-table .label {
  display: block;
  font-size: var(--font-small);
  color: var(--text-muted);
}

/* 5.6. Applications‐Style Table (dashboard card list) - CLEAN WHITE THEME */
.applications-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: var(--space-md);
  background: #ffffff;  /* Clean white background */
  border: 1px solid #dee2e6;  /* Visible border */
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);  /* Enhanced shadow */
}
.applications-table th {
  background: #f8f9fa;  /* Light grey header */
  padding: var(--space-sm) var(--space-md);  /* Better padding */
  font-weight: 600;
  color: var(--color-text-primary);  /* Dark text */
  font-size: var(--font-small);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #dee2e6;  /* Visible border */
  text-align: center;  /* Center all column headers */
}
.applications-table th:first-child {
  text-align: left;  /* Keep application name left-aligned */
}
.applications-table td {
  padding: var(--space-sm) var(--space-md);  /* Better padding */
  border-bottom: 1px solid #e9ecef;  /* Light grey borders */
  color: var(--color-text-primary);  /* Dark text */
}
.applications-table td.numeric {
  text-align: center;  /* Center numeric values */
  font-family: monospace;  /* Monospace font for numbers */
  font-weight: 500;  /* Slightly bold for readability */
}
.applications-table tbody tr:hover {
  background: #f8f9fa;  /* Light grey hover */
}

/* 5.7. Subscription Table (generic) */
.subscription-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--space-md) 0;
}
.subscription-table th,
.subscription-table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}
.subscription-table th {
  text-align: left;
  background: var(--color-bg-white);
}

/* 5.8. No‐data placeholder */
.no-data {
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  padding: var(--space-md) 0;
}


/* ============================================================================
   6. BADGES & LABELS
   ----------------------------------------------------------------------------
   - .status-badge      : generic status indicator
   - .app-badge         : tag/badge component
   - Variants for "expiring" or status changes
   ========================================================================= */

/* 6.1. Generic Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-small);
  font-weight: 500;
  min-width: 60px;
  text-align: center;
  color: var(--text-primary);
  background-color: var(--bg-light);
}
.status-badge.active {
  background-color: #d4edda;  /* Light green background */
  color: #155724;  /* Dark green text */
  border: 1px solid #c3e6cb;
}
.status-badge.inactive {
  background-color: #f8d7da;  /* Light red background */
  color: #721c24;  /* Dark red text */
  border: 1px solid #f5c6cb;
}
.status-badge.expiring {
  background-color: var(--color-alert-warning-light);
  color: var(--color-alert-warning);
}

/* PDFsummarizer Status Badge Variants */
.status-badge.status-pending {
  background-color: #e3f2fd;  /* Light blue background */
  color: #1565c0;             /* Dark blue text */
  border: 1px solid #bbdefb;
}
.status-badge.status-processing {
  background-color: #fff3e0;  /* Light orange background */
  color: #e65100;             /* Dark orange text */
  border: 1px solid #ffcc02;
}
.status-badge.status-completed {
  background-color: #e8f5e8;  /* Light green background */
  color: #2e7d32;             /* Dark green text */
  border: 1px solid #c8e6c9;
}
.status-badge.status-downloaded {
  background-color: #f3e5f5;  /* Light purple background */
  color: #7b1fa2;             /* Dark purple text */
  border: 1px solid #e1bee7;
}
.status-badge.status-error {
  background-color: #ffebee;  /* Light red background */
  color: #c62828;             /* Dark red text */
  border: 1px solid #ffcdd2;
  cursor: help;               /* Show help cursor for error tooltip */
}

/* Processing Status Icons */
.processing-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  line-height: 1;
}

.processing-icon.completed {
  background-color: #e8f5e8;  /* Light green */
  color: #2e7d32;             /* Dark green */
  border: 1px solid #c8e6c9;
}

.processing-icon.pending {
  background-color: #f3e5f5;  /* Light gray */
  color: #757575;             /* Gray text */
  border: 1px solid #e0e0e0;
}

.processing-icon.error {
  background-color: #ffebee;  /* Light red */
  color: #c62828;             /* Dark red */
  border: 1px solid #ffcdd2;
}

/* Processing status text for accessibility */
.processing-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-small);
}

.processing-status .icon-text {
  font-size: 10px;
  font-weight: 600;
}

/* 6.2. Application Tag / Badge */
.app-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  background: var(--accent-blue-light); /* define in base.css */
  color: var(--accent-blue);
  border-radius: var(--border-radius-lg);
  font-size: var(--font-small);
}


/* ============================================================================
   7. METRICS & UTILITY COMPONENTS
   ----------------------------------------------------------------------------
   - .metrics-grid : responsive grid of metric cards
   - .metric       : single metric card
   - .usage-meter  : vertical "bar" list for usage indicators
   - .usage-bar    : thin progress bar inside usage-meter
   - .usage-text   : small label for usage values
   - .tier-info, .tier-level, .tier-limit
   ========================================================================= */

/* 7.1. Responsive Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

/* 7.2. Single Metric Card */
.metric {
  background: var(--color-bg-lighter);
  padding: var(--space-md);
  border-radius: var(--border-radius-sm);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.metric .label {
  display: block;
  color: var(--color-text-primary);  /* FIXED: Use dark text for visibility */
  font-size: var(--font-small);
  margin-bottom: var(--space-xs);
  font-weight: 500;  /* Make labels slightly bolder for better readability */
}
.metric .value {
  font-size: var(--font-xlarge);
  font-weight: bold;
  color: var(--color-accent-blue);  /* Keep blue values for visual appeal */
}
/* Status Variants for Metric Cards */
.metric.good {
  background-color: rgba(33, 150, 243, 0.1); /* info status */
}
.metric.warning {
  background-color: rgba(255, 152, 0, 0.1);  /* warning status */
}
.metric.critical {
  background-color: rgba(244, 67, 54, 0.1);  /* critical status */
}

/* 7.3. Usage Meter (vertical stacked bars) */
.usage-meter {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.usage-bar {
  height: 4px;
  background: var(--color-bg-lighter);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}
.usage-bar .progress {
  height: 100%;
  background: var(--accent-green);
  transition: width 0.3s ease;
}
.usage-text {
  font-size: var(--font-small);
  white-space: nowrap;
}

/* 7.4. Tier Info (small text cluster) */
.tier-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.tier-level {
  font-weight: 600;
  font-size: var(--font-small);
}
.tier-limit {
  font-size: var(--font-small);
  color: var(--text-muted);
}


/* ============================================================================
   8. DROPDOWNS & BUTTON GROUPS
   ----------------------------------------------------------------------------
   - .dropdown-menu, .dropdown-item, .dropdown-toggle-split
   - .btn-group, button adjacency, border-radius adjustments
   ========================================================================= */

/* 8.1. Dropdown Menu */
.dropdown-menu {
  background-color: var(--bg-dark);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-sm);
  box-shadow: 0 var(--space-xs) var(--space-lg) rgba(0, 0, 0, 0.175);
  min-width: 10rem;
  padding: var(--space-xs) 0;
  margin: var(--space-xs) 0 0;
  z-index: 1000;
}
.dropdown-item {
  display: block;
  width: 100%;
  padding: var(--space-xs) var(--space-md);
  font-weight: 400;
  text-align: inherit;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
  color: var(--text-primary);
  text-decoration: none;
}
.dropdown-item:hover,
.dropdown-item:focus {
  color: var(--accent-blue);
  background-color: rgba(255, 255, 255, 0.05);
}
.dropdown-toggle-split {
  padding-right: var(--space-sm);
  padding-left: var(--space-sm);
}

/* 8.2. Button Group (adjacent button styling) */
.btn-group {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}
.btn-group > .btn:not(:first-child) {
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.btn-group > .btn:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}


/* ============================================================================
   9. MODALS
   ----------------------------------------------------------------------------
   - .modal wrappers (backdrop) and .modal-content
   - .wide-modal variant for larger dialogs
   - .modal-header for title + close
   - .new-password for specific "reset" input styling
   ========================================================================= */

/* 9.1. Modal Backdrop */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide modal when hidden class is present */
.modal.hidden {
  display: none !important;
}

/* 9.2. Modal Content Container */
.modal-content {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 0.5rem;
  min-width: 300px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 9.3. Wide Modal Modifier */
.wide-modal {
  width: 90%;
  max-width: 1000px;
}

/* Modal Content h3 inside any .modal-content (title) */
.modal-content h3 {
  margin: 0 0 var(--space-md) 0;   /* var(--space-md) = 1rem */
  font-size: var(--font-large);    /* 1.25rem */
  color: var(--text-primary);
}


/* 9.4. Modal Header (title + close button) */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
  margin: 0;
  font-size: var(--font-large);
  color: var(--text-primary);
}

/* 9.5. Settings Modal Specific Styles */
.settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.settings-modal .modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  margin: 20px;
}

.settings-modal .modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

.settings-modal .modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.close-modal {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.close-modal:hover {
  color: #333;
  background-color: #f8f9fa;
}

.settings-modal form {
  padding: 20px 24px 24px;
}

.settings-modal .form-group {
  margin-bottom: 20px;
}

.settings-modal .form-group:last-of-type {
  margin-bottom: 24px;
}

.settings-modal label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.settings-modal .form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-modal .form-control:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.settings-modal .form-text {
  margin-top: 6px;
  font-size: 12px;
  color: #6c757d;
  line-height: 1.4;
}

.settings-modal .alert {
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 14px;
}

.settings-modal .alert-danger {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.settings-modal .alert-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.settings-modal .form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}

.settings-modal .btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.settings-modal .btn-success {
  background-color: #28a745;
  color: white;
  border-color: #28a745;
}

.settings-modal .btn-success:hover {
  background-color: #218838;
  border-color: #1e7e34;
}

.settings-modal .btn-secondary {
  background-color: #6c757d;
  color: white;
  border-color: #6c757d;
}

.settings-modal .btn-secondary:hover {
  background-color: #5a6268;
  border-color: #545b62;
}

.settings-modal .btn-danger {
  background-color: #dc3545;
  color: white;
  border-color: #dc3545;
}

.settings-modal .btn-danger:hover {
  background-color: #c82333;
  border-color: #bd2130;
}

/* 9.6. Password Toggle Styling */
.password-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.password-input {
  flex: 1;
}

.password-toggle-container {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.password-toggle-checkbox {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.password-toggle-label {
  margin: 0;
  cursor: pointer;
  color: #6c757d;
  font-size: 11px;
  user-select: none;
}

.password-toggle-label:hover {
  color: #007bff;
}

/* 9.7. Organization Summary Info Styling */
.org-summary-info {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e9ecef;
}

.org-summary-info .text-muted {
  font-size: 13px;
  line-height: 1.4;
}

.org-summary-info i {
  margin-right: 4px;
}

/* 9.8. New‐Password Box (for reset) */
.new-password {
  font-family: monospace;
  padding: var(--space-md);
  background: var(--bg-lighter);
  border-radius: var(--border-radius-sm);
  margin-top: var(--space-md);
  font-size: var(--font-medium);
}


/* ============================================================================
   10. UTILITY CLASSES & ANIMATIONS
   ----------------------------------------------------------------------------
   - .action-link      : styled <a> for inline actions
   - .fadeIn           : simple fade‐in animation
   ========================================================================= */

/* 10.1. Inline Action Link */
.action-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  display: inline-block;
}
.action-link:hover {
  text-decoration: underline;
  background-color: rgba(0, 123, 255, 0.1); /* Use var(--accent-blue-light) if defined */
  border-radius: var(--border-radius-sm);
}

/* 10.2. No Data Placeholder (generic fallback) */
.no-data {
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  padding: var(--space-md) 0;
}

/* 10.3. FadeIn Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 10.4. Command‐style link (very similar to .action-link) */
.command-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1em;
}
.command-link:hover {
  text-decoration: underline;
}

/* 10.5. Settings Utility Classes */
.settings-form {
  max-width: 800px;
}

.settings-form-section {
  display: flex;
  justify-content: center;
}

.settings-form-actions {
  justify-content: center;
}

/* 10.6. Organizations Management Styles */
.org-management-header {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.org-management-header h3 {
  color: #333;
  font-weight: 600;
  margin: 0;
}

/* 10.7. Utility Classes */
.d-flex {
  display: flex;
}

.justify-content-between {
  justify-content: space-between;
}

.align-items-center {
  align-items: center;
}

.mb-0 {
  margin-bottom: 0 !important;
}

/* 10.8. Form Check Input Styling */
.form-check-input {
  cursor: pointer;
  transform: scale(1.2);
}

.form-check-input:checked {
  background-color: #28a745;
  border-color: #28a745;
}

/* 10.9. Users Table Specific Styling */
/* Make the first 5 columns (Email, First Name, Last Name, Role, SuperUser) have equal width */
.users-table th:nth-child(1), 
.users-table td:nth-child(1) { 
    width: 25%; 
}

.users-table th:nth-child(2), 
.users-table td:nth-child(2) { 
    width: 15%; 
}

.users-table th:nth-child(3), 
.users-table td:nth-child(3) { 
    width: 15%; 
}

.users-table th:nth-child(4), 
.users-table td:nth-child(4) { 
    width: 15%; 
}

.users-table th:nth-child(5), 
.users-table td:nth-child(5) { 
    width: 20%; 
}

.users-table th:nth-child(6), 
.users-table td:nth-child(6) { 
    width: 10%; 
}

/* Set New Password column - reduced width to accommodate larger main columns */
.users-table th:nth-child(6), 
.users-table td:nth-child(6) {
  width: 16%; /* Reduced from 20% to 16% */
  text-align: center;
  min-width: 180px; /* Maintain minimum for password field */
}

/* Actions column - reduced width to accommodate larger main columns */
.users-table th:nth-child(7), 
.users-table td:nth-child(7) {
  width: 14%; /* Reduced from 15% to 14% */
  text-align: center;
  min-width: 150px; /* Ensure minimum for action buttons */
}

/* Password field improvements */
.users-table .password-container {
  min-width: 180px;
  max-width: 180px;
}

.users-table .password-input {
  width: 100%;
  font-size: 14px;
}

/* Actions column button spacing - bigger buttons */
.users-table .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.users-table .actions .btn {
  font-size: 14px;
  padding: 8px 12px;
  min-width: 70px;
}

/* 10.10. Form Utility Classes */
.form-control-min-width {
  min-width: 200px;
}

.form-inline {
  display: inline;
}

/* ============================================================================
   11. CLEAN WHITE THEME - NO DARK OVERRIDES
   ----------------------------------------------------------------------------
   All dark theme overrides removed for clean white background experience
   ============================================================================ */

/* REMOVED: All dark theme table and button overrides for clean white theme */


/* REMOVED: All dark theme monitoring card overrides for clean white theme */

/* REMOVED: Dark surface and metric-box-dark classes for clean white theme */

/* Utility classes - keeping clean white versions */
.monitoring-card.operation-logs {
  height: 350px;
  display: flex;
  flex-direction: column;
}

.logs-container {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: auto;
}

/* REMOVED: All dark theme emergency fixes - switching to clean white theme */

/* ============================================================================
   ORGANIZATIONAL SECTIONS - ENHANCED VISIBILITY
   ----------------------------------------------------------------------------
   Enhanced styling for better visual separation in organization templates
   ========================================================================= */

/* Organization sections within monitoring cards */
.org-section {
  background: #ffffff;  /* White background for contrast */
  border: 1px solid #dee2e6;  /* Visible border */
  border-radius: var(--border-radius-sm);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);  /* Subtle shadow */
}

/* Section headers */
.section-header {
  background: #f8f9fa;  /* Light grey header background */
  border: 1px solid #dee2e6;
  border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
  padding: var(--space-sm) var(--space-md);
  margin: calc(-1 * var(--space-md)) calc(-1 * var(--space-md)) var(--space-md) calc(-1 * var(--space-md));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-header h4 {
  margin: 0;
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: var(--font-medium);
}

/* Metrics sections */
.metrics-section {
  background: #f8f9fa;  /* Light grey background */
  border: 2px solid #dee2e6;  /* Thicker border */
  border-radius: var(--border-radius-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metrics-section h4 {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: var(--border-radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)) var(--space-md) calc(-1 * var(--space-lg));
  color: var(--color-text-primary);
  font-weight: 600;
  text-align: center;
}

/* ============================================================================
   ORGANIZATION-SPECIFIC CLASSES
   ----------------------------------------------------------------------------
   Classes specific to organization management templates
   ========================================================================= */

/* Add Organization Form */
.add-org-form {
  background: #f9f9f9;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

/* Tier Badge for Subscription Levels */
.tier-badge {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius);
  color: #ffffff;
  font-weight: 600;
  text-align: center;
  min-width: 120px;
}

.tier-badge.tier-0 { background: linear-gradient(135deg, #6c757d 0%, #495057 100%); }
.tier-badge.tier-1 { background: linear-gradient(135deg, #28a745 0%, #20c997 100%); }
.tier-badge.tier-2 { background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%); }
.tier-badge.tier-3 { background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%); }
.tier-badge.tier-4 { background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%); }
.tier-badge.tier-5 { background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%); }

/* Organization User Forms */
.add-org-user-form {
  background: var(--color-bg-lighter);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin-top: var(--space-md);
}

/* Subscription Forms */
.create-subscription-form {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.edit-subscription-form {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
}

/* Contact Display and Edit */
.contact-display .form-group {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid #f0f0f0;
}

.contact-display .form-group:last-child {
  border-bottom: none;
}

.form-control-static {
  padding: var(--space-xs) 0;
  color: var(--text-primary);
  font-weight: 500;
}

/* Inline Form Row */
.inline-form-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.inline-form-row label {
  min-width: 150px;
  font-weight: 600;
  color: #333333 !important;
}

/* Contact Edit Form Labels - Force Black Text */
.contact-edit label,
.contact-edit .inline-form-row label {
  color: #333333 !important;
  font-weight: 600;
}

/* Edit Input Hidden State */
.edit-input {
  display: none;
}

/* Display Value */
.display-value {
  display: inline-block;
}

/* Org Header */
.org-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.org-header h3 {
  margin: 0;
  color: var(--text-primary);
}

/* Section Actions */
.section-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* Usage Progress Bars */
.usage-progress {
  width: 100%;
  height: 4px;
  background-color: #e0e0e0;
  border-radius: 2px;
  margin: 2px 0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
  background-color: #28a745;
}

.progress-bar.warning {
  background-color: #ffc107;
}

.progress-bar.exceeded {
  background-color: #dc3545;
}



.usage-percent {
  font-size: 0.85em;
  color: #666;
  margin-left: var(--space-xs);
}

/* Operation Limit Warnings */
.limit-exceeded-warning {
  color: #dc3545 !important;
  font-weight: bold;
  font-size: 0.75rem;
  text-transform: uppercase;
  animation: blink 2s infinite;
}

.limit-warning-text {
  color: #ffc107 !important;
  font-weight: 600;
  font-size: 0.75rem;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.5; }
}

.usage-value.exceeded {
  color: #dc3545 !important;
  font-weight: bold;
}

.usage-value.warning {
  color: #ffc107 !important;
  font-weight: 600;
}

/* Subscription Summary */
.subscription-summary {
  background: var(--color-bg-lighter);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

/* Organizations List */
.organizations-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Ensure contact edit sections are properly hidden/shown */
.contact-edit.hidden {
  display: none !important;
}

.contact-display.hidden {
  display: none !important;
}

/* Ensure add-org-form is not hidden when it should be visible */
.add-org-form:not(.hidden) {
  display: block !important;
}

.inline-form {
  display: inline;
}

.btn-full-width {
  width: 100%;
}

/* ============================================================================
   PURE CSS MODAL (NO JAVASCRIPT)
   ----------------------------------------------------------------------------
   CSS-only modal using checkbox trick for toggle functionality
   ========================================================================= */

/* Hide the checkbox that controls the modal */
.modal-toggle {
  display: none;
}

/* Modal background - hidden by default */
.css-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show modal when checkbox is checked */
.modal-toggle:checked + .css-modal {
  opacity: 1;
  visibility: visible;
}

/* Modal overlay - click target for closing */
.css-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal content container */
.css-modal-content {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 0.5rem;
  min-width: 400px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  position: relative;
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

/* Scale up modal content when shown */
.modal-toggle:checked + .css-modal .css-modal-content {
  transform: scale(1);
}

/* Modal header */
.css-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

.css-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #333;
}

/* Close button */
.css-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.css-modal-close:hover {
  color: #333;
  background-color: #f8f9fa;
}

/* Style form actions in modal */
.css-modal .form-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Make cancel label look like a button */
.css-modal .form-actions label.btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Organization Users Section - add spacing from Application Usage */
.org-users-section {
  margin-top: 3rem; /* Large spacing between sections */
}

/* ============================================================================
   PURE CSS CONTACT EDIT (NO JAVASCRIPT)
   ----------------------------------------------------------------------------
   CSS-only contact edit using checkbox trick for toggle functionality
   ========================================================================= */

/* Hide the checkbox that controls the contact edit */
.contact-edit-toggle {
  display: none;
}

/* Contact display - visible by default */
.contact-display {
  display: block;
}

/* Contact edit form - hidden by default */
.contact-edit {
  display: none;
}

/* When checkbox is checked, hide display and show edit */
.contact-edit-toggle:checked ~ .contact-display {
  display: none;
}

.contact-edit-toggle:checked ~ .contact-edit {
  display: block;
}

/* Style the contact edit button */
.contact-edit-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background-color: #4c6fff !important;
  color: #ffffff !important;
  border-color: #4c6fff !important;
}

.contact-edit-btn:hover {
  background-color: #2c52cc !important;
  color: #ffffff !important;
  border-color: #2c52cc !important;
}

/* Ensure form actions labels behave like buttons */
.contact-edit .form-actions label.btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Contact Edit Actions - hidden by default */
.contact-edit-actions {
  display: none !important;
}

/* Show save/cancel buttons when in edit mode */
.contact-edit-toggle:checked ~ .section-header .contact-edit-actions {
  display: inline-flex !important;
}

/* Make edit button grey/disabled when in edit mode */
.contact-edit-toggle:checked ~ .section-header .contact-edit-btn {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: #ffffff !important;
  cursor: not-allowed;
  opacity: 0.6;
}

.contact-edit-toggle:checked ~ .section-header .contact-edit-btn:hover {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: #ffffff !important;
}

/* ============================================================================
   OPENAI KEY SETTINGS TOGGLE (PURE CSS)
   ========================================================================= */

/* Hide the checkbox that controls the OpenAI edit */
.openai-edit-toggle {
  display: none;
}

/* OpenAI display mode - visible by default */
.openai-display {
  display: block;
}

/* OpenAI edit mode - hidden by default */
.openai-edit {
  display: none;
}

/* When checkbox is checked, hide display and show edit */
.openai-edit-toggle:checked ~ .openai-display {
  display: none;
}

.openai-edit-toggle:checked ~ .openai-edit {
  display: block;
}

/* OpenAI edit button styling */
.openai-edit-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #ffffff !important;
}

.openai-edit-btn:hover {
  color: #ffffff !important;
}

/* OpenAI edit actions - hidden by default */
.openai-edit-actions {
  display: none;
}

/* Show edit actions when in edit mode */
.openai-edit-toggle:checked ~ .section-header .openai-edit-actions {
  display: inline-flex;
}

/* Hide edit button when in edit mode */
.openai-edit-toggle:checked ~ .section-header .openai-edit-btn {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  cursor: not-allowed !important;
}

.openai-edit-toggle:checked ~ .section-header .openai-edit-btn:hover {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: #ffffff !important;
}

/* Radio group styling - inline layout */
.radio-group-inline {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  align-items: center;
}

.radio-group-inline input[type="radio"] {
  margin: 0 0.5rem 0 0;
  width: 16px;
  height: 16px;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  color: #333;
  margin: 0 1rem 0 0;
  padding: 0.5rem 1rem;
  border: 2px solid #dee2e6;
  border-radius: 0.5rem;
  background-color: #fff;
  transition: all 0.2s ease;
}

.radio-label:hover {
  color: #007bff;
  border-color: #007bff;
  background-color: #f8f9ff;
}

/* Style selected radio labels */
input[type="radio"]:checked + .radio-label {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}

input[type="radio"]:checked + .radio-label:hover {
  background-color: #0056b3;
  border-color: #0056b3;
}

/* API Key field conditional behavior using CSS */
.api-key-field {
  position: relative;
}

/* Help text styling */
.help-text {
  display: block;
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* Hide OWN help text by default (PROVIDED is selected by default) */
.own-key-help {
  display: none;
}

/* Show PROVIDED help text by default */
.provided-key-help {
  display: block;
}

/* When OWN is selected, show OWN help and enable field */
.openai-edit-form:has(input[name="api_key_source"][value="OWN"]:checked) .api-key-field .own-key-help {
  display: block;
}

.openai-edit-form:has(input[name="api_key_source"][value="OWN"]:checked) .api-key-field .provided-key-help {
  display: none;
}

/* When PROVIDED is selected (default), disable the API key input */
.openai-edit-form:has(input[name="api_key_source"][value="PROVIDED"]:checked) .api-key-field input[name="openai_api_key"] {
  background-color: #f8f9fa;
  color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Fallback for browsers that don't support :has() */
@supports not selector(:has(*)) {
  /* When PROVIDED is selected, use traditional sibling selectors */
  input[name="api_key_source"][value="PROVIDED"]:checked ~ .form-group.api-key-field .own-key-help {
    display: none;
  }

  input[name="api_key_source"][value="PROVIDED"]:checked ~ .form-group.api-key-field .provided-key-help {
    display: block;
  }

  input[name="api_key_source"][value="PROVIDED"]:checked ~ .form-group.api-key-field input[name="openai_api_key"] {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
  }
}

/* Badge styling for API key source display */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.375rem;
}

.badge-primary {
  color: #fff;
  background-color: #007bff;
}

.badge-secondary {
  color: #fff;
  background-color: #6c757d;
}

/* Monthly Limit Badge Styles */
.limit-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  min-width: 60px;
  background-color: #e3f2fd;
  color: #1976d2;
  border: 1px solid #bbdefb;
}

.limit-badge.warning {
  background-color: #fff3e0;
  color: #f57c00;
  border-color: #ffcc02;
}

.limit-badge.exceeded {
  background-color: #ffebee;
  color: #d32f2f;
  border-color: #ffcdd2;
}

/* Ensure label buttons have white text */
label.btn-primary,
label.btn-primary:hover,
label.btn-primary:focus {
  color: #ffffff !important;
  text-decoration: none !important;
}

/* ============================================================================
   PURE CSS SUBSCRIPTION EDIT (NO JAVASCRIPT)
   ----------------------------------------------------------------------------
   CSS-only subscription edit using checkbox trick for toggle functionality
   ========================================================================= */

/* Hide the checkbox that controls the subscription edit */
.subscription-edit-toggle {
  display: none;
}

/* Subscription display row - visible by default */
.subscription-display-row {
  display: table-row;
}

/* Subscription edit row - hidden by default */
.subscription-edit-row {
  display: none;
}

/* When checkbox is checked, hide display and show edit */
.subscription-edit-toggle:checked ~ .subscription-table-container .subscription-display-row {
  display: none;
}

.subscription-edit-toggle:checked ~ .subscription-table-container .subscription-edit-row {
  display: table-row;
}

/* Style the subscription edit button */
.subscription-edit-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #ffffff !important;
}

.subscription-edit-btn:hover {
  color: #ffffff !important;
}

/* Subscription edit form styling */
.subscription-edit-form {
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
  border: 1px solid #dee2e6;
}

.subscription-edit-fields {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.edit-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 200px;
}

.edit-field-group label {
  font-weight: 600;
  color: #333;
  font-size: 0.9rem;
}

.subscription-edit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.subscription-edit-actions label.btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Ensure danger button styling is applied to labels - Override Django admin CSS */
.subscription-edit-actions label.btn-danger,
.subscription-edit-actions label.btn.btn-danger,
label.btn-danger[for*="subscription-edit-toggle"],
.monitoring-card label.btn-danger,
.org-section label.btn-danger {
  background-color: #ea4335 !important;
  color: #ffffff !important;
  border-color: #ea4335 !important;
  border: 1px solid #ea4335 !important;
  padding: 0.5rem 1rem !important;
  border-radius: 0.5rem !important;
  text-decoration: none !important;
  font-weight: 500 !important;
  font-size: 1rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.25rem !important;
  cursor: pointer !important;
  transition: transform 0.2s ease, background-color 0.2s ease !important;
}

.subscription-edit-actions label.btn-danger:hover,
.subscription-edit-actions label.btn.btn-danger:hover,
label.btn-danger[for*="subscription-edit-toggle"]:hover,
.monitoring-card label.btn-danger:hover,
.org-section label.btn-danger:hover {
  background-color: #e05555 !important;
  color: #ffffff !important;
  border-color: #e05555 !important;
  border: 1px solid #e05555 !important;
  text-decoration: none !important;
  transform: translateY(-1px) !important;
}

/* ============================================================================
   TEXT UTILITY CLASSES
   ----------------------------------------------------------------------------
   Utility classes for consistent text styling
   ========================================================================= */

/* Text color utilities */
.text-muted {
    color: #6c757d !important;
}

.text-success {
    color: #28a745 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-info {
    color: #17a2b8 !important;
}

/* Text alignment utilities */
.text-center {
    text-align: center !important;
}

.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}

/* Application Selector Dropdown */
.app-select {
  position: relative;
  display: inline-block;
  width: 100%;
}

.app-select select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  cursor: pointer;
}

.app-select::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #495057;
  pointer-events: none;
}

.app-select select:hover {
  border-color: #80bdff;
}

.app-select select:focus {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.app-select select option {
  padding: 0.5rem;
  font-size: 1rem;
}

.app-select select option.expiring-soon {
  color: #ffc107;
}

.app-select select option.expiring-warning {
  color: #dc3545;
}



/* ============================================================================
   API POOL TABLE RESPONSIVE STYLES
   ----------------------------------------------------------------------------
   Responsive adjustments for the API pool management table
   ========================================================================= */

/* Responsive table adjustments for API pool table */
@media (max-width: 1200px) {
    .metrics-table th:nth-child(6),
    .metrics-table td:nth-child(6),
    .metrics-table th:nth-child(7),
    .metrics-table td:nth-child(7) {
        display: none; /* Hide assigned to/since columns on smaller screens */
    }
}

@media (max-width: 768px) {
    .metrics-table th:nth-child(9),
    .metrics-table td:nth-child(9),
    .metrics-table th:nth-child(13),
    .metrics-table td:nth-child(13) {
        display: none; /* Hide total assignments and avg response on mobile */
    }
    
    /* Stack API key actions vertically on mobile */
    .metrics-table .actions {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .metrics-table .actions .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 480px) {
    /* Hide additional columns on very small screens */
    .metrics-table th:nth-child(5),
    .metrics-table td:nth-child(5),
    .metrics-table th:nth-child(8),
    .metrics-table td:nth-child(8) {
        display: none; /* Hide created and last used columns */
    }
}

/* Auto-refresh controls styling */
.auto-refresh-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-right: 20px;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.refresh-status {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-status.active {
    color: #28a745;
}

.refresh-status.inactive {
    color: #ffc107;
}

.refresh-loading {
    font-size: 14px;
    color: #007bff;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Auto-refresh notification animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.auto-refresh-notification {
    animation: slideInRight 0.3s ease-out;
}

/* Highlight animation for updated values */
.metric-highlight {
    background-color: #fff3cd !important;
    transition: background-color 0.3s ease;
}

.table-highlight {
    border: 2px solid #28a745 !important;
    transition: border 0.3s ease;
}

/* Assignment highlight */
.assignment-highlight {
    background-color: #d1ecf1 !important;
    transition: background-color 0.5s ease;
}

/* Trend info styling for cost metrics */
.trend-info {
    margin-top: 4px;
    font-size: 12px;
}

.trend-info small {
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-info .fas {
    font-size: 10px;
}

/* LeggiFatture: ULTIMATE CSS FIX - OVERRIDE ALL CONFLICTS */
div.page--dashboard.page--leggi-fatture header.dashboard-header .center-info {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    text-align: center !important;
    padding: 12px 0 8px 0 !important;
    gap: 12px !important;
    margin: 0 auto !important;
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

div.page--dashboard.page--leggi-fatture header.dashboard-header .center-info .upload-info,
div.page--dashboard.page--leggi-fatture header.dashboard-header .center-info .run-info {
    font-size: 1.25rem !important; /* 20px - same as filter-label */
    font-weight: 400 !important; /* Normal weight */
    line-height: 1.2 !important;
}

div.page--dashboard.page--leggi-fatture header.dashboard-header .center-info .filter-label {
    font-size: 1.25rem !important; /* 20px - same as others */
    font-weight: 700 !important; /* Bold */
    line-height: 1.2 !important;
}

div.page--dashboard.page--leggi-fatture header.dashboard-header .center-info .separator {
    font-size: 1.25rem !important; /* 20px - same as others */
    color: #666 !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
}

/* LeggiFatture: Force settings-badge to 20px font size */
.page--leggi-fatture .settings-badge#settings-summary-badge {
    font-size: 20px !important;
    line-height: 1.2 !important;
    font-weight: 400 !important;
}

/* Unique style for settings-badge (LeggiFatture and everywhere) */
.settings-badge {
    font-size: 20px !important;
    line-height: 1.2 !important;
    font-weight: 400 !important;
    color: #222 !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline !important;
}

.leggi-fatture-upload-instructions {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
}

.leggi-fatture-run-instructions {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
}
/* in your stylesheet or a <style> block */
.leggi-fatture-separator {
  font-size: 20px;
  color: #666;
  font-weight: 400;
  line-height: 1.2;
}

.leggi-fatture-selected-count {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}


/* styles.css (or inside a <style> in your <head>) */
.header-info {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-align: center;
  padding: 12px 0 8px;
  gap: 12px;
}

/* Header info row styling - replaces inline styles */
.header-info {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    text-align: center !important;
    padding: 12px 0 8px 0 !important;
    gap: 12px !important;
}

/* Header info text styling - consistent 20px font size */
.header-info .leggi-fatture-upload-instructions,
.header-info .leggi-fatture-selected-count,
.header-info .leggi-fatture-run-instructions {
    font-size: 20px !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
}

/* Selected count should be bold */
.header-info .leggi-fatture-selected-count {
    font-weight: 700 !important;
}

/* Separator styling */
.header-info .leggi-fatture-separator {
    font-size: 20px !important;
    color: #666 !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
}

/* Fix settings-badge visibility in right-actions container */
.right-actions .settings-badge {
    font-size: 20px !important;
    line-height: 1.2 !important;
    font-weight: 400 !important;
    color: #222 !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    min-width: auto !important;
    max-width: none !important;
    flex-shrink: 0 !important;
}

/* Ensure right-actions container has enough space */
.right-actions {
    min-width: 300px !important;
    max-width: none !important;
    overflow: visible !important;
}

/* Settings Modal Styles */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.settings-modal.modal-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    display: flex !important;
}

.settings-modal.show {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

.settings-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.settings-modal-content {
    position: relative;
    background: var(--color-bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.settings-modal.show .settings-modal-content {
    transform: translateY(0);
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-light);
}

.settings-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.settings-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.settings-modal-close:hover {
    color: var(--color-text-primary);
}

.settings-modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.fields-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.fields-actions {
    display: flex;
    gap: 8px;
}

.fields-container {
    position: relative;
    min-height: 200px;
}

.fields-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--color-accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fields-content {
    display: none;
}

.fields-content.show {
    display: block !important;
}

.field-group {
    margin-bottom: 24px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.field-group-header {
    background: var(--color-bg-light);
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.field-group-header:hover {
    background: var(--color-hover-bg);
}

.field-group-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.field-group-count {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    background: var(--color-accent-blue-light);
    padding: 2px 8px;
    border-radius: 12px;
}

.field-group-content {
    padding: 16px;
    display: none;
}

.field-group.expanded .field-group-content {
    display: block;
}

.field-group.expanded .field-group-header {
    background: var(--color-accent-blue-light);
}

.field-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

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

.field-item input[type="checkbox"] {
    margin-right: 12px;
    transform: scale(1.1);
}

.field-item label {
    flex: 1;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--color-text-primary);
    margin: 0;
    padding: 4px 0;
}

.field-item label:hover {
    color: var(--color-accent-blue);
}

.settings-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-light);
}

.settings-summary {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.settings-actions {
    display: flex;
    gap: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .settings-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .settings-modal-body {
        padding: 16px;
        max-height: 50vh;
    }
    
    .settings-modal-header,
    .settings-modal-footer {
        padding: 16px 20px;
    }
    
    .fields-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .settings-modal-footer {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .settings-actions {
        justify-content: flex-end;
    }
}

/* PDF Summarizer - NUCLEAR OPTION - FORCE 20px font size */
span.pdf-summarizer-run-instructions,
span.pdf-summarizer-separator,
span.pdf-summarizer-selected-count {
    font-size: 20px !important;
    font-size: 1.25rem !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    color: inherit !important;
    display: inline-block !important;
    white-space: nowrap !important;
}

/* PDF Summarizer - MAXIMUM SPECIFICITY rule to force 20px font size - UPDATED 2025-01-05 17:35 */
div.page--dashboard.page--pdf-summarizer .top-panel header.dashboard-header .header-bottom .right-actions span.pdf-summarizer-run-instructions {
    font-size: 20px !important;
    font-size: 1.25rem !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    color: inherit !important;
    display: inline-block !important;
    white-space: nowrap !important;
    /* Force browser to recognize this rule with a unique property */
    text-decoration: none !important;
}

/* PDF Summarizer - Fix right-actions alignment - text and button on same line */
div.page--dashboard.page--pdf-summarizer .top-panel header.dashboard-header .header-bottom .right-actions {
    flex-direction: row !important;
    align-items: center !important;
    gap: var(--space-md) !important;
    text-align: left !important;
}

/* PDF Summarizer header info text styling - consistent 20px font size */
.header-info .pdf-summarizer-upload-instructions,
.header-info .pdf-summarizer-selected-count {
    font-size: 20px !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
}

/* PDF Summarizer selected count should be bold */
.header-info .pdf-summarizer-selected-count {
    font-weight: 700 !important;
}

/* PDF Summarizer separator styling */
.header-info .pdf-summarizer-separator {
    font-size: 20px !important;
    color: #666 !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
}

/* PDF Summarizer header info text styling - consistent 20px font size */
.header-info .pdf-summarizer-selected-count {
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

/* PDF Summarizer separator styling */
.header-info .pdf-summarizer-separator {
    font-size: 20px !important;
    color: #666 !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
}

/* PDF Summarizer filter checkboxes in header-info - ULTRA SPECIFIC TO OVERRIDE pages.css 
   ISSUE: pages.css line 120 has rule ".page--dashboard .filter-top label" that conflicts
   SOLUTION: Use maximum specificity to override that rule for PDFsummarizer specifically */
div.page--dashboard.page--pdf-summarizer .top-panel header.dashboard-header .header-bottom .header-info label,
div.page--dashboard.page--pdf-summarizer .header-info label,
.page--pdf-summarizer .header-info label {
    font-size: 20px !important;
    font-size: 1.25rem !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    margin-left: var(--space-md) !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    color: inherit !important;
    display: inline !important;
}

.header-info label input[type="checkbox"] {
    margin-right: var(--space-xs);
    transform: scale(1.1);
}

/* anywhere after your other .right-actions rules */
.page--pdf-summarizer .header-bottom .right-actions {
  white-space: nowrap !important;
}

/* =============================================================================
   Operation Usage Badge - Progressive Fill System (Simplified)
   ============================================================================= */

.operation-usage-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--color-bg-light);
  border-radius: var(--border-radius);
  padding: var(--space-xs) var(--space-sm);
  margin-left: var(--space-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  border-left: 4px solid #2196f3; /* Simple blue border */
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.operation-usage-badge:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Progressive fill overlay using width classes - SIMPLIFIED BLUE ONLY */
.operation-usage-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: #2196f3; /* Simple blue background */
  opacity: 0.3;
  transition: width 0.5s ease, opacity 0.3s ease;
  z-index: 1;
}

/* Usage level specific widths */
.operation-usage-badge[data-usage-percentage="0"]::before { width: 0%; }
.operation-usage-badge[data-usage-percentage="1"]::before { width: 1%; }
.operation-usage-badge[data-usage-percentage="2"]::before { width: 2%; }
.operation-usage-badge[data-usage-percentage="3"]::before { width: 3%; }
.operation-usage-badge[data-usage-percentage="4"]::before { width: 4%; }
.operation-usage-badge[data-usage-percentage="5"]::before { width: 5%; }
.operation-usage-badge[data-usage-percentage="6"]::before { width: 6%; }
.operation-usage-badge[data-usage-percentage="7"]::before { width: 7%; }
.operation-usage-badge[data-usage-percentage="8"]::before { width: 8%; }
.operation-usage-badge[data-usage-percentage="9"]::before { width: 9%; }
.operation-usage-badge[data-usage-percentage="10"]::before { width: 10%; }
.operation-usage-badge[data-usage-percentage="11"]::before { width: 11%; }
.operation-usage-badge[data-usage-percentage="12"]::before { width: 12%; }
.operation-usage-badge[data-usage-percentage="13"]::before { width: 13%; }
.operation-usage-badge[data-usage-percentage="14"]::before { width: 14%; }
.operation-usage-badge[data-usage-percentage="15"]::before { width: 15%; }
.operation-usage-badge[data-usage-percentage="16"]::before { width: 16%; }
.operation-usage-badge[data-usage-percentage="17"]::before { width: 17%; }
.operation-usage-badge[data-usage-percentage="18"]::before { width: 18%; }
.operation-usage-badge[data-usage-percentage="19"]::before { width: 19%; }
.operation-usage-badge[data-usage-percentage="20"]::before { width: 20%; }
.operation-usage-badge[data-usage-percentage="21"]::before { width: 21%; }
.operation-usage-badge[data-usage-percentage="22"]::before { width: 22%; }
.operation-usage-badge[data-usage-percentage="23"]::before { width: 23%; }
.operation-usage-badge[data-usage-percentage="24"]::before { width: 24%; }
.operation-usage-badge[data-usage-percentage="25"]::before { width: 25%; }
.operation-usage-badge[data-usage-percentage="26"]::before { width: 26%; }
.operation-usage-badge[data-usage-percentage="27"]::before { width: 27%; }
.operation-usage-badge[data-usage-percentage="28"]::before { width: 28%; }
.operation-usage-badge[data-usage-percentage="29"]::before { width: 29%; }
.operation-usage-badge[data-usage-percentage="30"]::before { width: 30%; }
.operation-usage-badge[data-usage-percentage="31"]::before { width: 31%; }
.operation-usage-badge[data-usage-percentage="32"]::before { width: 32%; }
.operation-usage-badge[data-usage-percentage="33"]::before { width: 33%; }
.operation-usage-badge[data-usage-percentage="34"]::before { width: 34%; }
.operation-usage-badge[data-usage-percentage="35"]::before { width: 35%; }
.operation-usage-badge[data-usage-percentage="36"]::before { width: 36%; }
.operation-usage-badge[data-usage-percentage="37"]::before { width: 37%; }
.operation-usage-badge[data-usage-percentage="38"]::before { width: 38%; }
.operation-usage-badge[data-usage-percentage="39"]::before { width: 39%; }
.operation-usage-badge[data-usage-percentage="40"]::before { width: 40%; }
.operation-usage-badge[data-usage-percentage="41"]::before { width: 41%; }
.operation-usage-badge[data-usage-percentage="42"]::before { width: 42%; }
.operation-usage-badge[data-usage-percentage="43"]::before { width: 43%; }
.operation-usage-badge[data-usage-percentage="44"]::before { width: 44%; }
.operation-usage-badge[data-usage-percentage="45"]::before { width: 45%; }
.operation-usage-badge[data-usage-percentage="46"]::before { width: 46%; }
.operation-usage-badge[data-usage-percentage="47"]::before { width: 47%; }
.operation-usage-badge[data-usage-percentage="48"]::before { width: 48%; }
.operation-usage-badge[data-usage-percentage="49"]::before { width: 49%; }
.operation-usage-badge[data-usage-percentage="50"]::before { width: 50%; }
.operation-usage-badge[data-usage-percentage="51"]::before { width: 51%; }
.operation-usage-badge[data-usage-percentage="52"]::before { width: 52%; }
.operation-usage-badge[data-usage-percentage="53"]::before { width: 53%; }
.operation-usage-badge[data-usage-percentage="54"]::before { width: 54%; }
.operation-usage-badge[data-usage-percentage="55"]::before { width: 55%; }
.operation-usage-badge[data-usage-percentage="56"]::before { width: 56%; }
.operation-usage-badge[data-usage-percentage="57"]::before { width: 57%; }
.operation-usage-badge[data-usage-percentage="58"]::before { width: 58%; }
.operation-usage-badge[data-usage-percentage="59"]::before { width: 59%; }
.operation-usage-badge[data-usage-percentage="60"]::before { width: 60%; }
.operation-usage-badge[data-usage-percentage="61"]::before { width: 61%; }
.operation-usage-badge[data-usage-percentage="62"]::before { width: 62%; }
.operation-usage-badge[data-usage-percentage="63"]::before { width: 63%; }
.operation-usage-badge[data-usage-percentage="64"]::before { width: 64%; }
.operation-usage-badge[data-usage-percentage="65"]::before { width: 65%; }
.operation-usage-badge[data-usage-percentage="66"]::before { width: 66%; }
.operation-usage-badge[data-usage-percentage="67"]::before { width: 67%; }
.operation-usage-badge[data-usage-percentage="68"]::before { width: 68%; }
.operation-usage-badge[data-usage-percentage="69"]::before { width: 69%; }
.operation-usage-badge[data-usage-percentage="70"]::before { width: 70%; }
.operation-usage-badge[data-usage-percentage="71"]::before { width: 71%; }
.operation-usage-badge[data-usage-percentage="72"]::before { width: 72%; }
.operation-usage-badge[data-usage-percentage="73"]::before { width: 73%; }
.operation-usage-badge[data-usage-percentage="74"]::before { width: 74%; }
.operation-usage-badge[data-usage-percentage="75"]::before { width: 75%; }
.operation-usage-badge[data-usage-percentage="76"]::before { width: 76%; }
.operation-usage-badge[data-usage-percentage="77"]::before { width: 77%; }
.operation-usage-badge[data-usage-percentage="78"]::before { width: 78%; }
.operation-usage-badge[data-usage-percentage="79"]::before { width: 79%; }
.operation-usage-badge[data-usage-percentage="80"]::before { width: 80%; }
.operation-usage-badge[data-usage-percentage="81"]::before { width: 81%; }
.operation-usage-badge[data-usage-percentage="82"]::before { width: 82%; }
.operation-usage-badge[data-usage-percentage="83"]::before { width: 83%; }
.operation-usage-badge[data-usage-percentage="84"]::before { width: 84%; }
.operation-usage-badge[data-usage-percentage="85"]::before { width: 85%; }
.operation-usage-badge[data-usage-percentage="86"]::before { width: 86%; }
.operation-usage-badge[data-usage-percentage="87"]::before { width: 87%; }
.operation-usage-badge[data-usage-percentage="88"]::before { width: 88%; }
.operation-usage-badge[data-usage-percentage="89"]::before { width: 89%; }
.operation-usage-badge[data-usage-percentage="90"]::before { width: 90%; }
.operation-usage-badge[data-usage-percentage="91"]::before { width: 91%; }
.operation-usage-badge[data-usage-percentage="92"]::before { width: 92%; }
.operation-usage-badge[data-usage-percentage="93"]::before { width: 93%; }
.operation-usage-badge[data-usage-percentage="94"]::before { width: 94%; }
.operation-usage-badge[data-usage-percentage="95"]::before { width: 95%; }
.operation-usage-badge[data-usage-percentage="96"]::before { width: 96%; }
.operation-usage-badge[data-usage-percentage="97"]::before { width: 97%; }
.operation-usage-badge[data-usage-percentage="98"]::before { width: 98%; }
.operation-usage-badge[data-usage-percentage="99"]::before { width: 99%; }
.operation-usage-badge[data-usage-percentage="100"]::before { width: 100%; }

/* Enhanced fill for high usage - slightly more visible */
.operation-usage-badge[data-usage-high="true"]::before {
  opacity: 0.4;
}

/* Critical usage - more visible but still simple */
.operation-usage-badge[data-usage-critical="true"]::before {
  opacity: 0.5;
}

.badge-text {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  position: relative;
  z-index: 2;
  transition: color 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: var(--breakpoint-md)) {
  .operation-usage-badge {
    padding: var(--space-xs);
  }
  
  .badge-text {
    font-size: 10px;
  }
}

@media (max-width: var(--breakpoint-sm)) {
  .operation-usage-badge {
    display: none; /* Hide on very small screens */
  }
}

/* =============================================================================
   Enhanced Operation Usage Badge with Purchase Options
   ============================================================================= */

.operation-usage-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.operation-usage-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--color-bg-light);
  border-radius: var(--border-radius);
  padding: var(--space-xs) var(--space-sm);
  margin-left: var(--space-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  border-left: 4px solid #2196f3; /* Simple blue border */
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.operation-usage-badge:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Progressive fill overlay using width classes - SIMPLIFIED BLUE ONLY */
.operation-usage-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: #2196f3; /* Simple blue background */
  opacity: 0.3;
  transition: width 0.5s ease, opacity 0.3s ease;
  z-index: 1;
}

/* Purchase Options Styling */
.purchase-options {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.credits-display {
  font-size: 9px;
  color: #666;
  margin-right: 4px;
  white-space: nowrap;
}

.purchase-btn {
  font-size: 8px;
  padding: 2px 6px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-weight: 500;
}

.purchase-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.purchase-credits-btn {
  background: #28a745;
  color: white;
}

.purchase-credits-btn:hover {
  background: #218838;
}

.upgrade-tier-btn {
  background: #007bff;
  color: white;
}

.upgrade-tier-btn:hover {
  background: #0056b3;
}

/* Responsive adjustments for purchase options */
@media (max-width: var(--breakpoint-md)) {
  .operation-usage-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .purchase-options {
    margin-left: 0;
    margin-top: 2px;
  }
  
  .purchase-btn {
    font-size: 7px;
    padding: 1px 4px;
  }
}

@media (max-width: var(--breakpoint-sm)) {
  .operation-usage-container {
    display: none; /* Hide on very small screens */
  }
}

/* Hide the billing model edit toggle checkbox */
.billing-edit-toggle {
  display: none;
}

/* Billing display - visible by default */
.billing-display {
  display: block;
}

/* Billing edit form - hidden by default */
.billing-edit {
  display: none;
}

/* When checkbox is checked, hide display and show edit */
.billing-edit-toggle:checked ~ .billing-display {
  display: none;
}

.billing-edit-toggle:checked ~ .billing-edit {
  display: block;
}

/* Billing Edit Actions - hidden by default */
.billing-edit-actions {
  display: none !important;
}

/* Show save/cancel buttons when in edit mode */
.billing-edit-toggle:checked ~ .section-header .billing-edit-actions {
  display: inline-flex !important;
}

/* Make edit button grey/disabled when in edit mode */
.billing-edit-toggle:checked ~ .section-header .billing-edit-btn {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: #ffffff !important;
  cursor: not-allowed;
  opacity: 0.6;
}

.billing-edit-toggle:checked ~ .section-header .billing-edit-btn:hover {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: #ffffff !important;
}

/* Ensure password container styling */
.password-container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
