:root {
  --bg: #f5f4ef;
  --ink: #1d1a17;
  --card: #fffefb;
  --line: #d9d3c5;
  --input-bg: #fff;
  --input-placeholder: #8a8a8a;
  --focus-ring: rgba(0, 104, 79, 0.2);
  --primary: #00684f;
  --primary-ink: #ffffff;
  --good: #d8f4e7;
  --warn: #fff1d6;
  --neutral: #e7ecff;
  --error: #ffd9d9;
  --bg-grad-1: radial-gradient(circle at top right, #f9e2b8 0%, rgba(249, 226, 184, 0) 40%);
  --bg-grad-2: radial-gradient(circle at left 20%, #d7efe8 0%, rgba(215, 239, 232, 0) 38%);
}

html[data-theme='dark'] {
  --bg: #13181b;
  --ink: #e8ecef;
  --card: #1d2429;
  --line: #3f5260;
  --input-bg: #202c35;
  --input-placeholder: #a0b0bc;
  --focus-ring: rgba(79, 170, 149, 0.3);
  --primary: #2f9e84;
  --primary-ink: #0f171b;
  --good: #1f3b31;
  --warn: #403218;
  --neutral: #273246;
  --error: #4a2424;
  --bg-grad-1: radial-gradient(circle at top right, #3e3218 0%, rgba(62, 50, 24, 0) 42%);
  --bg-grad-2: radial-gradient(circle at left 20%, #16342f 0%, rgba(22, 52, 47, 0) 40%);
}

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

.sync-summary-card strong,
.sync-summary-card > div {
  margin: 0;
  line-height: 1.2;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 7.5rem;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    var(--bg-grad-1),
    var(--bg-grad-2),
    var(--bg);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(to bottom, rgba(245, 244, 239, 0.96), rgba(245, 244, 239, 0.92)),
    var(--bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

html[data-theme='dark'] .topbar {
  background:
    linear-gradient(to bottom, rgba(19, 24, 27, 0.96), rgba(19, 24, 27, 0.92)),
    var(--bg);
}

.app-home-link {
  display: inline-block;
  text-decoration: none;
  color: inherit;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.15;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-actions #site-switcher {
  min-width: 240px;
}
.topbar-actions .select2-container {
  min-width: 240px;
}

.topbar-actions .button,
.topbar-actions #site-switcher {
  border-radius: 8px;
  height: 2.5rem;
}

.topbar-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-actions .button.ghost:hover:not(:disabled),
.topbar-actions .button.ghost:focus-visible {
  background: rgba(0, 104, 79, 0.08);
  border-color: #b8c1b6;
}

.topbar-actions .button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

html[data-theme='dark'] .topbar-actions .button.ghost:hover:not(:disabled),
html[data-theme='dark'] .topbar-actions .button.ghost:focus-visible {
  background: rgba(47, 158, 132, 0.18);
  border-color: #5e7280;
}

.site-nav-btn {
  padding: 0.25rem 0.5rem;
  min-width: 1.9rem;
  line-height: 1;
}

.site-nav-btn svg {
  display: block;
}

.user-avatar {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

html[data-theme='dark'] .user-avatar {
  border-color: #5e7280;
}

.active-users-presence {
  display: flex;
  align-items: center;
  margin-right: 0.15rem;
  padding-right: 0.1rem;
}

.active-user-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.active-user-chip + .active-user-chip {
  margin-left: -0.35rem;
}

.active-user-chip:hover,
.active-user-chip:focus-within {
  z-index: 3;
}

.active-user-chip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translate(-50%, 4px);
  opacity: 0;
  pointer-events: none;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
  transition: opacity 0.08s ease, transform 0.08s ease;
}

.active-user-chip::before {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + 3px);
  width: 7px;
  height: 7px;
  transform: translateX(-50%) rotate(225deg);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--card);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease;
}

.active-user-chip:hover::after,
.active-user-chip:hover::before,
.active-user-chip:focus-within::after,
.active-user-chip:focus-within::before {
  opacity: 1;
}

.active-user-chip:hover::after,
.active-user-chip:focus-within::after {
  transform: translate(-50%, 0);
}

.active-user-avatar,
.active-user-fallback {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  box-shadow: 0 0 0 2px var(--card);
}

.active-user-avatar {
  object-fit: cover;
}

.active-user-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: #dbe6db;
}

html[data-theme='dark'] .active-user-avatar,
html[data-theme='dark'] .active-user-fallback {
  border-color: #5e7280;
  box-shadow: 0 0 0 2px var(--card);
}

html[data-theme='dark'] .active-user-chip::after {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.48);
}

html[data-theme='dark'] .active-user-fallback {
  background: #2a353d;
}

.profile-menu {
  position: relative;
}

.profile-menu-toggle {
  gap: 0.45rem;
  padding-left: 0.55rem;
  padding-right: 0.65rem;
  min-width: 0;
}

.profile-menu-name {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu-caret {
  width: 0.85rem;
  height: 0.85rem;
  opacity: 0.75;
}

.profile-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 12rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.3rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  z-index: 60;
}

.profile-menu-item {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.profile-menu-item:hover,
.profile-menu-item:focus-visible {
  background: rgba(0, 104, 79, 0.08);
  border-color: #b8c1b6;
  outline: none;
}

html[data-theme='dark'] .profile-menu-panel {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

html[data-theme='dark'] .profile-menu-item:hover,
html[data-theme='dark'] .profile-menu-item:focus-visible {
  background: rgba(47, 158, 132, 0.18);
  border-color: #5e7280;
}

.site-switcher-label {
  font-size: 0.9rem;
  opacity: 0.8;
}

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

h1, h2 {
  margin: 0 0 0.4rem;
}

.container {
  max-width: 1100px;
  margin: 1.25rem auto;
  padding: 0 1rem 2rem;
  display: grid;
  gap: 1rem;
}

@media (max-width: 760px) {
  .topbar-actions #site-switcher {
    min-width: 0;
    width: 100%;
  }
  .topbar-actions .select2-container {
    min-width: 0;
    width: 100% !important;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  align-items: end;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.admin-settings-form {
  grid-template-columns: 1fr;
  align-items: start;
}

.settings-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--line);
  margin-bottom: 1.5rem;
}

.settings-tab {
  padding: 0.5rem 1.1rem;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.6;
  border-radius: 6px 6px 0 0;
  transition: opacity 0.15s, color 0.15s;
}

.settings-tab:hover {
  opacity: 1;
}

.settings-tab.is-active {
  opacity: 1;
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.settings-tab-panel {
  display: grid;
  gap: 1.25rem;
}

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

.admin-settings-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.admin-settings-header h1 {
  margin: 0;
  margin-right: auto;
}

.admin-settings-field {
  gap: 0.5rem;
}

.admin-settings-field input[type='text'],
.admin-settings-field input[type='url'],
.admin-settings-field input[type='email'],
.admin-settings-field textarea {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.97rem;
  line-height: 1.5;
}

.admin-settings-field input[type='text'],
.admin-settings-field input[type='url'],
.admin-settings-field input[type='email'] {
  min-height: 44px;
}

.admin-settings-field textarea {
  min-height: 210px;
  resize: vertical;
}

.admin-settings-field textarea[name='initial_scan_email_subject_options'] {
  min-height: unset;
}

.admin-settings-field input[type='text']:focus,
.admin-settings-field input[type='url']:focus,
.admin-settings-field input[type='email']:focus,
.admin-settings-field textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
}

input, select {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  height: 2.5rem;
  line-height: 1.5;
}

input::placeholder {
  color: var(--input-placeholder);
}

input:focus,
select:focus,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--open .select2-selection--single {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d1a17' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

select::-ms-expand {
  display: none;
}

select:disabled {
  opacity: 1;
  color: var(--input-placeholder);
  -webkit-text-fill-color: var(--input-placeholder);
}

.select2-container--default .select2-selection--single {
  background: var(--input-bg) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  height: 2.5rem !important;
  display: flex !important;
  align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 0 0.7rem !important;
  line-height: 1.5 !important;
  color: var(--ink) !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--input-placeholder) !important;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
  color: var(--ink) !important;
  opacity: 0.68;
  font-size: 1.05rem;
  margin-right: 0.25rem;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover,
.select2-container--default .select2-selection--single .select2-selection__clear:focus {
  color: var(--primary) !important;
  opacity: 1;
}

.select2-container--default .select2-results > .select2-results__options {
  background: var(--input-bg);
  color: var(--ink);
}

.select2-dropdown {
  background: var(--input-bg) !important;
  border: 1px solid var(--line) !important;
}

.select2-container--default .select2-results__option--selected {
  background-color: rgba(47, 158, 132, 0.24) !important;
  color: var(--ink) !important;
}

.select2-container--default .select2-results__option[aria-selected='true'] {
  background-color: rgba(47, 158, 132, 0.24) !important;
  color: var(--ink) !important;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: #2f6fb7;
  color: #fff;
}

html[data-theme='dark'] .select2-container--default .select2-results__option[aria-selected='true'] {
  background-color: #2b3c4b !important;
  color: #e8ecef !important;
}

html[data-theme='dark'] .select2-container--default .select2-results__option--selected {
  background-color: #2b3c4b !important;
  color: #e8ecef !important;
}

html[data-theme='dark'] .select2-container--default .select2-results__option[aria-selected='true']:not(.select2-results__option--highlighted) {
  background-color: #2b3c4b !important;
  color: #e8ecef !important;
}

html[data-theme='dark'] .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: #3f84d8 !important;
  color: #ffffff !important;
}

.select2-search--dropdown .select2-search__field {
  background: var(--input-bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.select2-selection__arrow {
  top: 50% !important;
  transform: translateY(-50%) !important;
  right: 0.2rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--ink) transparent transparent transparent !important;
}

html[data-theme='dark'] select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8ecef' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

html[data-theme='dark'] input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(0.9) brightness(1.2);
}

.button {
  display: inline-block;
  background: var(--primary);
  color: var(--primary-ink);
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.button:disabled,
.button[disabled] {
  background: var(--line);
  color: #6f6a63;
  border: 1px solid var(--line);
  cursor: not-allowed;
  opacity: 0.75;
  box-shadow: none;
}

html[data-theme='dark'] .button:disabled,
html[data-theme='dark'] .button[disabled] {
  background: #3a4650;
  color: #8fa0ad;
  border-color: #4c5d6b;
}

.button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.button.button-danger,
.table-action-btn.button-danger {
  background: #c7372f;
  color: #fff7f6;
  border: 1px solid #a62b24;
}

.button.button-danger:hover,
.button.button-danger:focus-visible,
.table-action-btn.button-danger:hover,
.table-action-btn.button-danger:focus-visible {
  background: #da433b;
  color: #fffdfd;
}

html[data-theme='dark'] .button.button-danger,
html[data-theme='dark'] .table-action-btn.button-danger {
  background: #cf524b;
  color: #fff7f6;
  border-color: #e57a73;
}

html[data-theme='dark'] .button.button-danger:hover,
html[data-theme='dark'] .button.button-danger:focus-visible,
html[data-theme='dark'] .table-action-btn.button-danger:hover,
html[data-theme='dark'] .table-action-btn.button-danger:focus-visible {
  background: #df665f;
  color: #fffdfd;
}

.table-action-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 0;
  line-height: 1.2;
}

html[data-theme='dark'] .table-action-btn {
  background: #5ec9ad;
  color: #063d33;
}

html[data-theme='dark'] .table-action-btn:hover,
html[data-theme='dark'] .table-action-btn:focus-visible {
  background: #7ad8c0;
  color: #052f28;
}

.flash {
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
}

.toast-stack {
  position: fixed;
  top: calc(1.25rem + 2.5rem + 1.25rem + 1px + 1rem);
  right: 1rem;
  width: min(24rem, calc(100vw - 2rem));
  display: grid;
  gap: 0.55rem;
  z-index: 1100;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  animation: toast-enter 180ms ease-out;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.toast.is-leaving {
  animation: toast-exit 240ms ease-in forwards;
}

.toast-message {
  padding-right: 0.25rem;
}

.toast-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.12);
}

html[data-theme='dark'] .toast-progress {
  background: rgba(255, 255, 255, 0.16);
}

.toast-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  opacity: 0.8;
}

.toast-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  opacity: 0.7;
  transition: opacity 150ms ease;
}

.toast-dismiss:hover,
.toast-dismiss:focus {
  opacity: 1;
  outline: none;
}

.toast-dismiss:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-exit {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes toast-progress-linear {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }

  .toast-progress-bar {
    animation: none !important;
  }
}

@media (max-width: 680px) {
  .toast-stack {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
  }
}

.flash + .client-grid {
  margin-top: 0.85rem;
}

.flash-success {
  background: var(--good);
}

.flash-info {
  background: var(--neutral);
}

.flash-error {
  background: var(--error);
}

.table-wrap {
  overflow: auto;
}

.scan-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.scan-history-header h2 {
  margin: 0;
}

.scan-history-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.score-trends-meta {
  margin: 0.5rem 0 0.8rem;
  font-size: 0.84rem;
  opacity: 0.8;
}

.score-trends-description {
  margin: 0.5rem 0 0.65rem;
  color: var(--muted);
}

.score-trends-table-wrap {
  --score-trends-header-height: 2.4rem;
  max-height: calc(2.4rem + (6 * 2.85rem));
  overflow: auto;
}

.score-trends-overflow-indicator {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.score-trends-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--card);
  box-shadow: inset 0 -1px 0 var(--line);
}

.score-trends-table-wrap tbody tr:first-child td {
  position: sticky;
  top: calc(var(--score-trends-header-height) - 1px);
  z-index: 2;
  background: var(--card);
  box-shadow: inset 0 -1px 0 var(--line);
}

.scan-report-status {
  margin-top: 0.65rem;
  margin-bottom: 0.65rem;
}

.scan-report-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 0.6rem;
  vertical-align: top;
}

.client-contacts-table th,
.client-contacts-table td {
  vertical-align: middle;
}

.client-contacts-table tbody tr.client-contacts-row-active td {
  background: #0b2b1d;
  color: #e7f2ec;
}

.client-contacts-table tbody tr.client-contacts-row-inactive td {
  background: #3a1014;
  color: #f7e9eb;
}

.client-contacts-table tbody tr.client-contacts-row-deleted td {
  background: #2b2f36;
  color: #edf1f5;
}

.client-contacts-actions-cell {
  white-space: nowrap;
}

.client-contacts-action-form {
  display: inline-flex;
  margin: 0;
}

.client-contacts-action-form + .client-contacts-action-form {
  margin-left: 0.35rem;
}

.scan-select-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
}

.scan-select-option input[type='checkbox'] {
  cursor: pointer;
  margin: 0;
}

.scan-action-cell {
  vertical-align: middle;
}

.scan-action-cell .scan-select-option {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  white-space: nowrap;
  margin-top: 0;
  line-height: 1.2;
  vertical-align: middle;
}

.scan-action-cell .scan-select-option input[type='checkbox'] {
  flex: 0 0 auto;
  margin-top: 0;
}

.scan-cached-report-link {
  margin-left: 0.4rem;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1;
  color: #0b6f94;
  vertical-align: middle;
}

.scan-cached-report-link:hover,
.scan-cached-report-link:focus-visible {
  color: #095775;
  text-decoration: none;
  filter: brightness(1.15);
}

html[data-theme='dark'] .scan-cached-report-link {
  color: #8fd9ff;
}

html[data-theme='dark'] .scan-cached-report-link:hover,
html[data-theme='dark'] .scan-cached-report-link:focus-visible {
  color: #b8e8ff;
}

.scan-cached-report-icon {
  width: 1.75rem;
  height: 1.75rem;
  display: inline-block;
  vertical-align: text-bottom;
  fill: currentColor;
}

/* Email log icon button */
.scan-email-log-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: 0.4rem;
  border: none;
  background: none;
  cursor: pointer;
  color: #0b6f94;
  vertical-align: middle;
}

.scan-email-log-btn:hover,
.scan-email-log-btn:focus-visible {
  color: #095775;
  filter: brightness(1.15);
  outline: none;
}

html[data-theme='dark'] .scan-email-log-btn {
  color: #8fd9ff;
}

html[data-theme='dark'] .scan-email-log-btn:hover,
html[data-theme='dark'] .scan-email-log-btn:focus-visible {
  color: #b8e8ff;
}

.scan-email-log-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
}

/* Email log dialog content */
.scan-email-log-content {
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.scan-email-log-entry {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.scan-email-log-entry--sep {
  border-top: 1px solid var(--line, #d0dae4);
}

.scan-email-log-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
}

.scan-email-log-meta > div {
  display: contents;
}

.scan-email-log-meta dt {
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.scan-email-log-meta dd {
  margin: 0;
  color: var(--ink);
  word-break: break-all;
}

.scan-email-log-preview-wrap {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.scan-email-log-preview-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #5a6a7a);
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scan-email-log-preview {
  width: 100%;
  flex: 1;
  min-height: 200px;
  border: 1px solid var(--line, #d0dae4);
  border-radius: 4px;
  background: #fff;
  display: block;
}

.scan-history-table td {
  vertical-align: middle;
}

.trends-summary {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  background: color-mix(in srgb, var(--card) 94%, #0b6f94 6%);
}

.trends-summary-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.trends-summary-title {
  margin: 0;
  font-weight: 700;
}

.trends-summary-meta {
  margin: 0;
  font-size: 0.84rem;
  opacity: 0.8;
}

.trends-summary-meta-sep {
  margin: 0 0.35rem;
}

.trends-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trends-table {
  min-width: 620px;
}

.trends-table th,
.trends-table td {
  padding: 0.5rem 0.65rem;
  white-space: nowrap;
}

.trends-table th {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.85;
}

.trend-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.trend-chip-up {
  background: #0b2b1d;
  color: #d7f4e7;
  border-color: #1c6f49;
}

.trend-chip-down {
  background: #3a1014;
  color: #ffdce2;
  border-color: #8b2b36;
}

.trend-chip-neutral {
  background: #203041;
  color: #dce9f7;
  border-color: #3d5670;
}

@media (max-width: 680px) {
  .trends-summary {
    padding: 0.65rem;
  }

  .trends-table {
    min-width: 560px;
  }

  .trends-summary-meta-sep {
    display: none;
  }
}

td a {
  color: #0b6f94;
  text-decoration-color: currentColor;
  text-underline-offset: 2px;
}

td a:hover {
  color: #095775;
}

.scan-json-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88rem;
}

html[data-theme='dark'] td a {
  color: #8fd9ff;
}

html[data-theme='dark'] td a:hover {
  color: #b8e8ff;
}

.scan-json-dialog {
  width: min(980px, 94vw);
  max-height: 86vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: var(--card);
  color: var(--ink);
}

#scan-report-dialog[open],
#scan-email-log-dialog[open] {
  display: flex;
  flex-direction: column;
  height: min(86vh, 920px);
  overflow: hidden;
}

.scan-json-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.scan-json-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}

#scan-report-dialog .scan-json-dialog-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
}

.scan-json-dialog-header h3 {
  margin: 0;
}

.scan-json-content {
  margin: 0;
  padding: 1rem;
  max-height: calc(86vh - 68px);
  overflow: auto;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.4;
}

.scan-report-content {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.scan-report-refine-panel {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

#scan-report-dialog .scan-report-version-row {
  position: sticky;
  top: 63px;
  z-index: 19;
}

.scan-report-version-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.scan-report-version-label {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.scan-report-version-select {
  min-width: 250px;
  max-width: 100%;
}

.scan-report-version-row .site-nav-btn {
  border-radius: 8px;
  height: 2.5rem;
}

.scan-report-delete-btn {
  margin-left: auto;
}

.scan-report-refine-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.scan-report-refine-textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 0.55rem 0.65rem;
}

.scan-report-refine-actions {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

.scan-report-email-panel {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.scan-report-email-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.scan-report-email-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.scan-report-email-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.scan-report-email-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}

.scan-report-email-input,
.scan-report-email-textarea {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  font-family: inherit;
}

.scan-report-email-field .select2-container {
  width: 100% !important;
}

.scan-report-email-field .select2-container--default .select2-selection--single {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 4px !important;
  height: auto !important;
  min-height: 38px;
}

.scan-report-email-field .select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 0.45rem 2rem 0.45rem 0.6rem !important;
  font-size: 0.9rem;
  line-height: 1.5 !important;
}

.scan-report-email-field .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--input-placeholder) !important;
}

.scan-report-email-field .select2-selection__arrow {
  height: 100% !important;
}

select.scan-report-email-input,
select.scan-report-version-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

.scan-report-email-textarea {
  min-height: 72px;
  resize: vertical;
}

#scan-report-email-intro,
#scan-report-email-footer {
  min-height: 160px;
}

.scan-report-email-preview-wrapper {
  margin-bottom: 0.65rem;
}

.scan-report-email-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.scan-report-email-preview-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scan-report-email-preview-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
}

.scan-report-email-preview-toggle svg {
  width: 0.7rem;
  height: 0.7rem;
  fill: currentColor;
  flex: 0 0 auto;
}

.scan-report-email-preview-toggle:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.scan-report-email-preview {
  width: 100%;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  display: block;
}

.scan-report-email-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
}

.report-preview {
  background: #ffffff;
  color: #1a2430;
  border-radius: 10px;
  border: 1px solid #d7e1ec;
  overflow: hidden;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  background: linear-gradient(130deg, #0f4f72, #0b6f94 58%, #27a39c);
  color: #f8fcff;
}

.report-header-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.report-logo {
  max-height: 34px;
  max-width: 150px;
  object-fit: contain;
  display: block;
}

.report-wordmark {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.report-header-meta {
  margin-left: auto;
  text-align: right;
}

.report-header-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.report-header-client,
.report-header-date {
  font-size: 0.82rem;
  opacity: 0.95;
}

.report-body {
  padding: 1rem 1.05rem;
  line-height: 1.5;
}

.report-body .report-section + .report-section {
  margin-top: 0.35rem;
}

.report-body h1,
.report-body h2,
.report-body h3 {
  color: #0d4b6f;
  margin-top: 0.85rem;
  margin-bottom: 0.35rem;
  break-after: avoid;
  page-break-after: avoid;
}

.report-body p {
  margin: 0.45rem 0;
}

.report-body ul,
.report-body ol {
  margin: 0.45rem 0 0.6rem 1.2rem;
}

.report-body .report-link {
  color: #0b6f94;
  text-decoration: underline;
  font-weight: 600;
}

.report-body .report-cta-button {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  background: #27a39c;
  color: #052f28;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(5, 47, 40, 0.08);
}

.report-body .report-cta-button:hover,
.report-body .report-cta-button:focus-visible {
  background: #1f938d;
  color: #ffffff;
  text-decoration: none;
}

.json-token-key {
  color: #6b4fdb;
}

.json-token-string {
  color: #0f7a57;
}

.json-token-number {
  color: #b24d00;
}

.json-token-boolean {
  color: #0b6f94;
  font-weight: 600;
}

.json-token-null {
  color: #8b4f19;
  font-weight: 600;
}

html[data-theme='dark'] .json-token-key {
  color: #b4a6ff;
}

html[data-theme='dark'] .json-token-string {
  color: #7ddfb5;
}

html[data-theme='dark'] .json-token-number {
  color: #ffb26f;
}

html[data-theme='dark'] .json-token-boolean {
  color: #8fd9ff;
}

html[data-theme='dark'] .json-token-null {
  color: #ffca85;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  overflow-x: auto;
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  position: sticky;
  top: 0.75rem;
  z-index: 10;
}

.stat-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.stat-card-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 12px;
}

.stat-card {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0.9rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.stat-card h2,
.stat-card .stat-value {
  margin: 0;
}

.stat-card.good { background: var(--good); }
.stat-card.warn { background: var(--warn); }
.stat-card.neutral { background: var(--neutral); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.delta-groups {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 1rem;
}

.delta-group-item > h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.delta-instances {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.delta-instance-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem;
  background: var(--card);
}

.delta-instance-item > div {
  margin-bottom: 0.35rem;
}

.delta-instance-item a {
  color: #0b6f94;
  text-decoration-color: currentColor;
  text-underline-offset: 2px;
}

.delta-instance-item a:hover {
  color: #095775;
}

html[data-theme='dark'] .delta-instance-item a {
  color: #8fd9ff;
}

html[data-theme='dark'] .delta-instance-item a:hover {
  color: #b8e8ff;
}

.login-screen {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(96vw, 420px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
}

.delta-badge .badge-count {
  font-weight: 700;
}

.hidden {
  display: none;
}

/* ── Sort controls ───────────────────────────────── */

.sort-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sort-label {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.6;
  margin-right: 0.2rem;
  white-space: nowrap;
}

/* ── Disabled / archived site cards ─────────────── */

.client-card-item[data-site-status='disabled'],
.client-card-item[data-site-status='archived'] {
  opacity: 0.6;
}

.client-card-item[data-site-status='disabled']:hover,
.client-card-item[data-site-status='archived']:hover {
  opacity: 1;
}

.hidden-until-client {
  display: none;
}

/* ── Client card grid ───────────────────────── */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.section-header h2 {
  margin: 0;
}

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

#sites-grid,
#disabled-sites-grid,
#archived-sites-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

#pending-sites-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.client-card-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.client-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  flex: 1;
  min-width: 0;
}

.client-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow 0.15s, border-color 0.15s;
  height: 100%;
  min-width: 0;
}

.client-card.sync-summary-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  height: auto;
}

.client-card-link:hover .client-card {
  border-color: var(--primary);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
}

.client-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.client-card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.client-card-meta {
  font-size: 0.75rem;
  opacity: 0.55;
  white-space: nowrap;
}

.client-card-score {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.score-number {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}

.score-number.score-excellent {
  color: #218f76;
}

.score-number.score-good {
  color: #b37f1a;
}

.score-number.score-fair {
  color: #c4682a;
}

.score-number.score-poor {
  color: #c84f4f;
}

html[data-theme='dark'] .score-number.score-excellent {
  color: #75d7bf;
}

html[data-theme='dark'] .score-number.score-good {
  color: #f0c15c;
}

html[data-theme='dark'] .score-number.score-fair {
  color: #f1a464;
}

html[data-theme='dark'] .score-number.score-poor {
  color: #f08a8a;
}

.score-label {
  font-size: 0.9rem;
  opacity: 0.55;
}

.client-card-date {
  font-size: 0.8rem;
  opacity: 0.55;
}

.client-card-date.site-url {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.delta-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.5;
}

.delta-badge .badge-count {
  font-weight: 700;
}

.delta-badge.delta-good {
  background: var(--good);
  color: #145c30;
}

.delta-badge.delta-bad {
  background: var(--error);
  color: #7a1010;
}

.delta-badge.delta-neutral {
  background: var(--neutral);
  color: var(--ink);
}

html[data-theme='dark'] .delta-badge.delta-good { color: #7de8b4; }
html[data-theme='dark'] .delta-badge.delta-bad  { color: #ff9999; }

.client-card-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sev-pill {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}

.sev-pill.sev-critical { background: #ffd9d9; color: #6b0000; }
.sev-pill.sev-serious  { background: #ffe5cc; color: #7a3000; }
.sev-pill.sev-moderate { background: var(--warn); color: #5c3d00; }
.sev-pill.sev-minor    { background: var(--neutral); color: #2a3a6b; }
.sev-pill.sev-active   { background: var(--good); color: #0b4f33; }

html[data-theme='dark'] .sev-pill.sev-critical { background: #4a2020; color: #ffaaaa; }
html[data-theme='dark'] .sev-pill.sev-serious  { background: #4a3210; color: #ffcc88; }
html[data-theme='dark'] .sev-pill.sev-moderate { background: #403218; color: #ffe0a0; }
html[data-theme='dark'] .sev-pill.sev-minor    { background: #273246; color: #aabfff; }
html[data-theme='dark'] .sev-pill.sev-active   { background: #1f3b31; color: #9be3be; }

.client-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.client-card-hint {
  font-size: 0.8rem;
  opacity: 0.55;
}

/* ── Custom comparison accordion ───────────── */

.custom-comparison-toggle {
  all: unset;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  color: var(--ink);
}

.custom-comparison-toggle:hover {
  color: var(--primary);
}

.toggle-chevron {
  font-size: 0.75rem;
  transition: transform 0.15s;
}

[aria-expanded="true"] .toggle-chevron {
  transform: rotate(180deg);
}

/* ── Clickable client cards ───────────────── */

.client-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.client-card-link:hover .client-card {
  border-color: var(--primary);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
}

/* ── Upload toggle (same as custom comparison) ───────── */

.upload-toggle {
  all: unset;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  color: var(--ink);
}

.upload-toggle:hover {
  color: var(--primary);
}

/* ── Hidden sections ──────────────────────────────── */

.hidden {
  display: none;
}

/* ── Tab interface ───────────────────────────────── */

.upload-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 1.5rem;
}

.tab-button {
  all: unset;
  cursor: pointer;
  padding: 0.75rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  opacity: 0.65;
}

.tab-button:hover {
  color: var(--primary);
  opacity: 0.85;
}

.tab-button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  opacity: 1;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.15s;
}

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

/* Sync run link button */
.sync-run-link-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  color: #8fd9ff;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-decoration: none;
}

html[data-theme='light'] .sync-run-link-btn {
  color: #0066cc;
}

.sync-run-link-btn:hover {
  text-decoration: underline;
}

html[data-theme='dark'] .sync-run-link-btn:hover {
  color: #b8e8ff;
}

html[data-theme='light'] .sync-run-link-btn:hover {
  color: #0044aa;
}

/* Sync run details dialog */
.sync-run-details-dialog {
  width: min(980px, 94vw);
  max-height: 86vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: var(--card);
  color: var(--ink);
}

.sync-run-details-dialog[open] {
  display: flex;
  flex-direction: column;
  height: min(86vh, 920px);
  overflow: hidden;
}

.sync-run-details-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.sync-run-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
}

.sync-run-details-header h2 {
  margin: 0;
}

.sync-run-details-content {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

/* Sync run status row colors */
.sync-status-row-uptodate {
  background-color: rgba(34, 139, 34, 0.15);
}

html[data-theme='dark'] .sync-status-row-uptodate {
  background-color: rgba(34, 139, 34, 0.25);
}

.sync-status-row-imported {
  background-color: rgba(25, 25, 112, 0.15);
}

html[data-theme='dark'] .sync-status-row-imported {
  background-color: rgba(65, 105, 225, 0.25);
}

.sync-status-row-inactive {
  background-color: rgba(64, 64, 64, 0.15);
}

html[data-theme='dark'] .sync-status-row-inactive {
  background-color: rgba(96, 96, 96, 0.25);
}

/* Sync site ID secondary text */
.sync-site-id-secondary {
  display: block;
  font-size: 0.8rem;
  margin-top: 0.25rem;
  color: #d0d0d0;
  opacity: 0.7;
}

html[data-theme='light'] .sync-site-id-secondary {
  color: #808080;
  opacity: 0.65;
}
