@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap");
@import url("./dashboard-shared.css");

:root {
  color-scheme: light;
  --ink: #101b2d;
  --muted: #5f6b7f;
  --soft: #f8fafc;
  --line: #e6edf5;
  --blue: #2450B2;
  --dark: #00122B;
  --green: #14a66f;
  --amber: #d88717;
  --red: #ed1c24;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--soft);
  color: var(--ink);
  font-family: "Gotham", "Montserrat", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(24px, 2.8vw, 32px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.topbar span {
  display: block;
  max-width: 680px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.top-actions {
  display: flex;
  gap: 12px;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.primary-button {
  border: 0;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 12px 26px rgba(36, 80, 178, 0.2);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.primary-button:hover,
.ghost-button:hover,
.channel-card:hover {
  transform: translateY(-2px);
}

.channel-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.channel-overview article,
.empty-state,
.connection-flow,
.channel-card,
.permission-card,
.details-card,
.trust-section,
.schema-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
}

.channel-overview article {
  min-height: 116px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 20px;
}

.channel-overview span,
.channel-overview small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.channel-overview strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 42px 22px;
  text-align: center;
}

.empty-icon,
.channel-large-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #2450B2, #0f8bd4);
  color: #fff;
  font-weight: 800;
}

.empty-icon {
  width: 58px;
  height: 58px;
  font-size: 15px;
}

.empty-state h2,
.connection-flow h2,
.permission-card h2,
.trust-section h2,
.schema-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.2;
}

.empty-state p,
.connection-flow p,
.trust-section p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.connection-flow {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.4fr);
  gap: 22px;
  margin-top: 22px;
  padding: 22px;
}

.flow-copy {
  display: grid;
  align-content: center;
  gap: 10px;
}

.flow-steps {
  counter-reset: flow;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-steps li {
  min-height: 118px;
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #f8fbfd;
}

.flow-steps span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(36, 80, 178, 0.1);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.flow-steps strong {
  font-size: 14px;
}

.flow-steps small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.channel-card {
  display: grid;
  gap: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.channel-card-head,
.card-actions,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.channel-large-avatar {
  width: 48px;
  height: 48px;
  font-size: 14px;
}

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ready {
  background: #eafaf2;
  color: var(--green);
}

.status-pill.pending {
  background: #fff7e6;
  color: var(--amber);
}

.status-pill.action {
  background: #fff0f1;
  color: var(--red);
}

.channel-card h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.channel-card p,
.channel-card a {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.channel-card a {
  color: var(--blue);
  font-weight: 600;
}

.channel-card dl,
.details-card dl {
  display: grid;
  gap: 0;
  margin: 4px 0 0;
}

.channel-card dl div,
.details-card dl div {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.channel-card dt,
.details-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.channel-card dd,
.details-card dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.card-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  padding-top: 4px;
}

.card-actions button,
.modal-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.card-actions button:first-child {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.card-actions .danger,
.modal-actions .danger {
  border-color: rgba(237, 28, 36, 0.2);
  color: var(--red);
}

.permissions-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 16px;
  margin-top: 22px;
}

.permission-card,
.details-card,
.trust-section,
.schema-card {
  padding: 22px;
}

.permission-card ul {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.permission-card li {
  position: relative;
  padding-left: 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.permission-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.trust-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%);
}

.trust-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.trust-pills span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(36, 80, 178, 0.14);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.schema-card {
  margin-top: 22px;
}

.schema-card pre {
  overflow: auto;
  margin: 14px 0 0;
  border-radius: 16px;
  padding: 16px;
  background: #061325;
  color: #d9e6ff;
  font-size: 12px;
  line-height: 1.55;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 520;
  background: rgba(0, 18, 43, 0.48);
  backdrop-filter: blur(4px);
}

.disconnect-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 530;
  width: min(440px, calc(100vw - 36px));
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0, 18, 43, 0.28);
}

.disconnect-modal h2 {
  margin: 0;
  font-size: 24px;
}

.disconnect-modal p {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

@media (max-width: 1180px) {
  .channel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .channel-overview,
  .permissions-grid,
  .connection-flow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .topbar,
  .trust-section {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    flex-direction: column;
  }

  .top-actions .primary-button,
  .top-actions .ghost-button {
    width: 100%;
  }

  .channel-overview,
  .channel-grid,
  .flow-steps {
    grid-template-columns: 1fr;
  }

  .channel-overview article {
    min-height: 96px;
    padding: 16px;
  }

  .connection-flow,
  .permission-card,
  .details-card,
  .trust-section,
  .schema-card,
  .channel-card {
    padding: 18px;
  }

  .trust-pills {
    justify-content: flex-start;
  }
}
