:root {
  --bg: #0c1117;
  --bg-elev: #121a22;
  --bg-row: #0f161e;
  --line: #243041;
  --text: #e8eef5;
  --muted: #8b9bb0;
  --accent: #3dba8c;
  --accent-dim: #2a7d5f;
  --warn: #e2a84a;
  --danger: #e06b6b;
  --ok: #3dba8c;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, #163028 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1a2433 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}

code, .mono { font-family: var(--mono); font-size: 0.92em; }

.hidden { display: none !important; }

.brand {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--accent);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-panel {
  width: min(420px, 100%);
  animation: rise 0.45s ease both;
}

.login-panel h1 {
  margin: 0.35rem 0 0.5rem;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lede { color: var(--muted); margin: 0 0 1.5rem; }

.login-panel label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.login-panel input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--mono);
  margin-bottom: 0.85rem;
}

.login-panel input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

button, .tab {
  font-family: var(--font);
  cursor: pointer;
}

.login-panel button[type="submit"],
button:not(.ghost):not(.tab):not(.linkish) {
  background: var(--accent);
  color: #062016;
  border: 0;
  border-radius: var(--radius);
  padding: 0.7rem 1.1rem;
  font-weight: 600;
}

.ghost, .linkish {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}

.linkish {
  border: 0;
  color: var(--accent);
  padding: 0.25rem 0.4rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.error { color: var(--danger); margin-top: 0.75rem; }

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand { display: flex; align-items: center; gap: 0.5rem; }

.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius);
}

.tab.is-active {
  color: var(--text);
  background: var(--bg-elev);
}

.main {
  padding: 1.5rem 1.25rem 3rem;
  width: min(1200px, 100%);
  margin: 0 auto;
}

.view { animation: rise 0.35s ease both; }

.view-head {
  margin-bottom: 1.25rem;
}

.view-head h1 {
  margin: 0.35rem 0 0.25rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.view-head p { margin: 0; color: var(--muted); }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.metric {
  padding: 0.9rem 1rem;
  border-bottom: 2px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 26, 34, 0.9), transparent);
  animation: rise 0.4s ease both;
}

.metric:nth-child(2) { animation-delay: 0.05s; }
.metric:nth-child(3) { animation-delay: 0.1s; }
.metric:nth-child(4) { animation-delay: 0.15s; }
.metric:nth-child(5) { animation-delay: 0.2s; }

.metric .label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric .value {
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.5rem;
}

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .tabs { margin-left: 0; flex-wrap: wrap; }
  .topbar { flex-wrap: wrap; }
}

h2 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.75rem;
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr {
  background: transparent;
  transition: background 0.15s ease;
  animation: rise 0.3s ease both;
}

tbody tr:hover { background: var(--bg-row); }

.machine-link {
  color: var(--text);
  font-family: var(--mono);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
}

.machine-link:hover { color: var(--accent); }

.status {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  display: inline-block;
}

.status.done { color: var(--ok); background: rgba(61, 186, 140, 0.12); }
.status.failed,
.status.disabled { color: var(--danger); background: rgba(224, 107, 107, 0.12); }
.status.pending,
.status.uploading { color: var(--warn); background: rgba(226, 168, 74, 0.12); }

.whoami {
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: 0.35rem;
}

.account-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1.5rem;
  max-width: 900px;
}

.account-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.account-form input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--mono);
}

.account-form button[type="submit"] {
  height: 2.4rem;
}

.build-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  align-items: start;
}

@media (max-width: 960px) {
  .build-layout { grid-template-columns: 1fr; }
}

.build-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.build-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .build-row { grid-template-columns: 1fr; }
}

.build-form label,
.build-form .full {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.build-form input,
.build-form textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.build-form textarea { resize: vertical; min-height: 4.5rem; }

.build-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  margin: 0;
}

.build-fieldset legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.build-fieldset .hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

.check {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
  color: var(--text) !important;
  font-size: 0.9rem !important;
  cursor: pointer;
}

.check input { width: auto; }

.build-form button[type="submit"] {
  align-self: start;
  background: var(--accent);
  color: #062016;
  border: 0;
  border-radius: var(--radius);
  padding: 0.7rem 1.1rem;
  font-weight: 600;
}

.process-card {
  border-top: 2px solid var(--line);
  padding: 0.5rem 0 0;
  animation: rise 0.35s ease both;
}

.process-card h2 {
  margin-bottom: 0.85rem;
}

.process-steps {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.92rem;
}

.process-steps li { padding-left: 0.15rem; }

.paths-summary {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 220px;
}

.filters {
  display: flex;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.filters input[type="text"] {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font-family: var(--mono);
}

select {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font-family: var(--mono);
}


.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  max-width: min(360px, calc(100vw - 2rem));
  z-index: 50;
  animation: rise 0.25s ease both;
}

.toast.is-error { border-color: var(--danger); }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
