/* Internal ops console — plain utility styling */
:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --border: #d4d4d8;
  --text: #18181b;
  --muted: #71717a;
  --accent: #2d6a4f;
  --accent-hover: #1b4332;
  --danger: #9f1239;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

header {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
}

header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 72px);
}

nav {
  padding: 1rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

nav button {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  text-align: left;
}

main {
  padding: 1.25rem;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.row.spread {
  justify-content: space-between;
  align-items: flex-start;
}

.header-row {
  align-items: flex-start;
  gap: 1rem;
}

.status-cards {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.status-card {
  min-width: 6.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}

.status-card__label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.task-card__header {
  gap: 1rem;
}

.task-card__copy h3 {
  margin: 0;
}

.step-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eef2ff;
  color: #3730a3;
}

.risk-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.risk-badge--safe {
  background: #ecfdf5;
  color: var(--accent);
}

.risk-badge--write {
  background: #fff7ed;
  color: #c2410c;
}

.risk-badge--destructive {
  background: #fef2f2;
  color: var(--danger);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-panel {
  width: min(100%, 28rem);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.confirm-detail {
  font-size: 0.875rem;
  padding: 0.75rem;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.confirm-actions {
  justify-content: flex-end;
}

button.linkish {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  text-align: left;
}

button.linkish:hover {
  text-decoration: underline;
}

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

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

button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-hover);
}

button.danger {
  color: var(--danger);
  border-color: #fecdd3;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  background: #fff;
}

textarea {
  min-height: 4.5rem;
  resize: vertical;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

label span {
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.success {
  color: var(--accent);
}

.output {
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  max-height: 240px;
  overflow: auto;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #ecfdf5;
  color: var(--accent);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.ingredient-row,
.step-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
}

.cover-preview {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f4f9f4;
}

.auth-gate {
  max-width: 28rem;
  margin: 1.25rem auto;
}

#clerk-sign-in {
  margin-top: 0.75rem;
}

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

  nav {
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
  }

  nav button {
    width: auto;
    margin-bottom: 0;
    white-space: nowrap;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
