:root {
  --bg: #140c0e;
  --panel: #1f1216;
  --text: #f6eee8;
  --muted: #b59a9f;
  --accent: #ff9933;
  --accent-hover: #e8892a;
  --maroon: #800000;
  --danger: #c44b4b;
  --border: #3a2228;
  --ok: #3dba7a;
  --warn: #ff9933;
  --fail: #e35d5d;
  --font: "Segoe UI", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "Cascadia Code", "Consolas", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #3a1518 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}
a { color: #ffb366; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(20, 12, 14, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}
.brand:hover { text-decoration: none; opacity: 0.92; }
.brand-logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(220px, 55vw);
  object-fit: contain;
}
.topbar nav { display: flex; gap: 1rem; align-items: center; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--accent); }

.container { max-width: 960px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }

h1 { margin: 0 0 0.35rem; font-size: 1.75rem; }
h2 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.muted { color: var(--muted); margin: 0; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}
.btn:hover { border-color: #3d4d5e; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--maroon); font-weight: 700; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: transparent; border-color: var(--danger); color: #ffb4b4; }

.auth-card {
  max-width: 380px;
  margin: 4rem auto;
  padding: 1.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.auth-logo {
  display: block;
  height: 52px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  margin-bottom: 0.75rem;
}
.stack { display: grid; gap: 0.9rem; }
.stack label, .form-grid label { display: grid; gap: 0.35rem; font-size: 0.92rem; }
input[type="text"], input[type="password"], input[type="url"], input[type="file"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #10161d;
  color: var(--text);
  font: inherit;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.span-2 { grid-column: 1 / -1; }
fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem 1rem;
}
legend { padding: 0 0.35rem; color: var(--muted); }
.row { display: flex; gap: 1.25rem; margin-bottom: 0.75rem; }
.radio { display: flex !important; flex-direction: row !important; align-items: center; gap: 0.4rem; }
.hidden { display: none !important; }
.actions { display: flex; gap: 0.75rem; align-items: center; }
.actions.wrap { flex-wrap: wrap; }
.inline, .inline-form { display: inline; margin: 0; }
.linkish {
  background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0;
}
.linkish:hover { color: var(--text); text-decoration: underline; }

.table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 10px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table tr:last-child td { border-bottom: none; }

.status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #243040;
}
.status-running { color: #062117; background: var(--ok); }
.status-failed { color: #2a0a0a; background: var(--fail); }
.status-deploying, .status-pending { color: #2a2100; background: var(--warn); }
.status-stopped { color: var(--muted); background: #2a3340; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}
.meta { display: grid; grid-template-columns: 140px 1fr; gap: 0.4rem 1rem; margin: 0; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; word-break: break-all; }
code, .log, .error-box {
  font-family: var(--mono);
  font-size: 0.85rem;
}
.log, .error-box {
  background: #0b1015;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem;
  overflow: auto;
  max-height: 420px;
  white-space: pre-wrap;
}
.error-box { border-color: #6a3030; color: #ffc9c9; }
.banner {
  background: #2a2410;
  border: 1px solid #5a4a18;
  color: #f0d78c;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.banner a { color: var(--accent); margin-left: 0.35rem; }
.banner-warn {
  background: #2a1414;
  border-color: #6a3030;
  color: #ffc9c9;
}
.gate-card h1 { margin-top: 0; }
.flash-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.flash { padding: 0.65rem 0.9rem; border-radius: 8px; margin-bottom: 0.4rem; }
.flash-success { background: #123226; border: 1px solid #1f6b4a; }
.flash-error { background: #2a1414; border: 1px solid #6a3030; }
.empty {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.file-inline { font-size: 0.85rem; color: var(--muted); display: grid; gap: 0.25rem; }
.path-cell { font-size: 0.8rem; color: var(--muted); word-break: break-all; }
.event-type {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #9ecbff;
}
.msg-cell { font-size: 0.88rem; color: var(--muted); max-width: 28rem; }
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}
.filter-bar label { display: grid; gap: 0.35rem; font-size: 0.9rem; }
.filter-bar select {
  background: #10161d;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font: inherit;
}
.status-success, .status-info { color: #062117; background: var(--ok); }
.status-info { background: #4a90c8; color: #041018; }
.status-failed { color: #2a0a0a; background: var(--fail); }


@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .meta { grid-template-columns: 1fr; }
}
