:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #687386;
  --line: #d9dfe8;
  --accent: #176b5f;
  --accent-strong: #105348;
  --danger: #9d3d3d;
  --warning: #8a641b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 760;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #fff;
  color: var(--accent);
}

button.secondary:hover {
  background: #eef7f5;
}

button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

button.danger:hover {
  background: #7e2f2f;
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-box {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--panel);
}

.login-box h1 {
  margin-bottom: 8px;
}

.login-box p {
  margin-bottom: 0;
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 22px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 34px;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.topbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.auth {
  display: grid;
  grid-template-columns: minmax(170px, 240px) auto;
  gap: 8px;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding-bottom: 48px;
}

.panel {
  margin-top: 26px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.project-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.message {
  margin-bottom: 14px;
  border: 1px solid #e2c675;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff9df;
  color: var(--warning);
}

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.project {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

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

.project h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.status {
  flex: 0 0 auto;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eaf6f3;
  color: #126153;
  font-size: 12px;
  font-weight: 850;
}

.status.off {
  background: #f8ecec;
  color: var(--danger);
}

.branch-row,
.variant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 14px;
}

.variant-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.variants {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.variant {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.variant strong {
  display: block;
}

.variant a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.empty {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 940px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .auth,
  .project-form,
  .branch-row,
  .variant-form {
    grid-template-columns: 1fr;
  }
}
