/* Recast — house look. Palette after the Rosé Pine-ish mockup. */
:root {
  --bg: #232136;
  --panel: #2a273f;
  --panel-2: #2a283e;
  --overlay: #393552;
  --hl-low: #2a273f;
  --hl-med: #44415a;
  --hl-high: #56526e;
  --text: #e0def4;
  --muted: #908caa;
  --faint: #6e6a86;
  --iris: #c4a7e7;
  --iris-soft: #d3bcee;
  --foam: #9ccfd8;
  --gold: #f6c177;
  --love: #eb6f92;
  --pine: #3e8fb0;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
::selection { background: rgba(196, 167, 231, 0.3); }
a { color: inherit; text-decoration: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.82); } }

/* ---- layout ---- */
.page { min-height: 100vh; background: var(--bg); padding: 0 24px 80px; }
.container { max-width: 1080px; margin: 0 auto; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding: 28px 0 30px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
  width: 34px; height: 34px; border-radius: 9px; background: var(--iris); color: var(--bg);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
  font-size: 13px; letter-spacing: -0.5px;
}
.brand-name { font-size: 16px; font-weight: 650; letter-spacing: -0.2px; }
.eu-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.eu-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--foam); display: inline-block; }

/* ---- banner ---- */
.banner {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 22px;
  padding: 11px 15px; border-radius: 11px;
  background: rgba(246, 193, 119, 0.09); border: 1px solid rgba(246, 193, 119, 0.3);
  font-size: 13px; color: var(--text);
}
.banner .banner-glyph { color: var(--gold); flex-shrink: 0; }

/* ---- steps ---- */
.step { margin-bottom: 40px; }
.step-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.step-num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--faint); }
.step-title { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.2px; }
.step-hint { font-size: 12.5px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--overlay); border-radius: 14px; padding: 18px; }
.card + .card { margin-top: 14px; }

/* ---- template list (step 1) ---- */
.tpl-list { display: flex; flex-direction: column; gap: 10px; }
.tpl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--overlay);
  animation: rowIn .35s ease both;
}
.tpl-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tpl-thumb {
  width: 42px; height: 50px; border-radius: 8px; background: var(--overlay); border: 1px solid var(--hl-med);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; flex-shrink: 0;
}
.tpl-thumb span {
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px; color: var(--iris);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tpl-meta-wrap { min-width: 0; }
.tpl-name-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tpl-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px;
}
.tpl-meta { font-size: 12.5px; color: var(--faint); margin-top: 5px; }

.pill {
  font-size: 10.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.pill-stored {
  background: rgba(156, 207, 216, 0.14); border: 1px solid rgba(156, 207, 216, 0.35); color: var(--foam);
}

.empty-state {
  text-align: center; padding: 22px; border-radius: 12px;
  border: 1px dashed var(--hl-med); background: var(--panel-2); color: var(--muted); font-size: 13px;
}

/* ---- upload / dropzone ---- */
.dropzone {
  margin-top: 16px; border-radius: 12px; border: 1.5px dashed var(--hl-med); background: var(--panel-2);
  padding: 20px 18px; transition: border-color .2s ease, background .2s ease;
}
.dropzone:hover { border-color: var(--hl-high); background: #2d2a44; }
.dropzone-big { padding: 30px 22px; text-align: center; }
.dropzone-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.dropzone-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* two-path "create a template" explainer inside the upload dropzone */
.tpl-help { margin-bottom: 16px; }
.tpl-help-lead { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.tpl-help-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.tpl-help-list li { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.tpl-help-list strong { color: var(--text); font-weight: 600; }
.tpl-help-note { margin-top: 10px; font-size: 12px; color: var(--faint); line-height: 1.5; }

.field-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.text-input {
  flex: 1 1 180px; min-width: 0; padding: 9px 12px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--hl-med); color: var(--text); font-size: 13px;
}
.text-input::placeholder { color: var(--faint); }
input[type="file"] { color: var(--muted); font-size: 13px; }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 8px 14px; border-radius: 9px; cursor: pointer;
  background: var(--overlay); border: 1px solid var(--hl-high); color: var(--text);
  font-size: 12.5px; font-weight: 600;
}
input[type="file"]::file-selector-button:hover { background: var(--hl-med); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 9px;
  font-size: 13px; font-weight: 650; cursor: pointer; border: 1px solid transparent; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--iris); color: var(--bg); border: none; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); }
.btn-primary:hover:not(:disabled):not(.is-disabled) { background: var(--iris-soft); }
.btn-ghost { background: transparent; border: 1px solid var(--hl-high); color: var(--text); }
.btn-ghost:hover:not(:disabled):not(.is-disabled) { background: var(--hl-med); }
.btn-accent-ghost { background: transparent; border: 1px solid rgba(196, 167, 231, 0.4); color: var(--iris); }
.btn-accent-ghost:hover:not(:disabled):not(.is-disabled) { background: rgba(196, 167, 231, 0.1); }
.btn-danger {
  background: transparent; border: 1px solid var(--hl-med); color: var(--muted);
  padding: 7px 12px; font-size: 12px;
}
.btn-danger:hover { border-color: var(--love); color: var(--love); background: rgba(235, 111, 146, 0.08); }
.btn-lg { padding: 12px 26px; font-size: 14px; font-weight: 700; }

.actions-row { margin-top: 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---- error ---- */
.error-box {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px;
  padding: 12px 15px; border-radius: 11px;
  background: rgba(235, 111, 146, 0.1); border: 1px solid rgba(235, 111, 146, 0.35);
  color: var(--text); font-size: 13px;
}
.error-box .error-glyph { color: var(--love); flex-shrink: 0; font-weight: 700; }

/* ---- indicator (learning shimmer) ---- */
.htmx-indicator { opacity: 0; height: 0; overflow: hidden; transition: opacity .2s ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; height: auto; }
.learn-indicator {
  margin-top: 14px; padding: 12px 15px; border-radius: 11px; font-size: 13px; color: var(--iris);
  background: linear-gradient(90deg, rgba(196, 167, 231, 0.06) 0%, rgba(196, 167, 231, 0.22) 50%, rgba(196, 167, 231, 0.06) 100%);
  background-size: 200% 100%; animation: shimmer 1.35s linear infinite;
  border: 1px solid rgba(196, 167, 231, 0.25);
}

/* ---- jobs (step 3) ---- */
.jobs-batch {
  background: var(--panel); border: 1px solid var(--overlay); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 14px;
}
.jobs-batch-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.jobs-counts { font-size: 13.5px; color: var(--text); }
.jobs-counts b { font-weight: 700; }
.sep { color: var(--faint); }
.c-iris { color: var(--iris); }
.c-love { color: var(--love); }
.c-foam { color: var(--foam); }

/* ---- shared daily capacity meter ---- */
.usage-meter {
  background: var(--panel); border: 1px solid var(--overlay); border-radius: 12px;
  padding: 12px 15px; margin-bottom: 22px;
}
.usage-meter-row + .usage-meter-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--overlay); }
/* Only the exhausted dimension is marked (a subtle left accent), so a full
   Templates cap never paints the CV row (or vice versa). */
.usage-meter-row.is-full { border-left: 2px solid rgba(235, 111, 146, 0.55); padding-left: 10px; margin-left: -12px; }
.usage-meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.usage-meter-label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.usage-meter-count { font-size: 13.5px; color: var(--text); }
.usage-meter-count b { font-weight: 700; }
.usage-meter-note { margin-top: 7px; font-size: 12px; color: var(--love); }
.usage-meter-note.muted { color: var(--muted); }

/* ---- batch-level notice (e.g. daily-limit truncation) ---- */
.jobs-notice {
  margin-bottom: 12px; padding: 10px 14px; border-radius: 10px;
  background: rgba(246, 193, 119, 0.09); border: 1px solid rgba(246, 193, 119, 0.3);
  font-size: 13px; color: var(--text);
}

.progress { position: relative; height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.progress-agg { height: 5px; margin-top: 14px; }
.progress-fill { position: absolute; top: 0; left: 0; bottom: 0; border-radius: 999px; transition: width .5s ease; }
.fill-iris { background: var(--iris); }
.fill-foam { background: var(--foam); }
.fill-love { background: var(--love); }
.fill-muted { background: var(--faint); }
.fill-shimmer {
  background-image: linear-gradient(90deg, rgba(156, 207, 216, 0.45) 0%, var(--foam) 50%, rgba(156, 207, 216, 0.45) 100%);
  background-size: 200% 100%; animation: shimmer 1.35s linear infinite;
}

.job-rows { display: flex; flex-direction: column; gap: 9px; }
.job-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 13px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--overlay);
}
/* Entrance animation plays only on the first render (POST response), not on the
   700ms status polls — otherwise every re-render replays it and it reads as a
   blink. See view::job_panel's `animate_in`. */
.job-rows.animate-in .job-row { animation: rowIn .4s ease both; }
.job-filename-wrap { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 10px; }
.job-filename {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.job-reason { font-size: 11px; color: var(--love); white-space: nowrap; }
.job-chip-wrap { flex: 0 0 auto; }
.job-bar-wrap { flex: 1 1 130px; min-width: 90px; }
.job-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.status-pill.is-pending { color: var(--muted); background: var(--overlay); border-color: var(--hl-med); }
.status-pill.is-processing { color: var(--foam); background: rgba(156, 207, 216, 0.13); border-color: rgba(156, 207, 216, 0.42); }
.status-pill.is-done { color: var(--foam); background: rgba(156, 207, 216, 0.13); border-color: rgba(156, 207, 216, 0.42); }
.status-pill.is-failed { color: var(--love); background: rgba(235, 111, 146, 0.13); border-color: rgba(235, 111, 146, 0.42); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; animation: pulseDot 1.1s ease-in-out infinite; }

.download-link {
  padding: 6px 13px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: transparent; border: 1px solid rgba(62, 143, 176, 0.5); color: var(--pine); cursor: pointer;
}
.download-link:hover { background: rgba(62, 143, 176, 0.12); }
.download-link.is-disabled { border-color: #332f4a; color: var(--faint); opacity: .55; cursor: not-allowed; }

/* ---- template induction preview ---- */
.induction-title { margin: 0 0 4px; font-size: 15px; font-weight: 650; letter-spacing: -0.2px; }
.roundtrip-wrap { margin: 4px 0 16px; }
.roundtrip-table { display: flex; flex-direction: column; gap: 6px; }
.roundtrip-row {
  display: grid; grid-template-columns: 18px 140px 1fr 1fr; gap: 10px; align-items: center;
  padding: 8px 12px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--overlay);
  font-size: 12.5px;
}
.roundtrip-row.is-ok { opacity: .6; }
.roundtrip-row.is-mismatch { border-color: rgba(235, 111, 146, 0.45); background: rgba(235, 111, 146, 0.06); }
.roundtrip-glyph { text-align: center; font-weight: 700; }
.roundtrip-row.is-ok .roundtrip-glyph { color: var(--foam); }
.roundtrip-row.is-mismatch .roundtrip-glyph { color: var(--love); }
.roundtrip-field { color: var(--iris); font-size: 12px; }
.roundtrip-expected, .roundtrip-got {
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.unaccounted-list { margin: 8px 0 0; padding-left: 18px; font-size: 12px; }
.induction-warnings { margin: 4px 0 16px; padding-left: 18px; font-size: 12px; }

/* ---- footer ---- */
.footer {
  margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--overlay);
  font-size: 12px; color: var(--faint); text-align: center;
}
