body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #f5f7fa;
  color: #1f2937;
}

header {
  background: #111827;
  color: white;
  padding: 24px;
}

main {
  padding: 20px;
  display: grid;
  gap: 20px;
}

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

.top-grid {
  align-items: start;
}

.card {
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

h1, h2, p {
  margin-top: 0;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  line-height: 1.45;
}

img {
  max-width: 100%;
  height: auto;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}

.health-box {
  font-size: 28px;
  font-weight: bold;
  padding: 14px 18px;
  border-radius: 10px;
  display: inline-block;
  min-width: 120px;
  text-align: center;
  border: 1px solid #d1d5db;
}

.health-ok {
  background: #dcfce7;
  color: #166534;
}

.health-warn {
  background: #fef3c7;
  color: #92400e;
}

.health-fail {
  background: #fee2e2;
  color: #991b1b;
}

.health-unknown {
  background: #e5e7eb;
  color: #374151;
}

.nodes-list {
  display: grid;
  gap: 10px;
}

.node-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fafafa;
}

.node-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 12px;
}

.node-running {
  background: #22c55e;
}

.node-stopped {
  background: #ef4444;
}

.node-paused {
  background: #f59e0b;
}

.node-unknown {
  background: #9ca3af;
}

.node-label {
  font-size: 14px;
}

#architecture-summary {
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.4;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
}

.meta-line {
  margin-bottom: 8px;
}

/* OPS Assistant */
#ops-chatbox {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px;
}

.ops-chat-message {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid #d1d5db;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.ops-chat-user {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.ops-chat-assistant {
  background: #f9fafb;
  border-color: #d1d5db;
}

.ops-chat-role {
  font-weight: bold;
  margin-bottom: 6px;
}

.ops-chat-time {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}

#ops-context {
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.4;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  min-height: 320px;
  box-sizing: border-box;
}

#ops-msg {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

button {
  cursor: pointer;
}

button:hover {
  opacity: 0.95;
}

/* Assistant Plans */
#ops-plans-box {
  display: grid;
  gap: 12px;
}

.ops-plan-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
}

.ops-plan-title {
  font-weight: bold;
  margin-bottom: 6px;
}

.ops-plan-meta {
  font-size: 13px;
  color: #475569;
  margin-bottom: 10px;
}

.ops-plan-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}


.ops-plan-result {
  font-size: 13px;
  color: #334155;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}


.ops-plan-details {
  margin-top: 6px;
}

.ops-plan-details summary {
  cursor: pointer;
  color: #334155;
  font-size: 13px;
  margin-bottom: 8px;
}

.ops-plan-pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  max-height: 260px;
  overflow: auto;
}


.ops-ok {
  color: #16a34a;
  font-weight: 700;
}

.ops-warn {
  color: #d97706;
  font-weight: 700;
}

.ops-crit {
  color: #dc2626;
  font-weight: 700;
}



.ops-summary-ok {
  color: #2f9e44;
  font-weight: 700;
}

.ops-summary-pending {
  color: #d4a017;
  font-weight: 700;
}

.ops-summary-manual {
  color: #c92a2a;
  font-weight: 700;
}

.ops-summary-failed {
  color: #e03131;
  font-weight: 700;
}

.ops-summary-neutral {
  color: #4dabf7;
  font-weight: 700;
}

#ops-apply-all-lowrisk-output .ops-line {
  margin: 2px 0;
}

#ops-apply-all-lowrisk-output .ops-section-title {
  margin-top: 10px;
  font-weight: 700;
  text-decoration: underline;
}



.ops-guide-do-now {
  color: #2f9e44;
  font-weight: 700;
}

.ops-guide-review {
  color: #d4a017;
  font-weight: 700;
}

.ops-guide-caution {
  color: #c92a2a;
  font-weight: 700;
}

.ops-guide-done {
  color: #1c7ed6;
  font-weight: 700;
}

/* ===== Mobile / Responsive Fix ===== */

* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
}

body {
  -webkit-text-size-adjust: 100%;
}

header {
  position: sticky;
  top: 0;
  z-index: 1000;
}

button,
input,
textarea {
  font-size: 16px;
}

button {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

button:active {
  transform: scale(0.98);
}

.card {
  overflow: hidden;
}

pre {
  overflow-x: auto;
}

#ops-chatbox {
  max-width: 100%;
  overflow-x: hidden;
}

img {
  display: block;
}

@media (max-width: 900px) {

  main {
    padding: 12px;
    gap: 14px;
  }

  .grid,
  .top-grid {
    grid-template-columns: 1fr !important;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 18px;
  }

  .meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  #ops-chatbox {
    height: 260px !important;
  }

  #ops-context {
    min-height: 180px;
  }

  .ops-plan-actions {
    flex-wrap: wrap;
  }

  .node-item {
    align-items: flex-start;
  }

  input[type="text"] {
    width: 100%;
    min-width: 0;
  }
}

/* Assistant responsive layout */
.ops-assistant-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .ops-assistant-layout {
    grid-template-columns: 1fr;
  }
}


/* ===== OPS PLAN CARDS ===== */

#ops-plans-box {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.ops-plan-card {
  border: 1px solid #dbe4ee;
  border-left: 6px solid #94a3b8;
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.ops-plan-card[data-status="pending"] {
  border-left-color: #f59e0b;
}

.ops-plan-card[data-status="approved"] {
  border-left-color: #2563eb;
}

.ops-plan-card[data-status="applied"] {
  border-left-color: #16a34a;
}

.ops-plan-card[data-status="failed"] {
  border-left-color: #dc2626;
}

.ops-plan-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.ops-plan-meta {
  color: #475569;
  font-size: 13px;
  margin-bottom: 10px;
  word-break: break-word;
}

.ops-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ops-plan-actions button {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.ops-plan-actions button:hover {
  background: #eef2ff;
}

.ops-plan-result {
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
  margin-bottom: 10px;
}

.ops-plan-details summary {
  cursor: pointer;
  color: #2563eb;
  font-weight: 600;
}

.ops-plan-pre {
  max-height: 320px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 10px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .ops-plan-card {
    padding: 12px;
  }

  .ops-plan-title {
    font-size: 15px;
  }

  .ops-plan-actions {
    flex-direction: column;
  }

  .ops-plan-actions button {
    width: 100%;
  }
}


/* ===== Failed / Status Plan UI ===== */

.ops-plan-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin-right: 8px;
  color: #fff;
}

.ops-plan-badge-pending {
  background: #f59e0b;
}

.ops-plan-badge-approved {
  background: #2563eb;
}

.ops-plan-badge-applied {
  background: #16a34a;
}

.ops-plan-badge-failed {
  background: #dc2626;
}

.ops-plan-badge-rejected {
  background: #64748b;
}

.ops-plan-log {
  margin-top: 10px;
  padding: 10px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 10px;
  max-height: 160px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
}

.ops-plan-card[data-status="failed"] {
  background: #fff7f7;
  border-color: #fecaca;
  border-left-color: #dc2626;
}

.ops-plan-card[data-status="pending"] {
  background: #fffbeb;
}

.ops-plan-card[data-status="applied"] {
  background: #f0fdf4;
}

/* ===== OPS Recommendations ===== */

#ops-recommendations {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ops-rec {
  border-radius: 14px;
  padding: 14px;
  border-left: 6px solid #999;
  background: #fff;
  line-height: 1.5;
}

.ops-rec-warning {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.ops-rec-info {
  border-left-color: #2563eb;
  background: #eff6ff;
}

.ops-rec-risk {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.status-tile {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.status-tile-title {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}

.status-tile-value {
  font-size: 22px;
  font-weight: 700;
}

.status-tile-ok {
  border-left: 6px solid #22c55e;
}

.status-tile-fail {
  border-left: 6px solid #ef4444;
}

.status-tile-warn {
  border-left: 6px solid #f59e0b;
}

.status-tile-unknown {
  border-left: 6px solid #9ca3af;
}

.ops-plan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ops-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.ops-plan-result {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
}

.ops-plan-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #2563eb;
  margin-top: 8px;
}

.ops-plan-pre {
  margin-top: 10px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 10px;
  max-height: 320px;
  overflow: auto;
  font-size: 12px;
}

.ops-plan-mini-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.ops-mini-pill {
  background: #e2e8f0;
  color: #334155;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 900px) {

  .ops-plan-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ops-plan-actions button {
    width: 100%;
  }

  .ops-plan-log {
    max-height: 220px;
  }
}

.ops-collapsible {
  position: relative;
}

.ops-collapse-toggle {
  float: right;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
  margin-top: -4px;
}

.ops-collapsed > *:not(h2):not(.ops-collapse-toggle) {
  display: none !important;
}

.ops-quicknav {
  position: sticky;
  top: 76px;
  z-index: 900;
  background: rgba(245,247,250,0.96);
  backdrop-filter: blur(8px);
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ops-quicknav a {
  text-decoration: none;
  background: #111827;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

.ops-quicknav a:hover {
  opacity: 0.9;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 150px;
}

@media (max-width: 900px) {
  .ops-quicknav {
    top: 70px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .ops-quicknav a {
    white-space: nowrap;
  }
}

.ops-searchbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.ops-searchbar input {
  flex: 1;
  min-width: 240px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 16px;
}

.ops-hidden-by-filter {
  display: none !important;
}

.ops-filterchips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ops-filterchip {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}

.ops-filterchip-active {
  background: #111827;
  color: #ffffff;
}
