*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
a { color: var(--blue-ink); text-underline-offset: .25em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.brand {
  display: block;
  width: 13.5rem;
  max-width: 100%;
}

.brand img { display: block; width: 100%; height: auto; }

.shell {
  --menu-width: 11.75rem;
  --page-gutter: clamp(1rem, 2.5vw, 2rem);
  display: grid;
  grid-template-columns: var(--menu-width) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "sidebar header" "sidebar main";
  min-height: 100dvh;
  background: var(--white);
  font-size: .875rem;
}

.sidebar {
  grid-area: sidebar;
  min-width: 0;
  padding: 0 .65rem;
  border-right: 1px solid var(--line);
  background: var(--light);
}

.sidebar .brand { display: flex; align-items: center; width: 9rem; min-height: 3.4rem; margin-left: .45rem; }
.main-menu { display: grid; gap: .2rem; padding-block: .75rem; }

.main-menu a {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.3rem;
  padding: .35rem .55rem;
  border-radius: .35rem;
  color: var(--text);
  font-size: .8125rem;
  font-weight: 650;
  text-decoration: none;
}

.main-menu a svg { flex: none; }
.main-menu a:hover, .main-menu a[aria-current="page"] { background: var(--blue-tint); color: var(--blue-ink); }

.topline {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  min-width: 0;
  min-height: 3.4rem;
  padding: .35rem var(--page-gutter);
  border-bottom: 1px solid var(--line);
}

.header-actions, #workspace-picker { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.header-actions { margin-left: auto; }
#workspace-picker label { color: var(--text); font-size: .75rem; white-space: nowrap; }
#active-workspace {
  min-width: 0;
  max-width: 15rem;
  min-height: 1.95rem;
  padding: .25rem .45rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--white);
  color: var(--ink);
  font-size: .8125rem;
}
#sign-out { flex: none; }
.mode { color: var(--text); font-size: .75rem; }
.workspace { grid-area: main; min-width: 0; padding: 1.45rem var(--page-gutter) 2.25rem; }
.narrow-view { max-width: 48rem; }

h1 {
  margin-bottom: .5rem;
  font-size: 1.625rem;
  font-weight: 740;
  line-height: 1.2;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

h1:focus { outline: 0; }
h2 { margin-bottom: .55rem; font-size: 1rem; font-weight: 720; line-height: 1.3; }
.muted, .app-meta, .app-date { color: var(--text); }
.page-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .85rem; }
.page-heading h1 { margin: 0; }
#new-app { gap: .35rem; }
#new-app span { font-size: 1rem; line-height: 1; }
.empty-apps { padding-block: 1.1rem; border-top: 1px solid var(--line); }
.empty-apps h2 { margin-bottom: .25rem; }

.app-list, .team-list { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
.app-list :is(th, td), .team-list :is(th, td) { border-bottom: 1px solid var(--line); padding: .55rem .45rem; vertical-align: middle; }
.app-list thead th, .team-list thead th { color: var(--text); font-size: .75rem; font-weight: 690; }
.app-list tbody :is(th, td), .team-list tbody td { font-size: .8125rem; font-weight: 520; overflow-wrap: anywhere; }
.app-list .app-name-column { padding-left: .2rem; }
.app-source-column { width: 18%; }
.app-status-column { width: 22%; }
.app-date-column { width: 20%; }
.app-open-column { width: 1.5rem; color: var(--text); }
.app-list tbody .app-open-column { font-size: 1rem; }
.app-list tbody tr { cursor: pointer; }
.app-list tbody tr:hover, .app-list tbody tr:focus-within { background: var(--light); }
.app-name { color: var(--ink); font-weight: 740; text-decoration: none; }
.app-name:hover { text-decoration: underline; }
.app-url { color: inherit; }
.app-url[href] { color: var(--blue-ink); }
.app-meta { display: block; margin-top: .05rem; font-size: .75rem; }
.app-date { font-variant-numeric: tabular-nums; }
.app-list .status-label { font-size: .75rem; }
.team-list { margin-bottom: 1rem; }
.team-list th:last-child { width: 40%; }

.back-link { display: inline-block; margin-bottom: .65rem; color: var(--blue-ink); font-size: .8125rem; font-weight: 650; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: .15rem .8rem; margin-bottom: .9rem; border-bottom: 1px solid var(--line); }
.wizard-steps button {
  padding: .35rem .1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: .8125rem;
}
.wizard-steps button[aria-current] { border-bottom-color: var(--orange-action); color: var(--ink); font-weight: 700; }
.project-address { margin-top: .55rem; color: var(--blue-ink); font-weight: 680; overflow-wrap: anywhere; }

.intro { max-width: 65ch; margin-bottom: .95rem; color: var(--text); font-size: .875rem; overflow-wrap: anywhere; }
.sources, .split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.sources { margin-bottom: 1.15rem; }

.source {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
  min-height: 3.65rem;
  padding: .6rem .75rem;
  border: 1px solid var(--input-line);
  border-radius: .7rem;
  background: var(--white);
  color: var(--ink);
  text-align: left;
}

.source:not(:disabled):hover, .source.selected {
  border-color: var(--blue);
  background: var(--blue-tint);
}

.source-symbol {
  display: grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: .4rem;
  background: var(--light);
  color: var(--blue-ink);
  font-weight: 700;
}

.source.selected .source-symbol { background: var(--white); }
.source strong, .source small { display: block; }
.source strong { font-size: .8125rem; }
.source small { margin-top: .15rem; color: var(--text); font-size: .81rem; }

.selected-dot {
  flex: none;
  width: .9rem;
  height: .9rem;
  margin-left: auto;
  border: .23rem solid var(--blue);
  border-radius: 50%;
  background: var(--white);
}

.panel {
  padding: clamp(.8rem, 2vw, 1.2rem);
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: var(--white);
  box-shadow: 0 18px 38px -36px #273d7480;
}

.panel label {
  display: block;
  margin-bottom: .4rem;
  color: var(--ink);
  font-size: .875rem;
  font-weight: 660;
}

.panel input, .panel textarea, .panel select {
  width: 100%;
  min-height: 2.25rem;
  padding: .4rem .6rem;
  border: 1px solid var(--input-line);
  border-radius: .5rem;
  background: var(--white);
  color: var(--ink);
}

.panel input::placeholder { color: var(--text); }
.panel textarea {
  display: block;
  background: var(--light);
  font: .875rem / 1.65 ui-monospace, monospace;
  resize: vertical;
}

.split { margin-top: .95rem; }
details { margin-top: 1rem; }
summary { color: var(--blue-ink); cursor: pointer; font-size: .875rem; font-weight: 650; }
.details-fields { margin-top: .7rem; }
#team-invites { margin: 0 0 1rem; }
#invite-member button { grid-column: 1 / -1; justify-self: start; }

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: .8rem;
}

.primary, .secondary, .plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.125rem;
  padding: .35rem .65rem;
  border: 1px solid transparent;
  border-radius: .625rem;
  font-size: .8125rem;
  font-weight: 720;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.primary { background: var(--orange-action); color: var(--white); }
.primary:hover:not(:disabled) { background: var(--orange-action-hover); }
.secondary { border-color: var(--input-line); background: var(--white); color: var(--blue-ink); }
.plain { background: transparent; color: var(--blue-ink); }
.secondary:hover:not(:disabled), .plain:hover:not(:disabled) { background: var(--blue-tint); }

.quick-connect { margin-bottom: 1rem; border-top: .24rem solid var(--orange); }
.quick-connect h2 { margin-bottom: .4rem; }
.quick-description { color: var(--text); }
#onboard-text { margin-top: 1.15rem; }

.notice {
  margin: .85rem 0 0;
  padding: .6rem .8rem;
  border-left: .2rem solid var(--blue);
  background: var(--blue-tint);
  color: var(--blue-ink);
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.notice.error { border-left-color: #a42d46; background: #fff1f4; color: #8a2137; }
#global-error { margin: 0 0 1.25rem; }

.tool-switch {
  display: inline-flex;
  gap: .25rem;
  margin-bottom: 1rem;
  padding: .22rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--light);
}

.tool-switch button {
  min-height: 2.4rem;
  padding: .4rem .75rem;
  border: 1px solid transparent;
  border-radius: .42rem;
  background: transparent;
  color: var(--text);
  font-size: .875rem;
  font-weight: 660;
}

.tool-switch button:hover { color: var(--blue-ink); }
.tool-switch button[aria-pressed="true"] {
  border-color: var(--line);
  background: var(--white);
  color: var(--blue-ink);
}

.status-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .55rem; }
.status-top h2 { margin: 0; }
.status-label { display: inline-flex; gap: .4rem; align-items: center; color: var(--blue-ink); font-size: .85rem; font-weight: 700; }
.status-label::before { content: ""; width: .4rem; height: .4rem; background: currentColor; }
.status-label[data-state="succeeded"], .status-label[data-state="live"] { color: #155638; }
.status-label[data-state="failed"], .status-label[data-state="canceled"] { color: #8a2137; }
.status-label[data-state="queued"], .status-label[data-state="building"] { color: #9a3c14; }
.status-label[data-state="idle"], .status-label[data-state="offline"], .status-label[data-state="unknown"] { color: var(--text); }
#status-message { color: var(--text); }
.deployment-meta { margin-top: .65rem; color: var(--text); font: .8125rem / 1.5 ui-monospace, monospace; overflow-wrap: anywhere; }
.next-prompt { display: grid; gap: .2rem; margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.next-prompt span { color: var(--text); font-size: .825rem; }

.auth-header {
  display: flex;
  align-items: center;
  width: min(73rem, 100% - 2.25rem);
  min-height: 5.25rem;
  margin-inline: auto;
}

.auth-page {
  width: min(30rem, 100% - 2.25rem);
  margin-inline: auto;
  padding-block: clamp(1rem, 6vh, 4rem) 3rem;
}

.auth-page .panel { padding: clamp(1.2rem, 5vw, 2.2rem); }
.auth-page h1 { font-size: 1.625rem; }
.auth-page .intro { margin-bottom: 1rem; font-size: .875rem; }
.auth-page input, .auth-page select { margin-bottom: .9rem; }
.auth-page .actions { gap: .4rem; margin-top: .35rem; }
.auth-page .actions > * { width: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 54rem) {
  .shell { --menu-width: 10rem; }
  .sidebar .brand { width: 8rem; }
  .app-date-column { width: 22%; }
}

@media (max-width: 43rem) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "sidebar" "header" "main";
  }
  .sidebar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; border: 0; border-bottom: 1px solid var(--line); padding-inline: var(--page-gutter); }
  .sidebar .brand { margin: 0; min-width: 6.5rem; }
  .main-menu { display: flex; flex-wrap: wrap; justify-content: flex-end; padding-block: .4rem; }
  .main-menu a { gap: .3rem; padding-inline: .35rem; }
  .main-menu a svg { display: none; }
  .topline { min-height: 2.75rem; flex-wrap: wrap; }
  #active-workspace { max-width: 10.5rem; }
  .workspace { padding-top: 1.05rem; }
  .auth-header { min-height: 4.5rem; }
  .auth-header .brand { width: 11rem; }
}

@media (max-width: 36rem) {
  .sources, .split { grid-template-columns: 1fr; gap: .55rem; }
  .app-list :is(.app-source-column, .app-date-column) { display: none; }
  .app-list .app-status-column { width: 38%; }
  .header-actions { gap: .3rem; }
}

@media (max-width: 23rem) {
  #workspace-picker label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
