/* Owner: W2-IMPORT (deals-sheet import and drop zones).
   Root classes: .import-dialog, .drop-overlay; also .csv-preview, .dropzone and the
   .drop-active outline a drop zone gets while a file is over it.
   .csv-cat / .csv-line stay in app.css: the slide editor shows them too. */

/* ---- Drop zones ---- */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r-lg); padding: 14px; text-align: center; color: var(--muted); background: var(--surface); transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease); cursor: pointer; }
.dropzone strong { color: var(--ink); }
.dropzone.compact { padding: 10px; font-size: 13px; }
.dropzone.drop-active { outline: 3px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
.page.drop-active { outline: 3px dashed var(--accent); outline-offset: -8px; }

/* While files are dragged over the window: the whole window says where they go.
   It never takes the drop itself (pointer-events: none), so per-element targets keep working. */
.drop-overlay {
  position: fixed; inset: 0; z-index: var(--z-drop); pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.drop-overlay::before { content: ''; position: absolute; inset: 0; background: var(--accent-soft); opacity: .85; }
.drop-overlay::after { content: ''; position: absolute; inset: 12px; border: 3px dashed var(--accent); border-radius: var(--r-lg); }
.drop-overlay-box {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 28px 36px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2); max-width: min(560px, 90vw);
}
.drop-overlay-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink);
}
.drop-overlay-label { font-size: 20px; line-height: 26px; font-weight: 600; color: var(--ink); }
.drop-overlay-hint { font-size: 14px; color: var(--ink-2); }

/* ---- What the sheet says, line by line ---- */
.csv-preview { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; background: var(--surface-2); font-size: 13px; }
.csv-preview .csv-cat.is-bad { color: var(--bad-ink); }
.csv-preview .csv-tag { height: 18px; padding: 0 6px; margin-left: 6px; vertical-align: 1px; }

/* ---- The import dialog ---- */
.import-dialog .modal-body { padding-top: 14px; }
.import-dialog .import-section + .import-section,
.import-dialog .import-section + .explain,
.import-dialog .import-camps + .explain { margin-top: 18px; }
.import-dialog .import-section-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; }
.import-dialog .import-section-head h3 { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink); }
.import-dialog .import-intro { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); max-width: 760px; }

/* 1. Week */
.import-week { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 12px; }
.import-week .import-week-title { margin: 0 4px 0 0; padding-bottom: 7px; font-size: 14px; line-height: 20px; color: var(--ink); min-width: 52px; }
.import-week .field { margin: 0; width: 172px; }
.import-week-source { padding-bottom: 8px; font-size: 13px; color: var(--muted); }
.import-week-error { margin-top: 6px; }
.import-mismatch:not(:empty),
.import-cadence:not(:empty) { margin-top: 10px; max-width: 760px; }

/* 2. Stores */
.import-stores th, .import-stores td { padding: 7px 12px; vertical-align: middle; }
.import-stores .tick { width: 40px; padding-right: 0; }
.import-stores td.store { white-space: nowrap; }
.import-stores td.store label { font-weight: 700; cursor: pointer; margin-right: 8px; }
.import-stores td.deals { white-space: nowrap; width: 1%; }
.import-stores .prev { width: 1%; text-align: right; }
.import-stores .what { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.import-stores .what .ico { flex: 0 0 auto; }
.import-stores .what-update { color: var(--ink); }
.import-stores .what-update .ico { color: var(--info-ink); }
.import-stores .what-same { color: var(--muted); }
.import-stores .what-new { color: var(--accent-ink); font-weight: 600; }
.import-stores .what-warn { color: var(--warn-ink); font-weight: 600; }
.import-stores .what-off { color: var(--muted); }
.import-stores .what-draft { color: var(--warn-ink); font-weight: 600; }
.import-stores tr.is-off td.store label { color: var(--ink-2); font-weight: 600; }
.import-stores tr.is-off .what,
.import-stores tr.is-off .what .ico,
.import-stores tr.is-off .what-draft,
.import-stores tr.is-off td.deals { color: var(--muted); font-weight: 400; }
.import-stores .preview-btn { gap: 2px; }
.import-stores .preview-btn .ico { transition: transform var(--dur) var(--ease); }
.import-stores .preview-btn[aria-expanded="true"] .ico { transform: rotate(90deg); }
.import-stores tr.preview-row > td { background: var(--surface-2); padding: 4px 12px 12px 52px; }
.import-stores tr.preview-row .csv-preview { max-height: 320px; background: var(--surface); }
/* Every store row is followed by its preview row, so the last store row is always the
   second-last row: while its preview is shut, the table's own border closes it. */
.import-stores tbody tr:nth-last-child(2) > td { border-bottom: none; }
.import-stores tbody tr.preview-row:last-child:not([hidden]) > td { border-top: 1px solid var(--line); }

/* 3. Brand questions */
.import-dialog .brand-qs { display: flex; flex-direction: column; gap: 6px; }
.import-dialog .brand-q {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 340px); gap: 8px 16px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.import-dialog .brand-q.is-deal { border-color: var(--warn-line); background: var(--warn-soft); }
.import-dialog .brand-q-name { min-width: 0; overflow-wrap: anywhere; }
.import-dialog .brand-q-from { color: var(--muted); font-size: 13px; }
.import-dialog .brand-q-hint { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--warn-ink); }
/* "Did the sheet mean Muha Meds?  [Use Muha Meds]" — the closest brand, shown, never picked */
.import-dialog .brand-q-suggest { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.import-dialog .brand-q-suggest .brand-q-use { height: 24px; padding: 0 8px; font-size: 12px; }
.import-dialog .brand-q-suggest.is-used { gap: 4px; font-size: 12px; font-weight: 600; color: var(--ok-ink); }
@media (max-width: 760px) { .import-dialog .brand-q { grid-template-columns: 1fr; } }

/* 4. Campaigns */
.import-camps .check-line { font-weight: 600; }
.import-camps .field-hint { display: block; margin: 2px 0 0 24px; }

/* 5. More options */
.import-dialog .import-more { margin: 18px 0 0; }
.import-dialog .import-more .explain-body { display: flex; flex-direction: column; gap: 12px; max-width: 760px; padding-left: 2px; }
.import-dialog .import-more .field { margin: 0; }
.import-dialog .import-more .field select { max-width: 360px; }
.import-dialog .import-mode { display: flex; flex-direction: column; gap: 6px; margin: 2px 0; }
.import-dialog .import-sizes { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.import-dialog .import-howread p { margin: 4px 0 0; }

/* Footer: "3 brand names to check" (jumps to them), at the left like a disabled reason */
.import-dialog .modal-foot .import-foot-note { margin-right: auto; color: var(--warn-ink); }
.import-dialog .modal-foot .import-foot-note:hover { color: var(--warn-ink); background: var(--warn-soft); }

/* One slide (the editor's "Update from sheet") */
.import-slide .modal-body > .field { max-width: 560px; }
.import-slide .import-callouts:not(:empty),
.import-slide .import-summary:not(:empty) { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.import-slide .import-brands-toggle { margin: 0 0 12px; }
.import-slide .import-brands { margin-bottom: 4px; }
.import-slide .import-preview { margin-top: 18px; }

/* Crossed out on the .xlsx sheet, so left out */
.import-struck { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.import-struck s { opacity: .75; }

/* The ⓘ beside every "Upload weekly deals" button: how to get the .xlsx */
.sheet-upload { display: inline-flex; align-items: center; gap: 4px; }
.info-pop .sheet-howto { display: grid; gap: 6px; max-width: 280px; }
.info-pop .sheet-howto ol { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.info-pop .sheet-howto p { margin: 0; opacity: .85; }

/* The Sheet check step (ui/sheetcheck.js): one card per problem on the sheet. */
.sheet-check .sc-intro { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); max-width: 760px; }
.sheet-check .sc-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; font-size: 13px; }
.sheet-check .sc-count { font-weight: 600; margin-right: auto; }
.sheet-check .sc-ai { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.sheet-check .sc-ai.busy::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: sc-spin .8s linear infinite; vertical-align: -1px; }
@keyframes sc-spin { to { transform: rotate(360deg); } }
.sheet-check .sc-list { display: flex; flex-direction: column; gap: 8px; }
.sheet-check .sc-item { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.sheet-check .sc-item.remembered { border-color: var(--info-line, var(--line-strong)); }
.sheet-check .sc-head { display: flex; align-items: baseline; gap: 8px; cursor: pointer; font-size: 13px; }
.sheet-check .sc-head input { flex: 0 0 auto; transform: translateY(2px); }
.sheet-check .sc-kind { flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--muted); }
.sheet-check .sc-title { font-weight: 600; overflow-wrap: anywhere; }
.sheet-check .sc-fix { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin-left: 24px; }
.sheet-check .sc-to { width: auto; min-width: 160px; max-width: 320px; height: 28px; padding: 2px 8px; font-size: 13px; }
.sheet-check .sc-why { font-size: 12px; color: var(--muted); margin-left: 24px; }
.sheet-check .sc-cells { margin: 2px 0 0 24px; padding-left: 16px; font-size: 12px; display: grid; gap: 2px; overflow-wrap: anywhere; }
.sheet-check .sc-before { text-decoration: line-through; opacity: .7; }
.sheet-check .sc-after { font-weight: 600; }

/* Stock at each store (an updated sheet): per store, new deals and lines hidden by hand,
   each with its choice; price and wording changes listed to read. */
.import-stock-body { display: grid; gap: 8px; }
.stock-store { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 0 12px; }
.stock-store > summary { cursor: pointer; padding: 10px 0; font-size: 14px; }
.stock-store[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.stock-head { font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 0 2px; }
.stock-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--surface-2); }
.stock-row:last-child { border-bottom: 0; }
.stock-row .badge { flex: 0 0 auto; }
.stock-row .stock-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.stock-row .seg { flex: 0 0 auto; }
.stock-row.is-info .stock-text { color: var(--ink-2); }
.stock-kept { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); padding: 8px 0 10px; }

/* =====================================================================
   The Deals sheet page (ui/sheetpage.js): the upload's steps in the page, one under the
   other, in place of three windows.  Each step is a .sheet-panel carrying the window's
   own class (.sheet-check, .import-dialog), so its contents are styled as before.
   ===================================================================== */
.sheet-page .sheet-main { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.sheet-file { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; }
.sheet-file-text { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sheet-file-text strong { font-size: 16px; overflow-wrap: anywhere; }
.sheet-xl { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center; background: var(--ok-solid); color: #fff;
  font-size: 11px; font-weight: 900; letter-spacing: .04em; border: 2px solid var(--navy, var(--ink)); }
.sheet-done { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-weight: 700; color: var(--ok-ink); }
.sheet-done:empty { display: none; }
.sheet-done li { display: inline-flex; align-items: center; gap: 4px; }
.sheet-busy { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); font-weight: 700; }
.sheet-busy[hidden] { display: none; }
.sheet-steps { display: flex; flex-direction: column; gap: 16px; }
.sheet-panel { background: var(--surface); border: 2px solid var(--navy, var(--line-strong)); border-radius: var(--r-lg); box-shadow: var(--pop, var(--shadow-1)); min-width: 0; }
.sheet-panel-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 2px solid var(--navy, var(--line)); background: var(--surface-2); border-radius: 12px 12px 0 0; }
.sheet-panel-head h2 { font: 400 22px/1.15 var(--font-head, inherit); text-transform: uppercase; letter-spacing: .02em; margin: 0; }
.sheet-panel .sheet-panel-body { overflow-x: auto; padding: 16px 20px; }
.sheet-page .sheet-main > *, .sheet-steps > * { min-width: 0; max-width: 100%; }
.sheet-panel .import-week { flex-wrap: wrap; }
/* The step's buttons stay in view at the bottom of the window while its questions scroll. */
.sheet-panel .sheet-panel-foot { position: sticky; bottom: 0; z-index: var(--z-sticky); border-top: 2px solid var(--navy, var(--line)); border-radius: 0 0 12px 12px; box-shadow: 0 -4px 0 var(--accent-soft); }
.sheet-panel[aria-busy="true"] .sheet-panel-foot .btn { opacity: .6; pointer-events: none; }
.sheet-panel[aria-busy="true"] .sheet-panel-foot .btn[aria-busy="true"] { opacity: .85; }
.sheet-panel .import-camp-pick { margin-top: 6px; border: 0; background: none; padding: 0; font: inherit; font-size: 13px; font-weight: 700; color: var(--accent-ink); cursor: pointer; text-decoration: underline; }
.sheet-panel .import-camp-pick[hidden] { display: none; }
.sheet-cols { padding: 14px 16px; }
.sheet-cols .section-title { margin-top: 0; }
.sheet-cols .table-wrap { overflow-x: auto; }
.sheet-how h3 { margin: 0 0 6px; }
.sheet-how ul { margin: 0; padding-left: 20px; color: var(--ink-2); display: grid; gap: 4px; max-width: 820px; }
@media (max-width: 700px) {
  .sheet-panel .sheet-panel-body { padding: 12px; }
  .sheet-panel-head, .sheet-panel .sheet-panel-foot { padding-inline: 12px; }
  .sheet-panel .sheet-panel-foot .btn.large { flex: 1 1 100%; }
}
