:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.16), transparent 34rem),
    #f3f4f6;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) 1.25rem max(1.25rem, env(safe-area-inset-left));
  color: white;
  background: #111827;
  box-shadow: 0 8px 30px rgba(17, 24, 39, 0.18);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 7vw, 3rem); letter-spacing: -0.04em; }
h2 { margin-bottom: 0.35rem; font-size: clamp(1.35rem, 5vw, 1.8rem); letter-spacing: -0.025em; }

main { width: min(100%, 56rem); margin: 0 auto; padding: 1.25rem 1rem max(5rem, env(safe-area-inset-bottom)); }
.view, .queue-section { margin-bottom: 2rem; }
.hidden { display: none !important; }
.muted { color: #6b7280; }
.eyebrow { margin-bottom: 0.3rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; color: #d97706; }
.app-header .eyebrow { color: #fbbf24; }

.status-pill {
  flex: none;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: #374151;
  font-size: 0.78rem;
  font-weight: 750;
}
.status-pill.online { color: #064e3b; background: #a7f3d0; }
.status-pill.offline { color: #7f1d1d; background: #fecaca; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.workflow-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }

.workflow-card {
  min-height: 9.5rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 1.1rem;
  color: #111827;
  text-align: left;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
  cursor: pointer;
}
.workflow-card:active { transform: scale(0.985); }
.workflow-icon { display: block; margin-bottom: 0.8rem; font-size: 1.8rem; }
.workflow-name { display: block; margin-bottom: 0.3rem; font-weight: 800; font-size: 1rem; }
.workflow-help { display: block; color: #6b7280; font-size: 0.78rem; line-height: 1.35; }

.back-button { margin: 0 0 1.25rem; padding: 0; border: 0; color: #92400e; background: transparent; font-weight: 800; cursor: pointer; }
.workflow-form { display: grid; gap: 1rem; margin-top: 1.25rem; padding: 1rem; border-radius: 1rem; background: white; box-shadow: 0 10px 24px rgba(17,24,39,0.06); }
.field { display: grid; gap: 0.4rem; }
.field label { font-size: 0.86rem; font-weight: 800; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 3rem;
  padding: 0.8rem;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  color: #111827;
  background: white;
}
.field textarea { min-height: 6rem; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid rgba(245, 158, 11, 0.25); border-color: #d97706; }

.button { min-height: 2.75rem; padding: 0.7rem 1rem; border: 0; border-radius: 0.75rem; text-decoration: none; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.button-primary { color: white; background: #b45309; }
.button-secondary { color: #374151; background: #e5e7eb; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }

.queue-list { display: grid; gap: 0.75rem; }
.queue-card { padding: 1rem; border: 1px solid #e5e7eb; border-radius: 1rem; background: white; }
.queue-card-top { display: flex; justify-content: space-between; gap: 1rem; }
.queue-title { font-weight: 850; }
.queue-meta { margin-top: 0.25rem; color: #6b7280; font-size: 0.8rem; }
.queue-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }
.queue-actions .button { min-height: 2.35rem; padding: 0.5rem 0.75rem; font-size: 0.8rem; }
.queue-status { flex: none; padding: 0.25rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; text-transform: capitalize; }
.queue-status.queued { color: #78350f; background: #fef3c7; }
.queue-status.syncing { color: #1e3a8a; background: #dbeafe; }
.queue-status.synced { color: #065f46; background: #d1fae5; }
.queue-status.failed { color: #991b1b; background: #fee2e2; }
.empty-state { padding: 1.5rem; border: 1px dashed #d1d5db; border-radius: 1rem; color: #6b7280; text-align: center; }

dialog { width: min(calc(100% - 2rem), 30rem); border: 0; border-radius: 1rem; padding: 0; box-shadow: 0 24px 80px rgba(0,0,0,0.35); }
dialog::backdrop { background: rgba(17,24,39,0.66); }
.dialog-card { padding: 1.25rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.65rem; margin-top: 1.25rem; }

@media (min-width: 44rem) {
  main { padding-top: 2rem; }
  .workflow-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
  .workflow-card { transition: transform 120ms ease, box-shadow 120ms ease; }
  .workflow-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(17,24,39,0.1); }
}
