:root {
  --bg: #eef0f2;
  --bar: #dfe2e5;
  --card: #fff;
  --ink: #33383d;
  --muted: #8a9096;
  --muted-2: #6d7379;
  --muted-3: #7d838a;
  --faint: #a3a9ae;
  --line: #e4e7ea;
  --line-soft: #eef0f2;
  --chip: #e1e4e7;
  --code-bg: #f1f3f5;
  --off: #cdd2d6;
  --accent: #3b78c4;
  --accent-hover: #2a5f9f;
  --github: #24292f;
  --railway: #7b4fd6;
  --done: #6fae5c;
  --working: #d98a3d;
  --error: #c0492f;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .06);
  --shadow-bar: 0 1px 2px rgba(0, 0, 0, .12);
  --mono: ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: 'Source Sans 3', Helvetica, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
input::placeholder { color: var(--faint); }
h1, h2, h3 { margin: 0; font: inherit; }
:focus-visible { outline: 2px solid rgba(59, 120, 196, .6); outline-offset: 2px; }

/* A button that looks like the design's text links. */
.link, .quiet {
  background: none; border: none; padding: 0;
  font-weight: 600; color: var(--accent); text-align: left;
}
.link:hover { color: var(--accent-hover); }
.quiet { color: var(--muted-2); }
.quiet:hover, a.quiet:hover { color: var(--ink); }
a.quiet { color: var(--muted-2); }

/* ---------- Top bar ---------- */

.topbar {
  background: var(--bar);
  padding: 16px 20px;
  display: flex; gap: 16px; align-items: center;
}

.menu-wrap { position: relative; flex: none; }
.menu {
  width: 54px; height: 54px;
  background: var(--card); border: none; border-radius: 3px; box-shadow: var(--shadow-bar);
  display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center;
  position: relative;
}
.menu span { width: 18px; height: 2px; background: var(--ink); }
.menu[data-alert]::after {
  content: ""; position: absolute; top: 9px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--working);
}

.menu-panel {
  position: absolute; left: 0; top: calc(100% + 10px); z-index: 30;
  width: min(420px, calc(100vw - 32px));
  background: var(--card); border-radius: 3px; box-shadow: var(--shadow), 0 8px 24px rgba(0, 0, 0, .08);
}
.menu-panel[hidden] { display: none; }
.menu-head { padding: 22px 26px 6px; font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.provider {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 26px; border-bottom: 1px solid var(--line-soft);
}
.provider-name { font-size: 18px; font-weight: 600; }
.provider-state { font-size: 16px; font-weight: 600; letter-spacing: .03em; color: var(--muted); overflow-wrap: anywhere; }
.provider-state.on { color: var(--done); }
.provider .link, .provider .quiet { font-size: 16px; white-space: nowrap; }
.provider:last-child { border-bottom: none; padding-bottom: 20px; }
.menu-alert { margin: 0 26px 14px; font-size: 16px; color: var(--error); }

.search {
  flex: 1; min-width: 0; height: 54px;
  background: var(--card); border-radius: 3px; box-shadow: var(--shadow-bar);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; overflow: hidden;
}
.search-icon { width: 12px; height: 12px; border: 2px solid #9aa0a6; border-radius: 50%; flex: none; }
.search input {
  border: none; outline: none; font-size: 18px;
  width: 180px; flex: none; background: transparent;
}
.search input::-webkit-search-cancel-button { display: none; }

.chips { display: flex; gap: 10px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 1px solid var(--chip); border-radius: 2px;
  padding: 4px 10px; font-size: 18px; white-space: nowrap;
  background: none; color: var(--muted-2); font-weight: 400;
}
.chip[aria-pressed="true"] { color: var(--accent); font-weight: 600; }
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"]:hover { color: var(--accent-hover); }

/* ---------- Layout ---------- */

.layout {
  max-width: 1820px;
  margin: 0 auto;
  padding: 48px clamp(20px, 4vw, 70px) 80px;
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 56px clamp(32px, 5vw, 88px);
}
.col-main { flex: 1 1 640px; min-width: 0; }
.col-side { flex: 1 1 400px; max-width: 620px; min-width: 0; scroll-margin-top: 16px; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.section-title { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.back { font-size: 18px; font-weight: 600; white-space: nowrap; }

.empty {
  padding: 28px; text-align: center; color: var(--muted); font-size: 18px;
  border: 1px dashed var(--off); border-radius: 3px;
}

/* ---------- Cards ---------- */

.card { background: var(--card); border-radius: 3px; box-shadow: var(--shadow); }
.cards { display: flex; flex-direction: column; gap: 36px; }
.card-body { padding: 30px 38px 14px; }
.card-body.head { padding: 30px 38px 24px; }
.card-body.plain { padding: 30px 38px; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.card-title h3 { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.card-count { font-size: 16px; color: var(--muted); white-space: nowrap; }
.card-foot {
  border-top: 1px solid var(--line); padding: 16px 38px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px 24px; flex-wrap: wrap;
  font-size: 18px; font-weight: 600;
}
.label { font-size: 16px; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.muted { color: var(--muted); }
.note-text { font-size: 18px; color: var(--muted); padding: 12px 0; line-height: 1.4; }
.note-text.error { color: var(--error); }

/* ---------- Provider icons ---------- */

.icon { flex: none; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.icon.repo { background: var(--github); }
.icon.service { background: var(--railway); border-radius: 5px; }
.icon.repo::after { content: ""; border-radius: 50%; background: #fff; }
.icon.service::after { content: ""; border-radius: 2px; border: 2px solid #fff; }

.icon.md { width: 24px; height: 24px; }
.icon.md.repo::after { width: 8px; height: 8px; }
.icon.md.service::after { width: 10px; height: 10px; }

.icon.lg { width: 32px; height: 32px; }
.icon.lg.repo::after { width: 11px; height: 11px; }
.icon.lg.service::after { width: 13px; height: 13px; }
.icon.lg.service { border-radius: 6px; }

.icon.xl { width: 44px; height: 44px; }
.icon.xl.repo::after { width: 15px; height: 15px; }
.icon.xl.service { border-radius: 8px; }
.icon.xl.service::after { width: 18px; height: 18px; border-width: 3px; border-radius: 3px; }

/* The create row shows the provider as a plain shape. */
.icon.plain::before, .icon.plain::after { display: none; }
.icon.plain.github { background: var(--github); }
.icon.plain.railway { background: var(--railway); border-radius: 5px; }

.dot { display: inline-block; flex: none; border-radius: 50%; background: var(--github); }
.dot.s12 { width: 12px; height: 12px; }

/* ---------- Signals list ---------- */

.list { display: flex; flex-direction: column; gap: 12px; }

.row {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) minmax(0, 190px) minmax(0, 150px);
  gap: clamp(10px, 2vw, 18px);
  align-items: center;
  width: 100%;
  padding: 16px 22px;
  border: none;
  font-size: 18px;
  text-align: left;
  transition: box-shadow .12s ease;
}
.row:hover { box-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 6px 16px rgba(0, 0, 0, .09); }
.row[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.row:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(59, 120, 196, .45), var(--shadow); }
.row[aria-pressed="true"]:focus-visible { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 3px rgba(59, 120, 196, .3), var(--shadow); }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-type, .row-date { color: var(--muted-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-date { text-align: right; }

.create {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  gap: clamp(10px, 2vw, 18px);
  align-items: center;
  padding: 10px 22px;
  font-size: 18px;
  box-shadow: inset 0 0 0 2px var(--accent), 0 4px 12px rgba(0, 0, 0, .06);
}
.create input, .create select {
  font-size: 18px; font-weight: 600;
  padding: 6px 0; border: none; outline: none; background: transparent; min-width: 0; width: 100%;
}
.create select { cursor: pointer; }
.create .cta {
  padding: 7px 14px; background: var(--ink); color: #fff; border: none; border-radius: 3px;
  font-size: 16px; font-weight: 600; white-space: nowrap;
}
.create .cta:hover { background: #1f2327; }
.create .cta:disabled { opacity: .6; cursor: default; }
.create .quiet { font-size: 16px; }
.create-hint { grid-column: 2 / -1; font-size: 16px; color: var(--muted); margin-top: -4px; }
.create-hint.error { color: var(--error); }

.notice {
  display: flex; align-items: center; gap: clamp(10px, 2vw, 18px);
  padding: 14px 22px; font-size: 18px; color: var(--muted-2);
  border: 1px dashed var(--off); border-radius: 3px;
}
.notice > span { flex: 1; min-width: 0; }
.notice.error { color: var(--error); border-color: #e5b8ad; }
.notice .link { font-size: 18px; white-space: nowrap; }

/* ---------- Panels ---------- */

.entity { display: flex; align-items: center; gap: 16px; }
.entity-text { min-width: 0; }
.entity-owner { font-size: 16px; color: var(--muted); }
.entity-title { font-size: 18px; font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.switch-wrap { display: flex; align-items: center; gap: 12px; font-size: 16px; color: var(--muted-2); }
.switch {
  width: 44px; height: 24px; border-radius: 12px; background: var(--off);
  position: relative; flex: none; display: block;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.switch.on::after { left: 23px; }
.switch.on.green { background: var(--done); }
.switch.on.purple { background: var(--railway); }

.item {
  display: flex; align-items: baseline; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
  color: inherit;
}
a.item:hover .item-title { color: var(--accent); }
.item-num { font-family: var(--mono); font-size: 16px; color: var(--muted); flex: none; }
.item-main { min-width: 0; flex: 1; }
.item-title { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  flex: none; font-size: 16px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 2px; white-space: nowrap; border: none;
}
.badge.open { color: #4f8f3e; background: #e8f3e4; }
.badge.draft { color: var(--muted-2); background: var(--line-soft); }
.badge.merged { color: #7a52b3; background: #efe8f8; }
.badge.closed { color: #a1473a; background: #f8e7e3; }

/* Railway service */
.facts { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 14px 18px; margin-top: 24px; align-items: center; }
.fact { font-size: 18px; min-width: 0; }
.fact.deployed { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fact .repo-name { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 600; }
.pill { font-family: var(--mono); font-size: 16px; background: var(--code-bg); padding: 2px 7px; border-radius: 2px; white-space: nowrap; }
.fact .commit { color: var(--muted); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact a { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.volume { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.volume-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.volume-name { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.volume-size { font-size: 16px; color: var(--muted); white-space: nowrap; }
.volume-mount { font-family: var(--mono); font-size: 16px; color: var(--muted-2); margin-top: 2px; }
.bar { height: 4px; background: var(--line-soft); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.bar > div { height: 100%; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40;
  max-width: calc(100vw - 32px);
  background: var(--ink); color: #fff; border-radius: 3px; padding: 10px 16px; font-size: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}
.toast:empty { display: none; }

/* ---------- Narrow screens ---------- */

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; gap: 12px; }
  .menu { width: 48px; height: 48px; }
  .search { height: 48px; padding: 0 12px; }
  .search input { width: 120px; }
  .chip { padding: 3px 8px; }
  .layout { padding: 32px 16px 64px; gap: 48px; }
  .row { grid-template-columns: 28px minmax(0, 1fr) auto; padding: 14px 16px; }
  .row-type { display: none; }
  .create { grid-template-columns: 28px minmax(0, 1fr) auto; padding: 10px 16px; }
  .create .quiet { grid-column: 2; justify-self: start; }
  .notice { padding: 12px 16px; font-size: 16px; }
  .card-body, .card-body.head, .card-body.plain { padding-left: 22px; padding-right: 22px; }
  .card-foot { padding: 14px 22px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .facts .label { margin-top: 10px; }
  .fact.deployed { flex-wrap: wrap; row-gap: 4px; }
  .menu-head, .provider { padding-left: 18px; padding-right: 18px; }
  .menu-alert { margin: 0 18px 14px; }
}
