@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

:root {
  --red: #da2135;
  --black: #1a1a1a;
  --white: #ffffff;
  --paper: #ffffff;
  --panel: #ffffff;
  --field: #fafafa;
  --line: #e4e4e1;
  --line-strong: #d1d1cc;
  --muted: #6f6f6b;
  --soft-red: #fff0f2;
  --radius: 10px;
  --shadow: 0 18px 45px rgba(26, 26, 26, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--black);
  font-family: "Poppins", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

button:hover {
  border-color: var(--red);
}

button.primary {
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
  font-weight: 600;
}

button.primary:hover {
  transform: translateY(-1px);
}

button.danger {
  border-color: var(--red);
  color: var(--red);
  font-weight: 600;
}

button.danger:hover {
  background: var(--soft-red);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  min-height: 100vh;
  padding: 12px 24px 24px;
}

.topbar {
  display: grid;
  place-items: center;
  position: relative;
  max-width: 720px;
  margin: 0 auto 8px;
  padding-bottom: 4px;
  text-align: center;
}

.brand-header {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.brand-logo {
  display: block;
  width: clamp(54px, 5vw, 82px);
  height: auto;
  object-fit: contain;
}

.kicker {
  margin: 0 0 4px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.system-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(20px, 2.1vw, 24px);
  line-height: 1.15;
  font-weight: 700;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.status-strip {
  display: none;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.workflow-panel {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(240px, 1fr);
  gap: 10px;
  align-items: center;
  max-width: 560px;
  margin: 0 auto 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px 12px;
  box-shadow: 0 10px 26px rgba(26, 26, 26, 0.05);
}

.workflow-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.workflow-summary h2 {
  font-size: 15px;
}

.workflow-meter {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  padding: 8px 10px;
}

.workflow-meter.busy {
  border-color: var(--red);
  background: var(--soft-red);
}

.workflow-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--black);
  font-size: 12px;
}

.workflow-meter-head span {
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e5df;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  transition: width 220ms ease;
}

.workflow-meter.busy .progress-track span {
  background: var(--red);
}

.workflow-meter p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

#workflowSteps {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  list-style: none;
}

#workflowSteps li {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 5px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

#workflowSteps li.active {
  border-color: var(--red);
  background: var(--soft-red);
  color: var(--red);
}

#workflowSteps li.done {
  border-color: #216c3b;
  background: #e8f4ec;
  color: #216c3b;
}

.workspace {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: calc(100vh - 120px);
}

.setup-panel,
.queue-panel,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.setup-panel,
.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-panel {
  width: min(100%, 500px);
  border-color: var(--line-strong);
  padding: 20px;
  box-shadow: var(--shadow);
}

.hidden-ops {
  display: none !important;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--black);
  font-size: 13px;
  font-weight: 600;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.reference-mode-explanation {
  display: block;
  border-left: 3px solid var(--red);
  border-radius: 6px;
  background: var(--field);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--black);
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--soft-red);
  background: var(--white);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-stack {
  display: grid;
  gap: 8px;
}

.simple-flow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 6px 0 0;
}

.simple-flow button {
  min-height: 50px;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
}

.flow-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.utility-panel {
  display: grid;
  gap: 6px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 2px 0 0;
}

.utility-panel .kicker {
  color: var(--muted);
}

.utility-panel button {
  min-height: 42px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.utility-panel button.danger {
  border-color: var(--red);
  color: var(--red);
}

.utility-panel button.danger:hover {
  background: var(--soft-red);
}

.note {
  border-left: 4px solid var(--red);
  background: var(--soft-red);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--black);
  font-size: 13px;
  line-height: 1.45;
}

.production-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--black);
  border-radius: var(--radius);
  background: var(--white);
  padding: 14px;
}

.production-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.filename-box {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 10px;
}

.filename-box span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.filename-box strong,
.filename-box code,
.selected-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filename-box strong {
  font-size: 12px;
}

.filename-box code,
.selected-filename {
  color: var(--black);
  font-family: "Poppins", sans-serif;
  font-size: 12px;
}

.compact-actions button {
  padding: 9px 10px;
}

.advanced-settings {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
}

.advanced-settings summary {
  cursor: pointer;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  list-style-position: inside;
}

.prompt-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.prompt-editor summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--black);
  font-size: 13px;
  font-weight: 700;
}

.prompt-editor label {
  padding: 0 12px 12px;
}

.advanced-settings[open] {
  padding: 0 12px 12px;
}

.advanced-settings[open] summary {
  margin: 0 -12px 12px;
  border-bottom: 1px solid var(--line);
}

.advanced-settings p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.advanced-settings .grid-2 {
  margin-bottom: 10px;
}

.expert-tools {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 0;
}

.expert-tools summary {
  cursor: pointer;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  list-style-position: inside;
}

.expert-tools[open] {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.expert-tools[open] summary {
  margin: 0 -12px;
  border-bottom: 1px solid var(--line);
}

.expert-tools p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.detail-tools {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
}

.detail-tools summary {
  cursor: pointer;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  list-style-position: inside;
}

.detail-tools[open] {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.detail-tools[open] summary {
  margin: 0 -12px;
  border-bottom: 1px solid var(--line);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.shot-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 184px);
  overflow: auto;
  padding-right: 4px;
}

.shot-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 68px;
  padding: 10px;
  text-align: left;
  border-color: var(--line);
}

.shot-item.active {
  border-color: var(--red);
  background: var(--soft-red);
}

.shot-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.shot-main {
  min-width: 0;
}

.shot-main strong,
.shot-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shot-main strong {
  font-size: 13px;
}

.shot-main small {
  color: var(--muted);
  font-size: 12px;
}

.shot-status {
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.shot-status.done {
  background: #e8f4ec;
  color: #216c3b;
}

.shot-status.saved {
  background: #e8f4ec;
  color: #216c3b;
}

.shot-status.reject {
  background: #ffe8eb;
  color: var(--red);
}

.shot-status.copied {
  background: #fff6d7;
  color: #776000;
}

.shot-status.codex {
  background: #eef0ff;
  color: #334099;
}

.detail-actions,
.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.selected-filename {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.public-output {
  border: 1px solid rgba(218, 33, 53, 0.28);
  border-radius: 10px;
  background: #fff7f8;
  padding: 14px;
}

.public-output h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.public-output p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

#publicCodexText {
  min-height: 180px;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.4;
}

#promptText {
  min-height: 260px;
  font-size: 12px;
  line-height: 1.4;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .workspace {
    min-height: calc(100vh - 150px);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px 12px 12px;
  }

  .topbar,
  .status-strip,
  .workflow-panel {
    align-items: center;
    flex-direction: column;
  }

  .topbar {
    margin-bottom: 8px;
  }

  .brand-logo {
    width: 48px;
  }

  .workflow-panel {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  #workflowSteps {
    justify-content: flex-start;
  }

  h1 {
    font-size: 20px;
  }

  .workspace,
  .grid-2 {
    display: block;
  }

  .shot-list {
    max-height: 420px;
  }
}
