:root {
  --brand: #ab3033;
  --brand-dark: #8e272a;
  --brand-soft: #fbeeee;

  --ink: #1b1d21;
  --ink-2: #4b505a;
  --muted: #8a909b;

  --line: #ececef;
  --line-soft: #f4f5f7;
  --bg: #f6f6f8;
  --panel: #ffffff;

  --ok: #157a46;
  --ok-soft: #e9f6ef;
  --bad: #c0392b;
  --bad-soft: #fdeeec;
  --warn: #9a6700;
  --warn-soft: #fff6e0;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 20, 24, 0.05);
  --shadow: 0 1px 3px rgba(17, 20, 24, 0.06), 0 10px 30px rgba(17, 20, 24, 0.05);
}

@font-face {
  font-family: "MontserratLocal";
  src: url("fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "MontserratLocal";
  src: url("fonts/Montserrat-Medium.ttf") format("truetype");
  font-weight: 500;
}
@font-face {
  font-family: "MontserratLocal";
  src: url("fonts/Montserrat-SemiBold.ttf") format("truetype");
  font-weight: 600;
}
@font-face {
  font-family: "MontserratLocal";
  src: url("fonts/Montserrat-Bold.ttf") format("truetype");
  font-weight: 700;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "MontserratLocal", "Montserrat", -apple-system, system-ui, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea, table { font-family: inherit; }

a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
a:hover { color: var(--brand-dark); }

p { margin: 0; }

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

code {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--line-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  color: var(--ink-2);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 4px;
  background: var(--brand);
}
.subtitle { display: none; }

nav { display: flex; gap: 3px; flex-wrap: wrap; }
.nav-item {
  padding: 7px 13px;
  border-radius: 8px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
a.nav-item:hover { background: var(--line-soft); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-disabled { color: #c2c6ce; cursor: not-allowed; }
.nav-disabled:hover { background: none; }

/* ---------- Page ---------- */
.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 34px 22px 80px;
  display: grid;
  gap: 22px;
}
.page-wide { max-width: 1160px; }

/* ---------- Panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
.panel-subtitle { margin-top: 4px; color: var(--muted); font-size: 14px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 18px; margin-top: 22px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

input, select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: #b7bcc5; font-weight: 400; }
input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--brand-soft);
}

.hint { margin: 2px 0 0; font-size: 13px; }

/* ---------- Buttons ---------- */
button, .link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
}
button:hover, .link-button.primary:hover { background: var(--brand-dark); color: #fff; }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: default; }

.link-button {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.link-button:hover { background: var(--line-soft); color: var(--ink); }
.link-button.primary { background: var(--brand); color: #fff; border-color: transparent; }
.link-button.danger { color: var(--bad); border-color: var(--bad-soft); }
.link-button.danger:hover { background: var(--bad-soft); color: var(--bad); }
.link-button.danger:disabled { opacity: .6; cursor: default; }

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
}

/* ---------- Tables / lists ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 14px; }
th, td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td { font-size: 14px; }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: #fcfcfd; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Badges & pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.mode {
  background: var(--line-soft);
  color: var(--muted);
  font-weight: 600;
  text-transform: lowercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill > span { width: 7px; height: 7px; border-radius: 999px; }
.status-pill.ok { background: var(--ok-soft); color: var(--ok); }
.status-pill.ok > span { background: var(--ok); }
.status-pill.bad { background: var(--bad-soft); color: var(--bad); }
.status-pill.bad > span { background: var(--bad); }
.status-pill.neutral { background: var(--line-soft); color: var(--muted); }
.status-pill.neutral > span { background: #c2c6ce; }
a.status-pill { text-decoration: none; }
a.status-pill:hover { filter: brightness(0.97); }
a.status-pill.ok { color: var(--ok); }
a.status-pill.neutral { color: var(--muted); }

/* Settings: telegram meta row */
.tg-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.tg-form { max-width: 420px; }
.tg-test { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.tg-test h3 { font-size: 14px; margin-bottom: 10px; }

/* ---------- Home workflow launcher ---------- */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
}
.choice-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-weight: 400;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.choice-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: #e0e1e5;
  color: var(--ink);
}
.choice-card .wf-icon { width: 48px; height: 48px; }
.choice-title { font-size: 19px; font-weight: 700; letter-spacing: -0.015em; }
.choice-desc { margin-top: 5px; color: var(--muted); font-size: 14px; }
.choice-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
}
.choice-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  font-weight: 600;
  font-size: 14px;
  transition: gap 0.15s;
}
.choice-card:hover .choice-go { gap: 9px; }

/* Back link on sub-pages */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.back-link:hover { color: var(--ink); }

/* ---------- Workflow section headers ---------- */
.workflow-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 6px;
}
.wf-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}
.wf-icon.tg { background: #e9f0fb; color: #2a7ad1; }
.wf-titles { flex: 1; min-width: 0; }
.wf-titles h1 { font-size: 19px; }

/* ---------- Telegram inbox (preview) ---------- */
.tg-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.flow-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fcfcfd;
}
.flow-step {
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.flow-arrow { color: var(--muted); flex: none; }

.tg-preview { margin-top: 18px; }
.tg-preview-label {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.tg-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.tg-card.is-preview { border-style: dashed; opacity: 0.85; }
.tg-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 10px;
  background: var(--line-soft);
  color: var(--muted);
}
.tg-info { flex: 1; min-width: 0; }
.tg-name { font-weight: 600; overflow-wrap: anywhere; }
.tg-price { margin-top: 2px; color: var(--muted); font-size: 13px; }

.tg-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.tg-note { font-size: 13px; }

/* ---------- Alerts ---------- */
.alert { margin-top: 18px; padding: 13px 15px; border-radius: var(--radius-sm); font-size: 14px; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert div { margin-top: 2px; }
.alert strong { display: block; margin-bottom: 6px; }

/* ---------- Summary chips ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.summary strong { display: block; font-size: 13px; }
.summary span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ---------- Preflight review ---------- */
.preflight-table th.col-price { width: 130px; }
.preflight-table th.col-mode { width: 110px; }
.preflight-table th.col-thumb { width: 220px; }

.cell-thumb { display: flex; align-items: center; gap: 12px; }
.thumb {
  width: 52px;
  height: 52px;
  flex: none;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.file-name { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.cell-input { min-height: 42px; padding: 9px 12px; font-size: 14px; }
.cell-price { max-width: 120px; }
.edit-hint { margin: 16px 2px 0; font-size: 12px; }

/* ---------- Progress modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 24, 33, 0.42);
  backdrop-filter: blur(3px);
  animation: pm-fade 0.2s ease-out;
}
.modal-overlay[hidden] { display: none; }
@keyframes pm-fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 400px;
  padding: 28px;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(20, 24, 33, 0.3);
  animation: pm-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pm-pop {
  from { transform: translateY(10px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.modal-card-header h2 { font-size: 19px; }

.pm-task { margin: 5px 0 22px; font-size: 13px; overflow-wrap: anywhere; }

.pm-bar { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.pm-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--brand);
  transition: width 0.4s ease;
}
.pm-percent { margin-top: 10px; text-align: right; font-size: 13px; font-weight: 700; color: var(--ink-2); }

/* Calm status line, e.g. "Product 9 of 12" */
.pm-message {
  margin: 20px 0 0;
  min-height: 20px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Segmented stat bar: one cohesive pill split into Total / Done / Left */
.pm-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 18px 0 0;
  background: var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
}
.pm-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 8px;
}
.pm-chip + .pm-chip { box-shadow: inset 1px 0 0 #e6e7ea; }
.pm-chip strong {
  font-size: 23px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.pm-chip span {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.pm-chip.done strong { color: var(--ok); }
.pm-chip.left strong { color: var(--brand); }

.pm-error { margin-top: 16px; }
.pm-actions { margin-top: 22px; display: flex; }
.pm-actions .link-button { width: 100%; }

/* ---------- Completion screen ---------- */
.success-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 600;
  font-size: 14px;
}
.success-banner .dot { width: 9px; height: 9px; border-radius: 999px; background: var(--ok); flex: none; }

/* ---------- Stat summary cards ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.stat {
  padding: 18px 14px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
.stat strong { display: block; font-size: 28px; line-height: 1; font-weight: 700; letter-spacing: -0.02em; }
.stat .stat-text { font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.stat span {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.stat.ok strong { color: var(--ok); }
.stat.warn strong { color: var(--warn); }
.stat.bad strong { color: var(--bad); }

/* ---------- Upload area ---------- */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  padding: 28px 18px;
  border: 1.5px dashed #dcdee3;
  border-radius: var(--radius);
  background: #fcfcfd;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone svg { color: var(--brand); }
.dropzone strong { color: var(--ink); font-size: 14px; }
.dropzone span { font-size: 12px; }
.dropzone input[type="file"] {
  margin-top: 10px;
  max-width: 100%;
  min-height: auto;
  padding: 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.dropzone input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.dropzone input[type="file"]::file-selector-button:hover { background: var(--line-soft); }

/* ---------- Collapsible Advanced ---------- */
.advanced {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fcfcfd;
}
.advanced > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  list-style: none;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary em { color: var(--muted); font-style: normal; font-weight: 500; }
.advanced[open] .chev { transform: rotate(180deg); }
.advanced[open] > summary { border-bottom: 1px solid var(--line); }
.chev { transition: transform 0.15s ease; color: var(--muted); flex: none; }
.advanced-body { padding: 18px; display: grid; gap: 18px; }
.advanced-block h3 {
  margin: 0 0 9px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.advanced-block p { margin: 0 0 8px; }
.advanced-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.code-block {
  margin: 0 0 8px;
  padding: 13px 15px;
  background: #1f2126;
  color: #f2f3f5;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tick-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.tick-list li { position: relative; padding-left: 24px; font-size: 13px; color: var(--ink-2); }
.tick-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }

/* ---------- Product review cards ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(244px, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.product-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-thumb-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: #f7f8fa;
}
.card-thumb { width: 100%; height: 134px; object-fit: contain; }
.card-status { position: absolute; top: 11px; left: 11px; box-shadow: var(--shadow-sm); }
.card-body { padding: 14px 16px; display: grid; gap: 12px; }
.card-field { gap: 6px; font-size: 12px; }
.card-name { font-weight: 600; overflow-wrap: anywhere; }
.card-price { color: var(--muted); }
.card-price em { font-style: normal; font-size: 12px; }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
}
.card-foot .file-name { font-size: 11px; }

/* ---------- Output gallery ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(204px, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.gallery-item {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.gallery-item:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.gallery-link { display: block; background: #f7f8fa; line-height: 0; }
.gallery-link img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; }
.gallery-meta { padding: 14px 16px; }
.gallery-meta strong { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.gallery-meta span { color: var(--muted); font-size: 13px; }
.gallery-item .link-button { margin: 0 16px 16px; }

/* ---------- Task history list ---------- */
.task-list { display: grid; gap: 12px; margin-top: 22px; }
.task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.task-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.task-main { min-width: 0; }
.task-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.task-meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.task-meta .sep { color: #d4d6db; }
.task-meta .meta-bad { color: var(--bad); font-weight: 600; }
.task-actions { display: flex; gap: 8px; flex: none; }

/* Missing-file placeholder in the details gallery */
.gallery-item.missing { opacity: 0.9; }
.gallery-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  background: var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.link-button.disabled {
  background: var(--line-soft);
  color: var(--muted);
  border-color: var(--line);
  cursor: not-allowed;
  pointer-events: none;
}

/* Task report block */
.report-details { margin-top: 22px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; margin: 0; }
.report-grid > div { min-width: 0; }
.report-grid .report-wide { grid-column: 1 / -1; }
.report-grid dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
}
.report-grid dd { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }

/* ---------- Product inbox ---------- */
.dev-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: #fcfcfd;
  font-size: 13px;
}
.dev-bar form { margin-left: auto; }

/* Telegram import: scope picker + optional dates, sits right after "Pulling from" */
.dev-bar .import-form { margin-left: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.import-field { display: flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; font-size: 13px; }
.import-field select, .import-field input[type="date"] { min-height: 40px; width: auto; font: inherit; font-weight: 500; font-size: 13px; }
.import-field[hidden] { display: none; }
.import-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); white-space: nowrap; }
.import-check input { width: 18px; height: 18px; min-height: auto; accent-color: var(--brand); margin: 0; }
.import-check.muted { color: var(--muted); font-weight: 500; }
.alert .bring-back { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.alert .bring-back .link-button { min-height: 32px; background: #fff; }

/* Rows that arrived with the latest import */
.new-dot {
  position: absolute; top: -7px; left: -7px; z-index: 1;
  padding: 2px 7px; border-radius: 999px;
  background: var(--ok); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.new-dot.inline { position: static; display: inline-block; vertical-align: middle; margin: 0 2px; }
.inbox-row.is-new { border-color: #bfe3cd; box-shadow: inset 3px 0 0 var(--ok); }
.dev-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: #eef0f3;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.inline-create { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-create input, .inline-create select { min-height: 40px; width: auto; }
.inline-create input { min-width: 200px; }

.inbox-list { display: grid; gap: 10px; margin-top: 18px; }
.inbox-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
.inbox-row.selectable { cursor: pointer; }
.inbox-row.selectable:hover { border-color: #dcdee3; background: #fcfcfd; }
.inbox-row > input[type="checkbox"] { width: 18px; height: 18px; min-height: auto; flex: none; accent-color: var(--brand); }
.inbox-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  flex: none;
  border-radius: 8px;
  background: var(--line-soft);
  color: var(--muted);
  overflow: hidden;
}
.inbox-thumb img { width: 100%; height: 100%; object-fit: contain; }
.inbox-info { flex: 1; min-width: 0; }
.inbox-info .tg-name { font-weight: 600; overflow-wrap: anywhere; }

.link-button.small, button.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.small { font-size: 12px; }

/* Batched status reads as a positive, confirmed state */
.badge.batched { background: var(--ok-soft); color: var(--ok); }

/* "Generated" marker on a product thumbnail */
.inbox-thumb { position: relative; }
.gen-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--ok);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 0 0 2px #fff;
}
.gen-text { color: var(--ok); font-weight: 600; }

/* Batch generation traceability */
.trace-box { margin-top: 18px; }
.trace-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fcfcfd;
  font-size: 13px;
}
.trace-label { font-weight: 700; color: var(--ink); }
.trace-line > .link-button { margin-left: auto; }
.trace-box .alert { margin-top: 10px; }

/* Fixed-column inbox grid: every row aligns regardless of text length */
.inbox-grid { gap: 8px; }
.inbox-grid .inbox-row {
  display: grid;
  grid-template-columns: 22px 52px minmax(0, 1fr) 96px 144px 210px auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}
.inbox-grid .row-check { width: 18px; height: 18px; min-height: auto; accent-color: var(--brand); margin: 0; }
.inbox-grid .js-name,
.inbox-grid .js-price,
.inbox-grid .js-status,
.inbox-grid .js-assign { min-height: 38px; width: 100%; }
.inbox-grid .js-name { text-overflow: ellipsis; }       /* long names clip, never stretch */
.inbox-grid .inbox-state { min-width: 0; }
.inbox-grid .inbox-assign { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inbox-grid .js-batch-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-grid .inbox-actions { display: flex; align-items: center; gap: 6px; justify-self: end; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-height: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-soft); }

/* Show/hide row controls by batch state (no reload) */
.inbox-row .u-batched { display: none !important; }
.inbox-row.is-batched .u-open { display: none !important; }
.inbox-row.is-batched .u-batched { display: inline-flex !important; }

/* Inline auto-save feedback: brief field highlight, no extra column */
.inbox-grid input.field-ok, .inbox-grid select.field-ok {
  border-color: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}
.inbox-grid input.field-err, .inbox-grid select.field-err {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}

/* Breathing room above the table */
.create-row { margin-top: 16px; }
.create-row input { min-width: 240px; }

/* Bulk selection bar */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfbfc;
}
.bulk-check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; font-size: 13px; }
.bulk-check input { width: 18px; height: 18px; min-height: auto; accent-color: var(--brand); }
.bulk-count { color: var(--muted); font-size: 13px; }
.bulk-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.bulk-actions select { min-height: 40px; width: auto; }

/* Product detail modal */
.detail-card { max-width: 460px; }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-height: auto;
  padding: 0;
  border-radius: 8px;
  background: var(--line-soft);
  color: var(--ink-2);
}
.modal-close:hover { background: var(--line); color: var(--ink); }
.dm-image {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 18px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: #f7f8fa;
}
.dm-image img { max-width: 100%; max-height: 240px; object-fit: contain; border-radius: 8px; }

/* Inbox grid -> stacked on narrow screens */
@media (max-width: 760px) {
  .inbox-grid .inbox-row {
    grid-template-columns: 22px 52px 1fr;
    row-gap: 8px;
  }
  .inbox-grid .js-name { grid-column: 3; }
  .inbox-grid .js-price { grid-column: 2 / 4; }
  .inbox-grid .inbox-state,
  .inbox-grid .inbox-assign { grid-column: 1 / 4; }
  .inbox-grid .inbox-view { grid-column: 1 / 4; justify-self: start; }
}

/* ---------- Empty state ---------- */
.empty {
  margin-top: 20px;
  padding: 48px 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fcfcfd;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.empty strong { font-size: 16px; color: var(--ink); font-weight: 600; }
.empty p { max-width: 380px; color: var(--muted); font-size: 14px; }
.empty .link-button { margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .topbar { padding: 14px 18px; }
  .page { padding: 24px 16px 60px; }
  .panel { padding: 20px; }
  .field-row, .summary, .upload-grid, .advanced-cols, .report-grid, .choice-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .preflight-table th.col-thumb { width: auto; }
  .task-card { flex-direction: column; align-items: stretch; }
  .task-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .task-actions .link-button { width: 100%; }
  .tg-stats { grid-template-columns: 1fr; }
  .tg-card { flex-wrap: wrap; }
  .tg-card .link-button { width: 100%; }
  .inbox-row { flex-wrap: wrap; }
  .inbox-edit { width: 100%; }
  .inline-create input { min-width: 0; flex: 1; }
}

/* ---- Chat source picker (Telegram inbox) ---- */
.source-picker { position: relative; }
.source-picker > summary { cursor: pointer; list-style: none; }
.source-picker > summary::-webkit-details-marker { display: none; }
.source-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #fff;
  border: 1px solid #e3e6ec;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(18, 22, 33, 0.12);
}
.source-panel input[type="search"] { flex: 1 1 200px; }
.chat-results {
  flex: 1 1 100%;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-results button { text-align: left; }

/* A cut-out thumbnail has no backdrop of its own, so give it a chequerboard
   to make the transparency visible at a glance. */
.inbox-row.is-cutout .inbox-thumb {
  background-color: #f4f5f7;
  background-image:
    linear-gradient(45deg, #e2e5ea 25%, transparent 25%, transparent 75%, #e2e5ea 75%),
    linear-gradient(45deg, #e2e5ea 25%, transparent 25%, transparent 75%, #e2e5ea 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}

/* ---- Product image adjust panel ----
   .modal-card caps every dialog at 400px, which stacked this panel into one
   tall column. The adjust panel needs its own max-width AND a height cap, so
   the whole thing fits on screen without scrolling the page. */
.adjust-card {
  width: 100%;
  max-width: min(900px, 96vw);
  max-height: 94vh;
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.adjust-card .modal-card-header { margin: 0; }
.adjust-card .modal-card-header h3 {
  font-size: 16px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adjust-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
  min-height: 0;
}

/* The design is authored at a fixed 1080x1080, so the preview scales the whole
   frame down rather than reflowing it - the iframe must stay 1080 wide or the
   layout inside would not match the rendered PNG. --preview-size drives both
   the box and the scale factor, so one value changes both together. */
.adjust-stage {
  /* Unitless on purpose: scale() needs a bare number, and calc(460px / 1080)
     resolves to a length, which makes the whole transform invalid. */
  --preview-size: 460;
  /* content-box so --preview-size is the CONTENT area: under border-box the 1px
     border would shrink it to 458 and clip the edge of the scaled design. */
  box-sizing: content-box;
  width: calc(var(--preview-size) * 1px);
  height: calc(var(--preview-size) * 1px);
  max-width: 100%;
  justify-self: center;
  overflow: hidden;
  border: 1px solid #e3e6ec;
  border-radius: 12px;
  background: #fff;
}
.adjust-stage iframe {
  width: 1080px;
  height: 1080px;
  border: 0;
  transform: scale(calc(var(--preview-size) / 1080));
  transform-origin: top left;
  pointer-events: none;
}

.adjust-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* One line per control: name, live value, slider. Stacking these was what made
   the panel taller than the screen. */
.adjust-row {
  display: grid;
  grid-template-columns: 58px 46px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.adjust-row .adjust-label { font-size: 12px; font-weight: 700; color: var(--ink-2, #5b6472); }
.adjust-row output {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink-2, #5b6472);
}
.adjust-row input[type="range"] { width: 100%; margin: 0; }

.adjust-flip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink-2, #5b6472);
}
/* The global "input, select" rule sets width:100% and min-height:46px, which
   stretches a checkbox into a big bordered box - same override the inbox row
   checkboxes already need. */
.adjust-flip input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: auto;
  padding: 0;
  margin: 0;
  flex: none;
  accent-color: var(--brand);
}

.adjust-photo {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line);
}
.adjust-photo .adjust-label { font-size: 12px; font-weight: 700; color: var(--ink-2, #5b6472); }
.adjust-photo p { margin: 0; line-height: 1.35; }
.adjust-photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.adjust-photo-actions [hidden] { display: none !important; }  /* .link-button's display would otherwise win */
.adjust-hint { margin: 2px 0 0; line-height: 1.35; }
.adjust-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.adjust-actions button { min-width: 84px; }

/* Shorter screens: shrink the preview instead of overflowing the viewport. */
@media (max-height: 820px) {
  .adjust-stage { --preview-size: 380; }
}
@media (max-height: 700px) {
  .adjust-stage { --preview-size: 310; }
}

/* Narrow screens: fall back to a single column, with the controls scrollable. */
@media (max-width: 760px) {
  .adjust-body { grid-template-columns: minmax(0, 1fr); }
  .adjust-stage { --preview-size: 330; }
}

/* Marks a row whose product image has been adjusted. */
.inbox-row.is-adjusted .js-adjust { font-weight: 700; }
.inbox-row.is-adjusted .js-adjust::after { content: " \2022"; }

/* ---------- Telegram inbox: Working on shelf, search and filters ---------- */
/* The inbox uses more of a wide screen so product names are not cut short. */
.page-xwide { max-width: 1380px; }

/* Filtered-out rows (the grid's display would otherwise beat [hidden]) */
.inbox-row[hidden] { display: none !important; }

.work-shelf {
  margin-top: 16px;
  padding: 14px 16px 16px;
  border: 1px solid #efc9ca;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}
.work-head { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.work-titles { flex: 1; min-width: 220px; }
.work-titles h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--ink); }
.work-titles p { margin: 3px 0 0; }
.work-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}
.work-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.work-actions button { min-height: 40px; }
.work-shelf .inbox-list { margin-top: 12px; }
.work-shelf .inbox-row { border-color: #efc9ca; }
.work-empty { display: none; margin: 6px 0 0; line-height: 1.7; }
.work-empty strong { color: var(--ink-2); }

.work-shelf.is-empty { padding: 12px 16px; border-style: dashed; border-color: #dcdee3; background: #fcfcfd; }
.work-shelf.is-empty .work-count { background: #dcdee3; color: var(--ink-2); }
.work-shelf.is-empty .work-empty { display: block; }
.work-shelf.is-empty .work-titles p,
.work-shelf.is-empty .work-actions,
.work-shelf.is-empty #working-list { display: none; }

.pin-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-2);
  vertical-align: middle;
}

/* Pin = "work on this"; pressed while it sits on the shelf */
.pin-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: #efc9ca; }
.pin-btn[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.pin-btn[aria-pressed="true"]:hover { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.icon-btn:disabled { opacity: .55; cursor: default; }

.list-tools {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.search-field { position: relative; display: flex; align-items: center; flex: 1 1 240px; max-width: 340px; }
.search-field svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search-field input { min-height: 40px; padding-left: 36px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
}
.chip span { color: var(--muted); }
.chip:hover { background: var(--line-soft); color: var(--ink); }
.chip.is-active, .chip.is-active:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.is-active span { color: rgba(255, 255, 255, .7); }
.batch-filter { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.batch-filter select { min-height: 36px; width: auto; max-width: 260px; padding: 6px 10px; font-size: 13px; }
.list-tools .showing { margin-left: auto; white-space: nowrap; }

.filter-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
}
.filter-empty[hidden] { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 40;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }

@media (max-width: 760px) {
  .search-field { max-width: none; flex-basis: 100%; }
  .list-tools .showing { margin-left: 0; }
  .work-actions { width: 100%; }
}

/* ---------- Today Online products (templates/today.html) ---------- */
.wf-icon.tod { background: var(--brand-soft); color: var(--brand); }
.tod-signin {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fcfcfd;
}
.tod-signin .tod-wide { grid-column: 1 / -1; }
.tod-batch-input { width: 180px; min-height: 40px; font-size: 13px; }
.tod-stats .stat.warn strong { color: var(--warn); }
.tod-filters { flex-direction: column; align-items: flex-start; margin-top: 0; }
a.chip { display: inline-flex; align-items: center; font-weight: 600; }

.badge.tod-sent { background: #eceef1; color: #4b505a; }
.badge.tod-archived { background: var(--line-soft); color: var(--muted); text-decoration: line-through; }
.badge.tod-skip { background: var(--line-soft); color: var(--muted); }

.tod-bulk {
  position: sticky;
  top: 66px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
}

.tod-list { display: grid; gap: 16px; margin-top: 16px; }
.tod-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.tod-card[data-status="skipped"] { opacity: .6; }
.tod-card[data-status="live"] { border-color: #bfe3cf; }
.tod-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: #fcfcfd;
}
.tod-check { width: 18px; height: 18px; min-height: auto; margin: 0; accent-color: var(--brand); }
.tod-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tod-actions [hidden] { display: none !important; }
.tod-saving { min-width: 60px; }

.tod-body { display: grid; grid-template-columns: 300px 1fr; gap: 18px; padding: 16px; }
.tod-media { display: grid; gap: 12px; align-content: start; }
.tod-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tod-photo { position: relative; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--line-soft); }
.tod-photo.is-main { grid-column: 1 / -1; }
.tod-photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; }
.tod-photo figcaption { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; gap: 4px; justify-content: space-between; }
.tod-main-tag, .tod-file-tag {
  padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--ink); color: #fff;
}
.tod-file-tag { background: var(--ok); }
.tod-mini {
  min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px;
  background: rgba(255, 255, 255, .92); color: var(--ink); border: 1px solid var(--line);
}
.tod-mini:hover { background: #fff; color: var(--ink); }
.tod-mini.danger { color: var(--bad); }
.tod-nophoto { grid-column: 1 / -1; padding: 40px 0; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.tod-caption { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); font-size: 13px; }
.tod-caption p { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.tod-caption .tod-extra { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #ecd9a8; }
.tod-caption-label { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--warn); }

.tod-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; align-content: start; }
.tod-fields .tod-wide, .tod-row4 { grid-column: 1 / -1; }
.tod-row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tod-fields input, .tod-fields select { min-height: 40px; padding: 8px 11px; }
.tod-fields textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  resize: vertical;
}
.tod-fields textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-soft); }
.tod-en { display: grid; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.tod-en summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tod-en[open] summary { margin-bottom: 4px; }
.tod-foot-fields { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: end; }
.tod-foot { padding: 0 16px 14px; }
.tod-foot .js-problems { display: flex; gap: 6px; flex-wrap: wrap; }
.tod-foot .alert { margin-top: 10px; }

@media (max-width: 900px) {
  .tod-body { grid-template-columns: 1fr; }
  .tod-signin, .tod-fields, .tod-foot-fields { grid-template-columns: 1fr; }
  .tod-row4 { grid-template-columns: 1fr 1fr; }
}
.badge.tod-filled { background: #f1ecfb; color: #6b46c1; }

/* ---- Today Online: loading, live sync and Claude-filling states ---- */
@keyframes tod-spin { to { transform: rotate(360deg); } }
@keyframes tod-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes tod-shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.tod-spin {
  display: inline-block; flex: none;
  width: 13px; height: 13px; margin-right: 7px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 999px;
  animation: tod-spin .7s linear infinite; vertical-align: -2px;
}
.tod-spin.big { width: 22px; height: 22px; border-width: 3px; margin: 0; color: #6b46c1; }
button.is-loading, .link-button.is-loading { opacity: 1 !important; cursor: progress; }

.tod-card { transition: border-color .2s, box-shadow .2s; }
.tod-card[data-status="sent"] { border-color: #d7dae0; }
.tod-card[data-status="sent"] .tod-head { background: #f1f2f4; }
.tod-card[data-status="archived"] { opacity: .7; }
.tod-card.is-busy { box-shadow: 0 0 0 3px var(--brand-soft); }
.tod-card.is-busy .tod-body { opacity: .55; pointer-events: none; }

.badge.tod-claude { display: none; gap: 0; background: #f1ecfb; color: #6b46c1; }
.badge.tod-claude .tod-spin { width: 11px; height: 11px; margin-right: 6px; }
.tod-card.is-filling .badge.tod-claude { display: inline-flex; }
.tod-card.is-filling .js-status-badge { display: none; }
.tod-card.is-filling { border-color: #d9cdf3; }
.tod-card.is-filling .tod-fields input:not([data-field="price"]):not([data-field="sku"]):not([data-field="stock_quantity"]):not([data-field="compare_at_price"]),
.tod-card.is-filling .tod-fields textarea,
.tod-card.is-filling .tod-fields select {
  background: linear-gradient(90deg, #faf8fe 0%, #efe9fb 50%, #faf8fe 100%);
  background-size: 800px 100%;
  animation: tod-shimmer 1.6s linear infinite;
}

.tod-fillbar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px; padding: 14px 16px;
  border: 1px solid #e3d8f7; border-radius: var(--radius-sm);
  background: #f8f5fe;
}
.tod-fillbar[hidden] { display: none; }
.tod-fillbar-text { flex: 1; display: grid; gap: 4px; }
.tod-fillbar-text strong { color: #4c2d91; font-size: 14px; }
.tod-progress { height: 6px; border-radius: 999px; background: rgba(107, 70, 193, .14); overflow: hidden; }
.tod-progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: #6b46c1; transition: width .4s ease; }

.tod-bulk-progress { display: flex; align-items: center; gap: 8px; min-width: 260px; color: var(--ink-2); }
.tod-bulk-progress[hidden] { display: none; }
.tod-bulk-progress .tod-progress { flex: 1; min-width: 90px; background: var(--brand-soft); }
.tod-bulk-progress .tod-progress > span { background: var(--brand); }
.tod-ok-text { color: var(--ok); font-weight: 600; }
.tod-bad-text { color: var(--bad); font-weight: 600; }

.tod-site-note { margin-bottom: 8px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; }
.tod-site-note[hidden] { display: none; }
.tod-site-note.is-sent { background: #f1f2f4; color: #4b505a; }
.tod-site-note.is-live { background: var(--ok-soft); color: var(--ok); }
.tod-site-note.is-archived { background: var(--line-soft); color: var(--muted); }
.tod-saving { color: var(--ok); font-weight: 600; }

.tod-sync { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.tod-sync.is-ok { color: var(--ok); }
.tod-sync.is-bad { color: var(--bad); }
.tod-stat-sent strong { color: #4b505a; }
.tod-stat-filled strong { color: #6b46c1; }
.tod-site-note.is-pending { background: var(--warn-soft); color: var(--warn); }

/* ---- Today Online: WhatsApp drop zone + flyer reference ---- */
.tod-drop {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 18px; padding: 18px 20px;
  border: 2px dashed #e2c6c7; border-radius: var(--radius-sm);
  background: #fdf8f8; color: var(--brand);
  transition: background .15s, border-color .15s;
}
.tod-drop.is-over { background: var(--brand-soft); border-color: var(--brand); }
.tod-drop.is-busy { opacity: .7; pointer-events: none; }
.tod-drop-text { flex: 1; min-width: 240px; display: grid; gap: 2px; color: var(--ink); }
.tod-drop-text strong { font-size: 14px; }
.tod-flyer { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; margin-top: 2px; color: var(--ink-2); font-weight: 500; font-size: 12px; }
.tod-flyer img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid #ecd9a8; }
.tod-flyer:hover { color: var(--ink); }
.tod-drop button[hidden] { display: none; }

/* ---- Today Online: HD photos found online ---- */
.tod-suggest { padding: 10px 12px; border: 1px solid #cfe3f7; border-radius: var(--radius-sm); background: #f3f8fd; display: grid; gap: 6px; }
.tod-suggest .tod-caption-label { color: #2a6fb8; margin: 0; }
.tod-suggest-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tod-sug { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.tod-sug.is-used { border-color: #bfe3cf; }
.tod-sug img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; }
.tod-sug figcaption { display: grid; gap: 4px; padding: 6px; }
.tod-sug-meta { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tod-sug-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.tod-sug-used { font-size: 11px; font-weight: 700; color: var(--ok); align-self: center; margin-right: auto; }

/* ---- Today Online: AI sharpening ---- */
.tod-enhancebar { border-color: #cfe3f7; background: #f3f8fd; }
.tod-enhancebar .tod-spin.big { color: #2a6fb8; }
.tod-enhancebar strong { color: #1f4f85; }
.tod-ai-tag { background: #2a6fb8; }
.tod-soft-tag { background: var(--warn); }

/* ---- Today Online: live website locked ---- */
.tod-lock { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: #eef2f7; color: #33475b; font-size: 13px; }
.tod-lock svg { flex: none; margin-top: 1px; }
.js-site-write:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Today Online: local catalogue panel ---- */
.tod-local-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.tod-local-head h2 { display: flex; gap: 8px; align-items: baseline; }
.tod-local-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tod-local-row { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; }
.tod-local-row summary { cursor: pointer; }
.tod-path { margin-top: 4px; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.tod-skipped { margin: 6px 0 0; padding-left: 18px; color: var(--bad); }
.tod-log { margin: 8px 0 0; max-height: 320px; overflow: auto; padding: 10px; border-radius: 8px; background: #111418; color: #d7dde5; font-size: 12px; white-space: pre-wrap; }
.tod-attrs { display: flex; gap: 6px; flex-wrap: wrap; }
.tod-attrs .chip { min-height: 26px; font-size: 12px; display: inline-flex; align-items: center; }
