/* Detail Popup CSS - matches standalone/searchResults styles */

:root {
  --primary: #5fc73e;
  --accent: #4a9c30;
  --dashboard-white: #ffffff;
  --dashboard-border: #e5e7eb;
  --dashboard-text: #374151;
  --dashboard-text-light: #6b7280;
  --dashboard-hover: #f9fafb;
  --shadow: 0 12px 30px rgba(0,0,0,0.15);
  --transition: all 0.3s ease;
}

.detail-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10020;
}

/* Person popup should have higher z-index to appear above company popup */
#detailPopupPersonOverlay {
  z-index: 10030;
}

.detail-popup-overlay.active { display: flex; }

.detail-popup-modal {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  width: min(1100px, 95vw);
  height: 85vh;
  min-height: 600px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Deleted company modal styling */
.detail-popup-modal.deleted {
  background: #fef2f2 !important; /* Light red background for deleted companies */
  background-color: #fef2f2 !important; /* Light red background for deleted companies */
  border-color: #fecaca !important; /* Light red border */
}

.detail-popup-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--dashboard-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Deleted company header styling */
.detail-popup-modal.deleted .detail-popup-header {
  background: #fee2e2 !important; /* Slightly darker red background for header */
  background-color: #fee2e2 !important; /* Slightly darker red background for header */
  border-bottom-color: #fca5a5 !important; /* Red border */
}

/* Deleted company warning text */
.deleted-company-warning {
  color: #dc2626; /* Red text */
  font-weight: 700;
  font-size: 0.9rem;
  margin-left: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-popup-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--dashboard-text);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.company-favicon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
}

.detail-popup-title .orgnr {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dashboard-text-light);
  margin-left: 0.5rem;
}

.detail-popup-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--dashboard-text-light);
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
}

.detail-popup-close:hover { background: var(--dashboard-hover); color: var(--primary); }

.copy-org-btn {
  background: transparent;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--dashboard-text-light);
  padding: 0.25rem;
  border-radius: 4px;
  margin-left: 0.25rem;
  transition: var(--transition);
}

.copy-org-btn:hover {
  background: var(--dashboard-hover);
  color: var(--primary);
}

.copy-org-btn:active {
  transform: scale(0.95);
}

.detail-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--dashboard-border);
}

.detail-tab {
  background: transparent;
  border: none;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--dashboard-text-light);
  font-weight: 600;
}

.detail-tab.active { background: var(--dashboard-hover); color: var(--primary); }

.detail-popup-body {
  overflow: auto;
  padding: 1rem 1.25rem 1.25rem;
  flex: 1;
  min-height: 0;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Overview (Oversikt) */
.overview-top {
  display: grid;
  grid-template-columns: 0.4fr 0.6fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .overview-top { grid-template-columns: 1fr; }
}

.metrics-card, .official-card {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  padding: 1rem;
}

.card-title {
  font-weight: 800;
  color: var(--dashboard-text);
  margin-bottom: 0.5rem;
}

.card-subtitle {
  color: var(--dashboard-text-light);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.metric-item {
  background: var(--dashboard-hover);
  border-radius: 10px;
  padding: 0.75rem;
  border: 1px solid var(--dashboard-border);
}

.metric-label { color: var(--dashboard-text-light); font-size: 0.8rem; }
.metric-value { color: var(--dashboard-text); font-weight: 800; font-size: 1.05rem; }
.metric-year { color: var(--dashboard-text-light); font-size: 0.75rem; margin-left: 0.25rem; }
.metric-value.positive { color: #10b981; }
.metric-value.negative { color: #ef4444; }

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.25rem 0;
}

.info-row.full-width {
  grid-template-columns: 1fr;
}

.info-row.full-width .info-value {
  margin-top: 0.25rem;
}

.info-label { color: var(--dashboard-text); }
.info-value { color: var(--dashboard-text); }

/* Regnskap */
.accounting-section {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  overflow: hidden;
}

.accounting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--dashboard-border);
}

.accounting-header .title { font-weight: 800; color: var(--dashboard-text); }
.accounting-header .year { color: var(--dashboard-text-light); font-size: 0.9rem; }

.accounting-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .accounting-tables { grid-template-columns: 1fr; }
}

.accounting-table {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  overflow: hidden;
}

.acc-table-title {
  background: var(--dashboard-hover);
  padding: 0.5rem 0.75rem;
  font-weight: 700;
  color: var(--dashboard-text);
  border-bottom: 1px solid var(--dashboard-border);
}

.acc-row {
  display: grid;
  grid-template-columns: 1fr auto;
  border-bottom: 1px solid var(--dashboard-border);
}

.acc-row:last-child { border-bottom: none; }

.acc-cell {
  padding: 0.5rem 0.75rem;
}

.acc-label { color: var(--dashboard-text); }
.acc-amount { text-align: right; font-weight: 600; color: var(--dashboard-text); }
.acc-amount.positive { color: #10b981; }
.acc-amount.negative { color: #ef4444; }

.acc-row.section {
  background: var(--dashboard-hover);
  font-weight: 700;
}

.acc-row.total {
  background: #f0f9ff;
  font-weight: 800;
  border-top: 2px solid var(--dashboard-border);
}

.acc-row.indent .acc-label { padding-left: 1.5rem; }

/* Regnskap Downloads */
.regnskap-downloads {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 1rem;
}

.regnskap-downloads .acc-table-title {
  background: var(--dashboard-hover);
  padding: 0.5rem 0.75rem;
  font-weight: 700;
  color: var(--dashboard-text);
  border-bottom: 1px solid var(--dashboard-border);
}

.download-description {
  padding: 0.75rem;
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--dashboard-border);
  background: #fafbfc;
}

.download-years {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
}

.regnskap-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
}

.regnskap-download-btn:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(95, 199, 62, 0.3);
}

.regnskap-download-btn.disabled,
.regnskap-download-btn:disabled {
  background: #6b7280;
  color: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.regnskap-download-btn.disabled:hover,
.regnskap-download-btn:disabled:hover {
  background: #6b7280;
  transform: none;
  box-shadow: none;
}

.regnskap-download-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.regnskap-download-btn.unavailable {
  background: #6b7280;
  color: white;
  cursor: not-allowed;
}

.regnskap-download-btn.unavailable:hover {
  background: #6b7280;
  transform: none;
  box-shadow: none;
}

.download-status {
  padding: 0.75rem;
  min-height: 20px;
}

.download-info {
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.download-success {
  color: #10b981;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.download-warning {
  color: #f59e0b;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.download-error {
  color: #ef4444;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Regnskap Login Link Styles */
.regnskap-login-link {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.regnskap-login-link:hover {
  color: var(--primary-dark);
}

/* Email Display Styles */
.email-section {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1rem 0;
}

.email-login-prompt {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 1.25rem;
  text-align: center;
  border-bottom: 1px solid var(--dashboard-border);
  position: relative;
}

.email-login-prompt::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.email-login-prompt-text {
  color: var(--dashboard-text);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.email-login-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 6px;
  transition: all 0.2s ease;
  background: white;
}

.email-login-link:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.email-addresses {
  padding: 1rem;
  background: var(--dashboard-white);
}

.email-addresses .info-label {
  font-size: 0.85rem;
  color: var(--dashboard-text);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.email-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.email-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.2s ease;
}

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

.email-item:hover {
  background: #f8fafc;
  border-radius: 4px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.email-ceo-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: 50%;
  font-size: 0.85rem;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.email-ceo-indicator.disabled {
  background: linear-gradient(135deg, #94a3b8, #cbd5e1);
}

.email-address {
  flex: 1;
  color: var(--dashboard-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.email-address:hover {
  color: var(--primary);
}

.email-address.masked {
  color: #6b7280;
  cursor: default;
}

.email-address.masked:hover {
  color: #6b7280;
}

/* CEO Email Help Icon in Detail Popup */
.ceo-email-help-icon-popup {
  margin-left: 0.5rem;
  color: #2196f3;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.ceo-email-help-icon-popup:hover {
  color: #1976d2;
  transform: scale(1.1);
}

.ceo-email-help-icon-popup i {
  filter: drop-shadow(0 1px 2px rgba(33, 150, 243, 0.2));
}

.email-source-label {
  font-size: 0.75rem;
  color: var(--dashboard-text-light);
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-weight: 500;
}

.email-source-label.ceo {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}

.email-source-label.disabled {
  background: #e2e8f0;
  color: #64748b;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .email-login-prompt {
    padding: 1rem;
  }
  
  .email-addresses {
    padding: 0.75rem;
  }
  
  .email-item {
    gap: 0.5rem;
  }
  
  .email-ceo-indicator {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }
  
  .email-address {
    font-size: 0.85rem;
  }
}

/* Responsive design for download buttons */
@media (max-width: 600px) {
  .download-years {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.4rem;
  }
  
  .regnskap-download-btn {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }
}

.loading { text-align: center; color: var(--dashboard-text-light); padding: 2rem 0; }
.error { text-align: center; color: #ef4444; padding: 2rem 0; }

/* Nøkkeltall (Key Metrics) */
.key-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
  position: relative;
  border: 1px solid var(--dashboard-border);
}

.metric-info-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.metric-info-icon:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

.metric-info-popup {
  position: absolute;
  top: 35px;
  right: 10px;
  width: 340px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  padding: 1.5rem;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--dashboard-border);
  max-height: 500px;
  overflow-y: auto;
}

.metric-info-popup.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.metric-info-popup::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 20px;
  width: 16px;
  height: 16px;
  background: white;
  transform: rotate(45deg);
  border-left: 1px solid var(--dashboard-border);
  border-top: 1px solid var(--dashboard-border);
}

.info-popup-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dashboard-text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--dashboard-border);
}

.info-popup-section {
  margin-bottom: 1rem;
}

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

.info-popup-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dashboard-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.info-popup-formula {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--dashboard-text);
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--primary);
  white-space: nowrap;
  overflow-x: auto;
  text-align: center;
}

.info-popup-thresholds {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.threshold-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.threshold-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  min-width: 120px;
  text-align: center;
}

.threshold-value {
  color: var(--dashboard-text-light);
  font-weight: 500;
}

.metric-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dashboard-text-light);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Speedometer gauge */
.metric-visual {
  position: relative;
  width: 140px;
  height: 75px;
  margin: 0 auto 0.5rem;
}

.metric-speedometer {
  position: relative;
  width: 100%;
  height: 100%;
}

.speedometer-background {
  position: absolute;
  width: 140px;
  height: 70px;
  overflow: hidden;
  top: 0;
  left: 0;
}

.speedometer-arc {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  /* Top half only - colors from left to right on top */
  background: conic-gradient(
    from 180deg,
    /* Top half - left to right with 5 colors */
    #dc2626 90deg 126deg,    /* rød (leftmost) */
    #f97316 126deg 162deg,   /* orange */
    #84cc16 162deg 198deg,   /* lysegrønn */
    #22c55e 198deg 234deg,   /* grønn */
    #065f46 234deg 270deg,   /* mørkegrønn (rightmost) */
    /* Bottom half - transparent */
    transparent 270deg 450deg
  );
  position: absolute;
  top: 0;
  left: 0;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

/* Segment dividers */
.speedometer-segments {
  position: absolute;
  width: 140px;
  height: 70px;
  top: 0;
  left: 0;
  pointer-events: none;
}

.segment-divider {
  position: absolute;
  width: 1px;
  height: 70px;
  background: rgba(255,255,255,0.4);
  transform-origin: bottom center;
  bottom: 0;
  left: 69.5px;
}

.segment-divider:nth-child(1) { transform: rotate(-54deg); }
.segment-divider:nth-child(2) { transform: rotate(-18deg); }
.segment-divider:nth-child(3) { transform: rotate(18deg); }
.segment-divider:nth-child(4) { transform: rotate(54deg); }

/* Mid-segment dividers - thinner lines in the middle of each color */
.segment-divider:nth-child(5) { transform: rotate(-72deg); opacity: 0.5; }
.segment-divider:nth-child(6) { transform: rotate(-36deg); opacity: 0.5; }
.segment-divider:nth-child(7) { transform: rotate(0deg); opacity: 0.5; }
.segment-divider:nth-child(8) { transform: rotate(36deg); opacity: 0.5; }
.segment-divider:nth-child(9) { transform: rotate(72deg); opacity: 0.5; }

.speedometer-center {
  position: absolute;
  width: 100px;
  height: 50px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-radius: 50px 50px 0 0;
  top: 20px;
  left: 20px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.speedometer-needle {
  position: absolute;
  width: 2px;
  height: 45px;
  background: linear-gradient(to top, #1e293b, #475569);
  bottom: 10px;
  left: 69px;
  transform-origin: bottom center;
  transform: rotate(var(--needle-angle));
  z-index: 4;
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

.speedometer-needle::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, #475569, #1e293b);
  border-radius: 50%;
  bottom: -4px;
  left: -3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.speedometer-needle::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-bottom: 15px solid #1e293b;
  top: -15px;
  left: -2px;
}

.metric-value-display {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--dashboard-text);
  text-align: center;
  background: white;
  padding: 2px 8px;
  border-radius: 4px;
}

.metric-value-display.small-font {
  font-size: 1.1rem;
}

.speedometer-labels {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.speedometer-label {
  position: absolute;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--dashboard-text-light);
  transform-origin: center;
}

.speedometer-label.min {
  bottom: -5px;
  left: 5px;
}

.speedometer-label.max {
  bottom: -5px;
  right: 5px;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--dashboard-text-light);
  margin-top: 0.25rem;
}

.metric-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-status.meget-god {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.metric-status.god {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.metric-status.tilfredsstillende {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.metric-status.svak {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.metric-status.ikke-tilfredsstillende {
  background: linear-gradient(135deg, #991b1b, #7f1d1d);
  color: white;
}

.detailed-metrics {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid var(--dashboard-border);
}

.detailed-metrics h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dashboard-text);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--dashboard-border);
}

.metrics-matrix {
  display: table;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--dashboard-border);
}

.metrics-row {
  display: table-row;
}

.metrics-row:nth-child(even) {
  background: #f8fafc;
}

.metric-cell {
  display: table-cell;
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--dashboard-border);
  border-bottom: 1px solid var(--dashboard-border);
  vertical-align: middle;
}

.metric-cell:last-child {
  border-right: none;
}

.metrics-row:last-child .metric-cell {
  border-bottom: none;
}

.metric-cell.label {
  font-size: 0.8rem;
  color: var(--dashboard-text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, #f1f5f9, #f8fafc);
  width: 45%;
  cursor: help;
  position: relative;
}

.metric-cell.label:hover {
  color: var(--dashboard-text);
  text-decoration: underline dotted;
}

.metric-cell.value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dashboard-text);
  text-align: right;
  width: 55%;
}

.metric-cell.value.positive {
  color: #059669;
}

.metric-cell.value.negative {
  color: #dc2626;
}

.credit-assessment {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 12px;
  padding: 1.5rem;
  border-left: 4px solid #f59e0b;
  position: relative;
}

.credit-assessment::before {
  content: '⚠';
  position: absolute;
  top: 1.5rem;
  left: -2px;
  font-size: 1.5rem;
  color: #f59e0b;
  background: white;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.credit-assessment h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dashboard-text);
  margin-bottom: 1rem;
  margin-left: 2rem;
}

.credit-recommendation {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--dashboard-text);
  margin-left: 2rem;
}

.credit-recommendation strong {
  color: var(--dashboard-text);
  font-weight: 600;
}

@media (max-width: 768px) {
  
  /* Mobile notater adjustments */
  .notater-container {
    padding: 0.75rem;
  }
  
  .notater-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .notater-info {
    justify-content: center;
  }
  
  .notater-buttons {
    justify-content: center;
  }
  
  /* Horizontal scrolling tabs */
  .detail-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }
  
  .detail-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  
  .detail-tab {
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-block;
    min-width: auto;
  }
  
  /* Oversikt tab improvements */
  .overview-top {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  /* Single column metric grid on mobile */
  .metric-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .metric-item {
    padding: 1rem;
  }
  
  /* Single column info grid on mobile */
  .info-grid {
    gap: 0.75rem;
  }
  
  .info-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--dashboard-border);
  }
  
  .info-row:last-child {
    border-bottom: none;
  }
  
  .info-label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
  }
  
  .info-value {
    font-size: 0.95rem;
    padding-left: 0;
  }
  
  /* Key metrics adjustments */
  .key-metrics-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .metrics-list {
    grid-template-columns: 1fr;
  }
  
  .metric-info-popup {
    width: calc(100vw - 40px);
    right: -10px;
    left: auto;
  }
  
  /* Modal header adjustments */
  .detail-popup-header {
    padding: 1rem;
    position: relative;
  }
  
  .detail-popup-title {
    font-size: 1.1rem;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .detail-popup-title .company-favicon,
  .detail-popup-title #detailCompanyName {
    order: 1;
  }
  
  .detail-popup-title .orgnr {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--dashboard-text-light);
    margin-left: 0;
    order: 2;
    flex-basis: 100%;
    margin-top: 0.25rem;
  }
  
  .detail-popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }
  
  .detail-popup-body {
    padding: 1rem;
  }
}

/* Smooth scrollbar for info popup */
.metric-info-popup::-webkit-scrollbar {
  width: 6px;
}

.metric-info-popup::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.metric-info-popup::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.metric-info-popup::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===========================
   KUNNGJØRINGER TAB STYLES
   =========================== */

/* Kunngjøringer container */
.kunngjoringer-container {
  width: 100%;
  margin: 0;
  padding: 1rem;
}

.kunngjoringer-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.kunngjoringer-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dashboard-text);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.kunngjoringer-title i {
  color: var(--primary);
}

.kunngjoringer-subtitle {
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
  margin: 0;
}

.kunngjoringer-content {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  min-height: 300px;
}

/* States */
.kunngjoringer-loading,
.kunngjoringer-error,
.kunngjoringer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.kunngjoringer-loading .loading-spinner i {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.kunngjoringer-loading .loading-text {
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
}

.kunngjoringer-error .error-icon i {
  font-size: 2.5rem;
  color: #dc2626;
  margin-bottom: 1rem;
}

.kunngjoringer-error h4 {
  color: var(--dashboard-text);
  margin-bottom: 0.5rem;
}

.kunngjoringer-error p {
  color: var(--dashboard-text-light);
  margin-bottom: 1.5rem;
}

.retry-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.retry-btn:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.kunngjoringer-empty .empty-icon i {
  font-size: 2.5rem;
  color: var(--dashboard-text-light);
  margin-bottom: 1rem;
}

.kunngjoringer-empty h4 {
  color: var(--dashboard-text);
  margin-bottom: 0.5rem;
}

.kunngjoringer-empty p {
  color: var(--dashboard-text-light);
  max-width: 400px;
}

/* Announcements list */
.kunngjoringer-list {
  padding: 1rem;
}

.announcement-item {
  border-bottom: 1px solid var(--dashboard-border);
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
}

.announcement-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
}

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

.announcement-item:hover .announcement-header {
  background: var(--dashboard-hover);
}

.announcement-item.recent .announcement-header {
  background: linear-gradient(90deg, rgba(95, 199, 62, 0.05), transparent);
}

.announcement-item.recent {
  border-left: 3px solid var(--primary);
}

.announcement-date {
  flex-shrink: 0;
  text-align: center;
  position: relative;
}

.date-day {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dashboard-text);
  line-height: 1;
}

.date-month-year {
  font-size: 0.8rem;
  color: var(--dashboard-text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-badge {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.announcement-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.announcement-type {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dashboard-text);
  line-height: 1.4;
}

.announcement-expand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--dashboard-text-light);
  transition: all 0.2s ease;
}

.announcement-item:hover .announcement-expand-icon {
  color: var(--primary);
}

.announcement-expand-icon i {
  transition: transform 0.2s ease;
}

/* Footer */
.kunngjoringer-footer {
  padding: 1rem 1.25rem;
  background: var(--dashboard-hover);
  border-top: 1px solid var(--dashboard-border);
}

.source-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--dashboard-text-light);
  font-size: 0.85rem;
}

.source-info i {
  color: var(--primary);
}

.brreg-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  margin-left: 0.5rem;
}

.brreg-link:hover {
  text-decoration: underline;
}

/* Announcement Detail Modal */
.announcement-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  z-index: 10025;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.announcement-detail-modal {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  width: min(600px, 90vw);
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.announcement-detail-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--dashboard-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dashboard-hover);
}

.announcement-detail-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dashboard-text);
}

.announcement-detail-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--dashboard-text-light);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

.announcement-detail-close:hover {
  background: var(--dashboard-border);
  color: var(--dashboard-text);
}

.announcement-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.announcement-detail-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.announcement-detail-loading .loading-spinner i {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.announcement-detail-loading .loading-text {
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
}

.announcement-detail-info {
  margin-bottom: 1.5rem;
}

.detail-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.detail-date,
.detail-type {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
}

.detail-date i,
.detail-type i {
  color: var(--primary);
}

.announcement-structured-data {
  margin-bottom: 1.5rem;
}

.announcement-structured-data h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dashboard-text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.announcement-structured-data h4 i {
  color: var(--primary);
}

.structured-data-grid {
  background: var(--dashboard-hover);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--dashboard-border);
}

.data-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--dashboard-border);
}

.data-row:last-child {
  border-bottom: none;
}

.data-label {
  font-weight: 600;
  color: var(--primary);
  font-size: 0.9rem;
}

.data-value {
  color: var(--dashboard-text);
  font-size: 0.9rem;
}

.announcement-raw-content {
  margin-bottom: 1rem;
}

.announcement-raw-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dashboard-text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.announcement-raw-content h4 i {
  color: var(--primary);
}

.raw-content-text {
  background: var(--dashboard-hover);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--dashboard-border);
  color: var(--dashboard-text);
  font-size: 0.9rem;
  line-height: 1.6;
}

.detail-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.detail-error .error-icon i {
  font-size: 2rem;
  color: #dc2626;
  margin-bottom: 1rem;
}

.detail-error h4 {
  color: var(--dashboard-text);
  margin-bottom: 0.5rem;
}

.detail-error p {
  color: var(--dashboard-text-light);
}





/* Mobile responsive */
/* Announcement details (inline expanded content) */
.announcement-details {
  background: #fafbfc;
  border-top: 1px solid var(--dashboard-border);
  padding: 1.5rem;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
}

.announcement-details-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
  padding: 1rem;
}

.announcement-details-loading i {
  color: var(--primary);
}

.inline-announcement-detail {
  animation: fadeIn 0.3s ease-out;
}

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

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

.detail-meta-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.detail-date-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
}

.detail-date-inline i {
  color: var(--primary);
}



.announcement-structured-data-inline {
  margin-bottom: 1.5rem;
}

.announcement-structured-data-inline h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dashboard-text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.announcement-structured-data-inline h5 i {
  color: var(--primary);
}

.structured-data-grid-inline {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--dashboard-border);
}

.data-row-inline {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--dashboard-border);
}

.data-row-inline:last-child {
  border-bottom: none;
}

.data-label-inline {
  font-weight: 600;
  color: var(--primary);
  font-size: 0.85rem;
}

.data-value-inline {
  color: var(--dashboard-text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.full-content-row {
  grid-column: 1 / -1;
}

.full-content-row .data-label-inline {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.full-content-row .data-value-inline {
  background: #f8fafc;
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  padding: 1rem;
  line-height: 1.6;
  font-size: 0.9rem;
  white-space: pre-line; /* Preserve line breaks */
  word-wrap: break-word;
}

.announcement-raw-content-inline {
  margin-bottom: 1rem;
}

.announcement-raw-content-inline h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dashboard-text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.announcement-raw-content-inline h5 i {
  color: var(--primary);
}

.raw-content-text-inline {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--dashboard-border);
  color: var(--dashboard-text);
  font-size: 0.85rem;
  line-height: 1.6;
}

.inline-detail-error {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

.error-icon-inline i {
  font-size: 1.25rem;
  color: #dc2626;
}

.error-content-inline h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: var(--dashboard-text);
}

.error-content-inline p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--dashboard-text-light);
}

@media (max-width: 768px) {
  .kunngjoringer-container {
    padding: 0;
    margin: 0;
    width: 100%;
  }
  
  .kunngjoringer-content {
    border-radius: 0;
    border-left: none;
    border-right: none;
    width: 100%;
    margin: 0;
  }
  
  .kunngjoringer-list {
    padding: 0;
  }
  
  .announcement-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem;
  }
  
  .announcement-date {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  
  .date-day {
    font-size: 1.25rem;
  }
  
  .announcement-content {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }
  
  .detail-meta-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .data-row-inline {
    gap: 0.25rem;
  }
  
  .announcement-details {
    padding: 1rem;
  }
  
  .announcement-detail-modal {
    width: 95vw;
    max-height: 85vh;
  }
  
  .announcement-detail-body {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .kunngjoringer-container {
    padding: 0;
  }
  
  .kunngjoringer-content {
    border-radius: 0;
    border: none;
  }
  
  .kunngjoringer-list {
    padding: 0;
  }
  
  .kunngjoringer-loading,
  .kunngjoringer-error,
  .kunngjoringer-empty {
    padding: 2rem 1rem;
  }
  
  .announcement-header {
    padding: 0.75rem;
  }
  
  .announcement-details {
    padding: 0.75rem;
  }
  

  
  .announcement-detail-header {
    padding: 0.75rem 1rem;
  }
  
  .announcement-detail-header h3 {
    font-size: 1rem;
  }
}

/* ===========================
   NOTATER TAB STYLES
   =========================== */

/* Tab glow effect when notes exist */
.detail-tab.has-notes {
  position: relative;
  background: linear-gradient(135deg, rgba(95, 199, 62, 0.1), rgba(74, 160, 47, 0.1));
  border: 1px solid rgba(95, 199, 62, 0.3);
  color: var(--primary);
}

.detail-tab.has-notes::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  z-index: -1;
  opacity: 0.1;
  animation: notesGlow 2s ease-in-out infinite alternate;
}

@keyframes notesGlow {
  0% { opacity: 0.1; transform: scale(1); }
  100% { opacity: 0.3; transform: scale(1.02); }
}

/* Notater container */
.notater-container {
  width: 100%;
  padding: 1rem;
}

.notater-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.notater-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dashboard-text);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.notater-title i {
  color: var(--primary);
}

.notater-subtitle {
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
  margin: 0;
}

.notater-content {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.textarea-container {
  position: relative;
}

.notater-textarea {
  width: 100%;
  min-height: 300px;
  border: none;
  padding: 1.25rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--dashboard-text);
  background: var(--dashboard-white);
  resize: vertical;
  outline: none;
  transition: var(--transition);
}

.notater-textarea::placeholder {
  color: var(--dashboard-text-light);
  font-style: italic;
}

.notater-textarea:focus {
  background: #fafbfc;
}

.notater-actions {
  padding: 1rem 1.25rem;
  background: var(--dashboard-hover);
  border-top: 1px solid var(--dashboard-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.notater-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--dashboard-text-light);
  font-size: 0.85rem;
}

.notater-info i {
  color: var(--primary);
}

.notater-separator {
  color: var(--dashboard-border);
}

.notater-buttons {
  display: flex;
  gap: 0.5rem;
}

.notater-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  background: var(--dashboard-white);
  color: var(--dashboard-text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notater-btn:hover {
  background: var(--dashboard-hover);
  transform: translateY(-1px);
}

.notater-btn-clear {
  color: #dc2626;
  border-color: #fecaca;
}

.notater-btn-clear:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.notater-btn-copy {
  color: var(--primary);
  border-color: rgba(95, 199, 62, 0.3);
}

.notater-btn-copy:hover {
  background: rgba(95, 199, 62, 0.05);
  border-color: rgba(95, 199, 62, 0.5);
}

/* Confirmation dialog */
.notater-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10030;
  backdrop-filter: blur(4px);
}

.notater-confirm-dialog {
  background: var(--dashboard-white);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: min(400px, 90vw);
  max-width: 400px;
  overflow: hidden;
}

.notater-confirm-header {
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--dashboard-border);
}

.notater-confirm-header i {
  color: #f59e0b;
  font-size: 1.25rem;
}

.notater-confirm-header h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dashboard-text);
}

.notater-confirm-body {
  padding: 1.25rem 1.5rem;
}

.notater-confirm-body p {
  margin: 0 0 0.75rem 0;
  color: var(--dashboard-text);
  line-height: 1.5;
}

.notater-confirm-body p:last-child {
  margin-bottom: 0;
}

.notater-confirm-warning {
  color: #dc2626;
  font-weight: 500;
  font-size: 0.9rem;
}

.notater-confirm-actions {
  padding: 1rem 1.5rem 1.25rem;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.notater-btn-cancel {
  background: var(--dashboard-hover);
  border-color: var(--dashboard-border);
}

.notater-btn-cancel:hover {
  background: #e5e7eb;
}

.notater-btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
}

.notater-btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  transform: translateY(-1px);
}

/* Save status indicators */
#notater-save-status.saving {
  color: #f59e0b;
}

#notater-save-status.saved {
  color: #10b981;
}

#notater-save-status.error {
  color: #dc2626;
}

/* Extra small mobile screens */
@media (max-width: 480px) {
  
  .detail-popup-header {
    padding: 0.75rem;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    position: relative;
  }
  
  .detail-popup-title {
    font-size: 1rem;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .detail-popup-title .company-favicon,
  .detail-popup-title #detailCompanyName {
    order: 1;
  }
  
  .detail-popup-title .orgnr {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--dashboard-text-light);
    margin-left: 0;
    order: 2;
    flex-basis: 100%;
    margin-top: 0.25rem;
  }
  
  .detail-popup-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
  }
  
  .detail-tabs {
    padding: 0.25rem;
    gap: 0.125rem;
  }
  
  .detail-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .detail-popup-body {
    padding: 0.75rem;
  }
  
  .metric-item {
    padding: 0.75rem;
  }
  
  .info-row {
    padding: 0.375rem 0;
  }
  
  .info-label {
    font-size: 0.8rem;
  }
  
  .info-value {
    font-size: 0.9rem;
  }
  
  .metric-info-popup {
    width: calc(100vw - 20px);
    left: 10px;
    right: auto;
    max-height: 300px;
  }
  
  /* Small screen notater adjustments */
  .notater-container {
    padding: 0.5rem;
  }
  
  .notater-textarea {
    min-height: 250px;
    padding: 1rem;
    font-size: 0.9rem;
  }
  
  .notater-actions {
    padding: 0.75rem 1rem;
  }
  
  .notater-btn {
    padding: 0.625rem 0.875rem;
    font-size: 0.8rem;
  }
  
  .notater-confirm-dialog {
    width: 95vw;
  }
}

/* ===========================
   ROLLER TAB STYLES
   =========================== */

/* Roller container */
.roller-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.roller-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dashboard-text);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.roller-title i {
  color: var(--primary);
}

.roller-subtitle {
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
  margin: 0;
}

.roller-content {
  width: 100%;
}

/* States */
.roller-loading,
.roller-error,
.roller-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.roller-loading .loading-spinner i {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.roller-loading .loading-text {
  color: var(--dashboard-text-light);
  font-size: 0.9rem;
}

.roller-error .error-icon i {
  font-size: 2.5rem;
  color: #dc2626;
  margin-bottom: 1rem;
}

.roller-error h4 {
  color: var(--dashboard-text);
  margin-bottom: 0.5rem;
}

.roller-error p {
  color: var(--dashboard-text-light);
  margin-bottom: 1.5rem;
}

.roller-empty .empty-icon i {
  font-size: 2.5rem;
  color: var(--dashboard-text-light);
  margin-bottom: 1rem;
}

.roller-empty h4 {
  color: var(--dashboard-text);
  margin-bottom: 0.5rem;
}

.roller-empty p {
  color: var(--dashboard-text-light);
  max-width: 400px;
}

/* Summary Cards */
.roller-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.summary-card {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.summary-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.summary-content {
  flex: 1;
}

.summary-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dashboard-text);
  line-height: 1;
}

.summary-label {
  font-size: 0.85rem;
  color: var(--dashboard-text-light);
  font-weight: 500;
  margin-top: 0.25rem;
}

/* Role Categories */
.role-categories {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.role-section {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.section-header {
  background: var(--dashboard-hover);
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--dashboard-border);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dashboard-text);
  margin: 0 0 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title i {
  color: var(--primary);
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--dashboard-text-light);
  margin: 0;
}

.role-list {
  padding: 0;
}

/* Role Items */
.role-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--dashboard-border);
  cursor: pointer;
  transition: var(--transition);
}

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

.role-item:hover {
  background: var(--dashboard-hover);
}

.role-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.role-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.role-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(95, 199, 62, 0.1), rgba(74, 160, 47, 0.1));
  border: 1px solid rgba(95, 199, 62, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 0.9rem;
}

.role-info {
  flex: 1;
}

.role-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dashboard-text);
  margin-bottom: 0.125rem;
}

.role-name {
  font-size: 0.85rem;
  color: var(--dashboard-text-light);
}

.role-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.role-birth-year {
  font-size: 0.75rem;
  color: var(--dashboard-text-light);
  background: var(--dashboard-hover);
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-weight: 500;
}

.role-entity-badge {
  font-size: 0.75rem;
  color: var(--primary);
  background: rgba(95, 199, 62, 0.1);
  border: 1px solid rgba(95, 199, 62, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Role Detail Modal */
.role-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  z-index: 10025;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.role-detail-modal {
  background: var(--dashboard-white);
  border: 1px solid var(--dashboard-border);
  width: min(500px, 90vw);
  max-height: 70vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.role-detail-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--dashboard-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dashboard-hover);
}

.role-detail-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dashboard-text);
}

.role-detail-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--dashboard-text-light);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

.role-detail-close:hover {
  background: var(--dashboard-border);
  color: var(--dashboard-text);
}

.role-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.role-detail-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-row span {
  font-size: 0.95rem;
  color: var(--dashboard-text);
  padding: 0.5rem 0.75rem;
  background: var(--dashboard-hover);
  border-radius: 6px;
  border: 1px solid var(--dashboard-border);
}

/* Footer */
.roller-footer {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--dashboard-hover);
  border-top: 1px solid var(--dashboard-border);
  border-radius: 0 0 12px 12px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .roller-summary {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }
  
  .summary-card {
    padding: 1rem;
  }
  
  .summary-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
  
  .summary-number {
    font-size: 1.25rem;
  }
  
  .role-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .role-main {
    gap: 0.5rem;
  }
  
  .role-icon {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
  
  .role-meta {
    justify-content: flex-start;
  }
  
  .role-detail-modal {
    width: 95vw;
    max-height: 80vh;
  }
  
  .role-detail-body {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .roller-header {
    margin-bottom: 1rem;
  }
  
  .roller-title {
    font-size: 1.1rem;
  }
  
  .summary-card {
    padding: 0.75rem;
  }
  
  .role-item {
    padding: 0.75rem 1rem;
  }
  
  .section-header {
    padding: 0.75rem 1rem;
  }
  
  .role-detail-header {
    padding: 0.75rem 1rem;
  }
  
  .role-detail-header h3 {
    font-size: 1rem;
  }
}

/* Shareholders Table Styles */
.shareholders-table-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  border-radius: 8px;
}

/* Add subtle shadow to indicate scrollable content */
.shareholders-table-container::-webkit-scrollbar {
  height: 8px;
}

.shareholders-table-container::-webkit-scrollbar-track {
  background: var(--dashboard-hover);
  border-radius: 4px;
}

.shareholders-table-container::-webkit-scrollbar-thumb {
  background: var(--dashboard-text-light);
  border-radius: 4px;
}

.shareholders-table-container::-webkit-scrollbar-thumb:hover {
  background: var(--dashboard-text);
}

.shareholders-table {
  min-width: 650px;
  width: 100%;
}

/* Ensure proper column sizing */
.shareholders-header,
.shareholder-row {
  width: 100%;
}

/* Add gradient indicators for scrollable content */
.shareholders-table-container::before,
.shareholders-table-container::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 1;
  display: none;
}

.shareholders-table-container::before {
  left: 0;
  background: linear-gradient(to right, var(--dashboard-card), transparent);
}

.shareholders-table-container::after {
  right: 0;
  background: linear-gradient(to left, var(--dashboard-card), transparent);
}

/* Show gradient when scrollable */
@media (max-width: 768px) {
  .shareholders-table-container::after {
    display: block;
  }
  
  /* Add hint text on mobile */
  .shareholders-table-container {
    position: relative;
  }
  
  .shareholders-table-container::before {
    content: '← Swipe to see more →';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--dashboard-text-light);
    white-space: nowrap;
    background: none;
    width: auto;
    display: none;
  }
}
