:root {
  color-scheme: light;
  --bg: #f6f9ff;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #5b6472;
  --line: #d9e4f2;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --success: #0f766e;
  --warning: #a16207;
  --danger: #b91c1c;
  --soft: #edf5ff;
  --info: #e8f1ff;
  --shadow: 0 14px 36px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 16% 0%, rgba(37, 99, 235, 0.10), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 36%),
    var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

.shell {
  width: min(1040px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 44px;
}

.nav,
.card,
.stat,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  margin-bottom: 16px;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
  text-decoration: none;
  color: var(--ink);
}

.brand::before {
  content: "P2A";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.nav-meta {
  display: grid;
  gap: 8px;
  justify-self: end;
  justify-items: end;
}

.links,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.links a,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  background: white;
  color: var(--ink);
  font-weight: 700;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

button.button {
  cursor: pointer;
  font: inherit;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
}

.button.primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: white;
}

.button.warning {
  border-color: #f3d7a2;
  background: #fffbeb;
  color: #854d0e;
}

.button.danger {
  border-color: #fecaca;
  background: #fff5f5;
  color: var(--danger);
}

.button:hover,
.links a:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.08);
  transform: translateY(-1px);
}

.button:focus-visible,
.links a:focus-visible,
.input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.hero,
.grid,
.two-col {
  display: grid;
  gap: 14px;
}

.hero {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  margin-bottom: 14px;
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.apps-section,
.trash-section {
  margin-bottom: 14px;
}

.apps-lifecycle-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.apps-lifecycle-toolbar h2 {
  margin-bottom: 0;
}

.trash-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.trash-summary {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.trash-summary small,
.trash-meta,
.trash-empty {
  color: var(--muted);
  font-weight: 500;
}

.trash-meta {
  margin-bottom: 8px;
  font-size: 0.86rem;
}

.app-action-status {
  margin: 10px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.app-action-status--progress {
  color: #1d4ed8;
}

.app-action-status--error {
  color: #b91c1c;
}

.app-action-status--warning {
  color: #92400e;
}

.trash-section__header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.75fr);
}

.card,
.stat,
.panel {
  padding: 20px;
}

.card:hover,
.stat:hover,
.panel:hover {
  border-color: #c6d7ef;
}

.stack {
  display: grid;
  gap: 10px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--accent-strong);
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink);
}

p,
li,
small {
  color: var(--muted);
  line-height: 1.5;
}

.auth-status {
  margin: 0;
  text-align: right;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font: inherit;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(23, 32, 42, 0.02);
}

.input:hover {
  border-color: #b8c9e2;
}

.upload-box {
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, var(--soft) 100%);
}

.upload-card {
  width: min(100%, 840px);
  margin: 0 auto 14px;
  padding: 24px;
}

.upload-heading {
  display: grid;
  gap: 8px;
}

.upload-heading__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.upload-heading__bar .eyebrow {
  margin: 0;
}

body[data-page="upload"] .auth-status {
  display: none;
}

.upload-back-link {
  color: var(--accent);
}

.upload-heading h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.12;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 8px;
  padding: 0;
  list-style: none;
}

.wizard-steps li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 46px;
  padding: 10px;
  border: 1px solid #cfe0f6;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.wizard-steps span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
}

.upload-form {
  gap: 14px;
}

.form-field {
  gap: 7px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.app-upload-info {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid #cfe0f6;
  border-radius: 8px;
  background: #f8fbff;
}

.app-upload-info strong {
  color: var(--accent-strong);
}

.app-upload-info p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.upload-dropzone {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 2px dashed #b7cbed;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(237, 245, 255, 0.86)),
    #f8fbff;
}

.upload-dropzone__title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.upload-dropzone__hint {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.upload-file-button {
  justify-self: start;
  border-color: #b7cbed;
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.10);
  cursor: pointer;
}

.upload-file-button:hover {
  border-color: var(--accent);
  background: var(--info);
}

.upload-file-button:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.upload-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.source-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #cfe0f6;
  border-radius: 8px;
  background: #f8fbff;
}

.source-card strong {
  color: var(--accent-strong);
}

.source-card p,
.source-card span,
.upload-status {
  margin: 0;
}

.upload-file-summary {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-self: start;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid #cfe0f6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 700;
}

.upload-clear-file {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 0.86rem;
}

.upload-status {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.upload-actions .upload-status {
  flex: 1 1 260px;
}

.upload-submit {
  justify-self: start;
  min-width: 190px;
}

.upload-result-card {
  border-color: #cfe0f6;
}

.upload-result-card[hidden] {
  display: none !important;
}

.upload-result-card .grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.upload-result-card .stat {
  padding: 14px;
  box-shadow: none;
  background: #fbfdff;
}

.upload-result-card .stat h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.upload-result-card ul {
  margin: 0;
  padding-left: 18px;
}

.publish-panel {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.upload-publication-technical {
  display: none !important;
}

.app-preview-frame {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

label span {
  color: var(--ink);
  font-weight: 700;
}

.session-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--info);
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.checklist {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 20px, 460px);
  }

  .nav,
  .hero,
  .two-col,
  .apps-lifecycle-toolbar,
  .trash-summary,
  .trash-section__header {
    grid-template-columns: 1fr;
  }

  .apps-lifecycle-toolbar,
  .trash-summary {
    display: grid;
    align-items: start;
  }

  .trash-section__header {
    display: grid;
    align-items: start;
  }

  .nav-meta {
    justify-items: start;
  }

  .auth-status {
    text-align: left;
  }

  .links a,
  .button {
    flex: 1 1 auto;
  }

  .upload-card {
    padding: 18px;
  }

  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .upload-submit {
    width: 100%;
  }
}
