* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--primary-dark);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  color: #f8faf9;
  background: var(--sidebar);
  border-right: 1px solid #26332e;
}

.brand {
  display: flex;
  min-height: 86px;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #2b3833;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  border: 1px solid #35a99c;
  border-radius: 6px;
  font-size: 20px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 1px;
  color: var(--sidebar-muted);
  font-size: 12px;
}

.primary-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
}

.nav-item {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  color: var(--sidebar-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: left;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
}

.nav-item:hover {
  color: #ffffff;
  background: #222e29;
}

.nav-item.is-active {
  color: #ffffff;
  background: #253a34;
  border-color: #365048;
}

.sidebar-foot {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 9px;
  padding: 0 20px;
  color: var(--sidebar-muted);
  border-top: 1px solid #2b3833;
  font-size: 12px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  background: #36a968;
  border-radius: 50%;
}

.content-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 86px;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(20px, 3vw, 44px);
  background: rgba(244, 246, 245, 0.96);
  border-bottom: 1px solid var(--line);
}

.page-heading {
  min-width: 0;
  flex: 1;
}

.page-heading p,
.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 23px;
  font-weight: 720;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.icon-button:hover {
  color: var(--primary-dark);
  border-color: var(--line-strong);
  background: var(--primary-soft);
}

.icon-button.is-danger {
  color: var(--danger);
}

.icon-button.is-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc1bd;
}

.mobile-menu {
  display: none;
}

#app-view {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px clamp(20px, 3vw, 44px) 56px;
  outline: none;
}

.view-stack {
  display: grid;
  gap: 24px;
}

.section-heading {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
}

.section-heading p {
  max-width: 720px;
  margin: 5px 0 0;
  color: var(--muted);
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  min-width: 0;
  min-height: 126px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kpi-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 6px;
}

.kpi-icon.is-blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.kpi-icon.is-amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.kpi-icon.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.kpi-value {
  display: block;
  margin-top: 12px;
  overflow-wrap: anywhere;
  font-size: 30px;
  font-weight: 760;
  line-height: 1;
}

.kpi-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(520px, 1.5fr);
  gap: 18px;
  align-items: start;
}

.surface {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.surface-head {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.surface-head h2,
.surface-head h3 {
  margin: 0;
  font-size: 15px;
}

.surface-body {
  padding: 18px;
}

.bar-list {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(100px, 2fr) 48px;
  align-items: center;
  gap: 12px;
}

.bar-label {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  background: var(--surface-muted);
  border-radius: 3px;
}

.bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  background: var(--amber);
  border-radius: 3px;
}

.bar-value {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.table-shell {
  width: 100%;
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #f9faf9;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #f8faf9;
}

.table-primary {
  display: block;
  max-width: 340px;
  overflow: hidden;
  color: var(--ink);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-secondary {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.align-right {
  text-align: right !important;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.is-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #b8dec8;
}

.badge.is-warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #efd29d;
}

.badge.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc1bd;
}

.badge.is-info {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #bed3e6;
}

.score {
  display: inline-flex;
  min-width: 52px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 4px;
  font-weight: 750;
}

.score.is-mid {
  color: var(--amber);
  background: var(--amber-soft);
}

.score.is-low {
  color: var(--danger);
  background: var(--danger-soft);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-weight: 680;
  text-decoration: none;
}

.button svg {
  width: 18px;
  height: 18px;
}

.button:hover {
  background: var(--surface-muted);
}

.button.is-primary {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.button.is-primary:hover {
  background: var(--primary-dark);
}

.button.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc1bd;
}

.button.is-quiet {
  min-height: 36px;
  padding: 0 10px;
  color: var(--primary-dark);
  background: transparent;
  border-color: transparent;
}

.button.is-quiet:hover {
  background: var(--primary-soft);
}

.button.is-small {
  min-height: 36px;
  padding: 0 10px;
  font-size: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 20px;
  align-items: start;
}

.form-panel {
  min-width: 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.form-panel + .form-panel {
  margin-top: 16px;
}

.form-section {
  display: grid;
  gap: 18px;
}

.form-section + .form-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.form-section h2,
.form-section h3 {
  margin: 0;
  font-size: 15px;
}

.form-section .section-copy {
  margin: -12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-grid.is-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field > span,
.field-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.field small {
  color: var(--muted);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: none;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 120, 109, 0.13);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 44px;
  padding: 3px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.segmented label {
  position: relative;
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 36px;
  place-items: center;
  padding: 0 8px;
  border-radius: 4px;
  font-weight: 650;
  text-align: center;
}

.segmented input:checked + span {
  color: var(--primary-dark);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(19, 34, 28, 0.12);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.upload-field {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 144px;
  place-items: center;
  padding: 16px;
  color: var(--muted);
  background: #fafcfb;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  text-align: center;
}

.upload-field:hover,
.upload-field:focus-within {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: var(--primary);
}

.upload-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-field svg {
  width: 26px;
  height: 26px;
  margin-bottom: 8px;
}

.upload-field strong,
.upload-field small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.upload-field strong {
  color: var(--ink);
  font-size: 13px;
}

.upload-field small {
  margin-top: 4px;
  font-size: 11px;
}

.upload-field.has-file {
  color: var(--success);
  background: var(--success-soft);
  border-color: #8cc6a5;
}

.rule-note {
  display: flex;
  gap: 10px;
  padding: 13px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #c5d8e8;
  border-radius: 5px;
  font-size: 12px;
}

.rule-note svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink-soft);
}

.check-list svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 2px;
  color: var(--success);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-field {
  position: relative;
  min-width: 230px;
  flex: 1;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-field .input {
  padding-left: 38px;
}

.filter-bar .select {
  width: auto;
  min-width: 160px;
}

.watch-export-button {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

.watch-export-button.is-disabled {
  pointer-events: none;
  opacity: 0.55;
}

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  color: var(--line-strong);
}

.empty-state h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 15px;
}

.empty-state p {
  max-width: 480px;
  margin: 0;
}

.loading-state {
  display: grid;
  min-height: 420px;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
}

.spinner {
  width: 25px;
  height: 25px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-line {
  width: 100%;
  height: 7px;
  overflow: hidden;
  background: var(--surface-muted);
  border-radius: 3px;
}

.progress-line span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.review-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  color: var(--ink);
  background: var(--amber-soft);
  border: 1px solid #e8ca91;
  border-radius: var(--radius);
}

.review-banner.is-generated {
  background: var(--success-soft);
  border-color: #add6bf;
}

.review-banner h2 {
  margin: 0;
  font-size: 16px;
}

.review-banner p {
  margin: 4px 0 0;
  color: var(--ink-soft);
}

.reason-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.reason-item {
  min-width: 0;
  padding: 13px;
  background: #fafbf9;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.reason-item strong {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reason-item span {
  display: block;
  margin-top: 5px;
  font-size: 21px;
  font-weight: 750;
}

.teams-box {
  position: relative;
}

.teams-box .textarea {
  min-height: 132px;
  padding-right: 52px;
  background: #f9fbfa;
}

.teams-box .icon-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface);
}

.rule-condition-list {
  display: grid;
  gap: 10px;
}

.condition-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(150px, 1fr) minmax(160px, 1.3fr) 44px;
  gap: 8px;
  align-items: end;
  padding: 11px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.check-control {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
}

.check-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.rule-status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.catalog-selector {
  min-width: 0;
}

.catalog-selector .field-hint {
  margin-top: 4px;
}

.catalog-selector-chips {
  display: flex;
  min-height: 30px;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.catalog-selector-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 5px 4px 9px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #c5d8e8;
  border-radius: 999px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.catalog-selector-chip.is-legacy {
  color: var(--ink-soft);
  background: var(--surface-muted);
  border-style: dashed;
}

.catalog-selector-chip button {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.catalog-selector-chip button:hover,
.catalog-selector-chip button:focus-visible {
  background: rgba(19, 75, 115, 0.12);
  outline: none;
}

.catalog-selector-chip svg {
  width: 14px;
  height: 14px;
}

.catalog-selector-control {
  display: flex;
  min-width: 0;
  gap: 8px;
}

.catalog-selector-input-wrap {
  position: relative;
  min-width: 0;
  flex: 1;
}

.catalog-selector-input-wrap svg {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.catalog-selector-input-wrap .input {
  width: 100%;
  min-width: 0;
  padding-left: 38px;
}

.catalog-selector-control .button {
  flex: 0 0 auto;
}

.catalog-selector-message {
  min-height: 18px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.catalog-selector-message.is-error {
  color: var(--danger);
}

.definition-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
}

.definition-list dt {
  color: var(--muted);
}

.definition-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(15, 23, 20, 0.56);
}

.modal-frame {
  display: flex;
  max-height: calc(100vh - 34px);
  flex-direction: column;
}

.modal-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 20px;
  scroll-padding-bottom: 96px;
}

.modal-actions {
  position: sticky;
  bottom: -20px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin: 22px -20px -20px;
  padding: 14px 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  width: min(380px, calc(100vw - 40px));
  gap: 8px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  color: #ffffff;
  background: #27342f;
  border: 1px solid #3f5149;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.toast.is-error {
  background: #76251f;
  border-color: #9f3930;
}

.toast svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  place-items: center;
  background: rgba(244, 246, 245, 0.78);
}

.busy-overlay.is-visible {
  display: grid;
}

.busy-box {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.code-text {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.nowrap {
  white-space: nowrap;
}

.sidebar-scrim {
  display: none;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .form-layout {
    grid-template-columns: 1fr;
  }

  .form-layout > aside {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .form-panel + .form-panel {
    margin-top: 0;
  }
}

@media (max-width: 840px) {
  :root {
    --sidebar-width: 280px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-scrim.is-open {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: rgba(15, 23, 20, 0.46);
  }

  .content-shell {
    margin-left: 0;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .connection {
    display: none;
  }

  .topbar {
    min-height: 76px;
    padding: 10px 16px;
  }

  .page-heading h1 {
    font-size: 20px;
  }

  #app-view {
    padding: 20px 16px 42px;
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .upload-field {
    min-height: 104px;
  }

  .field-grid.is-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reason-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-layout > aside {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .catalog-selector-control {
    flex-direction: column;
  }

  .catalog-selector-control .button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .topbar-actions {
    gap: 6px;
  }

  .kpi-grid,
  .field-grid,
  .field-grid.is-three,
  .reason-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 112px;
  }

  .section-heading,
  .review-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .section-actions,
  .section-actions .button,
  .review-banner .button {
    width: 100%;
  }

  .filter-bar .select,
  .search-field {
    width: 100%;
    min-width: 0;
  }

  .watch-export-button {
    width: 100%;
    margin-left: 0;
  }

  .condition-row {
    grid-template-columns: 1fr;
  }

  .condition-row .icon-button {
    width: 100%;
  }

  .bar-row {
    grid-template-columns: minmax(100px, 1fr) minmax(80px, 1.4fr) 40px;
    gap: 8px;
  }

  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .modal-frame {
    max-height: calc(100vh - 18px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

.button,
.icon-button,
.nav-item,
.upload-field {
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.button:active,
.icon-button:active,
.nav-item:active {
  filter: brightness(0.94);
}

:where(button, a, input, select, textarea):focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 120;
  min-height: 44px;
  padding: 11px 14px;
  color: #ffffff;
  background: var(--primary-dark);
  border-radius: 5px;
  transform: translateY(-140%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.data-table td,
.kpi-value,
.bar-value,
.score {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 840px) {
  .button.is-small,
  .button.is-quiet {
    min-height: 44px;
  }
}

/* Dashboard glass analytics refresh */
/* Source catalogue, automation and Copilot */
.input.is-readonly {
  color: var(--ink);
  background: var(--surface-muted);
  cursor: default;
}

.field-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.table-secondary {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.source-filters .field {
  min-width: 170px;
}

.source-table .source-assignment {
  min-width: 110px;
}

.source-routing-control {
  display: grid;
  min-width: 190px;
  gap: 7px;
}

.source-effective {
  display: flex;
  align-items: center;
  gap: 7px;
}

.source-effective small {
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.source-age {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.source-age-copy,
.muted-text {
  color: var(--muted);
  font-size: 0.76rem;
}

.source-brands {
  min-width: 190px;
  max-width: 300px;
  white-space: normal;
}

.automation-list {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.automation-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(210px, 0.9fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 78px;
  padding: 14px 16px;
  background: var(--surface);
}

.automation-row + .automation-row {
  border-top: 1px solid var(--line);
}

.delete-confirmation {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.delete-confirmation-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #efc1bd;
  border-radius: 6px;
}

.delete-confirmation-icon svg {
  width: 20px;
  height: 20px;
}

.delete-confirmation-copy {
  margin: 1px 0 16px;
  color: var(--ink);
}

.delete-job-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.delete-job-summary > div {
  min-width: 0;
  padding: 0 12px;
  border-left: 1px solid var(--line);
}

.delete-job-summary > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.delete-job-summary dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.delete-job-summary dd {
  margin: 0;
  font-weight: 700;
}

.delete-retention-note {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

@media (max-width: 560px) {
  .delete-confirmation {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
  }

  .delete-job-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .delete-job-summary > div,
  .delete-job-summary > div:first-child {
    padding: 0;
    border-left: 0;
  }

  .delete-confirmation + .modal-actions {
    flex-direction: column-reverse;
  }

  .delete-confirmation + .modal-actions .button {
    width: 100%;
  }
}

.automation-toggle span {
  display: grid;
  gap: 3px;
}

.automation-toggle small,
.automation-next span {
  color: var(--muted);
  font-size: 0.72rem;
}

.automation-next {
  display: grid;
  gap: 4px;
}

.automation-next strong {
  font-size: 0.82rem;
}

.automation-next small {
  color: var(--muted);
  font-size: 0.72rem;
}

.automation-interval {
  margin: 0;
}

.stepper-field {
  display: grid;
  grid-template-columns: minmax(64px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.stepper-field small {
  color: var(--muted);
}

.watchlist-table .button {
  min-height: 36px;
  padding-block: 7px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .automation-row {
    grid-template-columns: minmax(220px, 1fr) minmax(130px, 0.55fr) auto;
  }

  .automation-next {
    display: none;
  }
}

@media (max-width: 720px) {
  .source-filters .field {
    min-width: 0;
    width: 100%;
  }

  .automation-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }

  .automation-row .button {
    width: 100%;
  }

  .automation-next {
    display: grid;
  }
}

html {
  background: var(--bg);
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(8, 127, 115, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 127, 115, 0.028) 1px, transparent 1px);
  background-size: 32px 32px;
  font-family: "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
}

.sidebar {
  background: rgba(20, 32, 28, 0.985);
  border-right-color: rgba(255, 255, 255, 0.08);
  box-shadow: 14px 0 38px rgba(15, 27, 23, 0.08);
}

.brand {
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

.brand-mark {
  background: var(--primary);
  border-color: rgba(122, 227, 212, 0.52);
  box-shadow: 0 8px 20px rgba(8, 127, 115, 0.25);
}

.nav-item {
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.065);
}

.nav-item.is-active {
  background: rgba(89, 190, 173, 0.13);
  border-color: rgba(119, 210, 194, 0.18);
}

.nav-item.is-active::before {
  position: absolute;
  inset: 9px auto 9px -1px;
  width: 3px;
  content: "";
  background: #60d1bd;
  border-radius: 0 3px 3px 0;
}

.sidebar-foot {
  border-top-color: rgba(255, 255, 255, 0.09);
}

.topbar {
  min-height: 82px;
  background: rgba(247, 250, 249, 0.78);
  border-bottom-color: rgba(185, 201, 195, 0.72);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.page-heading p {
  color: #55736a;
}

.connection,
.icon-button {
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 5px 18px rgba(27, 53, 44, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#app-view {
  max-width: 1560px;
  padding-top: 24px;
}

.dashboard-page {
  gap: 20px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(430px, 0.96fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
  min-height: 318px;
  padding: 22px 4px 26px;
}

.dashboard-hero-copy {
  min-width: 0;
  padding: 8px 0;
}

.live-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  color: var(--primary-dark);
  background: rgba(222, 243, 239, 0.72);
  border: 1px solid rgba(8, 127, 115, 0.2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-hero-copy h2 {
  max-width: 720px;
  margin: 18px 0 12px;
  color: #12201c;
  font-size: 40px;
  font-weight: 760;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.dashboard-hero-copy > p {
  max-width: 690px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.button.is-glass {
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(8, 127, 115, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.button.is-glass:hover {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--primary);
}

.hero-footnote {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.hero-footnote span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.hero-footnote svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.hero-analytics {
  min-width: 0;
  padding: 22px 24px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.hero-analytics-head,
.analytics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.hero-analytics-head h3 {
  margin: 3px 0 0;
  font-size: 16px;
}

.hero-analytics-head .eyebrow,
.analytics-head .eyebrow {
  color: #64766f;
  font-size: 10px;
  letter-spacing: 0;
}

.history-visual {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  margin-top: 18px;
}

.history-donut {
  position: relative;
  display: grid;
  width: 174px;
  height: 174px;
  flex: 0 0 174px;
  place-items: center;
  background: conic-gradient(var(--blue) 0 var(--run-share), var(--violet) var(--run-share) 100%);
  border-radius: 50%;
  box-shadow: 0 14px 32px rgba(69, 77, 158, 0.2);
}

.history-donut::after {
  position: absolute;
  inset: 16px;
  content: "";
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(216, 226, 222, 0.78);
  border-radius: 50%;
}

.history-donut > span {
  position: relative;
  z-index: 1;
  display: grid;
  max-width: 130px;
  gap: 4px;
  text-align: center;
}

.history-donut strong {
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.history-donut small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.history-legend {
  display: grid;
  gap: 10px;
  margin: 0;
}

.history-legend > div {
  display: grid;
  grid-template-columns: minmax(70px, 0.8fr) minmax(90px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(216, 226, 222, 0.8);
}

.history-legend > div:last-child {
  border-bottom: 0;
}

.history-legend dt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.history-legend dd {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: flex-end;
  gap: 7px;
  margin: 0;
  font-size: 16px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.history-legend dd small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 2px;
}

.legend-dot.is-run,
.legend-dot.is-retained {
  background: var(--blue);
}

.legend-dot.is-new {
  background: var(--violet);
}

.legend-dot.is-excluded {
  background: var(--amber);
}

.kpi-card,
.surface {
  background: var(--glass);
  border-color: rgba(204, 217, 212, 0.82);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
}

.kpi-card {
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.kpi-card:hover {
  background: var(--glass-strong);
  border-color: rgba(145, 173, 163, 0.82);
  box-shadow: 0 14px 36px rgba(27, 53, 44, 0.1);
}

.dashboard-kpi {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  padding: 19px;
}

.dashboard-kpi::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  content: "";
  background: var(--primary);
}

.dashboard-kpi.is-blue::before {
  background: var(--blue);
}

.dashboard-kpi.is-amber::before {
  background: var(--amber);
}

.dashboard-kpi.is-danger::before {
  background: var(--danger);
}

.kpi-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-kpi .kpi-value {
  margin-top: 14px;
  font-size: 32px;
}

.kpi-meta {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  margin-bottom: 1px;
  padding: 3px 8px;
  color: var(--ink-soft);
  background: rgba(237, 243, 241, 0.82);
  border: 1px solid rgba(196, 211, 205, 0.84);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.75fr);
  gap: 18px;
  align-items: stretch;
}

.analytics-panel {
  min-height: 350px;
}

.analytics-head {
  min-height: 70px;
}

.analytics-head > div {
  min-width: 0;
}

.analytics-head h2 {
  margin-top: 2px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.activity-chart-legend {
  max-width: 440px;
  row-gap: 7px;
}

.legend-dot.is-integrated {
  background: var(--success);
}

.legend-dot.is-in-progress {
  background: #d7951f;
}

.legend-dot.is-not-integrated {
  background: var(--danger);
}

.legend-dot.is-unchecked {
  background: #87958f;
}

.chart-body {
  min-height: 278px;
}

.activity-chart {
  position: relative;
  display: grid;
  height: 292px;
  grid-template-columns: repeat(var(--activity-weeks, 8), minmax(34px, 1fr));
  gap: clamp(8px, 1.5vw, 18px);
  align-items: stretch;
  padding: 104px 8px 0;
}

.activity-chart::before {
  position: absolute;
  z-index: 1;
  inset: 104px 8px 34px;
  content: "";
  background-image: linear-gradient(to bottom, rgba(102, 118, 111, 0.13) 1px, transparent 1px);
  background-size: 100% 25%;
  pointer-events: none;
}

.activity-wave {
  position: absolute;
  z-index: 0;
  inset: 104px 8px 34px;
  width: calc(100% - 16px);
  height: calc(100% - 138px);
  overflow: hidden;
  border-radius: 4px;
  pointer-events: none;
}

.activity-wave path {
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.activity-wave .is-integrated {
  fill: color-mix(in srgb, var(--success) 18%, transparent);
  stroke: color-mix(in srgb, var(--success) 58%, transparent);
}

.activity-wave .is-in-progress {
  fill: rgba(215, 149, 31, 0.17);
  stroke: rgba(215, 149, 31, 0.58);
}

.activity-wave .is-not-integrated {
  fill: color-mix(in srgb, var(--danger) 15%, transparent);
  stroke: color-mix(in srgb, var(--danger) 54%, transparent);
}

.activity-wave .is-unchecked {
  fill: rgba(135, 149, 143, 0.13);
  stroke: rgba(103, 121, 113, 0.42);
}

.activity-column {
  z-index: 2;
  display: grid;
  min-width: 0;
  grid-template-rows: minmax(0, 1fr) 34px;
  gap: 7px;
  align-items: end;
  outline: none;
}

.activity-plot {
  display: flex;
  min-height: 0;
  height: 100%;
  align-items: flex-end;
  justify-content: center;
}

.activity-stack {
  display: flex;
  width: clamp(22px, 42%, 40px);
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--surface-muted);
  border: 1px solid rgba(21, 35, 30, 0.08);
  border-radius: 4px 4px 2px 2px;
  box-shadow: 0 4px 12px rgba(24, 48, 40, 0.08);
  transition: box-shadow 160ms ease, filter 160ms ease, transform 160ms ease;
}

.activity-segment {
  display: block;
  width: 100%;
  min-height: 3px;
}

.activity-segment.is-retained {
  background: var(--blue);
}

.activity-segment.is-excluded {
  background: var(--amber);
}

.activity-column:hover .activity-stack,
.activity-column:focus-visible .activity-stack {
  box-shadow: 0 9px 20px rgba(24, 48, 40, 0.16);
  filter: saturate(1.12);
  transform: translateY(-2px);
}

.activity-column:focus-visible .activity-stack {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.activity-period {
  display: grid;
  min-width: 0;
  align-content: start;
  justify-items: center;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.activity-period b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.activity-period small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  opacity: 0.78;
}

.activity-tooltip {
  position: absolute;
  z-index: 8;
  top: 8px;
  left: 50%;
  display: grid;
  visibility: hidden;
  width: min(420px, calc(100% - 16px));
  gap: 8px;
  padding: 10px 12px;
  color: #f7faf9;
  background: #15231e;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  box-shadow: 0 14px 30px rgba(21, 35, 30, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.activity-tooltip > header,
.activity-tooltip > header small,
.activity-tooltip-metrics {
  display: flex;
  align-items: center;
}

.activity-tooltip-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.activity-tooltip-status span {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 2px 6px;
  align-items: center;
  color: rgba(247, 250, 249, 0.78);
  font-size: 10px;
}

.activity-tooltip-status b {
  grid-column: 2;
  color: #f7faf9;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.activity-tooltip > header {
  justify-content: space-between;
  gap: 14px;
}

.activity-tooltip > header > strong {
  font-size: 12px;
  font-weight: 720;
}

.activity-tooltip > header small {
  flex: 0 0 auto;
  gap: 6px;
  color: rgba(247, 250, 249, 0.76);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.activity-tooltip > header small b {
  color: #f7faf9;
}

.activity-tooltip-metrics {
  align-items: stretch;
  gap: 18px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.activity-tooltip-row {
  display: grid;
  min-width: 0;
  flex: 1 1 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 10px;
  font-size: 11px;
}

.activity-tooltip-row > span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: rgba(247, 250, 249, 0.78);
}

.activity-tooltip-row b {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.activity-tooltip-row small {
  grid-column: 1 / -1;
  margin-left: 13px;
  color: rgba(247, 250, 249, 0.8);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.activity-column:hover .activity-tooltip,
.activity-column:focus-visible .activity-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

.activity-chart:not(:has(.activity-column:hover)):not(:has(.activity-column:focus-visible))
  .activity-column:last-child .activity-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

.chart-empty {
  position: relative;
  display: grid;
  min-height: 258px;
  place-items: center;
  overflow: hidden;
  text-align: center;
}

.chart-empty > div:last-child {
  position: relative;
  z-index: 1;
  max-width: 390px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(216, 226, 222, 0.84);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chart-empty h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.chart-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-empty-grid {
  position: absolute;
  inset: 18px 16px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 16px;
  padding: 0 16px;
  background-image: linear-gradient(to bottom, rgba(102, 118, 111, 0.1) 1px, transparent 1px);
  background-size: 100% 25%;
}

.chart-empty-grid span {
  width: 8%;
  max-width: 34px;
  background: rgba(47, 111, 237, 0.08);
  border: 1px solid rgba(47, 111, 237, 0.08);
  border-radius: 4px 4px 0 0;
}

.chart-empty-grid span:nth-child(1) { height: 30%; }
.chart-empty-grid span:nth-child(2) { height: 46%; }
.chart-empty-grid span:nth-child(3) { height: 38%; }
.chart-empty-grid span:nth-child(4) { height: 64%; }
.chart-empty-grid span:nth-child(5) { height: 52%; }
.chart-empty-grid span:nth-child(6) { height: 76%; }

.reason-panel .surface-body {
  min-height: 278px;
}

.reason-panel .empty-state {
  min-height: 242px;
  padding: 22px;
}

.reason-panel .bar-fill {
  background: var(--amber);
}

.reason-panel .bar-row {
  grid-template-columns: minmax(105px, 1.05fr) minmax(80px, 1.25fr) 44px;
}

.quality-panel,
.recent-jobs-panel {
  overflow: hidden;
}

.quality-panel .data-table th,
.recent-jobs-panel .data-table th {
  background: rgba(245, 248, 247, 0.9);
}

.quality-panel .data-table tbody tr:hover,
.recent-jobs-panel .data-table tbody tr:hover {
  background: rgba(226, 242, 238, 0.42);
}

.button.is-primary {
  box-shadow: 0 8px 18px rgba(8, 127, 115, 0.18);
}

.button.is-primary:hover {
  box-shadow: 0 10px 24px rgba(8, 127, 115, 0.24);
}

@media (max-width: 1180px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero-analytics {
    max-width: 720px;
  }

  .dashboard-analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .dashboard-hero {
    min-height: 0;
    padding-top: 10px;
  }

  .dashboard-hero-copy h2 {
    font-size: 30px;
  }

  .hero-analytics {
    padding: 18px;
  }

  .history-visual {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 18px;
  }

  .history-donut {
    width: 150px;
    height: 150px;
    flex-basis: 150px;
  }

  .activity-chart {
    grid-template-columns: repeat(var(--activity-weeks, 8), minmax(24px, 1fr));
    gap: 5px;
  }

  .chart-legend {
    justify-content: flex-start;
  }

  .activity-chart-legend {
    max-width: none;
  }

  .analytics-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 500px) {
  body {
    background-size: 24px 24px;
    font-size: 16px;
  }

  .dashboard-hero-copy h2 {
    font-size: 27px;
  }

  .dashboard-hero-copy > p {
    font-size: 15px;
  }

  .hero-actions,
  .hero-actions .button {
    width: 100%;
  }

  .hero-footnote {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .history-visual {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .history-legend {
    width: 100%;
  }

  .hero-analytics-head {
    align-items: flex-start;
  }

  .dashboard-kpi {
    min-height: 132px;
  }

  .activity-chart {
    height: 282px;
    padding-inline: 0;
  }

  .activity-chart::before {
    right: 0;
    left: 0;
  }

  .activity-wave {
    right: 0;
    left: 0;
    width: 100%;
  }

  .activity-tooltip-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Grafana connector */
[hidden] {
  display: none !important;
}

.sync-source-heading {
  align-items: flex-end;
}

.source-segmented {
  width: min(100%, 340px);
  flex: 0 0 340px;
}

.source-segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.source-segmented svg {
  width: 16px;
  height: 16px;
}

.source-detail-panel {
  display: grid;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sync-status-line,
.sync-status-line > div,
.source-actions {
  display: flex;
  align-items: center;
}

.sync-status-line {
  justify-content: space-between;
  gap: 16px;
}

.sync-status-line > div {
  min-width: 0;
  gap: 11px;
}

.sync-status-line strong,
.sync-status-line small {
  display: block;
  overflow-wrap: anywhere;
}

.sync-status-line small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.sync-status-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid rgba(8, 127, 115, 0.18);
  border-radius: 6px;
  place-items: center;
}

.sync-status-icon svg {
  width: 20px;
  height: 20px;
}

.sync-facts,
.connector-overview {
  display: grid;
  margin: 0;
  background: rgba(237, 243, 241, 0.58);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sync-facts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sync-facts > div,
.connector-overview > div {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.sync-facts > div:last-child,
.connector-overview > div:last-child {
  border-right: 0;
}

.sync-facts dt,
.connector-overview dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.sync-facts dd,
.connector-overview dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.source-actions {
  justify-content: space-between;
  gap: 14px;
}

.inline-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid rgba(174, 101, 9, 0.24);
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.5;
}

.inline-alert.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(184, 59, 53, 0.24);
}

.inline-alert svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 1px;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  filter: none;
  opacity: 0.46;
}

.connector-settings {
  gap: 0;
}

.connector-overview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 4px;
}

.connector-group {
  display: grid;
  gap: 14px;
  padding-top: 22px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.connector-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.connector-group-head > div {
  min-width: 0;
}

.connector-group-head .button {
  flex: 0 0 auto;
}

.connector-group > div:first-child h4 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.connector-group > div:first-child p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.connector-actions {
  margin-top: 2px;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.password-field .icon-button {
  width: 44px;
  height: 44px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: minmax(230px, 1.4fr) repeat(2, minmax(160px, 0.8fr));
  gap: 14px;
  align-items: end;
}

.schedule-grid.is-generation {
  grid-template-columns: minmax(190px, 1.25fr) repeat(3, minmax(0, 0.75fr));
}

.quality-settings-grid .field:last-child {
  grid-column: 1 / -1;
}

.copilot-automation-block {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.copilot-automation-block .section-heading.is-compact {
  margin-bottom: 14px;
}

.schedule-grid.is-copilot {
  grid-template-columns: minmax(260px, 1.4fr) repeat(2, minmax(150px, 0.7fr));
}

.copilot-reinjection-toggle {
  align-items: flex-start;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.copilot-reinjection-toggle strong,
.copilot-reinjection-toggle small {
  display: block;
}

.copilot-reinjection-toggle small {
  margin-top: 3px;
  color: var(--ink-soft);
}

.automation-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.automation-facts > div {
  min-width: 0;
  padding: 11px 12px;
}

.automation-facts > div + div {
  border-left: 1px solid var(--line);
}

.automation-facts dt {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.automation-facts dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.watchlist-automation-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 11px 14px;
  color: var(--ink-soft);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.watchlist-automation-strip strong {
  color: var(--ink);
}

.watchlist-automation-strip .badge {
  margin-left: auto;
}

@media (max-width: 700px) {
  .settings-panel .schedule-grid.is-copilot,
  .automation-facts {
    grid-template-columns: 1fr;
  }

  .automation-facts > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .watchlist-automation-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .watchlist-automation-strip .badge {
    margin-left: 0;
  }
}

.schedule-toggle {
  min-height: 44px;
  padding: 10px 12px;
  background: rgba(237, 243, 241, 0.58);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.sync-profile-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.sync-profile-options legend {
  width: 100%;
  margin-bottom: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1000px) {
  .schedule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-toggle {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .connector-group-head {
    align-items: stretch;
    flex-direction: column;
  }

  .connector-group-head .button {
    width: 100%;
  }

  .sync-source-heading {
    align-items: stretch;
  }

  .source-segmented {
    width: 100%;
    flex-basis: auto;
  }

  .sync-facts,
  .connector-overview {
    grid-template-columns: 1fr;
  }

  .sync-facts > div,
  .connector-overview > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sync-facts > div:last-child,
  .connector-overview > div:last-child {
    border-bottom: 0;
  }

  .source-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .source-actions .button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .schedule-grid {
    grid-template-columns: 1fr;
  }

  .schedule-toggle {
    grid-column: auto;
  }

  .connector-actions,
  .connector-actions .button {
    width: 100%;
  }

  .sync-status-line {
    align-items: flex-start;
  }
}

