:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-2: #181e24;
  --text: #f3f6f8;
  --muted: #9aa7b3;
  --line: #27313a;
  --line-strong: #34424d;
  --accent: #ff4d5e;
  --accent-dark: #ff7b88;
  --teal: #2dd4bf;
  --warn: #f6b44b;
  --ok: #4ade80;
  --danger: #ef4444;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 77, 94, 0.08), rgba(11, 13, 16, 0) 280px),
    var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 70%);
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0;
}

.topbar,
.public-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.public-header {
  min-height: 70px;
  align-items: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #ffffff;
}

.topbar p,
.muted {
  color: var(--muted);
  margin-top: 7px;
  line-height: 1.55;
}

.panel {
  background: color-mix(in srgb, var(--panel) 88%, #ffffff 12%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.setup-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-card .button {
  margin-top: 10px;
  align-self: flex-start;
}

.setup-card .status-pill.inline {
  margin-bottom: 2px;
}

.grid > div,
.topbar > div,
.job-main {
  min-width: 0;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  margin-top: 14px;
  box-shadow: 0 10px 24px rgba(255, 77, 94, 0.2);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.18);
}

.button.secondary,
button.secondary {
  background: #202832;
  color: #dbe7ef;
  box-shadow: none;
}

button.danger {
  background: var(--danger);
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.18);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.actions,
.top-actions,
.public-nav,
.public-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.top-actions form {
  margin: 0;
}

.actions button,
.actions .button {
  margin-top: 0;
}

.status-pill {
  white-space: nowrap;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  background: rgba(246, 180, 75, 0.12);
  border: 1px solid rgba(246, 180, 75, 0.22);
  color: var(--warn);
}

.status-pill.ok {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.24);
  color: var(--ok);
}

.status-pill.inline {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 8px;
}

.notice {
  margin-top: 12px;
  color: var(--warn);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.tiny {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

code {
  background: #0e1318;
  border: 1px solid #26313b;
  color: #c7d2dc;
  border-radius: 5px;
  padding: 2px 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

a {
  color: var(--teal);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 13px;
  font-size: 15px;
  background: #0f1419;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: rgba(45, 212, 191, 0.75);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

input::placeholder {
  color: #65727e;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-shell {
  width: min(430px, calc(100% - 32px));
}

.auth-panel {
  margin-bottom: 0;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-logo {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  margin-bottom: 18px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
}

.auth-panel h1 {
  margin-bottom: 8px;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.auth-form button {
  width: 100%;
}

.public-shell {
  width: min(1080px, calc(100% - 32px));
}

.brand-line {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 18px;
}

.brand-line img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.public-nav a:not(.button) {
  color: #d2dde6;
  font-weight: 800;
  text-decoration: none;
}

.public-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 30px;
  align-items: center;
  padding: 38px 0 30px;
}

.public-hero h1 {
  font-size: 48px;
  line-height: 1.02;
}

.public-hero p {
  max-width: 760px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.public-logo {
  width: 220px;
  height: 220px;
  border-radius: 32px;
  box-shadow: var(--shadow);
}

.public-info p,
.legal p {
  color: var(--muted);
  line-height: 1.7;
}

.legal-shell {
  width: min(920px, calc(100% - 32px));
}

.legal {
  display: grid;
  gap: 18px;
}

.legal h2 {
  margin-bottom: -8px;
}

.jobs {
  display: grid;
  gap: 9px;
}

.job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.02);
}

.job-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
  color: var(--text);
  text-decoration: none;
}

.job-main strong {
  color: var(--teal);
}

.job-row form {
  margin: 0;
}

button.small {
  min-height: 34px;
  padding: 0 12px;
  margin-top: 0;
}

.meter,
.small-meter {
  background: #0e1318;
  border: 1px solid #202a33;
  border-radius: 999px;
  overflow: hidden;
}

.meter {
  height: 15px;
  margin-bottom: 18px;
}

.small-meter {
  height: 11px;
  margin: 14px 0;
}

#bar,
#currentBar {
  width: 0;
  height: 100%;
  transition: width 0.25s ease;
}

#bar {
  background: linear-gradient(90deg, var(--accent), var(--teal));
}

#currentBar {
  background: var(--teal);
}

.stats,
.details {
  display: grid;
  gap: 12px;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.details {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stats div,
.details div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #11171d;
}

.stats span,
.details span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats strong,
.details strong {
  color: #f8fbfd;
}

.code-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.logs {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #090c10;
  color: #d6e1ea;
  border: 1px solid #222b34;
  border-radius: 7px;
  padding: 15px;
  font-size: 13px;
  line-height: 1.5;
}

.current {
  font-size: 18px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.links {
  display: grid;
  gap: 10px;
}

.links a {
  color: var(--teal);
  font-weight: 800;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
  align-items: start;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.admin-summary div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.admin-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-summary strong {
  display: block;
  margin-top: 8px;
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
}

.admin-account {
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
}

.admin-account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.admin-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.admin-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(45, 212, 191, 0.26);
  border-radius: 8px;
  background: rgba(45, 212, 191, 0.12);
  color: #dffefa;
  font-size: 18px;
  font-weight: 900;
}

.admin-identity h2 {
  margin-bottom: 2px;
  font-size: 18px;
}

.admin-identity p {
  color: var(--muted);
  font-size: 13px;
}

.admin-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  margin: 0;
  background: var(--line);
}

.admin-stats div {
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 13px;
  background: #11171d;
}

.admin-stats span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-stats strong {
  display: block;
  color: #f8fbfd;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-jobs {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.admin-job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main side"
    "actions actions";
  gap: 12px;
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1419;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.admin-job:hover {
  border-color: var(--line-strong);
  background: #111820;
}

.admin-job-main {
  grid-area: main;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.admin-job-main strong,
.admin-job-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-job-main small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.admin-progress {
  display: block;
  height: 7px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #070a0d;
}

.admin-progress i {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--teal));
}

.admin-job-side {
  grid-area: side;
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 5px;
  text-align: right;
}

.admin-job-side em {
  color: var(--teal);
  font-style: normal;
  font-weight: 800;
}

.admin-job-side small {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.admin-job-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.admin-job-actions a {
  min-height: 30px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #151d24;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.admin-job-actions a:hover {
  border-color: rgba(45, 212, 191, 0.36);
  background: rgba(45, 212, 191, 0.1);
}

@media (max-width: 760px) {
  .topbar,
  .form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .grid,
  .admin-grid,
  .stats,
  .details,
  .public-hero {
    grid-template-columns: 1fr;
  }

  .admin-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-pill {
    width: fit-content;
  }

  .actions,
  .top-actions,
  .public-nav {
    justify-content: flex-start;
  }

  .public-header {
    display: grid;
  }

  .public-logo {
    width: 140px;
    height: 140px;
  }

  .public-hero h1 {
    font-size: 36px;
  }

  .job-row,
  .job-main {
    align-items: flex-start;
  }

  .admin-job {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "side"
      "actions";
  }

  .admin-job-side {
    justify-items: start;
    text-align: left;
  }

  .admin-account-head {
    display: grid;
  }

  .admin-pills {
    justify-content: flex-start;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
