/* Packshot Flow — base: variables, reset, app shell, title, layout, left column */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --bg: #ffffff;
    --surface: #fafafa;
    --surface-2: #f4f4f5;
    --border: #ececec;
    --border-strong: #d4d4d4;
    --text-1: #0a0a0a;
    --text-2: #5a5a5a;
    --text-3: #9a9a9a;
    --accent: #0a0a0a;
    --accent-soft: rgba(10,10,10,0.06);
    --target-ring: #6366f1;
    --target-soft: rgba(99,102,241,0.10);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 30px rgba(0,0,0,0.08);
    --shadow-xl: 0 30px 60px rgba(0,0,0,0.18);
  }

  /* Generic hide helper. Deliberately NOT called `.hidden` — the splash and the
     login screen use that name for an opacity fade, which display:none breaks. */
  .is-hidden { display: none !important; }

  html, body { height: 100%; overflow: hidden; }
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13.5px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--text-1);
    -webkit-font-smoothing: antialiased;
  }
  button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
  button { cursor: pointer; }

  /* ========= APP SHELL ========= */
  .app {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
    width: 100%;
    max-width: 1640px;
    padding: 20px 26px;
    gap: 16px;
  }

  /* ========= TITLE ========= */
  .title-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
  }
  h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
  }
  .sub {
    color: var(--text-3);
    font-size: 12.5px;
    margin-top: 4px;
  }
  .header-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 12px;
    color: var(--text-2);
  }
  .header-status .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34,197,94,0.18);
  }

  /* History button — same pill shape as the status chips next to it. */
  .history-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    transition: all 0.15s;
  }
  .history-btn:hover { background: #fff; border-color: var(--border-strong); color: var(--text-1); }
  .history-count {
    min-width: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
  }

  /* ========= MAIN SPLIT ========= */
  .main {
    display: grid;
    grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
  }

  .panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex-shrink: 0;
  }

  /* ========= LEFT COL ========= */
  .left-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }
  .left-col::-webkit-scrollbar { width: 5px; }
  .left-col::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

  .section-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
  }
  .section-label .right-text {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-3);
    font-size: 11.5px;
  }
  .section-label .link {
    color: var(--text-1);
    text-decoration: none;
    font-weight: 500;
    font-size: 11.5px;
    text-transform: none;
    letter-spacing: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s;
  }
  .section-label .link:hover { background: var(--surface); }

  /* Inputs */
  .upload-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    /* A touch of air below the slots so the panel edge sits a bit under them. */
    margin-bottom: 16px;
  }
  /* Model & shoes sit two-up. */
  .upload-row.two { grid-template-columns: 1fr 1fr; }
  /* Sub-heading above each garment reference row (Top / Bottom). */
  .garment-group-label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    margin: 2px 0 7px;
  }
  .garment-group-label span {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-3);
  }
  .upload {
    position: relative;
    /* LOCKED layout — do not change. 7:9 fills edge-to-edge; the normalised
       images keep ~5% grey margin around the subject and cover only trims
       ~1.8% per side, so the model/product is never cropped. The box size is
       set purely by the column width (aspect-ratio), so it is identical for
       empty and filled slots — the row below can never shift. */
    aspect-ratio: 7 / 9;
    height: auto;
    border: 1.5px dashed var(--border-strong);
    border-radius: 11px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    overflow: hidden;
  }
  .upload:hover { border-color: var(--text-1); background: #fff; }
  .upload.dragging { border-color: var(--target-ring); background: var(--target-soft); }
  .upload input { display: none; }
  .upload-icon {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
  }
  .upload-label { font-size: 12.5px; font-weight: 600; color: var(--text-1); }
  .upload-hint { font-size: 10.5px; color: var(--text-3); }
  .upload.has-file {
    border-style: solid;
    border-color: var(--border);
    background: #fff;
    padding: 0;
  }
  /* Fill the whole slot. The library images are normalised (subject centered
     with grey margin), so cover only trims background - never the product. */
  .upload img.preview { width: 100%; height: 100%; object-fit: contain; background: #f2f2f2; }
  /* A selected image opens in the zoom lightbox on click. */
  .upload.has-file { cursor: zoom-in; }
  .upload.has-file > *:not(img):not(.remove-btn):not(.upload-tag) { display: none; }
  .upload-tag {
    position: absolute;
    top: 7px; left: 7px;
    padding: 3px 8px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(6px);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-1);
    display: none;
  }
  /* Never show a text pill over the thumbnail — just the image + remove button. */
  .upload.has-file .upload-tag { display: none; }
  .remove-btn {
    position: absolute;
    top: 6px; right: 6px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(10,10,10,0.85);
    color: #fff;
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
  }
  .remove-btn:hover { background: rgba(10,10,10,1); }
  .upload.has-file .remove-btn { display: flex; }

  /* Measurements note box — sits in the upload grid next to the size chart
     slot, so it keeps the exact same footprint as an upload box. */
  .fit-note-box {
    position: relative;
    aspect-ratio: 7 / 9;
    border: 1.5px dashed var(--border-strong);
    border-radius: 11px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    padding: 9px 10px;
    gap: 4px;
    overflow: hidden;
    transition: all 0.15s ease;
  }
  .fit-note-box:focus-within { border-style: solid; border-color: var(--text-1); background: #fff; }
  .fit-note-label {
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
  }
  .fit-note-box textarea {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--text-1);
    scrollbar-width: thin;
  }
  .fit-note-box textarea::placeholder { color: var(--text-3); }

