@font-face {
  font-family: "Aeonik";
  src: url("fonts/Aeonik/Aeonik-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Aeonik";
  src: url("fonts/Aeonik/Aeonik-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Aeonik";
  src: url("fonts/Aeonik/Aeonik-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Aeonik";
  src: url("fonts/Aeonik/Aeonik-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Aeonik";
  src: url("fonts/Aeonik/Aeonik-Black.otf") format("opentype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Aeonik", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f5f7;
  color: #020617;
  min-height: 100vh;
}

header {
  background: #020617;
  color: #fff;
  padding: 18px 40px;
}
.header-left h1 {
  font-size: 1.5rem;
  font-weight: 700;
}
.header-left p {
  margin-top: 4px;
  opacity: 0.65;
  font-size: 0.9rem;
}

nav.tabs {
  background: #fff;
  border-bottom: 1px solid #e2e4e9;
  display: flex;
  padding: 0 40px;
  gap: 4px;
}
.tab {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab:hover {
  color: #020617;
}
.tab.active {
  color: #020617;
  border-bottom-color: #020617;
}

main {
  max-width: 980px;
  margin: 28px auto;
  padding: 0 20px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
}
.tab-panel.active {
  display: flex;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 22px 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.step-num {
  background: #020617;
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}
.hint {
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 12px;
}
.hint code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
}
code {
  font-family: "SF Mono", "Fira Mono", monospace;
  font-size: 0.85em;
}

/* Forms ------------------------------------------------------------------ */

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.form-row input,
.form-row select,
select,
input[type="text"],
input[type="url"] {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid #c8ccd4;
  border-radius: 6px;
  background: #fff;
}
.form-row input:focus,
.form-row select:focus {
  outline: 2px solid #020617;
  outline-offset: -1px;
}

/* Breathing room between the slug/name row and the JSON textarea below it */
.editor-identity {
  margin-bottom: 16px;
}

/* Stacked label + input (e.g. the slug/name fields in the workflow editor) */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: #555;
}

button {
  background: #020617;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
button:not(:disabled):hover {
  opacity: 0.85;
}
.link-btn {
  background: transparent;
  color: #020617;
  padding: 4px 8px;
  font-size: 0.85rem;
  text-decoration: underline;
}
.link-btn:hover {
  background: transparent;
  opacity: 0.7;
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 14px;
}
.inline.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

textarea {
  width: 100%;
  font-family: "SF Mono", "Fira Mono", monospace;
  font-size: 0.82rem;
  padding: 12px;
  border: 1px solid #c8ccd4;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* Tables ---------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
th {
  background: #f4f5f7;
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  border-bottom: 1px solid #e2e4e9;
}
td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
}
tr:last-child td {
  border-bottom: none;
}

/* Run history ----------------------------------------------------------- */

.run-group {
  margin-bottom: 18px;
}
.run-group-date {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  margin-bottom: 6px;
}
.runs-table .run-time {
  white-space: nowrap;
  color: #555;
  font-variant-numeric: tabular-nums;
}
.runs-table .run-actions {
  white-space: nowrap;
  text-align: right;
}
.runs-table .run-actions a,
.runs-table .run-actions .link-btn {
  margin-left: 14px;
}

/* Upload zone ----------------------------------------------------------- */

.upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #c8ccd4;
  border-radius: 8px;
  padding: 28px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: #020617;
  background: #f8f9fb;
}
.upload-zone.done {
  border-color: #22c55e;
  color: #166534;
  background: #f0fdf4;
}
.upload-zone.error {
  border-color: #ef4444;
  color: #991b1b;
  background: #fef2f2;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}
.pill-on {
  background: #dcfce7;
  color: #166534;
}
.pill-off {
  background: #f0f0f0;
  color: #555;
}

/* Mapping rows ---------------------------------------------------------- */

.map-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}
.map-row:last-child {
  border-bottom: none;
}
.map-row label {
  font-size: 0.88rem;
}
/* Grid items default to min-width:auto, so a <select> with a long option (e.g.
   a full URL step) widens its track and overflows the card. Let it shrink and
   clip instead. */
.map-row select {
  min-width: 0;
  width: 100%;
}

/* Recorder step log ----------------------------------------------------- */

#record-steps {
  margin-top: 14px;
  max-height: 280px;
  overflow-y: auto;
  background: #f8f9fb;
  border-radius: 6px;
  padding: 8px 12px;
  font-family: "SF Mono", "Fira Mono", monospace;
  font-size: 0.78rem;
}
/* Suppress the empty styled box when nothing has been recorded yet */
#record-steps:empty {
  display: none;
}
.record-step {
  padding: 2px 0;
  color: #333;
}

/* Logs tab -------------------------------------------------------------- */

#row-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.row-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.row-pending {
  background: #f0f0f0;
  color: #555;
}
.row-running {
  background: #dbeafe;
  color: #1e40af;
}
.row-done {
  background: #dcfce7;
  color: #166534;
}
.row-failed {
  background: #fee2e2;
  color: #991b1b;
  cursor: help;
}
.row-skipped {
  background: #f0f0f0;
  color: #777;
  cursor: help;
}

/* Reusable flex grid of pills (the interactive loop reuses it as a class) */
.row-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

/* Interactive run -------------------------------------------------------- */

.int-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}

.int-loop {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #ececec;
}
.int-loop h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.int-match {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #d8d8d8;
}
.int-match h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.78rem;
  font-family: inherit;
  background: #f3f3f3;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.pill-run {
  background: #dbeafe;
  color: #1e40af;
}
.pill-loop {
  background: #fef9c3;
  color: #854d0e;
}
.pill-manual {
  background: #fae8ff;
  color: #86198f;
}

#log-panel {
  background: #0f0f1a;
  color: #c8ffc8;
  font-family: "SF Mono", "Fira Mono", monospace;
  font-size: 0.8rem;
  border-radius: 6px;
  padding: 14px;
  height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.log-line {
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-line.fail {
  color: #fca5a5;
}
.log-line.success {
  color: #86efac;
}

.hidden {
  display: none !important;
}
