/* The portal shell. Palette comes from tokens.css, shared with every app.
   This file only describes the hub itself -- the apps style themselves. */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--font);
}

/* In app view the page must not scroll -- the frame owns the viewport, the
   way a full-screen app does. */
body.in-app { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.in-app .view#app { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.view[hidden] { display: none; }

/* ---- bars ---- */
.bar {
  display: flex; align-items: center; gap: 11px;
  padding: 14px clamp(12px, 4vw, 40px);
}
.appbar {
  padding: 9px clamp(12px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.spacer { flex: 1; }

h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.clock { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.updated { font-size: 11.5px; color: var(--muted); }

.ghost {
  font: inherit; font-size: 12px; cursor: pointer; text-decoration: none;
  padding: 5px 11px; border-radius: var(--radius-sm);
  color: var(--text); background: var(--chip);
  border: 1px solid var(--border);
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.back { font-weight: 600; }

/* ---- the app grid ---- */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  padding: 4px clamp(12px, 4vw, 40px) 24px;
}

.tile {
  display: flex; flex-direction: column; gap: 12px;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px;
  transition: transform .14s ease, border-color .14s ease;
}
.tile:hover, .tile:focus-visible { transform: translateY(-2px); border-color: var(--accent); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile[disabled] { opacity: .5; cursor: default; }
.tile[disabled]:hover { transform: none; border-color: var(--border); }

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .tile:hover, .tile:focus-visible { transform: none; }
}

.tile-head { display: flex; align-items: center; gap: 12px; }

/* App icon: a monogram tile. Reads as an icon without needing artwork, and
   the per-app tint is the one place a non-palette colour is allowed. */
.mark {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .03em;
}
.mark.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 9px; }

.tile-name { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.tile-tag { font-size: 11.5px; color: var(--muted); line-height: 1.4; margin-top: 2px; }

.tile-head .dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;
  background: var(--muted);
}
.dot.ok { background: var(--pos); }
.dot.warn { background: #f5a524; }
.dot.err { background: var(--neg); }

.tile-body { border-top: 1px solid var(--border); padding-top: 11px; }
.tile-headline { font-size: 13.5px; font-weight: 600; }
.tile-detail { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

.tile-stats { display: flex; gap: 18px; margin-top: 11px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat span {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600;
}

.tile-foot { font-size: 11px; color: var(--muted); margin-top: 10px; }
.pill-soon {
  align-self: flex-start; font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 3px 9px;
}

#frame { width: 100%; flex: 1; border: 0; display: block; background: var(--bg); }

.foot {
  margin: 0; padding: 0 clamp(12px, 4vw, 40px) 30px;
  font-size: 11.5px; color: var(--muted);
}
