:root {
  --bg: #12161d;
  --bg-soft: #1a2029;
  --surface: #dbe4ee;
  --surface-soft: #cbd8e6;
  --surface-top: #edf3f8;
  --text: #eef3f8;
  --text-card: #1f2933;
  --muted: #9aa8b7;
  --muted-card: #5f6f82;
  --line: rgba(226, 232, 240, 0.18);
  --line-card: rgba(83, 100, 122, 0.14);
  --accent: #2f80ed;
  --accent-strong: #155eb7;
  --green: #11a980;
  --orange: #d58b18;
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, #1b222d 0, #151a22 300px, #10141b 100%),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 72%);
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 24px;
  width: min(1220px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 40px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-self: start;
  min-height: calc(100vh - 64px);
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, 0.12);
  border-radius: 10px;
  background: rgba(27, 34, 45, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 28px rgba(0, 0, 0, 0.18);
}

.eyebrow,
.status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.eyebrow {
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 6px 0 0;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: 0;
}

.content {
  min-width: 0;
  padding-top: 8px;
}

.content-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 31px;
  margin-bottom: 14px;
}

.content-head .status {
  padding: 7px 10px;
  border: 1px solid rgba(226, 232, 240, 0.12);
  border-radius: 999px;
  background: rgba(27, 34, 45, 0.58);
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #c6d0dd;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
  border-color: rgba(226, 232, 240, 0.1);
  background: rgba(247, 249, 252, 0.07);
}

.tab[aria-selected="true"] {
  color: var(--accent-strong);
  background: linear-gradient(180deg, var(--surface-top), var(--surface));
  border-color: rgba(219, 228, 238, 0.78);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

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

.app-card {
  position: relative;
  display: grid;
  grid-template-rows: 126px auto;
  min-height: 178px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface-top), var(--surface));
  color: var(--text-card);
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 4px 14px rgba(0, 0, 0, 0.16);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.app-card::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  box-shadow: inset 0 -1px 0 rgba(83, 100, 122, 0.08);
}

.app-card:hover {
  border-color: rgba(171, 200, 236, 0.8);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.app-card:focus-visible,
.tab:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.image-wrap {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0)),
    var(--surface-soft);
}

.app-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 18px;
}

.image-fallback {
  position: absolute;
  display: none;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, #4b91ee, #22b495 58%, #d3993f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 18px rgba(35, 58, 82, 0.2);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

.image-wrap.image-error .app-image {
  display: none;
}

.image-wrap.image-error .image-fallback {
  display: grid;
}

.app-meta {
  display: grid;
  gap: 0;
  align-content: center;
  min-width: 0;
  padding: 16px;
}

.app-name {
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-transform: capitalize;
}

.empty,
.error {
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted-card);
}

.error {
  color: #ffd3c2;
  border-color: rgba(255, 160, 122, 0.3);
  background: #332621;
}

@media (max-width: 640px) {
  .shell {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
    width: min(100% - 20px, 1220px);
    padding-top: 18px;
  }

  .sidebar {
    gap: 14px;
    padding-right: 10px;
  }

  h1 {
    font-size: 20px;
  }

  .tab {
    height: 36px;
    padding: 0 10px;
  }

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

  .app-card {
    grid-template-rows: 92px auto;
    min-height: 144px;
  }

  .app-name {
    font-size: 15px;
  }

  .app-meta {
    padding: 12px;
  }
}
