* { box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; margin: 0; padding: 0; background: #e0e2e0 !important; color: #374151; }
body.gradient-background {
  background: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)),
    linear-gradient(302deg, #469168, #ced0d4, #dbdcdf) !important;
  background-size: 100% 100%, 180% 180%;
  background-repeat: no-repeat;
  animation: gradient-animation 15s ease infinite;
}
@keyframes gradient-animation {
  0%   { background-position: 0% 50%, 0% 50%; }
  50%  { background-position: 0% 50%, 100% 50%; }
  100% { background-position: 0% 50%, 0% 50%; }
}
.main-content { padding: 8px 20px 20px; background: none; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 24px; }
.header h1 { font-size: 24px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header h1 .matrix-title { font-weight: 600; color: #469168; }
.header-stats { display: flex; gap: 12px; flex: 1; justify-content: center; }
.account-menu { position: relative; }
.account-menu-toggle { background: #f3f4f6; border: 0; border-radius: 8px; padding: 8px 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: #1f2937; font: 500 14px 'Wix Madefor Display', system-ui, -apple-system, 'Wix Madefor Text', sans-serif; white-space: nowrap; transition: background 0.2s ease, box-shadow 0.2s ease; }
.account-menu-toggle:hover { background: #dfe3e9; box-shadow: 0 2px 4px rgba(15, 23, 42, 0.12); }
.account-menu-toggle:focus-visible { outline: 2px solid #469168; outline-offset: 2px; }
.account-menu-toggle-icon { font-size: 12px; line-height: 1; }
.account-menu-dropdown { position: absolute; top: calc(100% + 6px); right: 0; background: #fff; border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18); min-width: 190px; padding: 8px 0; display: flex; flex-direction: column; z-index: 1200; }
.account-menu-dropdown[hidden] { display: none; }
.account-menu-item { padding: 8px 16px; text-decoration: none; color: #111827; font: 500 14px 'Wix Madefor Text', system-ui, -apple-system, sans-serif; display: flex; align-items: center; gap: 8px; background: transparent; border: 0; cursor: pointer; width: 100%; text-align: left; }
.account-menu-item:hover { background: #f3f4f6; }
.mini-stat { text-align: center; padding: 8px 12px; background: white; border-radius: 6px; border: 4px solid #ffffff !important; min-width: 70px; height: 46px; margin-top: -3px; }
.mini-stat-number { font-size: 18px; font-weight: 600; margin: 0; color: #111827; line-height: 1.2; }
.mini-stat-number { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; display: inline-block; min-width: 4ch; text-align: center; }
.mini-stat-label { font-size: 10px; color: #6b7280; text-transform: uppercase; font-weight: 500; margin: 2px 0 0; line-height: 1; }
.header-buttons { display: flex; gap: 12px; flex-shrink: 0; align-items: center; }
.btn { padding: 12px 16px; border-radius: 8px; text-decoration: none; font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid; transition: all 0.2s ease; height: 45px; min-width: 120px; }
.btn-primary { background: #469168; color: white; border-color: #469168; }
.btn-secondary { background: white; color: #6b7280; border-color: #d1d5db; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-primary:hover { background: #3d7957; border-color: #3d7957; }
.btn-secondary:hover { background: #f9fafb; border-color: #9ca3af; color: #374151; }
.filters { background: rgba(255, 255, 255, 0); border-radius: 8px; border: 0; margin: 8px 0 8px 0; padding: 16px 10px; display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; text-align: center; }
.search-input { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; width: 200px; background: #ffffff; }
#pluginSearch { padding: 10px 9px !important; padding-left: 37px !important; }
#siteSearch { padding: 10px 9px !important; padding-left: 37px !important; }
.select-input { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; background: white; }
#statusFilter, #serverFilter {
  font: 500 14px 'Wix Madefor Text', 'Inter', sans-serif;
}
.checkbox-group { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.baseline-toggle { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }
.baseline-toggle.active { background: #dbeafe; border-color: #3b82f6; color: #1d40af; }
.baseline-cell { opacity: 0.4; background: #f9fafb; }
.baseline-diff { background: #fef3c7; border: 2px solid #f59e0b; }
.matrix-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: 14px; color: #6b7280; }
.density-controls { display: flex; gap: 8px; }
.density-btn { padding: 4px 8px; border: 1px solid #d1d5db; background: white; border-radius: 4px; font-size: 12px; cursor: pointer; }
.density-btn.active { background: #3b82f6; color: white; border-color: #3b82f6; }
:root { --plugin-width: 220px; --active-width: 60px; --updates-width: 60px; --active-left: var(--plugin-width); --updates-left: calc(var(--plugin-width) + var(--active-width)); --site-width: 165px; }
.matrix-container { background: white; border-radius: 8px; border: 0px solid #e5e7eb; overflow: hidden; position: relative; }
.table-wrapper { overflow: auto; max-height: 70vh; position: relative; min-height: 480px; }
.horizontal-scroll-container { display: none; }
.horizontal-scroll-content { display: none; }
.matrix-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0 6px; margin-top: -6px; font-size: 13px; table-layout: fixed; background: #e0e2e0; }
.matrix-table th, .matrix-table td { padding: 8px 6px; border-right: 1px solid #f3f4f6; text-align: center; white-space: nowrap; }
.matrix-table tbody td { border-bottom: 0; }
.matrix-table tbody tr { background: #ffffff; border-radius: 10px; box-shadow: 0 0 0 1px #e5e7eb; }
.matrix-table tbody tr td:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.matrix-table tbody tr td:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
.matrix-table tbody tr td:not([style*="display: none"]):not(:has(~ td:not([style*="display: none"]))) { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
.matrix-table th { background: #f3f4f3; font-weight: 500; color: #333333; border-bottom: 1px solid #ffffff; border-right: 2px solid #ffffff; }
.matrix-table td strong.zero-count { color: #878787; }
.matrix-table td.zero-count-cell { background-color: #f7f7f7; }
.site-header { min-width: var(--site-width); max-width: 198px; width: var(--site-width); font-size: 11px; line-height: 1.2; vertical-align: top; padding: 8px 4px; position: sticky; top: 0; background: var(--site-header-bg, #f3f4f3); z-index: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 2px solid #ffffff; }
/* Ensure sticky headers engage reliably inside the scroller */
/* Site headers should sit under the frozen left columns */
.matrix-table thead th.site-header { position: sticky !important; top: 0; background: var(--site-header-bg, #f3f4f3); box-shadow: 0 1px 0 #e5e7eb; color: #333333; z-index: 2; }
.placeholder-site { color: #9ca3af; opacity: 0.45; pointer-events: none; }
.placeholder-cell { opacity: 0.35; background: #fafafa; }
.site-header > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.site-header .ts {
  display: block;
  height: 14px;           /* reserve exact space to avoid snap */
  line-height: 14px;      /* keep single-line vertical alignment */
  white-space: nowrap;    /* no wrap so height stays stable */
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-header .server-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;           /* keep ellipsis working with flex */
  width: 100%;
  text-align: center;
  height: 14px;           /* match ts line height */
  line-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.site-header .server-display::before {
  content: '';
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  background: url('/Server.svg') no-repeat center;
  background-size: contain;
}
.plugin-header {
  text-align: left;
  padding-left: 8px;
  position: sticky;
  left: 0;
  top: 0;
  background: #f3f4f3;
  z-index: 30;
  min-width: var(--plugin-width);
  max-width: var(--plugin-width);
  width: var(--plugin-width);
  font-weight: 600;
  font-size: 1.1em;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-right: 2px solid #ffffff;
}
.active-header { min-width: var(--active-width); max-width: var(--active-width); width: var(--active-width); text-align: center; padding: 8px 5px !important; position: sticky; left: var(--active-left); top: 0; background: #f3f4f3; z-index: 30; font-size: 11px; line-height: 1.1; border-right: 2px solid #ffffff; }
.updates-header { min-width: var(--updates-width); max-width: var(--updates-width); width: var(--updates-width); text-align: center; padding: 8px 5px !important; position: sticky; left: var(--updates-left); top: 0; background: #f3f4f3; z-index: 30; font-size: 11px; line-height: 1.1; border-right: 2px solid #ffffff; }
.plugin-cell, .active-cell, .updates-cell { font-weight: 500; background: white; position: sticky; z-index: 20; }
.plugin-cell.plugin-cell-clickable { cursor: pointer; }
.site-header.site-header-clickable {
  cursor: pointer;
  background: var(--site-header-bg, #f3f4f3) !important;
  transition: background-color 0.2s;
}
.site-header.site-header-clickable.network-subsite {
  background: #deedf9 !important;
}
.site-header.site-header-clickable:hover {
  background: #ffffff !important;
}
.matrix-column-highlight {
  background: #f3f4f3 !important;
}
.network-expand-btn {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 2px;
  border-radius: 3px;
  transition: background 0.2s ease, transform 0.2s ease;
  background: #efefef;
}

.network-expand-btn:hover {
  background: rgba(107, 114, 128, 0.2);
}

.network-expand-btn img {
  width: 22px;
  height: 22px;
  display: block;
  transition: transform 0.2s ease;
}

.network-expand-btn.expanded img {
  transform: rotate(-90deg);
}
.plugin-cell {
  text-align: left !important;
  padding-left: 32px;
  padding-right: 42px;
  left: 0;
  min-width: var(--plugin-width);
  max-width: var(--plugin-width);
  width: var(--plugin-width);
  border-right: 2px solid #e5e7eb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 20;
}

.plugin-cell::before {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background-image: url('./ThreeDot.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}
.active-cell { text-align: center; min-width: var(--active-width); max-width: var(--active-width); width: var(--active-width); position: sticky; left: var(--active-left); background: white; z-index: 20; border-right: 1px solid #f3f4f6; }
.updates-cell { text-align: center; min-width: var(--updates-width); max-width: var(--updates-width); width: var(--updates-width); position: sticky; left: var(--updates-left); background: white; z-index: 20; border-right: 2px solid #e5e7eb; }
.status-cell { width: var(--site-width); height: 32px; position: relative; min-width: var(--site-width); max-width: 198px; }
.status-cell.status-cell-active { background: #d3f4e2; }
.status-cell.status-cell-inactive { background: #efefef; border: 0px solid #ffffff; }
.matrix-table.matrix--inactive-only td.status-cell.status-cell-inactive {
  background: #e9e9e9 !important;
}
.matrix-table tbody tr:hover td.status-cell:not(.status-cell-active):not(.status-cell-inactive) {
  background: #f1f3f5;
}
.matrix-table tbody tr:hover td.status-cell.status-cell-update {
  background: #fcf4cb !important;
}
.matrix-table tbody tr:hover td.status-cell.status-cell-active:not(.status-cell-update) {
  background: #d3f4e2 !important;
}
.matrix-table tbody tr:hover td.status-cell.status-cell-inactive {
  background: #fef3c7 !important;
}
.matrix-table.matrix--inactive-only tbody tr:hover td.status-cell.status-cell-active {
  background: #ffffff !important;
}
.matrix-table.matrix--updates-only tbody tr:hover td.status-cell.status-cell-active:not(.status-cell-update) {
  background: #ffffff !important;
}
.matrix-table.matrix--inactive-only tbody tr:hover td.status-cell.status-cell-inactive {
  background: #e9e9e9 !important;
}
.matrix-table.matrix--active-only tbody tr:hover td.status-cell.status-cell-inactive {
  background: #ffffff !important;
}
.status-cell.status-cell-update { background: #fcf4cb; border: none; }
.status-cell.network-subsite:not(.status-cell-active):not(.status-cell-update):not(.status-cell-inactive) {
  background: #edf3f9;
}
.matrix-table.matrix--inactive-only .status-cell-active {
  opacity: 0.25;
  background: #ffffff !important;
  border-right: 1px solid #cccccc;
}
.matrix-table.matrix--updates-only .status-cell-active:not(.status-cell-update) {
  opacity: 0.25;
  background: #ffffff;
  border-right: 1px solid #cccccc;
}
.matrix-table.matrix--updates-only .status-cell-inactive:not(.status-cell-update) { opacity: 0.35; }
.matrix-table.matrix--active-only .status-cell-inactive {
  opacity: 1;
  background: #ffffff;
  border-right: 1px solid #f3f3f3;
}
.ghost-site { opacity: 0; pointer-events: none; }
.ghost-cell { opacity: 0; pointer-events: none; }
.status-indicator { width: 22px; height: 22px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; position: relative; margin-top: -1px; margin-bottom: -1px;}
.status-indicator.status-inactive { border-radius: 0; background: none; font-size: 16px; border: none;}
.status-active { background: #10b981; color: white; }
.status-inactive { background: none; color: #9ca3af; }
.status-missing { background: #f3f4f6; border: 1px solid #d1d5db; }
.tooltip { position: relative; display: inline-block; }
.tooltip .tooltip-content { visibility: hidden; opacity: 0; position: fixed; background-color: #1f2937; color: white; text-align: left; padding: 8px 12px; border-radius: 6px; font-size: 12px; font-weight: normal; min-width: 200px; max-width: 300px; z-index: 1000; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); transition: opacity 0.2s, visibility 0.2s; pointer-events: none; }
.tooltip .tooltip-content.above::after { content: ""; position: absolute; width: 0; height: 0; border-width: 5px; border-style: solid; top: 100%; left: 50%; margin-left: -5px; border-color: #1f2937 transparent transparent transparent; }
.tooltip .tooltip-content.below::after { content: ""; position: absolute; width: 0; height: 0; border-width: 5px; border-style: solid; bottom: 100%; left: 50%; margin-left: -5px; border-color: transparent transparent #1f2937 transparent; }
.tooltip:hover .tooltip-content { visibility: visible; opacity: 1; }
.update-badge { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; background: #f59e0b; border-radius: 50%; border: 1px solid white; display:none; }
.matrix-table tbody tr:hover { background: #f9fafb; }
.matrix-table tbody tr:hover .plugin-cell, .matrix-table tbody tr:hover .active-cell, .matrix-table tbody tr:hover .updates-cell { background: #f9fafb; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding: 16px; background: white; border-radius: 8px; border: 1px solid #e5e7eb; }
.pagination-info { font-size: 14px; }
/* Pager controls (ensure soft-nav parity with SSR inline) */
.pagination-controls { display: flex; gap: 12px; align-items: center; }
.page-select { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.page-select select { padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px; }
.pagination-buttons { display: flex; gap: 4px; }
.page-btn { padding: 6px 12px; border: 1px solid #d1d5db; background: white; border-radius: 4px; font-size: 14px; cursor: pointer; text-decoration: none; color: #374151; }
.page-btn:hover { background: #f9fafb; }
.page-btn.active { background: #d3f4e2; color: #065f46; border-color: #d3f4e2; }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.page-controls { display: flex; gap: 6px; }
.density-label { color: #6b7280; margin-right: 8px; }
.scroll-hint { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.7); color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px; pointer-events: none; opacity: 0; transition: opacity 0.3s; }
.matrix-container:hover .scroll-hint { opacity: 1; }
.modal-content { background: white; padding: 20px; border-radius: 12px; width: 95%; max-width: 520px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); border: 1px solid #e5e7eb; }
.modal-header { display: flex; align-items: center; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #e5e7eb; }
.modal-title { font-size: 18px; font-weight: 600; color: #374151; margin: 0; line-height: 1.4; text-align: left; flex: 1; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #6b7280; padding: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.modal-close:hover { background: #f3f4f6; color: #374151; }
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 500; color: #374151; margin-bottom: 6px; font-size: 14px; }
.form-input, .form-textarea, .form-select { width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; font-family: inherit; box-sizing: border-box; }
.form-textarea { resize: vertical; min-height: 80px; }
.tags-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag-option { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 20px; font-size: 13px; cursor: pointer; transition: all 0.2s; user-select: none; }
.tag-option:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.tag-option.selected { background: #e0f2fe; border-color: #0284c7; color: #0f172a; box-shadow: 0 0 0 1px rgba(14,165,233,0.35); }
.tag-option:hover { background: #e5e7eb; }
.tag-option.selected:hover { background: #bae6fd; }
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 0px solid #eef2f7;
  margin-top: -10px;
  margin-bottom: 10px;
}
.btn-cancel { padding: 8px 16px; border: 1px solid #d1d5db; background: white; color: #374151; border-radius: 6px; font-size: 14px; cursor: pointer; }
.btn-save { padding: 8px 16px; background: #10b981; color: white; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; }
.btn-save:disabled { opacity: 0.5; }
/* Keep vertical scrollbar reserved to avoid horizontal snap on first paint */
html { overflow-y: scroll; }

/* Reserve brand text width to avoid center tile shift when font loads */
#account-bar .brand .brand-title { display: inline-block; min-width: 64px; }
#account-bar .brand { min-width: 180px; }
#account-bar .brand img { height: 28px; width: auto; }

/* Reserve space for org label to prevent center shift */
#whoami-label { display: inline-block; min-width: 160px; text-align: right; }

/* Matrix view: keep background transparent so body backdrop shows through */
main#app-main.main-content.matrix-main {
  background: transparent;
}
