/* Apps dashboard (#/apps): team websites opened with one sign-in.
   Every colour comes from the theme variables in app.css; --app-color is the
   app's own colour (set per tile from the server, always #RRGGBB). */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 16px;
}

.app-tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px 20px 16px;
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.app-tile::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--app-color, var(--teal));
}
.app-tile:hover { border-color: var(--line-2); }
.app-tile.off { opacity: .74; }
.app-tile.off::before { background: var(--line-2); }
.app-tile-skel { min-height: 190px; }

.app-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-mark {
  flex: none; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 12px;
  font: 600 15px var(--font-ui); letter-spacing: .02em; color: var(--text);
  background: var(--surface-3);
  background: color-mix(in srgb, var(--app-color, var(--teal)) 22%, var(--surface-2));
  border: 1px solid var(--line-2);
  border-color: color-mix(in srgb, var(--app-color, var(--teal)) 55%, transparent);
}
.app-title-wrap { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-name { font-size: 17px; font-weight: 600; line-height: 1.25; margin: 0; }
.app-host { font-size: 12.5px; color: var(--text-3); }
.app-desc { color: var(--text-2); font-size: 14px; line-height: 1.45; margin: 0; overflow-wrap: anywhere; }

.app-status {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font: 500 12.5px var(--font-mono); color: var(--text-2);
}
.app-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.app-status.up .app-dot { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.app-status.down .app-dot { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.app-status.down { color: var(--down); }

.app-badges { display: flex; flex-wrap: wrap; gap: 6px; }

.app-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line);
}
.app-foot .btn-primary svg { width: 14px; height: 14px; }
.app-tools { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.app-tools .app-del:hover { color: var(--down); background: var(--down-soft); }

.apps-empty, .apps-error { grid-column: 1 / -1; }
.apps-error { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.apps-meta { margin: -6px 0 0; }

.apps-how .app-steps { margin-bottom: 10px; }

/* Lists of steps (help card, Caddy dialog) */
.app-steps { margin: 6px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 14px; }
.app-steps li::marker { color: var(--teal); font-weight: 600; }
.app-help { font-size: 12.5px; color: var(--text-3); }

/* Edit dialog */
.app-color-input {
  width: 100%; height: 42px; padding: 4px; cursor: pointer;
  border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface-2);
}
.app-color-input:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus); }

/* Access dialog */
.app-choices { display: flex; flex-direction: column; gap: 8px; }
.app-choice {
  display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface-2);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.app-choice:hover { border-color: var(--text-3); }
.app-choice:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.app-choice input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--teal); flex: none; }
.app-choice span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.app-choice b { font-size: 15px; }
.app-choice small { font-size: 13px; color: var(--text-2); }
.app-people {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 260px; overflow-y: auto;
  padding: 6px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-2);
  transition: opacity .15s var(--ease);
}
.app-people.dim { opacity: .5; }
.app-person { min-height: 36px; padding: 4px 8px; border-radius: 8px; min-width: 0; }
.app-person:hover { background: var(--surface-2); }
.app-person .badge { margin-left: auto; }

/* Caddy dialog */
.app-snippet-wrap { position: relative; min-width: 0; }
.app-snippet {
  margin: 0; padding: 16px 16px 52px; max-width: 100%; overflow-x: auto;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-2);
  font: 12.5px/1.6 var(--font-mono); color: var(--text); white-space: pre; tab-size: 4;
}
.app-snippet:focus-visible { outline: none; box-shadow: var(--focus); }
.app-snippet-actions { position: absolute; right: 10px; bottom: 10px; }

@media (max-width: 600px) {
  .app-tile { padding: 18px 16px 14px; }
  .app-foot .btn-primary { flex: 1 1 auto; }
  .app-tools { margin-left: 0; }
  .app-snippet { font-size: 11.5px; }
}
