:root {
  color-scheme: light;
  --ink: #171a18;
  --muted: #69716b;
  --paper: #f4f2eb;
  --card: #fffef9;
  --line: #dcd8cc;
  --accent: #d4512d;
  --accent-dark: #a83519;
  --green: #27664d;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); min-height: 100vh; }
button, input, textarea, select { font: inherit; }
.hidden { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
  background: rgba(244, 242, 235, .92); backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(23, 26, 24, .08);
}
.brand { color: inherit; display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--ink); color: white; border-radius: 13px; font-weight: 800; letter-spacing: -.05em;
}
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.status-pill { color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; font-size: 12px; }
.status-pill.online { color: var(--green); border-color: #a8cbb9; background: #edf8f2; }

main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 96px; }
.hero, .queue-header, .section-heading, .item-head {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
h1 { font-size: clamp(34px, 5vw, 62px); line-height: .98; letter-spacing: -.055em; margin: 6px 0 28px; }
h2 { margin: 0; letter-spacing: -.025em; }
.eyebrow { margin: 0; text-transform: uppercase; color: var(--accent); letter-spacing: .14em; font-weight: 750; font-size: 11px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 10px 32px rgba(50, 44, 29, .045); }
.login-panel { max-width: 620px; margin: 12vh auto; text-align: center; padding: 42px; }
.login-panel h1 { font-size: 44px; }
.login-panel p:not(.eyebrow) { color: var(--muted); line-height: 1.6; margin-bottom: 24px; }

.button {
  appearance: none; border: 0; border-radius: 12px; padding: 12px 16px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.button.primary { background: var(--accent); color: white; box-shadow: 0 8px 20px rgba(212, 81, 45, .18); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { background: var(--ink); color: white; }
.button.quiet { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.button:disabled { opacity: .5; cursor: wait; }

.settings-grid, .item-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px;
}
.settings-grid label > span, .item-grid label > span { display: block; font-weight: 720; font-size: 13px; margin-bottom: 8px; }
.settings-grid select, .settings-grid input, .item-grid input, .item-grid textarea {
  width: 100%; border: 1px solid var(--line); background: white; border-radius: 11px; padding: 11px 12px; color: var(--ink);
}
.settings-grid select[multiple] { min-height: 110px; }
.wide { grid-column: 1 / -1; }
.targets { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; }
.targets legend { font-weight: 720; font-size: 13px; margin-bottom: 10px; }
.targets label { display: flex; gap: 7px; align-items: center; color: var(--muted); }
.targets input { width: auto; }
.mockup-settings { margin-top: 18px; }
.mockup-settings .settings-grid { margin-top: 18px; }
.switch-label { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.hint { color: var(--muted); margin: 0; font-size: 13px; }

.items { display: grid; gap: 18px; margin: 18px 0; }
.item-card { position: relative; }
.item-head { margin-bottom: 16px; }
.dropzone, .mockup-file-wrap {
  padding: 18px; border: 1px dashed #b8b1a2; border-radius: 13px; background: #faf8f1;
}
.item-grid small { display: block; color: var(--muted); margin-top: 8px; line-height: 1.35; }
.brief-field textarea { min-height: 128px; resize: vertical; }
.submit-bar {
  position: sticky; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  border: 1px solid rgba(23, 26, 24, .12); background: rgba(255, 254, 249, .94); backdrop-filter: blur(16px);
  padding: 14px 16px; border-radius: 16px; box-shadow: 0 18px 44px rgba(30, 25, 14, .14);
}
.submit-bar p { margin: 0; color: var(--muted); font-size: 13px; }
.template-admin { margin: 50px 0 28px; }
.template-admin summary { cursor: pointer; font-weight: 750; }
.template-admin form { margin-top: 18px; }
.queue-header { margin: 44px 0 16px; }
.queue { display: grid; gap: 14px; }
.job-card { display: grid; grid-template-columns: 1fr auto; gap: 16px; }
.job-card h3 { margin: 0 0 6px; }
.job-meta { color: var(--muted); font-size: 12px; margin: 0; }
.job-progress { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.job-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.preview-grid { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.preview-box { background: #f7f5ee; border-radius: 12px; padding: 14px; min-width: 0; }
.preview-box h4 { margin: 0 0 8px; }
.preview-box .title { font-weight: 760; line-height: 1.3; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.tag-list li { border: 1px solid var(--line); padding: 5px 8px; border-radius: 999px; font-size: 11px; background: white; }
.description-preview { max-height: 240px; overflow: auto; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.error { color: #9a2e1b; }

@media (max-width: 720px) {
  main { width: min(100% - 20px, 1120px); padding-top: 28px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .status-pill { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero { align-items: flex-start; }
  .hero .button { padding: 10px 12px; }
  .settings-grid, .item-grid, .preview-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .panel { padding: 17px; border-radius: 15px; }
  .submit-bar { align-items: stretch; flex-direction: column; }
  .submit-bar .button { width: 100%; }
  .job-card { grid-template-columns: 1fr; }
  .job-actions { flex-direction: row; flex-wrap: wrap; }
}
