/* ChromoLab studio (the signed-in tool). Operate mode: familiar controls, dense and calm. */

body.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 20px;
  background: var(--ink-900);
  color: var(--on-ink);
  border-bottom: 1px solid var(--ink-line);
}
.bar-end { display: flex; align-items: center; gap: 12px; min-width: 0; }
.balance {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  align-items: center;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-md);
  color: var(--on-ink-2);
  font-size: var(--t-sm);
  background: var(--ink-800);
}
.balance b { font-family: var(--font-mono); font-size: var(--t-lg); font-weight: 600; color: var(--on-ink); }
.who {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--on-ink-2);
  font-size: var(--t-sm);
}
.bar .btn { min-height: 44px; padding: 0 14px; font-size: var(--t-sm); }

/* ---------- Layout ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr) 340px;
  min-height: 0;
}

/* Without the settings panel (history view) */
.layout.no-panel { grid-template-columns: 284px minmax(0, 1fr); }

/* ---------- Rail ---------- */
.rail {
  background: var(--ink-800);
  color: var(--on-ink);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.rail-h {
  margin: 12px 12px 8px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-ink-3);
}
.rail-h:first-child { margin-top: 0; }
.rail-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: var(--r-md);
  color: var(--on-ink-2);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.rail-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-item .t { display: block; font-size: var(--t-md); font-weight: 600; line-height: 1.25; color: var(--on-ink); }
.rail-item .s { display: block; font-size: var(--t-xs); line-height: 1.3; color: var(--on-ink-3); }
.rail-item .c {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--on-ink-3);
  padding: 2px 7px;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
}
.rail-item:hover { background: rgba(238, 240, 255, 0.07); }
.rail-item[aria-current="true"] { background: var(--ink-700); color: #fff; }
.rail-item[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #ff5fae;
}
.rail-item[aria-current="true"] .c { color: var(--on-ink); border-color: rgba(238, 240, 255, 0.3); }
.rail-foot {
  margin-top: auto;
  padding: 16px 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: var(--t-sm);
}
.rail-foot a { text-decoration: none; color: var(--on-ink-3); display: inline-flex; align-items: center; min-height: 32px; }
.rail-foot a:hover { color: var(--on-ink); }

/* ---------- Work area ---------- */
.work { padding: 28px 32px 40px; min-width: 0; }
.work-head { margin-bottom: 20px; max-width: 70ch; }
.work-head h1 { font-size: var(--t-3xl); line-height: 1.15; font-weight: 650; letter-spacing: -0.02em; text-wrap: balance; }
.work-head p { margin-top: 6px; color: var(--text-2); max-width: 62ch; text-wrap: pretty; }

/* The proof stage: neutral checkerboard so transparency is visible and colour is judged true */
.stage {
  position: relative;
  min-height: 460px;
  height: min(60vh, 640px);
  border-radius: var(--r-lg);
  background-color: #eef0f4;
  background-image:
    conic-gradient(#dfe2ea 25%, transparent 0 50%, #dfe2ea 0 75%, transparent 0);
  background-size: 20px 20px;
  border: 1px solid var(--line-strong);
  overflow: hidden;
}
/* registration crop marks */
.stage .reg { position: absolute; width: 18px; height: 18px; pointer-events: none; z-index: 3; }
.stage .reg::before, .stage .reg::after { content: ""; position: absolute; background: var(--key); }
.stage .reg::before { width: 18px; height: 1px; top: 0; left: 0; }
.stage .reg::after { width: 1px; height: 18px; top: 0; left: 0; }
.stage .reg.tl { top: 10px; left: 10px; }
.stage .reg.tr { top: 10px; right: 10px; transform: scaleX(-1); }
.stage .reg.bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
.stage .reg.br { bottom: 10px; right: 10px; transform: scale(-1); }

.stage-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* Drop target */
.drop {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 520px);
  padding: 44px 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.drop:hover, .drop.is-over { border-color: var(--mag); background: #fff; box-shadow: 0 0 0 4px var(--mag-tint); }
.drop .ico { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: var(--mag-tint); color: var(--mag); }
.drop .ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop .d-t { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.01em; }
.drop .d-s { color: var(--text-2); font-size: var(--t-sm); max-width: 42ch; }
.drop .d-k { color: var(--text-3); font-size: var(--t-sm); }
.drop kbd {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
}

/* Auth card, inline where the drop target would be */
.auth-card {
  width: min(100%, 400px);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}
.auth-card h2 { font-size: var(--t-2xl); font-weight: 650; letter-spacing: -0.02em; }
.auth-card .lead { margin-top: 4px; color: var(--text-2); font-size: var(--t-sm); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 18px 0 4px; padding: 4px; background: var(--sunken); border-radius: var(--r-md); }
.seg button {
  min-height: 40px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  cursor: pointer;
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* Form controls */
.field { display: grid; gap: 6px; margin-top: 14px; }
.field label, .lbl { font-size: var(--t-sm); font-weight: 600; color: var(--text); }
.field .hint { font-size: var(--t-xs); color: var(--text-3); }
.input, .select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover { border-color: #9aa2bd; }
.input:focus-visible, .select:focus-visible { outline: none; border-color: var(--mag); box-shadow: 0 0 0 3px var(--mag-tint); }
.input[aria-invalid="true"] { border-color: var(--err); }
.pw { position: relative; }
.pw .input { padding-right: 48px; }
.pw button {
  position: absolute;
  right: 2px; top: 2px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: var(--text-2); cursor: pointer;
}
.pw button:hover { color: var(--text); }
.pw svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.form-err {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--err-bg);
  color: var(--err);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  font-weight: 500;
}
.auth-card .btn { width: 100%; margin-top: 18px; }
.auth-foot { margin-top: 14px; font-size: var(--t-xs); color: var(--text-3); text-align: center; }

/* Preview and compare */
#preview { position: absolute; inset: 0; }
.view-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 28px; }
.cmp { position: absolute; inset: 0; --pos: 50%; touch-action: none; }
.cmp .after { clip-path: inset(0 0 0 var(--pos)); }
.cmp .handle {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: var(--key);
  pointer-events: none;
  z-index: 2;
}
.cmp .handle::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 36px; height: 36px;
  transform: translate(-50%, -50%);
  background: var(--key) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7l-5 5 5 5M15 7l5 5-5 5'/%3E%3C/svg%3E") center/20px no-repeat;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-1);
}
.cmp input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 4;
}
.cmp:focus-within .handle::after { outline: 2px solid var(--mag); outline-offset: 3px; }
.tag {
  position: absolute;
  top: 14px;
  z-index: 3;
  padding: 4px 10px;
  background: var(--key);
  color: #fff;
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tag.l { left: 36px; }
.tag.r { right: 36px; background: var(--mag); }

/* Working overlay */
.working {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(16, 18, 51, 0.5);
}
.working .box {
  display: grid;
  gap: 14px;
  width: min(86%, 320px);
  padding: 22px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  text-align: center;
}
.working .strip { height: 10px; }
.working .w-t { font-weight: 600; }
.working .w-s { font-size: var(--t-sm); color: var(--text-2); }

/* Status line under the stage */
.statusbar { display: flex; align-items: center; gap: 14px; margin-top: 12px; min-height: 44px; }
.statusbar .strip { width: 92px; flex: none; }
.status { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--text-2); min-width: 0; }
.status svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.status.ok { color: var(--ok); font-weight: 600; }
.status.err { color: var(--err); font-weight: 600; }

/* ---------- Panel ---------- */
.panel {
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 24px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.panel h2 { font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.panel section + section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.facts { display: grid; gap: 8px; margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 16px; font-size: var(--t-sm); }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.facts dd.mono { font-family: var(--font-mono); font-weight: 500; }
.cost-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--sunken);
  border-radius: var(--r-md);
}
.cost-line .k { font-size: var(--t-sm); color: var(--text-2); }
.cost-line .v { font-family: var(--font-mono); font-size: var(--t-2xl); font-weight: 600; }
.cost-line .v small { font-size: var(--t-sm); color: var(--text-2); font-weight: 500; font-family: var(--font-ui); }
.run { width: 100%; margin-top: 14px; min-height: 52px; font-size: var(--t-lg); }
.promise { margin-top: 10px; font-size: var(--t-xs); color: var(--text-3); text-align: center; text-wrap: balance; }
.result-actions { display: grid; gap: 8px; }
.result-actions .btn { width: 100%; }
.notice { padding: 12px 14px; border-radius: var(--r-md); font-size: var(--t-sm); background: var(--warn-bg); color: var(--warn); }

/* ---------- History ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-sm); min-width: 560px; }
.tbl caption { text-align: left; padding: 14px 16px; font-weight: 600; color: var(--text-2); }
.tbl th { text-align: left; padding: 10px 16px; font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); background: var(--sunken); border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #f8f9fc; }
.tbl .num { text-align: right; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.done { background: var(--ok-bg); color: var(--ok); }
.pill.failed { background: var(--err-bg); color: var(--err); }
.pill.processing, .pill.pending { background: var(--warn-bg); color: var(--warn); }
.empty { padding: 56px 24px; text-align: center; color: var(--text-2); }
.empty h2 { font-size: var(--t-xl); color: var(--text); font-weight: 600; margin-bottom: 6px; text-transform: none; letter-spacing: 0; }
.empty p { max-width: 44ch; margin: 0 auto 18px; }
.skel { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--sunken), #f7f8fb, var(--sunken)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Packs dialog ---------- */
dialog.dlg {
  width: min(92vw, 460px);
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  color: var(--text);
}
dialog.dlg::backdrop { background: rgba(11, 12, 38, 0.6); }
.dlg-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 22px 22px 6px; }
.dlg-head h2 { font-size: var(--t-2xl); font-weight: 650; letter-spacing: -0.02em; }
.dlg-head p { margin-top: 4px; font-size: var(--t-sm); color: var(--text-2); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; background: transparent; border: 0; border-radius: var(--r-md); color: var(--text-2); cursor: pointer; flex: none; margin: -6px -8px 0 0; }
.icon-btn:hover { background: var(--sunken); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dlg-body { padding: 14px 22px 22px; display: grid; gap: 10px; }
.pack {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 16px;
  width: 100%;
  min-height: 72px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.pack:hover { border-color: var(--mag); box-shadow: 0 0 0 3px var(--mag-tint); }
.pack .p-n { font-weight: 600; }
.pack .p-c { font-size: var(--t-sm); color: var(--text-2); }
.pack .p-p { grid-row: 1 / span 2; grid-column: 2; font-family: var(--font-mono); font-size: var(--t-xl); font-weight: 600; }
.dlg-err { margin: 0 22px 16px; }
.dlg-foot { padding: 0 22px 20px; font-size: var(--t-xs); color: var(--text-3); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .layout, .layout.no-panel { grid-template-columns: 220px minmax(0, 1fr); }
  .panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
  .panel section + section { margin-top: 0; padding-top: 0; border-top: 0; }
}
@media (max-width: 820px) {
  .bar { padding: 0 14px; }
  .who { display: none; }
  .layout, .layout.no-panel { grid-template-columns: minmax(0, 1fr); }
  .rail { flex-direction: row; gap: 6px; padding: 10px 12px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; }
  .rail-h, .rail-foot, .rail-item .s, .rail-item .c { display: none; }
  .rail-item { grid-template-columns: 22px auto; flex: none; width: auto; min-height: 44px; padding: 8px 14px; scroll-snap-align: start; }
  .rail-item[aria-current="true"]::before { left: 12px; right: 12px; top: auto; bottom: 0; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .work { padding: 20px 16px 28px; }
  .work-head h1 { font-size: var(--t-2xl); }
  .stage { min-height: 340px; height: 56vh; }
  .drop { padding: 32px 18px; }
  .panel { padding: 20px 16px 28px; }
  .tag.l { left: 30px; } .tag.r { right: 30px; }
}

@media (max-width: 520px) {
  .bar .brand span { display: none; }
  .bar { gap: 8px; }
  .bar-end { gap: 8px; }
  .balance { padding: 0 10px; }
  .bar .btn { padding: 0 10px; }
}
