/* ─── Brand tokens ──────────────────────────────────────────────────────────── */
:root {
  --navy:        #012E53;
  --blue:        #0A638D;
  --blue-mid:    #90D0F7;
  --blue-light:  #D0EBFB;
  --salmon:      #FF5C5F;
  --salmon-light:#FCB0B2;

  --text:        #1e293b;
  --text-muted:  #475569;
  --bg:          #f0f4f8;
  --card:        #ffffff;
  --card-border: #e2e8f0;
}

/* ─── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
header {
  background: var(--navy);
  color: #fff;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  height: 26px;
  width: auto;
  flex-shrink: 0;
}

.header-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,.2);
  flex-shrink: 0;
}

.header-appname {
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .02em;
  flex: 1;
  color: rgba(255,255,255,.9);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-left: auto;
  flex-shrink: 0;
}

.user-badge-name {
  font-size: .82rem;
  color: rgba(255,255,255,.8);
}

/* ─── Page content ─────────────────────────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.page-intro {
  margin-bottom: 2rem;
}

.page-intro h1 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -.01em;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: .95rem;
  margin-top: .25rem;
}

/* ─── Tile grid ────────────────────────────────────────────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}

.tile:hover,
.tile:focus-visible {
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  border-color: var(--blue-mid);
  transform: translateY(-2px);
  outline: none;
}

.tile:focus-visible {
  box-shadow: 0 4px 16px rgba(0,0,0,.12), 0 0 0 3px var(--blue-light);
}

.tile-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--blue-light);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tile-icon svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
}

.tile-description {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Empty / loading states ───────────────────────────────────────────────── */
.tile-grid[aria-busy="true"]::before {
  content: "Loading apps…";
  color: var(--text-muted);
  font-size: .9rem;
  grid-column: 1 / -1;
}

.tile-grid-error {
  grid-column: 1 / -1;
  padding: 1rem 1.25rem;
  background: var(--salmon-light);
  border-radius: 6px;
  color: #7a1a1c;
  font-size: .9rem;
}

/* ─── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  header { padding: 0 1rem; }
  main { padding: 1.5rem 1rem 3rem; }
  .tile-grid { grid-template-columns: 1fr; }
}
