* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
}

h2.section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-faint);
  margin: 0 0 12px;
  font-weight: 700;
}

/* shared small button (sidebar footer, page actions) */
.tbtn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tbtn:hover { border-color: var(--accent); color: var(--accent-soft); }

.role-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-soft);
  background: rgba(255,138,0,.1);
  border: 1px solid rgba(255,138,0,.3);
  padding: 1px 7px;
  border-radius: 20px;
}

/* --- dashboard layout --------------------------------------------------- */
.dash {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 22px;
  align-items: start;
}
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

/* --- app card ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  display: flex;
  flex-direction: column;
  gap: 11px;
  text-decoration: none;
  color: inherit;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .head { display: flex; align-items: center; gap: 10px; }
.card .icon {
  font-size: 20px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
/* The name must win the space fight. A long version (e.g. the mtime fallback
   `0.0.0+202607031735`) used to push the name down to "M..." — the version is
   the less important of the two, so it truncates instead. */
.card .titles { min-width: 0; flex: 1 1 auto; }
.card .name {
  font-weight: 700; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .ns { font-family: var(--font-mono); font-size: 9px; color: var(--text-faint); }
.card .ver {
  margin-left: auto;
  flex: 0 1 auto; min-width: 0; max-width: 45%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--accent-soft);
  background: rgba(255,138,0,.08);
  border: 1px solid rgba(255,138,0,.25);
  padding: 2px 7px; border-radius: 20px;
  cursor: help;
}
.card .ver.none { color: var(--text-faint); background: none; border-color: var(--border); }
.card .desc {
  color: var(--text-dim); font-size: 12.5px; line-height: 1.45;
  min-height: 36px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* icon stats with hover tooltips (tooltip styling lives in shell.css) */
.card .stats {
  display: flex;
  gap: 6px;
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
}
.stat {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--surface-2);
  font-size: 12px;
  cursor: default;
  color: var(--text-dim);
}
.stat .icn { width: 13px; height: 13px; }
.stat b { font-family: var(--font-mono); font-weight: 700; color: var(--text); }
.stat.zero { opacity: .4; }
.stat.zero b { color: var(--text-faint); }
.stat.warn:not(.zero) b { color: var(--warn); }
.stat.warn:not(.zero) { background: rgba(255,176,32,.1); }

/* --- activity feed ------------------------------------------------------ */
.feed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 78px;
}
.feed ul { list-style: none; margin: 0; padding: 0; max-height: 68vh; overflow-y: auto; }
.feed li {
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
}
.feed li:last-child { border-bottom: none; }
.feed .when {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  display: block;
  margin-top: 2px;
}
.feed .empty { color: var(--text-faint); font-size: 13px; }

/* --- toast -------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  z-index: 100;
  max-width: 90vw;
  box-shadow: var(--shadow);
}
.toast code {
  font-family: var(--font-mono);
  color: var(--accent-soft);
  word-break: break-all;
}
