/* Bifrost Ledger Excel Add-in Styles */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #323130;
  background-color: #faf9f8;
}

.ms-welcome__header {
  padding: 20px;
  text-align: center;
  background-color: #0078d4;
  color: white;
  margin-bottom: 20px;
}

.ms-welcome__header img {
  margin-bottom: 10px;
}

.ms-welcome__header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 300;
}

.ms-welcome__main {
  padding: 0 20px 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

/* Navigation */
.nav-bar {
  display: none;
  background: #f3f2f1;
  border-bottom: 1px solid #edebe9;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.nav-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 13px;
  cursor: pointer;
  color: #323130;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 80px;
}

.nav-btn:hover {
  background: #edebe9;
  color: #0078d4;
}

.nav-btn.active {
  color: #0078d4;
  border-bottom-color: #0078d4;
  background: white;
}

/* Views */
.view {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

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

/* Authentication Forms */
.auth-form {
  background: white;
  padding: 20px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.auth-form h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
  color: #323130;
}

.auth-description {
  margin-bottom: 20px;
  color: #605e5c;
  font-size: 14px;
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  color: #323130;
}

.input-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #8a8886;
  border-radius: 2px;
  font-size: 14px;
  transition: border-color 0.15s ease-in-out;
}

.input-group input:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 1px #0078d4;
}

/* Buttons */
.ms-Button {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #8a8886;
  border-radius: 2px;
  background-color: white;
  color: #323130;
  font-size: 14px;
  font-weight: 400;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  margin-right: 8px;
  margin-bottom: 8px;
}

.ms-Button:hover {
  background-color: #f3f2f1;
  border-color: #323130;
}

.ms-Button:disabled {
  background-color: #f3f2f1;
  border-color: #c8c6c4;
  color: #a19f9d;
  cursor: not-allowed;
}

.ms-Button--primary {
  background-color: #0078d4;
  border-color: #0078d4;
  color: white;
}

.ms-Button--primary:hover:not(:disabled) {
  background-color: #106ebe;
  border-color: #106ebe;
}

.ms-Button-label {
  display: inline-block;
}

/* Auth Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: #605e5c;
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #edebe9;
}

.auth-divider span {
  padding: 0 12px;
}

/* SSO Button */
.sso-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #fff;
  border: 1px solid #8a8886;
  color: #323130;
}

.sso-button:hover {
  background-color: #f3f2f1;
  border-color: #323130;
}

.sso-button .ms-Button-label {
  font-weight: 600;
}

/* Messages */
.error-message {
  color: #a4262c;
  background-color: #fde7e9;
  border: 1px solid #a4262c;
  border-radius: 2px;
  padding: 8px 12px;
  margin-top: 12px;
  font-size: 14px;
}

.loading-message {
  color: #0078d4;
  background-color: #deecf9;
  border: 1px solid #0078d4;
  border-radius: 2px;
  padding: 8px 12px;
  margin-top: 12px;
  font-size: 14px;
}

/* Authenticated View */
.user-info {
  background: white;
  padding: 20px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.user-info h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #0078d4;
}

.user-info p {
  margin: 4px 0;
  color: #323130;
}

.actions {
  background: white;
  padding: 20px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.status {
  background: white;
  padding: 20px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.status p {
  margin: 8px 0;
}

.status-connected {
  color: #107c10;
  font-weight: 600;
}

.status-disconnected {
  color: #a4262c;
  font-weight: 600;
}

.status-active {
  color: #107c10;
  font-weight: 600;
}

.status-expired {
  color: #a4262c;
  font-weight: 600;
}

/* Help Section */
#help-section {
  background: white;
  padding: 20px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#help-section h3 {
  margin-top: 0;
  color: #0078d4;
}

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

.section-header h3 {
  margin: 0;
}

#refresh-formulas-btn {
  padding: 4px 12px;
  font-size: 12px;
}

#help-section ul {
  margin: 12px 0;
  padding-left: 20px;
}

#help-section li {
  margin: 8px 0;
}

#help-section code {
  background-color: #f8f8f8;
  border: 1px solid #e1dfdd;
  border-radius: 2px;
  padding: 2px 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  color: #0078d4;
}

/* Settings View */
.settings-container {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow: hidden;
}

.settings-container h2 {
  margin: 0;
  padding: 20px;
  background: #f3f2f1;
  border-bottom: 1px solid #edebe9;
  font-size: 18px;
  font-weight: 600;
  color: #323130;
}

.settings-section {
  padding: 20px;
  border-bottom: 1px solid #f3f2f1;
}

.settings-section:last-of-type {
  border-bottom: none;
}

.settings-section h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #323130;
}

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

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-item label {
  font-weight: 500;
  color: #323130;
  margin-bottom: 0;
  flex: 1;
}

.setting-item input[type="number"],
.setting-item select {
  width: 120px;
  padding: 6px 8px;
  border: 1px solid #8a8886;
  border-radius: 2px;
  font-size: 14px;
}

.setting-item input[type="number"]:focus,
.setting-item select:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 1px #0078d4;
}

/* Toggle Switch */
.toggle-label {
  display: flex !important;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 40px;
  height: 20px;
  background: #c8c6c4;
  border-radius: 10px;
  margin-right: 12px;
  transition: background 0.2s ease;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 8px;
  transition: left 0.2s ease;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
  background: #0078d4;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::after {
  left: 22px;
}

.settings-actions {
  padding: 20px;
  background: #f3f2f1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Help View */
.help-container {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.help-container h2 {
  margin: 0;
  padding: 20px;
  background: #f3f2f1;
  border-bottom: 1px solid #edebe9;
  font-size: 18px;
  font-weight: 600;
  color: #323130;
}

.help-section {
  padding: 20px;
  border-bottom: 1px solid #f3f2f1;
}

.help-section:last-child {
  border-bottom: none;
}

.help-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #323130;
}

.help-section h4 {
  margin: 16px 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #0078d4;
}

.help-section p {
  margin: 8px 0;
  color: #605e5c;
  line-height: 1.5;
}

.help-section ul {
  margin: 8px 0;
  padding-left: 20px;
}

.help-section li {
  margin: 4px 0;
  color: #605e5c;
  line-height: 1.5;
}

.help-section code {
  background: #f3f2f1;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #323130;
}

.formula-help {
  background: #f8f8f8;
  padding: 16px;
  border-radius: 4px;
  margin: 12px 0;
}

/* Aliases View */
.aliases-container {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.aliases-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #f3f2f1;
  border-bottom: 1px solid #edebe9;
}

.aliases-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #323130;
}

#refresh-aliases-btn {
  padding: 4px 12px;
  font-size: 12px;
}

.aliases-description {
  margin: 0;
  padding: 12px 20px;
  font-size: 13px;
  color: #605e5c;
  border-bottom: 1px solid #f3f2f1;
}

.aliases-search-container {
  padding: 12px 20px;
  border-bottom: 1px solid #f3f2f1;
}

.aliases-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #8a8886;
  border-radius: 2px;
  font-size: 14px;
}

.aliases-search-input:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 1px #0078d4;
}

.aliases-list {
  padding: 12px 20px 20px;
}

.alias-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f8f8f8;
  border-radius: 4px;
  border-left: 3px solid #0078d4;
  margin-bottom: 8px;
}

.alias-item:last-child {
  margin-bottom: 0;
}

.alias-name {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #0078d4;
  min-width: 80px;
}

.alias-arrow {
  color: #a19f9d;
  font-size: 12px;
  flex-shrink: 0;
}

.alias-code {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: #323130;
}

/* Status View */
.status-container {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.status-container h2 {
  margin: 0;
  padding: 20px;
  background: #f3f2f1;
  border-bottom: 1px solid #edebe9;
  font-size: 18px;
  font-weight: 600;
  color: #323130;
}

.status-loading {
  padding: 40px;
  text-align: center;
  color: #605e5c;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #f3f2f1;
  border-top: 3px solid #0078d4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px;
}

.status-item {
  padding: 16px;
  border-radius: 4px;
  border: 1px solid #edebe9;
}

.status-item h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
}

.status-item p {
  margin: 0;
  font-size: 13px;
}

.status-build-info {
  margin: 16px 20px 4px;
  padding-top: 12px;
  border-top: 1px solid #edebe9;
  font-size: 11px;
  color: #605e5c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.status-good {
  background: #f3f9f1;
  border-color: #92c353;
}

.status-good h4 {
  color: #92c353;
}

.status-bad {
  background: #fdf2f2;
  border-color: #d13438;
}

.status-bad h4 {
  color: #d13438;
}

.status-warning {
  background: #fff8f0;
  border-color: #f7630c;
}

.status-warning h4 {
  color: #f7630c;
}

.status-info {
  background: #f3f8ff;
  border-color: #0078d4;
}

.status-info h4 {
  color: #0078d4;
}

.status-metrics {
  padding: 20px;
  border-top: 1px solid #f3f2f1;
}

.status-metrics h4 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #323130;
}

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

.status-metrics li {
  padding: 6px 0;
  color: #605e5c;
  border-bottom: 1px solid #f3f2f1;
}

.status-metrics li:last-child {
  border-bottom: none;
}

.status-error {
  padding: 40px;
  text-align: center;
  color: #d13438;
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 4px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

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

.notification-success {
  background: #92c353;
}

.notification-error {
  background: #d13438;
}

.notification-warning {
  background: #f7630c;
}

.notification-info {
  background: #0078d4;
}

/* Responsive Design */
@media (max-width: 480px) {
  .nav-btn {
    font-size: 11px;
    padding: 10px 8px;
  }
  
  .settings-actions {
    flex-direction: column;
  }
  
  .settings-actions .ms-Button {
    margin-right: 0;
    width: 100%;
  }
  
  .status-grid {
    grid-template-columns: 1fr;
  }
  
  .setting-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .setting-item input[type="number"],
  .setting-item select {
    width: 100%;
  }
}

/* Accessibility Features */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #0078d4;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 9999;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 6px;
}

/* Focus indicators */
:root.focus-indicators *:focus {
  outline: 2px solid #0078d4 !important;
  outline-offset: 2px !important;
}

.keyboard-focus {
  outline: 2px solid #0078d4 !important;
  outline-offset: 2px !important;
}

/* High contrast mode */
:root.high-contrast {
  --primary-bg: #000000;
  --primary-text: #ffffff;
  --secondary-bg: #ffffff;
  --secondary-text: #000000;
  --border-color: #ffffff;
  --button-bg: #000080;
  --button-text: #ffffff;
  --error-color: #ff0000;
  --success-color: #00ff00;
}

:root.high-contrast body {
  background: var(--primary-bg);
  color: var(--primary-text);
}

:root.high-contrast .ms-Button {
  background: var(--button-bg);
  color: var(--button-text);
  border-color: var(--border-color);
}

:root.high-contrast .nav-btn:hover,
:root.high-contrast .nav-btn.active {
  background: var(--button-bg);
  color: var(--button-text);
}

:root.high-contrast input,
:root.high-contrast select,
:root.high-contrast textarea {
  background: var(--secondary-bg);
  color: var(--secondary-text);
  border-color: var(--border-color);
}

/* Reduced motion */
:root.reduced-motion *,
:root.reduced-motion *::before,
:root.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* Font scaling */
:root[data-font-size="small"] {
  font-size: 12px;
}

:root[data-font-size="large"] {
  font-size: 16px;
}

:root[data-font-size="extra-large"] {
  font-size: 18px;
}

/* Improved button accessibility */
button, .ms-Button {
  position: relative;
  min-height: 44px;
  min-width: 44px;
}

button[aria-expanded="true"]::after {
  content: " (expanded)";
  position: absolute;
  left: -9999px;
}

button[aria-expanded="false"]::after {
  content: " (collapsed)";
  position: absolute;
  left: -9999px;
}

/* Enhanced toggle accessibility */
.toggle-label {
  min-height: 44px;
  position: relative;
}

.toggle-label::after {
  content: attr(data-state);
  position: absolute;
  left: -9999px;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider + *::after {
  content: "on";
}

.toggle-label input[type="checkbox"]:not(:checked) + .toggle-slider + *::after {
  content: "off";
}

/* Loading indicator accessibility */
.spinner {
  position: relative;
}

.spinner::after {
  content: "Loading";
  position: absolute;
  left: -9999px;
}

/* Status indicators */
.status-good::before {
  content: "Status: Good - ";
  position: absolute;
  left: -9999px;
}

.status-bad::before {
  content: "Status: Error - ";
  position: absolute;
  left: -9999px;
}

.status-warning::before {
  content: "Status: Warning - ";
  position: absolute;
  left: -9999px;
}

.status-info::before {
  content: "Status: Information - ";
  position: absolute;
  left: -9999px;
}

/* Form validation accessibility */
.input-group.error input {
  border-color: #d13438;
  background-color: #fdf2f2;
}

.input-group.error::after {
  content: "Error: " attr(data-error);
  color: #d13438;
  font-size: 12px;
  display: block;
  margin-top: 4px;
}

/* Notification accessibility */
.notification {
  role: alert;
}

.notification::before {
  content: attr(aria-label) ": ";
  font-weight: bold;
}

/* Tab navigation improvements */
.nav-btn[aria-selected="true"] {
  font-weight: bold;
}

.nav-btn[aria-selected="true"]::after {
  content: " (current tab)";
  position: absolute;
  left: -9999px;
}

/* Progress bar accessibility */
.progress-bar {
  background: #f3f2f1;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar::after {
  content: attr(aria-valuenow) "% complete";
  position: absolute;
  left: -9999px;
}

.progress-fill {
  background: #0078d4;
  height: 100%;
  width: var(--progress-width, 0%);
  transition: width 0.3s ease;
}

:root.reduced-motion .progress-fill {
  transition: none;
}

/* Enhanced keyboard navigation for settings */
.setting-item:focus-within {
  background: rgba(0, 120, 212, 0.1);
  border-radius: 4px;
  padding: 8px;
  margin: -8px;
}

/* Responsive adjustments */
@media (max-width: 320px) {
  .ms-welcome__main {
    padding: 0 12px 12px;
  }
  
  .auth-form,
  .user-info,
  .actions,
  .status,
  #help-section {
    padding: 16px;
  }

  /* Maintain minimum touch targets on mobile */
  button, .ms-Button, .nav-btn {
    min-height: 48px;
    min-width: 48px;
  }
}

/* Print accessibility */
@media print {
  .nav-bar,
  .notification,
  .spinner {
    display: none;
  }

  .sr-only {
    position: static !important;
    width: auto !important;
    height: auto !important;
    clip: auto !important;
    white-space: normal !important;
    font-weight: bold;
  }
}

/* Formula List Styles */
.formulas-list {
  margin-top: 12px;
}

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

.formula-item {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #f3f2f1;
  border-radius: 6px;
  border-left: 3px solid #0078d4;
}

.formula-code {
  display: block;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 4px;
  color: #0078d4;
  word-break: break-all;
  cursor: pointer;
}

.formula-code:hover {
  background: #e1dfdd;
}

.formula-desc {
  margin: 6px 0 0;
  font-size: 12px;
  color: #605e5c;
}

.formula-rows-hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: #797775;
  padding-left: 4px;
}

.formula-rows-hint code {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 10px;
  background: #edebe9;
  padding: 1px 4px;
  border-radius: 2px;
  color: #605e5c;
}

.no-formulas {
  color: #605e5c;
  font-style: italic;
  margin: 8px 0;
}

.hint-text {
  color: #797775;
  font-size: 12px;
  margin: 4px 0;
}

.error-text {
  color: #a4262c;
  font-size: 12px;
}

.loading-formulas {
  color: #605e5c;
  font-style: italic;
  padding: 8px 0;
}

/* Setting descriptions */
.setting-description {
  margin: 6px 0 0 28px;
  font-size: 12px;
  color: #605e5c;
  line-height: 1.4;
}

/* Button group */
.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button-group .ms-Button {
  margin: 0;
}

#sync-formulas-btn {
  padding: 4px 12px;
  font-size: 12px;
}

/* Sync result styles */
.sync-result {
  padding: 16px;
  border-radius: 6px;
  margin-top: 12px;
  line-height: 1.6;
}

.sync-result code {
  display: block;
  background: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px 0;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  word-break: break-all;
}

.sync-result ol {
  margin: 8px 0;
  padding-left: 20px;
}

.sync-result li {
  margin: 4px 0;
}

.sync-result em {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: #605e5c;
}

.sync-success {
  background: #f3f9f1;
  border: 1px solid #92c353;
  color: #107c10;
}

.sync-success code {
  color: #0078d4;
  border: 1px solid #e1dfdd;
}

.sync-error {
  background: #fde7e9;
  border: 1px solid #a4262c;
  color: #a4262c;
}

.sync-info {
  background: #deecf9;
  border: 1px solid #0078d4;
  color: #0078d4;
}

/* Loading Progress Container */
.loading-progress-container {
  background: linear-gradient(135deg, #deecf9 0%, #f0f7ff 100%);
  border: 1px solid #0078d4;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 120, 212, 0.15); }
  50% { box-shadow: 0 4px 16px rgba(0, 120, 212, 0.25); }
}

:root.reduced-motion .loading-progress-container {
  animation: none;
}

.loading-progress-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.loading-progress-icon {
  font-size: 18px;
  animation: spin 1.5s linear infinite;
}

:root.reduced-motion .loading-progress-icon {
  animation: none;
}

#loading-progress-title {
  font-weight: 600;
  color: #0078d4;
  font-size: 14px;
}

.loading-progress-container .progress-bar {
  background: rgba(255, 255, 255, 0.8);
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.loading-progress-container .progress-fill {
  background: linear-gradient(90deg, #0078d4 0%, #106ebe 50%, #0078d4 100%);
  background-size: 200% 100%;
  animation: progressShimmer 1.5s ease-in-out infinite;
  height: 100%;
  border-radius: 5px;
  transition: width 0.3s ease;
}

@keyframes progressShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

:root.reduced-motion .loading-progress-container .progress-fill {
  animation: none;
  background: #0078d4;
}

.loading-progress-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #605e5c;
}

#loading-progress-status {
  flex: 1;
}

#loading-progress-percent {
  font-weight: 600;
  color: #0078d4;
  min-width: 40px;
  text-align: right;
}

/* Company Switcher */
.company-role {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: #605e5c;
}

.single-company-name {
  margin: 4px 0 0 0;
  color: #605e5c;
}

/* Grouped formula list */
.formula-company-group {
  margin-bottom: 16px;
}

.formula-company-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px 6px 0 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.formula-company-header.company-badge-primary {
  background: #e8f0fe;
  border-bottom: 2px solid #0078d4;
}

.formula-company-header.company-badge-external {
  background: #f3f0ff;
  border-bottom: 2px solid #8764b8;
}

.company-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.company-badge.company-badge-primary {
  background: #0078d4;
  color: white;
}

.company-badge.company-badge-external {
  background: #8764b8;
  color: white;
}

.company-header-name {
  font-size: 13px;
  font-weight: 600;
  color: #323130;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-formula-count {
  font-size: 11px;
  color: #605e5c;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}

.company-prefix-hint {
  font-size: 11px;
  color: #605e5c;
  padding: 6px 10px;
  background: #faf9f8;
  border-left: 3px solid #8764b8;
  margin-bottom: 4px;
}

.company-prefix-hint code {
  font-weight: 600;
  color: #8764b8;
  background: #f3f0ff;
  padding: 1px 4px;
  border-radius: 2px;
}

.company-no-shortname-warning {
  font-size: 11px;
  color: #a4262c;
  padding: 6px 10px;
  background: #fde7e9;
  border-left: 3px solid #a4262c;
  margin-bottom: 4px;
}

.formula-card-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Formula search */
.formulas-search-container {
  padding: 0 0 8px 0;
}

.formulas-search-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #8a8886;
  border-radius: 4px;
  background: white;
  color: #323130;
  box-sizing: border-box;
}

.formulas-search-input:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 1px #0078d4;
}

/* Builder company banner */
.builder-company-banner {
  background: #f3f0ff;
  color: #323130;
  padding: 8px 12px;
  margin: 0 0 12px 0;
  border-radius: 4px;
  font-size: 12px;
  border-left: 3px solid #8764b8;
}


/* Dashboard Action Grid */
.dashboard-actions {
  background: white;
  padding: 20px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.dashboard-actions h3 {
  margin: 0 0 12px 0;
  color: #323130;
  font-size: 15px;
  font-weight: 600;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 1px solid #edebe9;
  border-radius: 6px;
  background: #faf9f8;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
}

.action-btn:hover {
  background: #f3f2f1;
  border-color: #0078d4;
}

.action-btn:active {
  background: #edebe9;
}

.action-icon {
  font-size: 16px;
  color: #0078d4;
}

.action-label {
  font-size: 12px;
  color: #323130;
  text-align: center;
}

/* Formulas Container */
.formulas-container {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.formulas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #f3f2f1;
  border-bottom: 1px solid #edebe9;
}

.formulas-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #323130;
}

.formulas-browse {
  padding: 12px 20px 20px;
}

.formulas-build {
  padding: 12px 20px 20px;
}

/* Formula Cards */
.formula-card {
  padding: 12px;
  margin-bottom: 10px;
  background: #faf9f8;
  border: 1px solid #edebe9;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.formula-card:hover {
  border-color: #0078d4;
  box-shadow: 0 2px 6px rgba(0, 120, 212, 0.15);
}

.formula-card:focus {
  outline: 2px solid #0078d4;
  outline-offset: 1px;
}

.formula-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.formula-card-name {
  font-weight: 600;
  color: #323130;
  font-size: 14px;
}

.formula-card-fn {
  display: block;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  color: #0078d4;
  margin-bottom: 4px;
}

.formula-card-desc {
  margin: 4px 0 0;
  font-size: 12px;
  color: #605e5c;
}

/* Formula Type Badges */
.formula-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-ledger {
  background: #deecf9;
  color: #0078d4;
}

.badge-budget {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-ar {
  background: #fff3e0;
  color: #e65100;
}

.badge-ap {
  background: #fce4ec;
  color: #c62828;
}

/* Formula Builder */
.builder-back-btn {
  background: none;
  border: none;
  color: #0078d4;
  cursor: pointer;
  padding: 4px 0;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 32px;
}

.builder-back-btn:hover {
  text-decoration: underline;
}

.builder-header {
  margin-bottom: 16px;
}

.builder-title {
  margin: 8px 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: #323130;
}

.builder-fn-name {
  display: inline-block;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  color: #0078d4;
  background: #f3f2f1;
  padding: 2px 6px;
  border-radius: 3px;
}

.builder-desc {
  margin: 8px 0 0;
  font-size: 13px;
  color: #605e5c;
}

.builder-params {
  margin-bottom: 16px;
}

.builder-param-group {
  margin-bottom: 12px;
}

.builder-param-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #323130;
  margin-bottom: 4px;
}

.builder-input-wrapper {
  display: flex;
  align-items: stretch;
  position: relative;
}

.builder-input-wrapper .builder-input {
  flex: 1;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.builder-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #8a8886;
  border-radius: 3px;
  font-size: 14px;
  box-sizing: border-box;
}

.builder-input:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 1px #0078d4;
}

.builder-input.picking {
  border-color: #0078d4;
  background: #f0f6ff;
}

.builder-input.has-ref {
  background: #f0f6ff;
  font-family: 'Consolas', 'Monaco', monospace;
  color: #0078d4;
  font-weight: 600;
}

.builder-ref-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  border: 1px solid #8a8886;
  border-left: none;
  border-radius: 0 3px 3px 0;
  background: #f3f2f1;
  color: #605e5c;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  flex-shrink: 0;
}

.builder-ref-btn:hover {
  background: #e1dfdd;
  color: #323130;
}

.builder-ref-btn.picking {
  background: #0078d4;
  border-color: #0078d4;
  color: #fff;
}

.builder-date-row {
  display: flex;
  gap: 8px;
}

.builder-date-row .builder-input-wrapper {
  flex: 1;
}

.builder-date-input {
  flex: 1;
}

.builder-preview-section {
  margin-bottom: 16px;
}

.builder-preview {
  display: block;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  background: #f3f2f1;
  padding: 10px 12px;
  border-radius: 4px;
  color: #0078d4;
  word-break: break-all;
  border: 1px solid #edebe9;
}

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

.builder-actions .ms-Button {
  flex: 1;
  margin: 0;
}

/* Inline Confirm Dialog */
.action-grid:has(.confirm-inline) {
  display: block;
}

.confirm-inline {
  background: #fff8f0;
  border: 1px solid #f7630c;
  border-radius: 6px;
  padding: 16px;
}

.confirm-message {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #323130;
}

.confirm-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.confirm-actions .ms-Button {
  flex: 1;
  margin: 0;
  min-width: 0;
  text-align: center;
}

/* Status actions */
.status-actions {
  padding: 16px 20px;
  border-top: 1px solid #f3f2f1;
}

.status-info-section {
  padding: 16px 20px;
  border-top: 1px solid #f3f2f1;
}

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

  .builder-date-row {
    flex-direction: column;
  }

  .builder-actions {
    flex-direction: column;
  }
}
/* ---- Company Switcher ---- */
.company-switcher {
  position: relative;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 12px;
}

.company-switcher-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: #1f2937;
}

.company-switcher-trigger:hover {
  background: #f9fafb;
}

.company-switcher-trigger .cs-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.company-switcher-trigger .cs-current {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-switcher-trigger .cs-chevron {
  color: #6b7280;
  font-size: 10px;
}

.company-switcher-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-top: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
}

.cs-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

.cs-item:hover {
  background: #f3f4f6;
}

.cs-item.cs-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.cs-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.cs-badge-demo {
  background: #fef3c7;
  color: #92400e;
}

.cs-badge-primary {
  background: #dbeafe;
  color: #1e40af;
}

.cs-badge-external {
  background: #ede9fe;
  color: #5b21b6;
}

/* Short-name badge that sits inline with the type badge in the company switcher.
   Distinct from .cs-badge: shortname is identity, type badge is status. */
.cs-shortname {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  background: #f3f4f6;
  color: #374151;
  letter-spacing: 0.02em;
  margin-right: 4px;
}

/* Static-mode switcher (single-company users) — visible read-only chip so
   the active company is always in the user's peripheral vision, not just
   when they open a picker. */
.company-switcher--static .cs-static {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
}

/* Industry color accent — applied to the company switcher (left border)
   and to the demo banner. Subtle, not loud — these are work tools. The
   five industries match defaultFormulaService.ts industry templates. */
.industry-consulting { border-left: 3px solid #3b82f6; }    /* cool blue */
.industry-healthcare { border-left: 3px solid #14b8a6; }    /* teal */
.industry-insurance { border-left: 3px solid #f59e0b; }     /* amber */
.industry-manufacturing { border-left: 3px solid #64748b; } /* slate */
.industry-retail { border-left: 3px solid #a855f7; }        /* purple */
.industry-unknown { border-left: 3px solid transparent; }

/* When the company switcher is the demo type, the chevron and label get
   a subtle yellow tint to reinforce "you are in a sample environment". */
.company-switcher--type-demo .company-switcher-trigger {
  background: linear-gradient(to right, #fffbeb, transparent 40%);
}

.company-switcher--type-demo.company-switcher--static .cs-static {
  background: linear-gradient(to right, #fffbeb, transparent 40%);
}

/* ---- Demo banner (bifrost-demo-banner) ---- */
.bifrost-demo-banner {
  background: #fef3c7;
  color: #92400e;
  padding: 10px 14px;
  font-size: 12px;
  border-bottom: 2px solid #f59e0b;
}

.bifrost-demo-banner__title {
  font-weight: 600;
  margin-bottom: 4px;
}

.bifrost-demo-banner__tip {
  font-size: 11px;
  color: #78350f;
  font-weight: 400;
}

.bifrost-demo-banner__tip code {
  background: rgba(245, 158, 11, 0.15);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'Consolas', monospace;
  font-weight: 600;
}

.bifrost-demo-banner__sample-btn {
  display: block;
  margin: 8px auto;
  padding: 6px 16px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.bifrost-demo-banner__sample-btn:hover {
  background: #d97706;
}

/* Industry tint on the demo banner — overrides the default amber border-left
   set by .industry-* (left border still works because the banner has its own
   border-bottom for the original yellow look). */
.bifrost-demo-banner.industry-consulting { background: #eff6ff; color: #1e40af; border-bottom-color: #3b82f6; }
.bifrost-demo-banner.industry-consulting .bifrost-demo-banner__tip { color: #1e3a8a; }
.bifrost-demo-banner.industry-consulting .bifrost-demo-banner__tip code { background: rgba(59, 130, 246, 0.15); }
.bifrost-demo-banner.industry-consulting .bifrost-demo-banner__sample-btn { background: #3b82f6; }
.bifrost-demo-banner.industry-consulting .bifrost-demo-banner__sample-btn:hover { background: #2563eb; }

.bifrost-demo-banner.industry-healthcare { background: #f0fdfa; color: #0f766e; border-bottom-color: #14b8a6; }
.bifrost-demo-banner.industry-healthcare .bifrost-demo-banner__tip { color: #134e4a; }
.bifrost-demo-banner.industry-healthcare .bifrost-demo-banner__tip code { background: rgba(20, 184, 166, 0.15); }
.bifrost-demo-banner.industry-healthcare .bifrost-demo-banner__sample-btn { background: #14b8a6; }
.bifrost-demo-banner.industry-healthcare .bifrost-demo-banner__sample-btn:hover { background: #0d9488; }

.bifrost-demo-banner.industry-manufacturing { background: #f8fafc; color: #334155; border-bottom-color: #64748b; }
.bifrost-demo-banner.industry-manufacturing .bifrost-demo-banner__tip { color: #1e293b; }
.bifrost-demo-banner.industry-manufacturing .bifrost-demo-banner__tip code { background: rgba(100, 116, 139, 0.15); }
.bifrost-demo-banner.industry-manufacturing .bifrost-demo-banner__sample-btn { background: #64748b; }
.bifrost-demo-banner.industry-manufacturing .bifrost-demo-banner__sample-btn:hover { background: #475569; }

.bifrost-demo-banner.industry-retail { background: #faf5ff; color: #6b21a8; border-bottom-color: #a855f7; }
.bifrost-demo-banner.industry-retail .bifrost-demo-banner__tip { color: #581c87; }
.bifrost-demo-banner.industry-retail .bifrost-demo-banner__tip code { background: rgba(168, 85, 247, 0.15); }
.bifrost-demo-banner.industry-retail .bifrost-demo-banner__sample-btn { background: #a855f7; }
.bifrost-demo-banner.industry-retail .bifrost-demo-banner__sample-btn:hover { background: #9333ea; }

/* insurance keeps the default amber */

/* ---- Formula tab: demo company group + copy button ---- */

.company-badge-demo {
  background: #fef3c7;
  color: #92400e;
}

.formula-company-group--type-demo .formula-company-header {
  background: #fffbeb;
}

/* Per-card Copy button — small, unobtrusive, inline with the formula name. */
.formula-card-copy {
  margin-left: auto;
  padding: 2px 8px;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.formula-card-copy:hover:not(:disabled) {
  background: #e5e7eb;
  color: #111827;
}

.formula-card-copy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Prefix explainer — collapsible, sits inside the prefix hint block. */
.company-prefix-explainer {
  margin-top: 6px;
  font-size: 11px;
}

.company-prefix-explainer summary {
  cursor: pointer;
  color: #4b5563;
  font-weight: 600;
  user-select: none;
}

.company-prefix-explainer summary:hover {
  color: #1f2937;
}

.company-prefix-explainer p {
  margin: 6px 0 0;
  color: #4b5563;
  line-height: 1.4;
}


/*# sourceMappingURL=taskpane.css.map*/