:root {
  color-scheme: light dark;

  /* Primaris Primary Color Palette */
  --primaris-red: #E12727;
  --primaris-dark-gray: #4B4F55;
  --primaris-medium-gray: #787A80;
  --primaris-light-gray-1: #EDEDED;
  --primaris-light-gray-2: #C9C9CC;
  --primaris-blue: #6B91BA;
  --primaris-tan: #BFB59E;

  /* Primaris Secondary Color Palette (Community-focused) */
  --primaris-teal: #2E9EA6;
  --primaris-green: #9EB03D;
  --primaris-gold: #E5A64A;
  --primaris-purple: #A12966;

  /* Semantic Colors */
  --color-error: #b42318;
  --color-success: #0b6a0b;
  --color-info: var(--primaris-blue);

  /* Background Colors */
  --bg-body: #f5f5f5;
  --bg-white: #fff;
  --bg-light: var(--primaris-light-gray-1);

  /* Text Colors */
  --text-primary: var(--primaris-dark-gray);
  --text-secondary: var(--primaris-medium-gray);
  --text-light: #888;
  --text-on-dark: #fff;

  /* Primaris Brand Typography */
  --font-headline: 'Georgia', serif;  /* Fallback for Sentinel */
  --font-body: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;

  /* Primaris Brand Assets */
  --logo-2color: url('/assets/logos/Primaris 2c logo RGB.png');
  --logo-white: url('/assets/logos/Primaris 1c logo White RGB.png');
  --logo-red: url('/assets/logos/Primaris 1c logo Red RGB.png');
  --logo-gray: url('/assets/logos/Primaris 1c logo Gray RGB.png');
  --logo-black: url('/assets/logos/Primaris 1c logo Black RGB.png');

  /* Apply body font */
  font-family: var(--font-body);
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  font-family: var(--font-body);
}

/* Primaris Pattern Background (subtle) */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/assets/patterns/Primaris_TrapeziodPattern_LightGray1_RGB.png');
  background-repeat: repeat;
  background-size: 300px;
  opacity: 0.08;
  z-index: -1;
  pointer-events: none;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background-color: var(--primaris-dark-gray);
  background-image: url('/assets/patterns/Primaris_ArrrowPattern_LightGray1_RGB.png');
  background-repeat: repeat;
  background-size: 50% auto;
  background-blend-mode: overlay;
  color: var(--text-on-dark);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--primaris-dark-gray);
  opacity: 0.92;
  z-index: 0;
  pointer-events: none;
}

header > * {
  position: relative;
  z-index: 1;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.primaris-logo {
  height: 90px;
  min-height: 25px;
  width: auto;
  object-fit: contain;
}

header h1 {
  margin: 0;
  margin-bottom: -6px;
  font-size: 1.5rem;
  font-family: var(--font-headline);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: 0.4rem;
  cursor: pointer;
  background-color: var(--bg-white);
  color: var(--primaris-dark-gray);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.nav-button:hover {
  background-color: var(--primaris-light-gray-1);
  transform: translateY(-1px);
}

header button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: 0.4rem;
  cursor: pointer;
  background-color: var(--bg-white);
  color: var(--primaris-dark-gray);
  font-weight: 600;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

header button:hover {
  background-color: var(--primaris-light-gray-1);
  transform: translateY(-1px);
}

main {
  padding: 2rem;
}

#status {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #555;
}

#status.error {
  color: #b42318;
}

#status.success {
  color: #0b6a0b;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.tickets-panel {
  overflow-x: auto;
  min-width: 0;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.table-toolbar-left,
.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#clearFiltersButton {
  padding: 0.45rem 0.9rem;
  border-radius: 0.4rem;
  border: 1px solid var(--primaris-red);
  background-color: var(--bg-white);
  color: var(--primaris-red);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

#clearFiltersButton.inactive {
  opacity: 0.65;
  cursor: default;
}

#clearFiltersButton:hover {
  background-color: var(--primaris-light-gray-1);
}

#clearFiltersButton.inactive:hover {
  background-color: var(--bg-white);
}

.density-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.density-control label {
  font-weight: 600;
}

.density-control select {
  padding: 0.4rem 0.6rem;
  font-size: 0.95rem;
  border: 1px solid var(--primaris-light-gray-2);
  border-radius: 0.3rem;
  background-color: var(--bg-white);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
}

.column-control button {
  padding: 0.45rem 0.9rem;
  border-radius: 0.4rem;
  border: 1px solid var(--primaris-red);
  background-color: var(--bg-white);
  color: var(--primaris-red);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.column-control button:hover {
  background-color: var(--primaris-light-gray-1);
}

.column-control button .icon {
  font-size: 1rem;
}

.column-manager-panel {
  margin-bottom: 1rem;
  background-color: #fff;
  border: 1px solid #d0d7de;
  border-radius: 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  padding: 1rem;
}

.column-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.column-manager-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--primaris-red);
  font-family: var(--font-headline);
}

.column-manager-header button {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0;
}

.column-manager-header button:hover {
  color: var(--primaris-red);
}

.column-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.column-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background-color 0.15s;
}

.column-list label:hover {
  background-color: #F8F8F8;
}

.column-list input[type="checkbox"] {
  cursor: pointer;
}

.column-manager-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.column-manager-actions button {
  padding: 0.45rem 0.9rem;
  border-radius: 0.4rem;
  border: 1px solid var(--primaris-red);
  background-color: #fff;
  color: var(--primaris-red);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.column-manager-actions button:hover {
  background-color: var(--primaris-light-gray-1);
}

.page-size-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.page-size-control select {
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
  border: 1px solid #b5bdc7;
  border-radius: 0.3rem;
  background-color: #fff;
  color: #222;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.pagination-controls button {
  padding: 0.4rem 0.75rem;
  border-radius: 0.4rem;
  border: 1px solid var(--primaris-red);
  background-color: var(--primaris-red);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.pagination-controls button:hover:not([disabled]) {
  background-color: #C81E1E;
}

.pagination-controls button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  table-layout: auto;
}

/* Column-specific widths for better proportions */
th:nth-child(1),
td:nth-child(1) {
  width: 12%;
  max-width: 180px;
  word-break: break-all;
  font-size: 0.85rem;
}

th:nth-child(2),
td:nth-child(2) {
  width: 45%;
  min-width: 250px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 15%;
  min-width: 120px;
  white-space: nowrap;
}

th:nth-child(4),
td:nth-child(4) {
  width: 12%;
  text-align: center;
}

th:nth-child(5),
td:nth-child(5) {
  width: 8%;
  text-align: center;
}

thead {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

th,
td {
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

thead th {
  border-bottom: none;
  padding-bottom: 0.5rem;
}

/* Density modes */
table.density-compact th,
table.density-compact td {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

table.density-comfortable th,
table.density-comfortable td {
  padding: 0.75rem 1rem;
}

table.density-spacious th,
table.density-spacious td {
  padding: 1rem 1.25rem;
}

th {
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: bottom;
}

th.column-hidden,
td.column-hidden {
  display: none;
}

th .header-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  border: none;
  background: none;
  font: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

th .header-button:focus-visible {
  outline: 2px solid var(--primaris-red);
  outline-offset: 2px;
}

th .header-button .header-label {
  flex: 1 1 auto;
  font-size: 0.85rem;
}

th .header-button .sort-indicator {
  flex: 0 0 auto;
  min-width: 0.75rem;
  text-align: right;
  color: var(--primaris-red);
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.9;
}

th .header-button:not(.is-sorted) .sort-indicator {
  color: #999;
  font-weight: 400;
  opacity: 0.5;
}

th .header-button:hover .sort-indicator {
  opacity: 1;
}

.filter-input {
  margin-top: 0.4rem;
  width: 100%;
  padding: 0.3rem 0.45rem;
  border: 1px solid #c5cbd3;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  color: #222;
  background-color: #fff;
}

.filter-input:focus {
  border-color: var(--primaris-red);
  box-shadow: 0 0 0 1px rgba(0, 69, 120, 0.2);
  outline: none;
}

.date-range-filter {
  margin-top: 0.4rem;
}

.date-range-input {
  width: 100%;
  padding: 0.3rem 0.45rem;
  border: 1px solid #c5cbd3;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  color: #222;
  background-color: #fff;
  cursor: pointer;
}

.date-range-input:focus {
  border-color: var(--primaris-red);
  box-shadow: 0 0 0 1px rgba(0, 69, 120, 0.2);
  outline: none;
}

.dropdown-filter-container {
  margin-top: 0.4rem;
  position: relative;
}

.dropdown-filter-toggle {
  width: 100%;
  padding: 0.3rem 0.45rem;
  border: 1px solid #c5cbd3;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  color: #222;
  background-color: #fff;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropdown-filter-toggle::after {
  content: '▼';
  font-size: 0.7rem;
  color: #666;
  margin-left: 0.5rem;
}

.dropdown-filter-toggle:hover {
  border-color: var(--primaris-red);
  background-color: #f9fafb;
}

.dropdown-filter-toggle:focus {
  border-color: var(--primaris-red);
  box-shadow: 0 0 0 1px rgba(0, 69, 120, 0.2);
  outline: none;
}

.dropdown-filter-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  background-color: #fff;
  border: 1px solid #c5cbd3;
  border-radius: 0.25rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  min-width: 200px;
  width: max-content;
  max-width: 300px;
}

.dropdown-filter-option {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1.2;
  transition: background-color 0.15s;
}

.dropdown-filter-option:hover {
  background-color: #F8F8F8;
}

.dropdown-filter-option input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

.dropdown-filter-option span {
  flex: 1;
  user-select: none;
}

.sort-indicator-multi {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.sort-order-badge {
  display: inline-block;
  min-width: 1rem;
  padding: 0.1rem 0.3rem;
  background-color: var(--primaris-red);
  color: #fff;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}

th .header-button.is-sorted-multi .sort-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: #F8F8F8;
  cursor: pointer;
}

tbody tr.selected {
  background-color: var(--primaris-light-gray-1);
}

tbody tr.selected:hover {
  background-color: #d6e8f7;
}

tbody td {
  font-size: 0.9rem;
  color: #333;
}

/* Make GUIDs/IDs more subtle */
tbody td:first-child {
  color: #666;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.8rem;
}

td.empty-row {
  text-align: center;
  font-style: italic;
  color: #555;
}

.empty-state {
  padding: 1rem;
  text-align: center;
  color: #777;
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

#ticketDetails {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  position: sticky;
  top: 2rem;
  min-width: 0;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.details-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

#closeDetailsButton {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

#closeDetailsButton:hover {
  color: var(--primaris-red);
}

#ticketDetailsStatus {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #555;
}

#summarySection {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid #d0d7de;
  border-radius: 0.5rem;
  background-color: #f9fafb;
}

#summarySection h3 {
  margin: 0 0 0.5rem;
}

#summaryContent {
  font-size: 0.95rem;
  color: #222;
}

#summaryContent:not(.formatted-summary) {
  white-space: pre-wrap;
}

#summaryContent.loading {
  color: #555;
  font-style: italic;
}

#summaryContent.error {
  color: #b42318;
}

#summaryContent.formatted-summary {
  white-space: normal;
}

#summaryContent .summary-paragraph {
  margin: 0.35rem 0;
}

#summaryContent .summary-paragraph:first-child {
  margin-top: 0;
}

#summaryContent .summary-paragraph:last-child {
  margin-bottom: 0;
}

#summaryContent .summary-list {
  margin: 0.35rem 0 0.35rem 1.1rem;
  padding-left: 1.1rem;
  list-style: disc;
}

#summaryContent .summary-list:first-child {
  margin-top: 0;
}

#summaryContent .summary-list:last-child {
  margin-bottom: 0;
}

#summaryContent .summary-list .summary-list {
  margin: 0.3rem 0 0.3rem 1rem;
  list-style: circle;
}

#summaryContent .summary-label {
  font-weight: 600;
  color: var(--primaris-red);
}

#summaryContent .summary-list li {
  margin-bottom: 0.25rem;
}

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

#ticketDetailsFields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0 0 1.5rem;
}

#ticketDetailsFields dt {
  font-weight: 600;
  color: var(--primaris-red);
}

#ticketDetailsFields dd {
  margin: 0;
  color: #333;
  word-break: break-word;
}

#activitiesSection h3 {
  margin-top: 0;
}

#activitiesList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.activity-item {
  border: 1px solid #d0d7de;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: #f9fafb;
}

.activity-item h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  color: var(--primaris-red);
}

.activity-meta {
  font-size: 0.85rem;
  color: #555;
}

.activity-body-wrapper {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.activity-body-preview {
  font-size: 0.95rem;
  color: #333;
  white-space: pre-wrap;
}

.activity-toggle {
  align-self: flex-start;
  background: transparent;
  border: none;
  color: var(--primaris-red);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.activity-toggle:hover,
.activity-toggle:focus-visible {
  text-decoration: underline;
  outline: none;
}

.activity-body {
  margin-top: 0.5rem;
  white-space: pre-wrap;
}

.activity-body.rich-text {
  white-space: normal;
}

.activity-body img {
  max-width: 100%;
  height: auto;
  display: block;
}

.activity-body table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 0.5rem;
}

.activity-body table td,
.activity-body table th {
  border: 1px solid #d0d7de;
  padding: 0.4rem 0.6rem;
}

@media (max-width: 1024px) {
  .content-layout {
    grid-template-columns: 1fr;
  }

  #ticketDetails {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .table-toolbar-right {
    justify-content: space-between;
  }

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

/* ========== AI Actions Section ========== */
.ai-actions-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-white);
  border: 1px solid var(--primaris-light-gray-2);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ai-actions-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: var(--font-headline);
  font-weight: 600;
}

.ai-actions-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ai-action-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--bg-white);
  border: 1px solid var(--primaris-red);
  color: var(--primaris-red);
  border-radius: 4px;
  font-size: 0.875rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-action-button:hover:not(:disabled) {
  background: var(--primaris-red);
  color: var(--bg-white);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(225, 39, 39, 0.2);
}

.ai-action-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ai-action-button .button-icon {
  font-size: 1.125rem;
}

.ai-action-button .button-spinner {
  font-size: 1rem;
  animation: spin 1s linear infinite;
}

/* ========== Modal Styles ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1001;
}

.modal-small {
  max-width: 400px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #dee2e6;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #212529;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

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

.modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #495057;
  font-size: 0.875rem;
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group textarea:focus,
.form-group input:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.form-group textarea[readonly] {
  background: #f8f9fa;
  cursor: default;
  color: #212529;
}

#securityAwarenessContent {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #212529;
  white-space: pre-wrap;
}

.email-preview {
  width: 100%;
  min-height: 400px;
  max-height: 500px;
  overflow-y: auto;
  padding: 1rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.8;
  color: #212529;
  white-space: pre-wrap;
  font-size: 0.9375rem;
}

.email-preview strong {
  font-weight: 600;
  color: #000;
}

.email-preview h1,
.email-preview h2,
.email-preview h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.danger-button {
  padding: 0.625rem 1.25rem;
  border: 1px solid;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.primary-button {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  background: #0b5ed7;
  border-color: #0a58ca;
}

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

.secondary-button:hover:not(:disabled) {
  background: #6c757d;
  color: #fff;
}

.danger-button {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

.danger-button:hover:not(:disabled) {
  background: #bb2d3b;
  border-color: #b02a37;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button-spinner {
  animation: spin 1s linear infinite;
}

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

#faqModalStatus,
#securityAwarenessModalStatus,
#faqEditModalStatus,
#faqDetailStatus {
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

#faqModalStatus.info,
#securityAwarenessModalStatus.info,
#faqEditModalStatus.info,
#faqDetailStatus.info {
  background: #cfe2ff;
  color: #084298;
  border: 1px solid #b6d4fe;
}

#faqModalStatus.success,
#securityAwarenessModalStatus.success,
#faqEditModalStatus.success,
#faqDetailStatus.success {
  background: #d1e7dd;
  color: #0f5132;
  border: 1px solid #badbcc;
}

#faqModalStatus.error,
#securityAwarenessModalStatus.error,
#faqEditModalStatus.error,
#faqDetailStatus.error {
  background: #f8d7da;
  color: #842029;
  border: 1px solid #f5c2c7;
}

/* ========== Onboarding Modal Styles ========== */

/* Larger modal for onboarding */
.modal-large {
  max-width: 900px;
}

/* Tab Navigation */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-button {
  background: transparent;
  border: none;
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #6c757d;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  margin-bottom: -2px;
}

.tab-button:hover {
  color: #0d6efd;
  background: #f8f9fa;
}

.tab-button.active {
  color: #0d6efd;
  border-bottom-color: #0d6efd;
  font-weight: 600;
}

/* Tab Content */
.tab-content {
  animation: fadeIn 0.2s ease-in;
}

.tab-content[hidden] {
  display: none;
}

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

/* Peer List */
.peer-list {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1rem;
  max-height: 300px;
  overflow-y: auto;
}

.peer-item {
  padding: 0.75rem;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.peer-name {
  font-weight: 600;
  color: #212529;
  font-size: 0.9375rem;
}

.peer-role {
  color: #6c757d;
  font-size: 0.8125rem;
}

.peer-list-empty {
  color: #6c757d;
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

/* Readonly inputs in details tab */
input[readonly] {
  background: #f8f9fa;
  cursor: default;
  color: #495057;
}

input[type="date"][readonly] {
  background: #f8f9fa;
}

/* Status badges for onboarding modal */
#onboardingModalStatus {
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

#onboardingModalStatus.info {
  background: #cfe2ff;
  color: #084298;
  border: 1px solid #b6d4fe;
}

#onboardingModalStatus.success {
  background: #d1e7dd;
  color: #0f5132;
  border: 1px solid #badbcc;
}

#onboardingModalStatus.error {
  background: #f8d7da;
  color: #842029;
  border: 1px solid #f5c2c7;
}

#onboardingModalStatus:empty {
  display: none;
}

/* Small helper text */
.form-group small {
  display: block;
  margin-top: 0.375rem;
  color: #6c757d;
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* Responsive adjustments for onboarding modal */
@media (max-width: 768px) {
  .modal-large {
    max-width: 95%;
  }

  .tabs {
    gap: 0;
  }

  .tab-button {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions button {
    width: 100%;
    justify-content: center;
  }
}

/* ========== Toast Notification ========== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #212529;
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  font-size: 0.875rem;
  max-width: 400px;
  animation: slideInUp 0.3s ease-out;
}

.toast-success {
  background: #198754;
}

.toast-error {
  background: #dc3545;
}

.toast-info {
  background: #0d6efd;
}

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

/* ========== FAQ Page Styles ========== */
.faq-panel {
  width: 100%;
}

.search-control {
  flex: 1;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.875rem;
}

.search-input:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.faq-card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1.25rem;
  transition: box-shadow 0.2s;
}

.faq-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.faq-question {
  margin: 0 0 0.75rem 0;
  font-size: 1.125rem;
  color: #212529;
  font-weight: 600;
}

.faq-answer {
  margin: 0 0 1rem 0;
  color: #495057;
  line-height: 1.6;
  font-size: 0.875rem;
}

.faq-meta {
  font-size: 0.75rem;
  color: #6c757d;
  margin-bottom: 0.75rem;
}

.faq-actions {
  display: flex;
  gap: 0.5rem;
}

.faq-view-button {
  padding: 0.5rem 1rem;
  background: #0d6efd;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s;
}

.faq-view-button:hover {
  background: #0b5ed7;
}

.faq-detail-content {
  margin-bottom: 1.5rem;
}

.faq-detail-section {
  margin-bottom: 1.25rem;
}

.faq-detail-section strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #495057;
  font-size: 0.875rem;
}

.faq-detail-section p {
  margin: 0;
  color: #212529;
  line-height: 1.6;
}

.faq-detail-section a {
  color: #0d6efd;
  text-decoration: none;
}

.faq-detail-section a:hover {
  text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .ai-actions-buttons {
    flex-direction: column;
  }

  .ai-action-button {
    width: 100%;
    justify-content: center;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions button {
    width: 100%;
  }

  .toast {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }

  .faq-card {
    padding: 1rem;
  }
}

/* ==================== Metrics Page ==================== */

.metrics-main {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Metrics Filters */
.metrics-filters {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
}

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

.filter-group label {
  font-weight: 600;
  font-size: 0.875rem;
  color: #495057;
}

.filter-group input,
.filter-group select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9375rem;
  font-family: inherit;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* KPI Cards */
.kpi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #0d6efd;
}

.kpi-label {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: #212529;
  margin-bottom: 0.5rem;
}

.kpi-target {
  font-size: 0.8125rem;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.kpi-change {
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.kpi-change.positive {
  color: #198754;
}

.kpi-change.negative {
  color: #dc3545;
}

.kpi-change.neutral {
  color: #6c757d;
}

/* Metrics Sections */
.metrics-section {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.metrics-section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  color: #212529;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0.75rem;
}

.metrics-section h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.125rem;
  color: #495057;
}

/* Metrics Table */
.table-container {
  overflow-x: auto;
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.metrics-table thead th {
  background: #f8f9fa;
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}

.metrics-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #dee2e6;
}

.metrics-table tbody tr:hover {
  background: #f8f9fa;
}

.metrics-table tbody td:first-child {
  font-weight: 500;
}

.metrics-table tbody td:not(:first-child) {
  text-align: center;
}

/* Categories Grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 1rem;
}

.category-chart {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-chart canvas {
  max-height: 300px;
}

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

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 0.875rem;
}

.category-item-label {
  font-weight: 500;
  color: #495057;
}

.category-item-value {
  font-weight: 600;
  color: #212529;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-top: 1rem;
}

.chart-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chart-container canvas {
  max-height: 300px;
}

/* Insights Grid */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.insight-card {
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.insight-card canvas {
  max-height: 250px;
}

/* Team Performance */
.team-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.team-stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.team-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.team-stat-name {
  font-weight: 500;
  color: #495057;
}

.team-stat-value {
  font-weight: 600;
  color: #212529;
}

.team-stat-bar {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}

.team-stat-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d6efd 0%, #0a58ca 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .kpi-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .metrics-main {
    padding: 1rem;
  }

  .metrics-filters {
    flex-direction: column;
    padding: 1rem;
  }

  .filter-group {
    min-width: unset;
  }

  .kpi-cards {
    grid-template-columns: 1fr;
  }

  .kpi-value {
    font-size: 1.75rem;
  }

  .metrics-section {
    padding: 1rem;
  }

  .metrics-section h2 {
    font-size: 1.25rem;
  }

  .categories-grid {
    grid-template-columns: 1fr;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .insights-grid {
    grid-template-columns: 1fr;
  }

  .metrics-table {
    font-size: 0.8125rem;
  }

  .metrics-table thead th,
  .metrics-table tbody td {
    padding: 0.5rem;
  }
}

/* Authentication UI Styles */
.auth-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-right: 1rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.user-name {
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
}

.login-button,
.logout-button {
  padding: 0.5rem 1rem;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-button:hover,
.logout-button:hover {
  background-color: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.login-button:disabled,
.logout-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .auth-container {
    margin-right: 0;
  }

  .user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ========== Approval Review Modal ========== */
.approval-employee-info {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.approval-employee-info h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #212529;
  font-size: 1.1rem;
  font-weight: 600;
}

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

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.info-item label {
  font-size: 0.75rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.info-item span {
  font-size: 0.95rem;
  color: #212529;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pending-approval {
  background: #fff3cd;
  color: #856404;
}

.status-approved {
  background: #d4edda;
  color: #155724;
}

.status-rejected {
  background: #f8d7da;
  color: #721c24;
}

.status-draft {
  background: #e7e7e7;
  color: #495057;
}

.status-completed {
  background: #d1ecf1;
  color: #0c5460;
}

.status-cancelled {
  background: #e2e3e5;
  color: #383d41;
}

.approval-content {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1.5rem;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  color: #212529;
}

.approval-actions {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid #dee2e6;
}

.button-group {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.button-primary,
.button-danger,
.button-secondary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.button-primary {
  background: #28a745;
  color: white;
}

.button-primary:hover {
  background: #218838;
}

.button-danger {
  background: #dc3545;
  color: white;
}

.button-danger:hover {
  background: #c82333;
}

.button-secondary {
  background: #6c757d;
  color: white;
}

.button-secondary:hover {
  background: #5a6268;
}

.button-primary:disabled,
.button-danger:disabled,
.button-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button-icon {
  font-size: 1.2rem;
}

.modal-status {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-weight: 500;
}

.modal-status-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

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

.modal-status-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
