:root { --bg: #d4d4d8; --bar: #1b1b2e; --fg: #f2f1f7; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); font-family: var(--sui-font, system-ui, sans-serif); }
body { display: flex; flex-direction: column; }
.bar { display: flex; gap: 12px; align-items: center; padding: 8px 16px; background: var(--bar); color: var(--fg); flex-wrap: wrap; }
.brand { margin-right: 8px; }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tool.is-active { border-color: var(--sui-accent); box-shadow: 0 0 0 2px var(--sui-accent-soft); }
.sui-btn { padding: 6px 10px; }
#pstyle, #pdfx { width: auto; padding: 6px 8px; }
main { flex: 1; overflow: auto; position: relative; }
canvas { display: block; cursor: default; }
.sub { background: #2a2a40; padding: 4px 16px; }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { width: 22px; height: 22px; border: 1px solid rgba(255,255,255,.4); border-radius: 4px; padding: 0; cursor: pointer; position: relative; }
.chip .spot { position: absolute; right: 1px; bottom: -2px; font-size: 9px; color: #fff; text-shadow: 0 0 2px #000; }
.pages { font-size: 0.8rem; margin-left: auto; }
.gridtoggle { display: flex; gap: 4px; align-items: center; font-size: 0.85rem; }
.status { font-size: 0.8rem; padding: 4px 16px; }
#keys { position: fixed; left: -1000px; top: 0; width: 10px; height: 10px; opacity: 0; }
/* Phone width: every bar is one row that scrolls sideways inside itself (the page never does), so the
   canvas keeps most of the screen instead of sitting under ten rows of wrapped buttons; controls are
   touch-sized (44 px), and the status line is one line. */
@media (max-width: 700px) {
  .brand { display: none; }
  body > *, .bar .tools { min-width: 0; max-width: 100vw; }
  header.bar { flex-direction: column; align-items: stretch; gap: 4px; padding: 4px 0; }
  .bar { gap: 6px; padding: 4px 8px; }
  .bar .tools, nav.bar.sub { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  header.bar .tools { padding: 0 8px; }
  .bar .tools::-webkit-scrollbar, nav.bar.sub::-webkit-scrollbar { display: none; }
  .bar .tools > *, nav.bar.sub > * { flex: 0 0 auto; }
  .sui-btn, .bar .sui-input, .gridtoggle { min-height: 44px; }
  .gridtoggle input { width: 20px; height: 20px; }
  .chip { width: 32px; height: 32px; }
  .swatches { flex-wrap: nowrap; }
  .pages { white-space: nowrap; }
  .status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dlg { max-height: calc(100dvh - 32px); }
  .dlg-body .row .sui-btn { flex: 1 1 auto; }
  .dlg-body label { font-size: 0.9rem; }
  .sui-input.num { width: 80px; }
}
.dlg { border: 1px solid #888; border-radius: 10px; padding: 0; max-width: min(520px, calc(100vw - 32px)); width: 100%; }
.dlg.wide { max-width: min(760px, calc(100vw - 32px)); }
.dlg-body { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.dlg-body h3 { margin: 0; }
.dlg-body label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.dlg-body .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dlg-body .row label { flex-direction: row; align-items: center; }
#seText { width: 100%; font: 15px/1.5 Georgia, serif; resize: vertical; }
body.busy, body.busy * { cursor: progress !important; }
.fxbar { gap: 6px; }
.fxbar .sui-input { width: auto; padding: 4px 6px; }
.sui-input.num { width: 64px; }
.fields { display: flex; gap: 4px; flex-wrap: wrap; }
.fields .sui-btn { padding: 2px 8px; font-size: 0.8rem; }
.out { max-height: 160px; overflow: auto; background: #f4f4f6; padding: 8px; border-radius: 6px; font-size: 0.8rem; margin: 0; white-space: pre-wrap; }
.aclist { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow: auto; }
.aclist li { padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.aclist li.is-active { background: var(--sui-accent-soft, #dbe6ff); }
.aclist li small { color: #666; margin-left: 6px; }

/* M8: preflight status and the separations preview */
.pfdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #999; margin-right: 6px; vertical-align: middle; }
.pfdot.ok { background: #2e9d4f; } .pfdot.bad { background: #d83a3a; }
.pflist { list-style: none; padding: 0; margin: 0; max-height: 50vh; overflow: auto; }
.pflist li { padding: 6px 4px; border-bottom: 1px solid rgba(128,128,128,.25); cursor: pointer; font-size: 0.88rem; }
.pflist li small { display: block; opacity: .7; }
.pflist li.error::before { content: "\2716  "; color: #d83a3a; } .pflist li.warning::before { content: "\26A0  "; color: #d98a00; }
.pflist li.info::before { content: "\2139  "; }
.sepinks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; }
.sepinks label { flex-direction: row !important; align-items: center; gap: 6px; }
.sepinks button { font-size: 0.75rem; }
.sepcanvas { width: 100%; max-height: 60vh; object-fit: contain; background: #fff; border: 1px solid rgba(128,128,128,.4); }
