:root {
  --bg: #f2efe8;
  --panel: #fffdf8;
  --ink: #1f1c16;
  --muted: #6a6258;
  --accent: #0f7b6c;
  --accent-soft: #d9efe9;
  --border: #ddd4c6;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, #e9e1d1 0, var(--bg) 50%);
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 1.6rem;
}

h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

label,
.sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.shell {
  display: block;
  min-height: 100vh;
}

.content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.content.full {
  max-width: 1440px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}

.topbar-left {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-right button {
  width: auto;
  margin: 0;
}

.topbar-right .mono {
  margin: 0;
}

.project-selector-btn {
  width: auto;
  min-width: 180px;
  text-align: left;
  padding: 0.5rem 0.75rem;
}

.project-picker {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  min-width: 420px;
  z-index: 20;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.project-picker ul {
  max-height: 210px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
}

.tabbar {
  padding: 0.55rem;
}

.tab-buttons {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tab-btn {
  width: auto;
  margin: 0;
  padding: 0.45rem 0.7rem;
  background: #ebe5da;
  color: var(--ink);
  border: 1px solid var(--border);
}

.tab-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #114137;
}

.tab-panel {
  display: none !important;
}

.tab-panel.active {
  display: grid !important;
}

.tab-panel.card.active {
  display: block !important;
}

.card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 10px;
  padding: 0.9rem;
}

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

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.6rem;
}

.metric {
  background: var(--accent-soft);
  border: 1px solid #b8dcd2;
  border-radius: 8px;
  padding: 0.6rem;
}

.metric strong {
  display: block;
  font-size: 1.1rem;
}

input,
textarea,
select,
button {
  width: 100%;
  margin-top: 0.35rem;
  margin-bottom: 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.6rem;
  font-size: 0.95rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.5rem;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 0.5rem;
  align-items: center;
}

.toolbar.three {
  grid-template-columns: repeat(3, minmax(110px, 1fr));
}

.toolbar.two {
  grid-template-columns: repeat(2, minmax(110px, 1fr));
}

.toolbar.four {
  grid-template-columns: repeat(4, minmax(110px, 1fr));
}

.toolbar.six {
  grid-template-columns: repeat(6, minmax(95px, 1fr));
}

.toolbar.compact input,
.toolbar.compact select,
.toolbar.compact button {
  margin: 0;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: #efebe2;
}

.badge.completed,
.badge.ok,
.badge.active {
  background: #d9efe9;
  border-color: #b8dcd2;
}

.badge.running,
.badge.queued,
.badge.processing {
  background: #fff0cc;
  border-color: #e5c987;
}

.badge.failed,
.badge.error,
.badge.disabled {
  background: #fddfdb;
  border-color: #f3b2a9;
}

.small-btn {
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  margin: 0;
}

.retry-btn {
  background: #8a5d16;
}

table button.small-btn {
  width: auto;
}

.inline-note {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  max-width: 280px;
}

.inline-note.error {
  background: #fddfdb;
  border-color: #f3b2a9;
  color: #6e1d15;
}

.inline-note.info {
  background: #e8f2ff;
  border-color: #b7d3fb;
  color: #1a3e73;
}

.inline-editor {
  margin-top: 0.6rem;
  background: #f8f3ea;
}

.inline-editor[hidden] {
  display: none;
}

.run-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.95);
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 45vh;
  overflow: auto;
}

li button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  text-align: left;
}

li button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  font-size: 0.86rem;
  padding: 0.45rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

pre {
  background: #1d1c19;
  color: #f6f4ef;
  border-radius: 8px;
  padding: 0.8rem;
  font-size: 0.8rem;
  overflow-x: auto;
  min-height: 180px;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--danger);
}

.toast-container {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 999;
}

.toast {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #efebe2;
  color: #2b261f;
  padding: 0.5rem 0.7rem;
  min-width: 260px;
  max-width: 420px;
  box-shadow: 0 8px 16px rgba(21, 18, 14, 0.14);
  font-size: 0.82rem;
}

.toast.success {
  background: #d9efe9;
  border-color: #b8dcd2;
}

.toast.error {
  background: #fddfdb;
  border-color: #f3b2a9;
}

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

  .metrics {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }

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

  .topbar {
    flex-direction: column;
  }

  .topbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .project-picker {
    position: static;
    min-width: 0;
    box-shadow: none;
  }
}
