:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-soft: #f2f4f8;
  --ink: #15171c;
  --muted: #656b76;
  --line: #d7d9df;
  --line-strong: #c8ccd4;
  --blue: #3458f6;
  --blue-dark: #2446dc;
  --blue-soft: #eaf0ff;
  --green-soft: #dff4e6;
  --green: #16894d;
  --amber-soft: #fff0c9;
  --amber: #9a6400;
  --red-soft: #ffe3e3;
  --red: #d83b3b;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.35;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(52, 88, 246, 0.28);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 56px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.brand-lockup,
.view-tabs,
.tab-button,
.header-actions,
.card-title-row,
.claimed-card-header,
.search-box,
.meta-row,
.checkbox-row,
.radio-row {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 10px;
}

.brand-icon,
.satellite-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 620;
}

.brand-icon {
  overflow: hidden;
  background: var(--blue);
}

.brand-icon img,
.brand-icon svg,
.satellite-icon svg {
  width: 74%;
  height: 74%;
  fill: currentColor;
}

.brand-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: none;
}

.tab-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.satellite-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--ink);
}

.satellite-icon.unverified {
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 1rem;
  line-height: 1;
}

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

.brand-lockup h1 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1;
}

.view-tabs {
  gap: 8px;
}

.header-actions {
  gap: 8px;
  margin-left: auto;
}

.tab-button,
.claim-button,
.unverified-submission-badge,
.icon-button,
.add-satellite-button,
.auth-button {
  border: 0;
  border-radius: 8px;
  font-weight: 620;
}

.tab-button {
  position: relative;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  background: var(--blue);
  color: #fff;
}

.view-tabs .tab-button:not(.guide-tab-button)::after {
  position: absolute;
  right: 12px;
  bottom: -7px;
  left: 12px;
  height: 4px;
  border-radius: 999px;
  background: transparent;
  content: "";
}

.view-tabs .tab-button:not(.guide-tab-button).active::after {
  background: var(--blue);
}

.tab-button.active,
.tab-button.has-claims,
.claim-button,
.add-satellite-button,
.auth-button {
  background: var(--blue);
  color: #fff;
}

.guide-tab-button,
.auth-button {
  background: #edf0f5;
  color: var(--ink);
}

.auth-button.signed-in {
  background: var(--red);
  color: #fff;
}

.add-satellite-button,
.auth-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 13px;
  white-space: nowrap;
}

.add-satellite-button .tab-icon {
  stroke-width: 2.8;
}

.tab-button:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.tab-button:hover,
.add-satellite-button:hover,
.submit-button:hover,
.external-link-button:hover {
  background: var(--blue-dark);
}

.guide-tab-button:hover,
.auth-button:hover,
.secondary-button:hover,
.open-record-button:hover,
.claim-button.claimed:hover {
  background: #e1e5ee;
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.view-heading h2 {
  margin-bottom: 6px;
  font-size: 1.45rem;
  line-height: 1.15;
}

.view-heading h2 span,
.view-heading p,
.norad-line,
.identity-line,
.meta-row dt {
  color: var(--muted);
}

.view-heading p,
.norad-line,
.identity-line {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.auth-message {
  display: grid;
  gap: 8px;
}

.search-box {
  gap: 10px;
  min-height: 42px;
  margin-bottom: 12px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 254, 250, 0.82);
}

.search-box span {
  color: #9b978e;
  font-size: 1.2rem;
}

.search-box input,
.field input,
.field select,
.field textarea,
.sort-box select,
.filter-bar select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background-color: var(--panel);
  background-image: none;
  color: var(--ink);
}

.field select,
.sort-box select,
.filter-bar select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='9' viewBox='0 0 14 9' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2l5 5 5-5' fill='none' stroke='%23171713' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 14px 9px;
}

.search-box input {
  min-height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
}

.catalog-controls {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 14px;
}

.sort-box,
.filter-bar {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 254, 250, 0.86);
}

.sort-box {
  flex: 0 0 138px;
}

.filter-bar {
  display: flex;
  flex: 1;
  flex-wrap: nowrap;
  gap: 7px;
  min-width: 0;
}

.sort-box select,
.filter-bar select {
  min-height: 38px;
  padding: 5px 28px 5px 9px;
  font-weight: 620;
  line-height: 1.15;
  white-space: normal;
}

.filter-bar select {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

#launching-state-filter {
  flex-grow: 1.35;
}

.filter-bar option {
  white-space: normal;
}

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

.satellite-card,
.dialog-card,
.claimed-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.satellite-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.satellite-card:hover,
.satellite-card:focus,
.satellite-card.selected {
  border-color: rgba(23, 23, 19, 0.32);
  box-shadow: 0 1px 2px rgba(30, 29, 25, 0.05), 0 14px 34px rgba(30, 29, 25, 0.08);
  outline: 0;
  transform: translateY(-1px);
}

.card-title-row {
  gap: 8px;
}

.card-title-row > div {
  min-width: 0;
}

.card-title-row h3 {
  margin: 0 0 2px;
  font-size: 0.92rem;
  line-height: 1.1;
}

.satellite-card .card-title-row h3,
.satellite-card .norad-line,
.satellite-card .meta-row dd {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fact-list {
  display: grid;
  gap: 5px;
  margin: 0;
}

.meta-row {
  gap: 6px;
  min-width: 0;
  font-size: 0.78rem;
}

.meta-row dt {
  display: inline;
  margin: 0;
  font-weight: 620;
}

.meta-row dd {
  display: inline;
  margin: 0;
  min-width: 0;
}

.satellite-card .meta-row dd {
  flex: 1 1 auto;
}

.satellite-card .status-pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 620;
}

.status-active {
  background: var(--green-soft);
  color: var(--green);
}

.status-non-responsive {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-debris {
  background: var(--red-soft);
  color: var(--red);
}

.claim-button {
  min-height: 30px;
  padding: 0 10px;
  background: var(--blue);
  font-size: 0.82rem;
}

.unverified-submission-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  background: #edf0f5;
  color: var(--muted);
  font-size: 0.82rem;
}

.claim-actions {
  display: grid;
  grid-template-columns: minmax(74px, 0.55fr) minmax(104px, 1fr);
  gap: 6px;
}

.claim-actions.locked {
  grid-template-columns: 1fr;
}

.claim-actions.single-action {
  grid-template-columns: 1fr;
}

.claim-actions.pending,
.claim-actions.locked {
  grid-template-columns: 1fr;
}

.unclaim-button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 620;
}

.open-record-button {
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: #edf0f5;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 620;
}

.open-record-button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.claim-button:hover {
  background: var(--blue-dark);
}

.claim-button.claimed {
  background: #edf0f5;
  color: var(--ink);
}

.expanded-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.modal-dialog {
  width: min(980px, calc(100% - 28px));
  max-height: min(760px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
}

.wide-dialog {
  width: min(1040px, calc(100% - 28px));
}

.modal-dialog::backdrop {
  background: rgba(247, 246, 242, 0.76);
  backdrop-filter: blur(10px);
}

.dialog-card {
  display: grid;
  gap: 12px;
  max-height: min(760px, calc(100dvh - 32px));
  padding: 14px;
  overflow: auto;
}

.dialog-title-row h3,
.upload-card h3 {
  margin: 0 0 2px;
}

.guide-card {
  position: relative;
  width: 100%;
}

#guide-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: min(880px, calc(100dvh - 28px));
}

#guide-dialog::backdrop {
  background: rgba(247, 246, 242, 0.86);
  backdrop-filter: blur(20px);
}

#guide-dialog .expanded-header {
  padding-right: 34px;
  padding-bottom: 0;
}

#guide-dialog .expanded-header .icon-button {
  position: absolute;
  top: 10px;
  right: 10px;
}

.guide-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.42;
}

.guide-list li::marker {
  color: var(--green);
  font-weight: 620;
}

.guide-dismiss-button {
  justify-self: end;
}

.owner-only-note {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #d7e5dc;
  border-radius: 999px;
  background: #eef6f1;
  color: #2f5145;
  font-size: 0.86rem;
  font-weight: 620;
}

.public-field-sections {
  display: grid;
  gap: 10px;
}

.public-detail-bucket {
  display: grid;
  gap: 10px;
}

.public-detail-bucket > h4 {
  margin: 2px 0 0;
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.public-detail-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.public-detail-section h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 620;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.public-title-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 0;
}

.public-title-fields dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.public-title-fields dd {
  margin: 2px 0 0;
  font-size: 0.9rem;
  font-weight: 620;
  overflow-wrap: anywhere;
}

.certificate-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding-top: 2px;
}

.certificate-button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #edf0f5;
  color: var(--muted);
  font-weight: 620;
}

.certificate-button.ready {
  background: var(--green);
  color: #fff;
}

.certificate-button:disabled {
  cursor: not-allowed;
}

.certificate-missing-fields {
  max-width: min(100%, 640px);
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: right;
}

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

.claimed-card {
  padding: 12px;
}

.claimed-card.is-minimized {
  display: grid;
  gap: 10px;
}

.claimed-card-header {
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.icon-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  background: transparent;
  color: var(--ink);
  font-size: 1.1rem;
}

.claimed-form {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.field-bucket {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.field-bucket h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 620;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.submission-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.submission-summary p {
  margin: 0;
  color: var(--muted);
  font-weight: 620;
}

.summary-actions,
.delete-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.field-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  background: var(--panel-soft);
  color: var(--ink);
  font-weight: 620;
  text-align: left;
}

.section-body {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px 12px;
}

.field-section.open .section-body {
  display: grid;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field label,
.choice-group legend {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 620;
  white-space: nowrap;
}

.required-marker {
  color: var(--red);
  font-weight: 800;
}

.field input,
.field select {
  min-height: 32px;
  padding: 0 8px;
}

.field textarea {
  min-height: 48px;
  padding: 7px 8px;
  resize: vertical;
}

.field-wide,
.choice-group {
  grid-column: span 3;
}

.choice-group {
  display: grid;
  grid-template-columns: minmax(128px, max-content) 1fr;
  gap: 8px 12px;
  align-items: start;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-row,
.radio-row {
  gap: 6px;
  font-size: 0.88rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.submit-button,
.external-link-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  font-weight: 620;
  text-decoration: none;
}

.oauth-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 620;
}

.oauth-button:hover {
  border-color: rgba(23, 23, 19, 0.3);
  background: var(--panel-soft);
}

.submit-button,
.external-link-button {
  background: var(--blue);
  color: #fff;
}

.secondary-button {
  background: #edf0f5;
  color: var(--ink);
}

.danger-button {
  background: var(--red);
  color: #fff;
}

.delete-card {
  max-width: 430px;
}

.delete-copy {
  margin: 0;
  color: var(--muted);
}

.field-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.inline-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 620;
  text-decoration: none;
  white-space: nowrap;
}

.inline-upload-button:hover {
  background: #dce5ff;
}

.choice-upload-action {
  grid-column: 2;
}

.choice-upload-action .inline-upload-button {
  margin-top: 2px;
}

.auth-card {
  position: relative;
  max-width: 440px;
  padding-bottom: 14px;
}

#auth-dialog {
  width: min(500px, calc(100% - 28px));
}

#auth-dialog .expanded-header {
  align-items: flex-start;
}

#auth-dialog .expanded-header .icon-button {
  flex: 0 0 auto;
}

#auth-dialog.link-sent {
  width: min(360px, calc(100% - 28px));
}

.auth-card.link-sent {
  min-height: 118px;
  padding: 18px;
}

.auth-card.link-sent .expanded-header {
  justify-content: flex-end;
  padding-bottom: 0;
  border-bottom: 0;
}

.auth-card.link-sent .expanded-header > div,
.auth-card.link-sent .auth-status {
  margin: 0;
  padding-right: 34px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 620;
  line-height: 1.35;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 620;
}

.empty-state {
  padding: 28px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .header-inner,
  .header-actions,
  .view-tabs {
    align-items: stretch;
    flex-direction: column;
  }

  .header-inner {
    gap: 10px;
  }

  .brand-lockup {
    align-self: flex-start;
  }

  .add-satellite-button {
    width: 100%;
  }

  .catalog-controls {
    flex-direction: column;
  }

  .sort-box {
    flex-basis: auto;
  }

  .choice-group {
    grid-template-columns: 1fr;
  }

  .tab-button {
    justify-content: center;
  }

  .satellite-grid,
  .section-body,
  .public-title-fields {
    grid-template-columns: 1fr;
  }

  .field-wide,
  .choice-group {
    grid-column: span 1;
  }
}
