:root {
  --bg0: #eef3ef;
  --bg1: #f7faf7;
  --ink: #14201a;
  --muted: #5f6f66;
  --line: #d5e0d8;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --accent: #0f7a4a;
  --accent-soft: #d9f0e4;
  --warn: #b7791f;
  --danger: #b42318;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Outfit", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --shadow: 0 18px 40px rgba(20, 40, 30, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, #cfe8d8 0%, transparent 55%),
    radial-gradient(700px 380px at 100% 0%, #dce7f0 0%, transparent 50%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}

body {
  -webkit-font-smoothing: antialiased;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 72px;
}

.hero {
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #117a4c, #1fa86a);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 10px 24px rgba(15, 122, 74, 0.28);
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

h1 {
  margin: 2px 0 0;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.lede {
  margin: 14px 0 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 16px;
}

.toolbar {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 220px auto;
  gap: 10px;
}

.search input,
select,
.btn {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  font: inherit;
  padding: 0 14px;
}

.search input:focus,
select:focus,
.btn:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, white);
  outline-offset: 1px;
}

.btn {
  cursor: pointer;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn:hover { background: #0c6640; }
.btn:active { transform: translateY(1px); }

.meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.list {
  display: grid;
  gap: 12px;
}

.card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 18px;
  padding: 18px 18px 16px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, white);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.project-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
}

.desc {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.urls {
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.urls a {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  word-break: break-all;
}

.urls a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 110px;
}

.status {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: lowercase;
}

.status.healthy { background: #d9f0e4; color: #0f7a4a; }
.status.running { background: #e8f0ff; color: #1d4f91; }
.status.stopped { background: #f3e8e8; color: var(--danger); }
.status.degraded { background: #fff1d6; color: var(--warn); }
.status.unknown { background: #eef1ef; color: var(--muted); }

.git {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  text-align: right;
  max-width: 180px;
}

.git:hover { color: var(--accent); }

.branch {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.banner {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.banner.error {
  background: #fdecec;
  color: #8a1f16;
  border: 1px solid #f3c1bc;
}

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Picking demos for a set --------------------------------------- */

.toolbar-2 {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.toolbar-2 .meta { margin-top: 0; }

.quick {
  display: flex;
  gap: 8px;
}

/* .btn is full-width by default for the toolbar grid; these sit inline. */
.quick .btn {
  width: auto;
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  white-space: nowrap;
}

.btn.ghost {
  background: var(--panel-solid);
  color: var(--ink);
  border-color: var(--line);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn.ghost:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.btn.small {
  width: auto;
  height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.card.pickable {
  grid-template-columns: auto 1fr auto;
  cursor: pointer;
}

.card.picked {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--panel-solid));
}

.pick {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Keeps the last cards reachable above the fixed tray. */
body.picking .page { padding-bottom: 128px; }

.tray {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(20, 40, 30, 0.1);
  z-index: 20;
}

.tray-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tray-count { font-size: 14px; white-space: nowrap; }
.tray-count strong { color: var(--accent); font-size: 17px; }

.tray-names {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Dialog -------------------------------------------------------- */

.dlg {
  width: min(440px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dlg::backdrop { background: rgba(20, 40, 30, 0.32); }

.dlg h2 {
  margin: 0 0 18px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.field em { font-style: normal; font-weight: 400; }

.field input,
.field textarea {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  font: inherit;
  padding: 0 14px;
}

.field textarea {
  height: auto;
  min-height: 72px;
  padding: 10px 14px;
  resize: vertical;
}

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.dlg-actions .btn { width: auto; padding: 0 20px; }

.dlg-err {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fdecec;
  color: #8a1f16;
  font-size: 13px;
}

/* ---------- Set editor ---------------------------------------------------- */

.side-row { display: flex; gap: 6px; }

.btn.ghost.danger { color: var(--danger); }
.btn.ghost.danger:hover {
  background: #fdecec;
  border-color: #f3c1bc;
}

.ed-items {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}

.ed-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg1);
}

.ed-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ed-ord {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.ed-name {
  flex: 1;
  min-width: 0;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 0 10px;
}

.ed-ctl { display: flex; gap: 4px; }

.ed-ctl button {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--muted);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.ed-ctl button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.ed-ctl button:disabled { opacity: 0.35; cursor: not-allowed; }

.ed-note {
  width: 100%;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 0 10px;
}

.ed-url {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

@media (max-width: 760px) {
  .toolbar { grid-template-columns: 1fr; }
  .card { grid-template-columns: 1fr; }
  .side { align-items: flex-start; }
  .git { text-align: left; max-width: none; }
}
