.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.toolbar h1 {
  margin: 0;
}

.toolbar > button {
  justify-self: end;
  height: 36px;
}

.workspace {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

form {
  display: flex;
  gap: 8px;
  align-items: center;
}

textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
}

.error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #f0b8aa;
  border-radius: 6px;
  background: #fff3f0;
  color: #9b2c1d;
  font-size: 14px;
}

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

.project-list-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.project-team-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.team-users-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.team-user-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.team-user {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  background: #f8fafc;
}

.team-user strong,
.team-user > div > span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-user strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}

.team-user > div > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.list-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 650;
}

.count {
  color: var(--muted);
  font-size: 13px;
}

.project-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.project-card:hover,
.project-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgb(22 103 199 / 12%);
  transform: translateY(-1px);
}

.project-link {
  display: grid;
  gap: 12px;
  min-height: 160px;
  padding: 16px 48px 16px 16px;
  color: inherit;
  text-decoration: none;
}

.project-link:focus-visible {
  outline: none;
}

.project-link h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.project-description {
  margin: 6px 0 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

.project-path {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.folder {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf7f0;
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
}

.folder.missing {
  background: #fff4df;
  color: var(--warn);
}

.card-menu {
  position: absolute;
  top: 10px;
  right: 10px;
}

.menu-button,
.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.menu-button:hover,
.icon-button:hover {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--text);
}

.menu-panel {
  position: absolute;
  right: 0;
  top: 36px;
  z-index: 5;
  width: 120px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgb(15 23 42 / 16%);
}

.menu-panel form {
  display: block;
}

.menu-action {
  width: 100%;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.menu-action:hover {
  background: #f8fafc;
}

.danger-button {
  width: 100%;
  background: transparent;
  color: #b42318;
  text-align: left;
}

.danger-button:hover {
  background: #fff3f0;
}

.empty {
  padding: 32px;
  background: #ffffff;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
}

.empty.compact {
  padding: 12px;
  font-size: 13px;
}

.project-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgb(15 23 42 / 24%);
}

.project-dialog::backdrop {
  background: rgb(15 23 42 / 38%);
}

.login-dialog[open] {
  position: fixed;
  top: 25dvh;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(720px, calc(100vw - 32px));
  margin: 0;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  max-height: calc(80dvh - 24px);
  z-index: 1001;
}

.login-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgb(15 23 42 / 42%);
  pointer-events: auto;
}

.project-dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.login-actions {
  justify-content: flex-end;
}

.login-form {
  width: 100%;
}

.dialog-head h2 {
  margin: 0;
  font-size: 18px;
}

.login-dialog .dialog-head {
  justify-content: center;
}

.login-dialog .dialog-head h2 {
  text-align: center;
}

.project-dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.project-dialog input {
  width: 100%;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(240px, 1fr);
  gap: 16px;
}

.online-users,
.login-fields {
  display: grid;
  align-content: start;
  gap: 8px;
}

.online-users {
  color: var(--muted);
  font-size: 13px;
}

.online-users h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.online-user-card {
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.online-users p {
  margin: 0;
}

.online-user-list {
  display: grid;
  align-content: start;
  gap: 4px;
}

.online-user {
  min-width: 0;
  min-height: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}

.online-user-dot {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--user-color, #3b82f6) !important;
  color: #ffffff !important;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(31, 41, 51, .08);
}

.online-user-name {
  min-width: 0;
  overflow: hidden;
  color: #52606d;
  text-overflow: ellipsis;
}

.login-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.secondary-button:hover {
  background: #f8fafc;
}

.directory-button {
  height: 36px;
  justify-self: start;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 650;
  cursor: pointer;
}

.classes-upload-card {
  min-height: 180px;
  display: grid;
  gap: 12px;
  place-items: center;
  align-content: center;
  padding: 24px;
  border: 1px dashed #9fb4ce;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-weight: 650;
  text-align: center;
  cursor: pointer;
}

.classes-upload-card:hover,
.classes-upload-card.dragging {
  border-color: var(--accent);
  background: #eef6ff;
  color: var(--text);
}

.classes-upload-card.uploading {
  opacity: .7;
  pointer-events: none;
}

.classes-dialog {
  width: min(560px, calc(100vw - 32px));
}

.classes-dialog textarea {
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.close-project-link {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
}

.close-project-link:hover {
  background: #f8fafc;
}

.upload-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.upload-panel {
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.drop-zone {
  min-height: 180px;
  display: grid;
  gap: 12px;
  place-items: center;
  align-content: center;
  padding: 24px;
  border: 1px dashed #9fb4ce;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent);
  background: #eef6ff;
  color: var(--text);
}

.drop-zone.uploading {
  pointer-events: none;
}

.upload-icon {
  --upload-progress: 0;
  position: relative;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #bfd0e4;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent);
  font-size: 28px;
  line-height: 1;
  font-weight: 400;
}

.upload-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    conic-gradient(rgb(22 103 199 / 58%) var(--upload-progress), rgb(226 232 240 / 82%) 0);
  transition: opacity 120ms ease;
}

.upload-icon::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  background: #ffffff;
}

.upload-symbol {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-1px);
}

.uploading .upload-icon::before {
  opacity: 1;
}

.upload-complete .upload-icon {
  border-color: #86efac;
  background: #dcfce7;
  color: #15803d;
}

.upload-complete .upload-icon::before {
  opacity: 0;
}

.upload-options {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.upload-options button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #334e68;
  font: inherit;
  cursor: pointer;
}

.upload-options button:hover {
  background: #e6f0ff;
  color: #243b53;
}

.action-link {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 650;
  text-decoration: none;
}

.action-link:hover {
  background: var(--accent-dark);
}

.action-link.disabled {
  background: #cbd5e1;
  color: #64748b;
  pointer-events: none;
}

.sftp-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.copy-icon-button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #334e68;
  font-size: 16px;
  line-height: 1;
}

.copy-icon-button:hover {
  background: #e6f0ff;
  color: #243b53;
}

.sftp-url-card {
  min-height: 180px;
  display: grid;
  align-content: center;
  padding: 18px;
  overflow: hidden;
  border: 1px dashed #9fb4ce;
  border-radius: 8px;
  background: #f8fbff;
  color: #334e68;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.sftp-url-card span {
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .toolbar,
  form {
    align-items: stretch;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .upload-layout {
    grid-template-columns: 1fr;
  }

  .project-team-layout {
    grid-template-columns: 1fr;
  }

  .login-layout {
    grid-template-columns: 1fr;
  }

  form {
    display: grid;
  }
}
