:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #17202a;
  --muted: #6b7785;
  --green: #238636;
  --green-dark: #176b2b;
  --border: #dfe4ea;
  --danger: #b42318;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--text); font-family: Arial, sans-serif; }
.topbar { background: #111820; color: white; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar a { color: white; text-decoration: none; margin-right: 16px; }
.brand { font-size: 20px; font-weight: 700; }
.container { max-width: 1500px; margin: 0 auto; padding: 24px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin: 18px 0; overflow-x: auto; }
.narrow { max-width: 700px; }
.login-card { max-width: 420px; margin: 10vh auto; background: white; padding: 32px; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.12); }
label { display: block; margin: 12px 0; font-weight: 600; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: white; }
button, .button { display: inline-block; border: 0; border-radius: 8px; padding: 10px 16px; color: white; background: var(--green); text-decoration: none; cursor: pointer; font-weight: 700; }
button:hover, .button:hover { background: var(--green-dark); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; background: white; padding: 16px; border-radius: 12px; border: 1px solid var(--border); align-items: end; }
.page-title { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi { background: white; border: 1px solid var(--border); padding: 18px; border-radius: 14px; }
.kpi span { display: block; color: var(--muted); font-size: 14px; }
.kpi strong { display: block; font-size: 30px; margin-top: 8px; }
.grid-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { border-bottom: 1px solid var(--border); padding: 10px; text-align: left; vertical-align: top; }
th { background: #edf7ef; position: sticky; top: 0; }
td.wide { min-width: 280px; white-space: pre-wrap; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 12px; }
.badge.ok { background: #dff7e4; color: #126b27; }
.badge.muted { background: #eceff2; color: #5b6570; }
.message { background: #e7f6ec; border: 1px solid #91d5a3; padding: 12px; border-radius: 10px; }
.error { background: #fff0ef; border: 1px solid #f0aaa5; color: var(--danger); padding: 12px; border-radius: 10px; }
.hint, small { color: var(--muted); }
pre { white-space: pre-wrap; word-break: break-word; }
code { background: #eef1f4; padding: 2px 5px; border-radius: 5px; }
@media (max-width: 700px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 12px 14px 8px; gap: 10px; }
  .topbar nav { display: flex; flex-wrap: nowrap; gap: 6px; width: 100%; overflow-x: auto; padding: 2px 0 7px; scrollbar-width: thin; }
  .topbar nav a { flex: 0 0 auto; margin: 0; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.08); white-space: nowrap; }
  .brand { font-size: 18px; }
  .container { width: 100%; padding: 12px; }
  .page-title { align-items: flex-start; flex-direction: column; }
  .page-title h1, h1 { margin: 8px 0 4px; font-size: 24px; line-height: 1.2; overflow-wrap: anywhere; }
  h2 { font-size: 20px; overflow-wrap: anywhere; }
  .card { width: 100%; padding: 13px; margin: 12px 0; overflow: hidden; }
  .login-card { width: calc(100% - 24px); margin: 5vh 12px; padding: 22px 18px; }
  .grid-two, .grid-three, .kpi-grid, .filters { grid-template-columns: minmax(0, 1fr); }
  button, .button, input, select, textarea { min-height: 44px; font-size: 16px; }
  button, .button { width: 100%; text-align: center; }
  form { max-width: 100%; }
  img, svg, video { max-width: 100%; height: auto; }
  pre, code { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }

  table { display: block; min-width: 0; width: 100%; }
  table thead { display: none; }
  table tbody { display: block; width: 100%; }
  table tr { display: block; width: 100%; margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
  table td { display: grid; grid-template-columns: minmax(105px, 36%) minmax(0, 1fr); gap: 10px; width: 100%; min-width: 0 !important; padding: 8px 2px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
  table td:last-child { border-bottom: 0; }
  table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.35; }
  table td:empty { display: none; }
  table td.wide { white-space: pre-wrap; }
  table td form + form { margin-top: 8px; }
}

textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(250px, 1fr)); gap: 12px 18px; margin-bottom: 18px; }
.form-grid .span-2 { grid-column: span 2; }
.checkbox { display: flex; gap: 8px; align-items: center; }
.checkbox input { width: auto; }
.grid-three { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.button.secondary { background: #54616d; margin-top: 8px; }
a { color: #1769aa; }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}

.card.inset { background: #f7faf8; border-style: dashed; padding: 12px; margin: 12px 0; }

.badge.running { background: #fff4cc; color: #7a5b00; }
.probe-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.probe-kpis span { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 12px; color: var(--muted); }
.probe-kpis strong { display: block; color: var(--text); font-size: 20px; margin-top: 3px; }
.artifact-links { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 720px) { .probe-kpis { grid-template-columns: 1fr; } }

.kpi small { display: block; margin-top: 7px; color: #64748b; font-size: 12px; line-height: 1.25; }
.legacy-local-status { display: none; }
.connector-runtime-summary {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #cfe2d3;
  border-radius: 10px;
  background: #f5fbf6;
}
.connector-runtime-summary p { margin: 7px 0; }


.action-kpi { border-color: #e5b94f; background: #fffaf0; }
.archive-kpi { border-color: #cbd5dc; background: #f6f8f9; }
.period-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.recent-card { border-left: 5px solid #2e7d32; }
.archive-card { border-left: 5px solid #78909c; background: #fafbfc; }
.archive-message { background: #f1f4f6; border-color: #cbd5dc; color: #475467; }
.archive-row { background: #fafbfc; color: #667085; }
.archive-value { color: #667085; }
@media (max-width: 720px) {
  .period-heading { flex-direction: column; }
}


.sync-box { border: 2px solid #2e7d32; background: #f5fbf6; }
.sync-title { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.sync-title p { margin-bottom: 0; }
.sync-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.sync-actions form { margin: 0; }
.secondary-button { background: #546e7a; }
.danger-button { background: #b42318; }
.progress-track {
  width: 100%;
  height: 14px;
  background: #dfe7e1;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
}
.progress-fill {
  height: 100%;
  background: #2e7d32;
  border-radius: inherit;
  transition: width 0.25s ease;
}
.diagnostics {
  margin-top: 16px;
  border-top: 1px dashed #b8c4bc;
  padding-top: 12px;
}
.diagnostics > summary {
  cursor: pointer;
  font-weight: 700;
  color: #475467;
}
@media (max-width: 720px) {
  .sync-title { flex-direction: column; }
  .sync-actions { flex-direction: column; }
  .sync-actions button { width: 100%; }
}


.review-link { color: inherit; text-decoration: none; }
.review-link:hover { color: #147a35; text-decoration: underline; }
.review-detail-grid { align-items: start; }
.review-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.review-rating { font-size: 30px; font-weight: 800; margin-right: 10px; }
.review-text {
  white-space: pre-wrap;
  font-size: 17px;
  line-height: 1.55;
  padding: 16px;
  border-radius: 12px;
  background: #f7f9f8;
}
.published-reply, .latest-draft {
  margin-top: 18px;
  padding: 16px;
  border-left: 4px solid #2e7d32;
  background: #f3faf5;
  border-radius: 8px;
}
.review-actions, .draft-toolbar, .integration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}
.review-actions form,
.draft-toolbar form,
.integration-actions form,
.inline-form {
  margin: 0;
}
textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 180px;
  padding: 12px;
  border: 1px solid #cfd8d3;
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.integration-card { min-height: 300px; }
@media (max-width: 720px) {
  .review-detail-header,
  .review-actions,
  .draft-toolbar,
  .integration-actions {
    flex-direction: column;
    align-items: stretch;
  }
}


.model-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 16px;
}
.model-list code {
  padding: 6px 9px;
  border-radius: 7px;
  background: #eef4f0;
  border: 1px solid #d7e3db;
}
.public-feedback { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: linear-gradient(145deg, #edf7ef, #f6f8fb); }
.public-feedback-card { width: min(100%, 620px); background: #fff; padding: 28px; border-radius: 20px; box-shadow: 0 12px 38px rgba(17,24,32,.12); }
.public-feedback-card h1 { margin: 0 0 8px; }.public-store { color: var(--muted); margin-top: 0; }
.rating-choice { display: flex; justify-content: space-between; gap: 8px; margin: 24px 0; }.rating-choice button { width: 100%; color: #c7cdd3; background: #f2f4f6; font-size: 30px; padding: 12px 4px; }.rating-choice button.selected,.rating-choice button:hover { color: #e4a11b; background: #fff7df; }.rating-choice small { display:block; color:inherit; font-size:12px; }
.public-link { margin: 6px 6px 0 0; }.public-feedback-card form { margin-top: 18px; }
.public-review-muted { color: #9aa4ae; font-size: 13px; text-decoration: none; }.public-review-muted:hover { color: #6b7785; text-decoration: underline; }
@media (max-width: 520px) { .public-feedback-card { padding: 22px 16px; }.rating-choice { gap: 4px; }.rating-choice button { font-size: 24px; padding: 10px 2px; } }


.publish-panel {
  margin-top: 18px;
  padding: 18px;
  border: 2px solid #2e7d32;
  border-radius: 12px;
  background: #f5fbf6;
}
.publish-panel h3 { margin-top: 0; }
.publish-preview {
  margin: 12px 0 16px;
  padding: 14px 16px;
  border-left: 4px solid #2e7d32;
  background: #ffffff;
  white-space: pre-wrap;
}
.publish-button {
  background: #1f7a35;
  font-size: 16px;
  padding: 12px 18px;
}
.publish-state-needs_verification {
  border-color: #d29b26;
  background: #fffaf0;
}
.publish-state-error {
  border-color: #cf4b42;
  background: #fff7f6;
}


.error-badge {
  background: #fee4e2;
  color: #b42318;
}
.sync-live-progress {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #b8d8c0;
  border-radius: 10px;
  background: #ffffff;
}
.sync-live-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin: 8px 0;
}
#sync-current-target {
  margin-bottom: 0;
  color: #344054;
}
@media (max-width: 720px) {
  .sync-live-row {
    flex-direction: column;
    gap: 6px;
  }
}


.sync-scope {
  margin: 12px 0 16px;
  padding: 10px 12px;
  border: 1px solid #d7e3db;
  border-radius: 10px;
  background: #f8fbf9;
}
.sync-scope summary {
  cursor: pointer;
  font-weight: 700;
}
.scope-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 14px;
}
.scope-columns ul {
  margin: 8px 0 0;
  padding-left: 20px;
}
@media (max-width: 720px) {
  .scope-columns {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}
.kpi-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-link:hover,
.kpi-link:focus-visible {
  border-color: var(--accent, #3478f6);
  box-shadow: 0 4px 16px rgba(40, 72, 120, 0.12);
  transform: translateY(-1px);
}
