/* Shared page styles from HTML mockups */
.kv-card .kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv-card .kv-row:last-child { border-bottom: none; }
.kv-card .k { color: var(--muted); }
.kv-card .v { font-family: ui-monospace, monospace; word-break: break-all; }
.servers-table-wrap { overflow: auto; margin-top: 12px; }
.servers-table .server-name { font-weight: 700; }
.servers-table .server-id { font-size: 12px; color: var(--muted); }
.servers-table .server-id code { font-size: 11px; }

.servers-table td:nth-child(10) .btn { display: inline-flex !important; }
.card.slim.kpi { display: flex; flex-direction: column; gap: 8px; }
.card.slim.kpi .num { font-size: 28px; }
.card.slim.kpi .overview-top-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card.slim.kpi .row { margin-top: 4px; }
.btn.secondary { background: var(--btn-bg); }
.foldTitle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px 0; }
.foldTitle h3 { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--muted); font-size: 12px; }
.mutedLink { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.searchItem { cursor: default; }
.certCard { min-height: 140px; }
.cert-fold-card { cursor: default; transition: border-color 0.2s, box-shadow 0.2s; }
.cert-fold-card .cert-fold-view-btn { cursor: pointer; }
.cert-fold-card.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(96,165,250,.2); }
html[data-theme="light"] .cert-fold-card.active { box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.cert-fold-card h3 { font-size: 15px; margin: 0; }
.cert-fold-count { font-size: 28px; font-weight: 700; margin: 8px 0 0 0; color: var(--text); }
.kv-row-domains { align-items: flex-start; }
.kv-row-domains .k { padding-top: 4px; }
.kv-card .v.v-domains {
  font-family: inherit;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 72%;
}
.domain-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--input-bg);
  font-size: 12px;
  color: var(--text);
  line-height: 1.2;
}
.domain-chip.more {
  color: var(--muted);
}
.cred-card .cred-desc { margin: 0 0 12px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.cred-card .cred-hr { margin: 14px 0; border: none; border-top: 1px solid var(--line); }
.cred-card .cred-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.cred-card .cred-row:last-of-type { border-bottom: none; }
.cred-card .cred-k { color: var(--muted); flex-shrink: 0; }
.cred-card .cred-v-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; justify-content: flex-end; }
.cred-card .cred-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; font-family: ui-monospace, monospace; font-size: 12px; color: var(--text); }
.cred-card .cred-copy-btn { flex-shrink: 0; padding: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px; }
.cred-card .cred-copy-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
html[data-theme="light"] .cred-card .cred-copy-btn:hover { background: rgba(0,0,0,0.06); }
.cred-card .cred-note { margin: 14px 0 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.agent-waiting { display: flex; align-items: center; gap: 12px; padding: 14px 0; }
.agent-waiting .spinner { width: 24px; height: 24px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: cred-spin 0.8s linear infinite; }
@keyframes cred-spin { to { transform: rotate(360deg); } }
.agent-success .success-msg { font-weight: 600; color: var(--text); margin-bottom: 12px; }
.agent-success .success-msg .badge { margin-left: 8px; vertical-align: middle; }
.agent-install-content #serverCredentialsCard { margin-bottom: 20px; }
.agent-install-content .grid.cols-2 { margin-top: 0; }
.agent-install-content .textarea[readonly] {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
  background: var(--input-bg);
}
.install-cmd-block {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(59, 130, 246, 0.04);
}
html[data-theme="light"] .install-cmd-block { background: rgba(37, 99, 235, 0.04); }
.chartWrap { width: 100%; height: 320px; border-radius: 22px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)); padding: 14px; box-shadow: var(--shadow); }
.payNow { white-space: nowrap; }
.inv-type { font-size: 12px; }
.inv-type.invoice { color: var(--brand); }
.inv-type.receipt { color: var(--good); }
.inv-type.credit { color: #93c5fd; } /* light blue */
.inv-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alerts-list { display: flex; flex-direction: column; gap: 16px; }
.alert-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.alert-card:hover { box-shadow: 0 12px 36px rgba(0,0,0,.12); }
html[data-theme="dark"] .alert-card:hover { box-shadow: 0 12px 36px rgba(0,0,0,.4); }
/* .alert-card--severity-warning { border-left: 4px solid var(--warn); } */
/* .alert-card--severity-critical { border-left: 4px solid var(--bad); } */
.alert-card--severity-info { border-left: 4px solid var(--brand); }
.alert-card .alert-head {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 14px 20px 16px 20px; margin: -20px -20px 0 -20px; margin-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.alert-card .alert-title {
  margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1.3;
}
.alert-card .alert-message {
  margin: 0; font-size: 13px; font-weight: 400; color: var(--text); line-height: 1.45; word-break: break-word; max-width: 100%;
}
.alert-badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.alert-badges .badge { padding: 5px 12px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.badge--severity.warn { background: rgba(251,191,36,.18); color: var(--warn); border: 1px solid rgba(251,191,36,.35); }
.badge--severity.bad { background: rgba(251,113,133,.18); color: var(--bad); border: 1px solid rgba(251,113,133,.35); }
.badge--severity:not(.warn):not(.bad) { background: rgba(96,165,250,.15); color: var(--brand); border: 1px solid rgba(96,165,250,.3); }
.badge--status.good { background: rgba(45,212,191,.15); color: var(--good); border: 1px solid rgba(45,212,191,.3); }
.badge--status.warn { background: rgba(251,191,36,.12); color: var(--warn); border: 1px solid rgba(251,191,36,.25); }
.alert-card .alert-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Alert identity strip — wider boxes (fewer columns) */
.alert-identity { margin-top: 16px; margin-bottom: 14px; }
.alert-identity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.alert-identity-box--actions .alert-identity-box-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.alert-identity-box--actions .alert-badges { margin: 0; }
.alert-identity-box--actions .alert-actions { margin: 0; padding: 0; border: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-success { background: #059669; border-color: transparent; color: #fff; font-weight: 600; }
.btn-success:hover { background: #047857; color: #fff; }
.alert-identity-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.alert-identity-box:hover { border-color: rgba(96,165,250,.2); }
.alert-identity-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.alert-identity-value { font-size: 13px; color: var(--text); word-break: break-word; line-height: 1.4; }
.alert-identity-value .alert-id-code { font-size: 11px; background: rgba(0,0,0,.12); padding: 3px 6px; border-radius: 6px; font-family: ui-monospace, monospace; }
html[data-theme="dark"] .alert-identity-value .alert-id-code { background: rgba(255,255,255,.08); }

/* Alert explanation box — no left colored border, white background */
.alert-msg-box {
  margin-top: 0;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-left-width: 0 !important;
  background: #fff !important;
}
.alert-msg-box.warn { background: #fff !important; }
.alert-msg-box.bad { background: #fff !important; }
.alert-msg-box:not(.warn):not(.bad) { background: #fff !important; }
.callout.alert-msg-box { margin-top: 0; background: #fff !important; }
.alert-msg-box-title { margin: 0 0 12px 0; font-size: 14px; font-weight: 600; color: var(--text); }
.alert-explain-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.5; margin-top: 4px; }
.alert-explain-table td { padding: 6px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.alert-explain-table tr:last-child td { border-bottom: none; }
.alert-explain-table .alert-explain-k { font-weight: 600; color: var(--muted); width: 1%; white-space: nowrap; padding-right: 14px; }
.alert-explain-table .alert-explain-v { color: var(--text); word-break: break-word; }
.alert-explain-steps { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.alert-explain-steps .alert-explain-k { font-weight: 600; color: var(--muted); font-size: 13px; display: block; margin-bottom: 8px; }
.alert-steps-list { margin: 0 0 0 4px; padding: 0 0 0 20px; font-size: 13px; line-height: 1.55; }
.alert-steps-list li { margin-bottom: 8px; padding-left: 4px; position: relative; }
.alert-steps-list li::marker { color: var(--brand); font-weight: 600; }

/* Previous failures table */
.alert-history-section { margin-top: 18px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.alert-history-section strong { font-size: 14px; color: var(--text); }
.alert-history-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.alert-history-table th, .alert-history-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.alert-history-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.alert-history-label { font-size: 12px; font-weight: 600; color: var(--text); }
.alert-history-table tbody tr:hover { background: rgba(0,0,0,.03); }
html[data-theme="dark"] .alert-history-table tbody tr:hover { background: rgba(255,255,255,.03); }
.alert-history-table td code { font-size: 12px; background: rgba(0,0,0,.1); padding: 4px 8px; border-radius: 6px; }
.alert-history-detail { font-size: 12px; }
.alert-history-detail summary { cursor: pointer; color: var(--brand); font-weight: 500; }
.alert-history-detail-pre { margin: 8px 0 0 0; padding: 12px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; font-size: 11px; white-space: pre-wrap; word-break: break-word; max-height: 180px; overflow: auto; }
/* Three columns side by side: Identity grid | What this means | Technical trace */
.alert-three-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.alert-three-col--double { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.alert-identity-col { min-width: 0; }
.alert-identity-col .alert-identity { margin-top: 0; margin-bottom: 0; }
.alert-identity-col .alert-identity-grid { grid-template-columns: 1fr; }
.alert-technical-col { min-width: 0; }
.alert-technical-box { padding: 16px 18px; }
.alert-technical-box--empty { padding: 14px; }
.alert-technical-pre { margin: 0; padding: 12px; white-space: pre-wrap; overflow: auto; max-height: 320px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #1a1a1a; font-size: 12px; }
.alerts-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.alerts-filters .label { font-size: 12px; color: var(--muted); margin-right: 4px; }
.alerts-filters select { min-width: 120px; padding: 10px 10px; font-size: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--text); }
.alerts-empty { min-height: 500px; padding: 24px; text-align: center; color: var(--muted); display: flex; align-items: center; justify-content: center; }

/* Date range picker */
.alerts-date-range-wrap { position: relative; }
.alerts-date-range-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  min-width: 160px; padding: 10px 12px; font-size: 13px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--text);
  cursor: pointer;
}
.alerts-date-range-trigger:hover { border-color: var(--brand); }
.alerts-date-range-chevron { font-size: 10px; color: var(--muted); }
.alerts-date-range-panel {
  position: absolute; left: 0; top: 100%; margin-top: 6px; z-index: 100;
  min-width: 320px; max-width: 420px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.alerts-date-range-header {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 14px; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.alerts-date-range-close {
  background: none; border: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; opacity: .9;
}
.alerts-date-range-close:hover { opacity: 1; }
.alerts-date-range-body { display: flex; padding: 12px; gap: 12px; max-height: 360px; overflow: auto; }
.alerts-date-range-presets {
  display: flex; flex-direction: column; gap: 2px; min-width: 140px;
}
.alerts-date-preset {
  display: block; width: 100%; padding: 8px 12px; text-align: left; font-size: 13px;
  background: none; border: none; border-radius: var(--radius); color: var(--text);
  cursor: pointer;
}
.alerts-date-preset:hover { background: rgba(96,165,250,.12); }
.alerts-date-preset.active { background: rgba(96,165,250,.2); color: var(--brand); font-weight: 600; }
.alerts-date-range-custom {
  flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.alerts-date-range-inputs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alerts-date-range-inputs .input { flex: 1; min-width: 120px; }
.alerts-date-range-sep { color: var(--muted); font-weight: 600; }
.alerts-date-range-custom .btn { align-self: flex-end; }
.checkout-cart { margin-top: 12px; }
.checkout-cart .table { width: 100%; border-collapse: collapse; font-size: 13px; }
.checkout-cart .table tr.total-row td { font-weight: 700; background: rgba(255,255,255,.03); }

/* Pages responsive (media queries only) */
@media (max-width: 1024px) {
  .alert-three-col { grid-template-columns: 1fr; }
  .alert-three-col--double { grid-template-columns: 1fr; }
  .alert-identity-col .alert-identity-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 640px) {
  .alert-identity-grid { grid-template-columns: 1fr; }
  .alert-identity-col .alert-identity-grid { grid-template-columns: 1fr; }
  .servers-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
  .servers-table th, .servers-table td { font-size: 12px; padding: 10px 12px; }
  .servers-table th:nth-child(9), .servers-table td:nth-child(9) { min-width: 100px; }
  .servers-table th:nth-child(10), .servers-table td:nth-child(10) { min-width: 100px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; gap: 12px; }
  .card.slim.kpi { min-width: 0; }
  .foldTitle { flex-wrap: wrap; gap: 8px; }
  .certCard { min-height: auto; }
  .cert-fold-card h3 { font-size: 14px; }
  .cert-fold-count { font-size: clamp(22px, 5vw, 28px); }
  .kv-card .v.v-domains { max-width: 100%; justify-content: flex-start; }
  .cred-card .cred-row { flex-wrap: wrap; }
  .cred-card .cred-value { max-width: 100%; }
  .inv-actions { flex-direction: column; align-items: stretch; }
  .inv-actions .btn { width: 100%; }
  .chartWrap { height: 240px; padding: 10px; }
  .payNow { white-space: normal; }
  .checkout-cart .table { font-size: 12px; }
  .checkout-cart .table th, .checkout-cart .table td { padding: 8px 10px; }
}
@media (max-width: 480px) {
  .servers-table-wrap { margin: 0 -12px; padding: 0 12px; }
}
@media (min-width: 480px) {
  .grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .inv-actions { flex-direction: row; flex-wrap: wrap; }
  .inv-actions .btn { width: auto; }
}
@media (min-width: 641px) {
  .servers-table th, .servers-table td { font-size: 13px; padding: 12px; }
  
  .chartWrap { height: 280px; }
  .checkout-cart .table { font-size: 13px; }
}
@media (min-width: 768px) {
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
  .chartWrap { height: 320px; }
}
