:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fb;
  color: #182033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button, input, select, textarea {
  font: inherit;
}

.shell {
  width: 100%;
  margin: 0 auto;
  padding: 28px clamp(16px, 2vw, 32px) 56px;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: calc(100vh - 88px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(26, 40, 70, 0.09);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.topbar {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-box span {
  color: #516078;
  font-weight: 700;
}

.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #fff;
}

.nav-btn {
  background: transparent;
  color: #40506a;
}

.nav-btn:hover,
.nav-btn.active {
  background: #2563eb;
  color: #fff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  color: #2563eb;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 46px;
  line-height: 1;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

.subtitle {
  max-width: 620px;
  color: #516078;
  font-size: 17px;
  line-height: 1.55;
}

.panel, .status-card, .integration-card {
  border: 1px solid #dfe6f2;
  background: #fff;
  box-shadow: 0 10px 28px rgba(26, 40, 70, 0.06);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metrics div {
  padding: 18px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #fff;
}

.metrics strong {
  display: block;
  font-size: 28px;
}

.metrics span {
  color: #66748a;
}

.panel {
  margin-top: 18px;
  padding: 22px;
  border-radius: 8px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head p {
  margin-bottom: 0;
  color: #66748a;
}

.status-card {
  min-width: 300px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  padding: 16px;
}

.status-card span:last-child {
  display: block;
  margin-top: 3px;
  color: #66748a;
  font-size: 13px;
}

.status-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.14);
}

.status-dot.ok {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.14);
}

.status-dot.bad {
  background: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}

.grid, .form-grid {
  display: grid;
  gap: 14px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.settings-list {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #40506a;
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #172033;
}

input, select {
  height: 42px;
}

textarea {
  min-height: 96px;
  padding-top: 10px;
  resize: vertical;
}

input[readonly] {
  background: #f8fafc;
}

.wide {
  grid-column: span 2;
}

.full {
  grid-column: 1 / -1;
}

.form-actions, .card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
}

.secondary-btn:hover {
  background: #f8fafc;
}

.section-gap {
  margin-top: 16px;
}

.data-filter-grid {
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.data-summary {
  min-height: 24px;
  margin: 16px 0 10px;
  color: #516078;
  font-weight: 800;
}

.data-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.table-shell {
  overflow: auto;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #fff;
}

.data-table, .detail-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td,
.detail-table th,
.detail-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e8eef7;
  text-align: left;
  vertical-align: top;
}

.data-table th,
.detail-table th {
  background: #f8fafc;
  color: #40506a;
  font-size: 12px;
  text-transform: uppercase;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover,
.data-table .selected-row {
  background: #eff6ff;
}

.data-table td strong,
.data-table td span,
.detail-table td strong,
.detail-table td span {
  display: block;
}

.data-table td span,
.detail-table td span {
  margin-top: 3px;
  color: #66748a;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.detail-panel {
  position: sticky;
  top: 16px;
  padding: 18px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(26, 40, 70, 0.06);
}

.detail-panel h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.detail-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-title p {
  margin: 0;
  color: #66748a;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.detail-grid div {
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
}

.detail-grid span {
  display: block;
  color: #66748a;
  font-size: 12px;
}

.detail-grid strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.mini-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.status-synced {
  background: #dcfce7;
  color: #166534;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-ignored {
  background: #f3f4f6;
  color: #4b5563;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.error-text {
  margin: 6px 0 0;
  color: #b91c1c;
  font-size: 12px;
}

button {
  height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: #2563eb;
  color: white;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

.danger-btn {
  width: 100%;
  margin-top: 12px;
  background: #dc2626;
}

.danger-btn:hover {
  background: #b91c1c;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.integration-card {
  border-radius: 8px;
  padding: 16px;
}

.integration-card strong {
  display: block;
  margin-bottom: 6px;
}

.integration-card dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.integration-card div {
  min-width: 0;
}

.integration-card dt {
  color: #66748a;
  font-size: 12px;
}

.integration-card dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.integration-description {
  margin: 8px 0 12px;
  color: #516078;
  font-size: 13px;
  line-height: 1.45;
}

.card-actions {
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 800;
}

.message {
  min-height: 20px;
  margin: 12px 0 0;
  color: #2563eb;
  font-weight: 700;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 70px;
  margin: 14px 0 0;
  padding: 14px;
  border-radius: 8px;
  background: #111827;
  color: #d1fae5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
}

.modal-shell {
  width: min(1180px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-head h2 {
  margin: 0 0 4px;
}

.modal-head p {
  margin: 0;
  color: #66748a;
  overflow-wrap: anywhere;
}

.preview-content {
  min-height: 0;
  overflow: hidden;
}

.zip-preview-layout {
  height: 100%;
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
}

.zip-entry-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
}

.zip-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid #e2e8f0;
  color: #40506a;
}

.zip-entry-head span {
  color: #66748a;
  font-size: 12px;
}

.zip-entry-list {
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.zip-entry-list button {
  width: 100%;
  height: auto;
  min-height: 48px;
  display: block;
  margin-bottom: 6px;
  padding: 9px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #172033;
  text-align: left;
}

.zip-entry-list button:hover,
.zip-entry-list button.active {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.zip-entry-list button:disabled {
  cursor: default;
  opacity: 0.65;
}

.zip-entry-list strong,
.zip-entry-list span {
  display: block;
  overflow-wrap: anywhere;
}

.zip-entry-list span {
  margin-top: 3px;
  color: #66748a;
  font-size: 12px;
}

.zip-entry-view {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  padding: 16px;
}

.preview-selected-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  color: #172033;
}

.preview-selected-title span {
  color: #66748a;
  font-size: 12px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.preview-toolbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #66748a;
  font-size: 12px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.segmented button {
  height: 32px;
  padding: 0 10px;
  border-radius: 4px;
  background: transparent;
  color: #40506a;
}

.segmented button.active {
  background: #2563eb;
  color: #fff;
}

.segmented button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.preview-code {
  min-height: 0;
  height: 100%;
  margin: 0;
  overflow: auto;
  white-space: pre;
  overflow-wrap: normal;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.preview-empty {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 240px;
  padding: 28px;
  color: #516078;
  text-align: center;
}

.preview-media {
  min-height: 0;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.preview-media img {
  max-width: 100%;
  max-height: 100%;
}

.preview-frame {
  width: 100%;
  height: 100%;
  min-height: 560px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

@media (max-width: 820px) {
  .hero, .panel-head, .topbar, .user-box {
    flex-direction: column;
    align-items: stretch;
  }

  .status-card {
    min-width: 0;
    width: 100%;
  }

  .two, .form-grid, .metrics {
    grid-template-columns: 1fr;
  }

  .data-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-shell {
    max-height: calc(100vh - 20px);
  }

  .zip-preview-layout {
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(150px, 34vh) minmax(0, 1fr);
  }

  .zip-entry-panel {
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .wide {
    grid-column: span 1;
  }

  h1 {
    font-size: 36px;
  }
}
