/* x0 live diagrams — HTML boxes + SVG arrows */

.diagram-wrap {
  position: relative;
  width: 100%;
  min-height: 220px;
}

.diagram-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.diagram-nodes {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0.5rem;
}

.diagram-node {
  flex: 1;
  min-width: 120px;
  background: #fff;
  border: 2px solid #bcccdc;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}

/* Homepage Data Flow: one horizontal line; CSS arrows on box midline (no SVG overlay) */
.arch-flow {
  margin: 0.75rem 0 0.25rem;
  width: 100%;
}

.arch-flow-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-height: 5.5rem;
  padding: 1.75rem 0.25rem 1.5rem;
  box-sizing: border-box;
}

.arch-box {
  flex: 0 0 auto;
  min-width: 6.5rem;
  max-width: 9.5rem;
  padding: 0.85rem 1rem;
  border: 2px solid #d9e2ec;
  border-radius: 10px;
  text-align: center;
  background: #fff;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.arch-box .node-title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 0.25rem;
  color: #1f2933;
}

.arch-box .node-sub {
  font-size: 0.85rem;
  color: #627d98;
  margin: 0;
}

.arch-box .arch-status {
  margin-top: 0.35rem;
  font-size: 0.78rem;
}

.arch-box-xero {
  background: rgba(19, 181, 234, 0.1); /* 10% of #13B5EA — whole box */
  border-color: rgba(19, 181, 234, 0.35);
}

.arch-box-x0 {
  background: rgba(0, 0, 0, 0.05); /* 5% grey */
  border-color: #d9e2ec;
}

.arch-box-excel {
  background: rgba(16, 124, 65, 0.1); /* 10% of #107C41 */
  border-color: rgba(16, 124, 65, 0.35);
}

/* Arrow is only a 2px shaft in the flex row → always on the vertical midline of the boxes.
   Labels are positioned above/below and do not affect alignment. */
.arch-arrow {
  position: relative;
  flex: 1 1 4.5rem;
  min-width: 4rem;
  max-width: 7.5rem;
  height: 2px;
  margin: 0 0.35rem;
  align-self: center;
}

.arch-arrow-line {
  display: block;
  width: 100%;
  height: 2px;
  background: #627d98;
  position: relative;
}

.arch-arrow-line::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid #627d98;
  transform: translateY(-50%);
}

.arch-arrow-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 500;
  color: #627d98;
  line-height: 1.2;
  pointer-events: none;
}

.arch-arrow-above {
  bottom: calc(100% + 0.4rem);
}

.arch-arrow-below {
  top: calc(100% + 0.4rem);
}

.diagram-node.active,
.arch-box.active {
  border-color: #0b69a3;
  box-shadow: 0 0 0 3px rgba(11, 105, 163, 0.15);
}

.diagram-node.done,
.arch-box.done {
  border-color: #3e8914;
  background: #f0fdf4;
}

.diagram-node.pending {
  border-color: #d9e2ec;
  color: #627d98;
}

.diagram-node .node-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.diagram-node .node-metric {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: #0b69a3;
}

.diagram-node .node-sub {
  font-size: 0.85rem;
  color: #627d98;
  margin-top: 0.35rem;
}

.diagram-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-top: 0.5rem;
}

.diagram-badge.ok { background: #e3f9e5; color: #056608; }
.diagram-badge.warn { background: #fff3c4; color: #8d6b00; }
.diagram-badge.idle { background: #eef2f7; color: #627d98; }

.ops-layout main,
.ops-layout header,
.ops-layout footer {
  max-width: 1100px;
}

.ops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 800px) {
  .ops-grid { grid-template-columns: 1fr; }
  .diagram-nodes { flex-direction: column; }
  .arch-flow-row {
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem 0;
  }
  .arch-arrow {
    flex: 0 0 auto;
    width: 2px;
    height: 2.75rem;
    min-width: 2px;
    max-width: 2px;
    margin: 0.15rem 0;
  }
  .arch-arrow-line {
    width: 2px;
    height: 100%;
  }
  .arch-arrow-line::after {
    right: 50%;
    top: auto;
    bottom: -1px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #627d98;
    border-bottom: 0;
    transform: translateX(50%);
  }
  .arch-arrow-above {
    bottom: auto;
    left: calc(100% + 0.45rem);
    top: 50%;
    transform: translateY(-50%);
  }
  .arch-arrow-below {
    top: auto;
    left: auto;
    right: calc(100% + 0.45rem);
    bottom: 50%;
    transform: translateY(50%);
  }
}

.customer-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 280px;
  overflow-y: auto;
}

.customer-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #eef2f7;
  font-size: 0.9rem;
}

.customer-list .state {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.customer-list .state.signup { color: #627d98; }
.customer-list .state.xero { color: #0b69a3; }
.customer-list .state.api_key { color: #7b2cbf; }
.customer-list .state.excel { color: #d97706; }
.customer-list .state.refresh_ok { color: #056608; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #627d98;
}

.live-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bcccdc;
}

.live-pill.connected::before {
  background: #3e8914;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
