:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1b2433;
  background: #f6f8fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f6f8fb;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 52px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.kicker,
.section-label {
  margin: 0;
  color: #4f6f52;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  color: #111827;
}

h1 {
  margin: 5px 0 0;
  font-size: clamp(1.75rem, 4vw, 3rem);
  line-height: 1.1;
}

h2 {
  margin: 4px 0 0;
  font-size: 1.2rem;
}

.status-panel,
.panel,
.summary-card {
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(31, 41, 55, 0.06);
}

.status-panel {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  margin-bottom: 14px;
}

.status-panel p {
  margin: 6px 0 0;
  color: #5d6879;
  line-height: 1.65;
}

.status-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-dot.pending {
  background: #d69e2e;
  box-shadow: 0 0 0 5px rgba(214, 158, 46, 0.14);
}

.status-dot.captured {
  background: #18865a;
  box-shadow: 0 0 0 5px rgba(24, 134, 90, 0.14);
}

.status-dot.error {
  background: #c2413f;
  box-shadow: 0 0 0 5px rgba(194, 65, 63, 0.14);
}

.panel {
  margin-top: 14px;
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid #d8e0ec;
  border-radius: 8px;
  background: #f6f8fb;
}

.segment {
  min-height: 34px;
  padding: 0 12px;
  color: #566276;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 0.86rem;
  font-weight: 750;
}

.segment.active {
  color: #fff;
  background: #365c3a;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.summary-card {
  min-height: 104px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.summary-card.highlight {
  color: #fff;
  border-color: #365c3a;
  background: #365c3a;
}

.summary-label {
  color: #667489;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.highlight .summary-label,
.highlight .summary-value {
  color: #fff;
}

.summary-value {
  color: #182235;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.highlight .summary-value {
  font-size: 0.92rem;
  line-height: 1.55;
}

.profile-name-label {
  display: grid;
  gap: 6px;
  min-width: min(360px, 100%);
  color: #5f6c80;
  font-size: 0.82rem;
  font-weight: 700;
}

.profile-name-label input {
  width: 100%;
  padding: 10px 12px;
  color: #172033;
  border: 1px solid #d8e0ec;
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.profile-name-label input:focus {
  border-color: #365c3a;
  box-shadow: 0 0 0 3px rgba(54, 92, 58, 0.13);
}

.code-output {
  display: block;
  width: 100%;
  min-height: 320px;
  padding: 15px;
  resize: vertical;
  color: #d9e6f2;
  border: 1px solid #1e293b;
  border-radius: 8px;
  outline: none;
  background: #101827;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  tab-size: 2;
}

.command-output {
  min-height: 168px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 750;
}

.primary-button {
  color: #fff;
  border: 1px solid #365c3a;
  background: #365c3a;
}

.primary-button:hover {
  background: #294c2d;
}

.secondary-button {
  color: #273448;
  border: 1px solid #cfd8e6;
  background: #fff;
}

.copy-status {
  color: #18865a;
  font-size: 0.86rem;
  font-weight: 750;
}

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

.detail-item {
  min-width: 0;
  padding: 13px;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #f8fafc;
}

.detail-item h3 {
  margin: 0 0 8px;
  color: #647087;
  font-size: 0.78rem;
}

.detail-item code,
.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.detail-item code {
  display: block;
  overflow-wrap: anywhere;
  color: #25334b;
  font-size: 0.78rem;
  line-height: 1.55;
}

[hidden] {
  display: none !important;
}

@media (max-width: 850px) {
  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

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

  .segmented {
    align-self: flex-start;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 22px;
  }

  .summary-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .copy-status {
    text-align: center;
  }
}

@media (prefers-color-scheme: dark) {
  :root,
  body {
    color: #e7edf7;
    background: #111827;
  }

  h1,
  h2,
  h3 {
    color: #f8fafc;
  }

  .status-panel,
  .panel,
  .summary-card {
    border-color: #273449;
    background: #182235;
    box-shadow: none;
  }

  .status-panel p,
  .summary-label,
  .profile-name-label {
    color: #a7b2c4;
  }

  .segmented {
    border-color: #2c3a50;
    background: #111827;
  }

  .segment {
    color: #a7b2c4;
  }

  .segment.active,
  .summary-card.highlight,
  .primary-button {
    background: #47734c;
    border-color: #47734c;
  }

  .profile-name-label input,
  .secondary-button {
    color: #e7edf7;
    border-color: #344258;
    background: #111827;
  }

  .detail-item {
    border-color: #2c3a50;
    background: #121b2d;
  }

  .detail-item h3 {
    color: #a7b2c4;
  }

  .detail-item code,
  .summary-value {
    color: #dce7f5;
  }
}
