:root {
  --blue: #1a73e8;
  --blue-dark: #0b57d0;
  --blue-soft: #e8f0fe;
  --blue-border: #d2e3fc;
  --green: #188038;
  --red: #d93025;
  --orange: #e37400;
  --purple: #a142f4;
  --text: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --soft-line: #e8eaed;
  --page: #f8f9fa;
  --panel: #ffffff;
  --chip: #f1f3f4;
  --shadow: 0 8px 24px rgba(60, 64, 67, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 8px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--blue-border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 15px;
  font-weight: 700;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

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

.topnav a,
.ghost-btn,
.secondary-btn,
.primary-btn,
.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.topnav a,
.ghost-btn,
.secondary-btn,
.secondary-link {
  background: var(--panel);
  border-color: var(--line);
  color: var(--blue);
}

.topnav a:hover,
.ghost-btn:hover,
.secondary-btn:hover,
.secondary-link:hover {
  background: var(--chip);
  border-color: var(--blue);
}

.primary-btn,
.primary-link {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.primary-btn:hover,
.primary-link:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.primary-btn:disabled,
.primary-link[aria-disabled="true"] {
  background: #dadce0;
  border-color: #dadce0;
  color: var(--muted);
  cursor: not-allowed;
  pointer-events: none;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--soft-line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--blue-border);
  border-radius: 18px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex: 0 0 auto;
}

.status-strip.error {
  border-color: #fad2cf;
  background: #fce8e6;
  color: var(--red);
}

.status-strip.error .status-dot {
  background: var(--red);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px);
  gap: 12px;
  margin: 20px 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.package-card,
.admin-panel,
.admin-card,
.empty-state {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--panel);
}

.package-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 330px;
  padding: 16px;
}

.package-card:hover {
  border-color: var(--blue-border);
  box-shadow: var(--shadow);
}

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

.package-type,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.package-type.extension {
  background: var(--blue-soft);
  color: var(--blue);
}

.package-type.pwa {
  background: #f3e5f5;
  color: var(--purple);
}

.latest-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 12px;
  background: #e6f4ea;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.latest-badge.empty {
  background: #f1f3f4;
  color: var(--muted);
}

.package-card h2,
.admin-panel h2,
.admin-card h3,
.empty-state h2 {
  margin: 6px 0 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.admin-card h3 {
  margin-top: 0;
  font-size: 15px;
}

.description {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.release-meta {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--chip);
}

.release-meta div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.release-meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.release-meta dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.download-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-select {
  margin-top: auto;
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-panel {
  margin-top: 24px;
  padding: 18px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.admin-header .eyebrow {
  margin-bottom: 4px;
}

.admin-header h2 {
  margin: 0;
}

.pill.neutral {
  background: var(--chip);
  color: var(--muted);
}

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

.pill.error {
  background: #fce8e6;
  color: var(--red);
}

.token-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 16px;
}

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

.admin-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}

.file-field input {
  padding: 7px;
}

progress {
  width: 100%;
  height: 10px;
  accent-color: var(--blue);
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

  .hero-band,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 16px;
  }

  .topnav {
    justify-content: flex-start;
    width: 100%;
  }

  main {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .toolbar,
  .catalog-grid,
  .token-row {
    grid-template-columns: 1fr;
  }

  .package-card {
    min-height: 0;
  }
}
