
  :root{
    --te-green:#5B8C2A;
    --te-green-dark:#3F6B1B;
    --te-green-pale:#EEF5E4;
    --te-blue:#1F5FA8;
    --te-blue-dark:#164683;
    --te-blue-pale:#EAF2FB;
    --te-yellow:#F5B400;
    --te-yellow-dark:#C98F00;
    --te-yellow-pale:#FFF6E0;
    --te-purple:#6C3FA6;
    --te-sky:#29ABE2;
    --te-ink:#232323;
    --te-sub:#5b5b5b;
    --te-line:#E1E4E0;
    --te-bg:#F7F8F5;
    --te-card:#ffffff;
    --te-mono: 'IBM Plex Mono', monospace;
    --te-sans: 'Manrope', sans-serif;
    --te-body: 'Lato', sans-serif;
  }
  *{box-sizing:border-box;}
  body{
    margin:0; background:var(--te-bg); color:var(--te-ink);
    font-family:var(--te-sans);
  }
  .app{max-width:1180px;margin:0 auto;padding:0 24px 120px;}
  #app-wrapper{display:none;}
  #app-wrapper.visible{display:block;}
  .topbar{
    display:flex;align-items:center;gap:14px;
    padding:22px 24px 18px; background:linear-gradient(135deg,var(--te-green),var(--te-green-dark));
    border-bottom:none;position:relative;
  }
  .topbar::before{
    content:'';position:absolute;left:0;right:0;top:0;height:4px;
    background:linear-gradient(90deg,var(--te-green) 0 34%, var(--te-blue) 34% 67%, var(--te-yellow) 67% 100%);
  }
  .topbar .logo-chip{margin-right:2px;}
  .topbar img{height:40px;width:auto;display:block;}
  .topbar .title{font-weight:800;font-size:20px;color:#fff;letter-spacing:.2px;}
  .topbar .sub{font-family:var(--te-mono);font-size:11.5px;color:rgba(255,255,255,.85);margin-top:2px;}
  .btn-back{
    border:1.5px solid rgba(255,255,255,.55);background:rgba(255,255,255,.08);color:#fff;
    border-radius:8px;padding:8px 12px;font-weight:700;font-size:12.5px;font-family:var(--te-sans);
    cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:all .18s ease;margin-right:6px;
  }
  .btn-back svg{width:14px;height:14px;}
  .btn-back:hover{background:#fff;color:var(--te-green-dark);border-color:#fff;transform:translateY(-1px);}
  .tabs{
    display:flex;gap:6px;margin:22px 0 18px;border-bottom:1px solid var(--te-line);
  }
  .tab-btn{
    border:none;background:none;padding:10px 18px;font-family:var(--te-sans);
    font-weight:700;font-size:14px;color:var(--te-sub);cursor:pointer;
    border-bottom:3px solid transparent;margin-bottom:-1px;transition:color .15s;
  }
  .tab-btn.active{color:var(--te-green-dark);border-bottom-color:var(--te-green);}
  .tab-btn:hover:not(.active){color:var(--te-blue);}
  .panel{display:none;}
  .panel.active{display:block;}

  .meta-card{
    background:var(--te-card);border:1px solid var(--te-line);border-radius:10px;
    padding:20px 22px;margin-bottom:20px;
    display:grid;grid-template-columns:1fr 1fr;gap:14px 18px;
  }
  .meta-card .full{grid-column:1/-1;}
  .field label{
    display:block;font-size:12px;font-weight:700;color:var(--te-green-dark);
    margin-bottom:5px;letter-spacing:.2px;
  }
  .field .hint{font-size:11px;color:var(--te-sub);font-weight:400;margin-left:6px;}
  input[type=text],input[type=date],textarea{
    width:100%;border:1px solid var(--te-line);border-radius:7px;
    padding:9px 10px;font-family:var(--te-sans);font-size:13.5px;color:var(--te-ink);
    background:#fff;
  }
  input[type=text]:focus,textarea:focus{outline:2px solid var(--te-green);outline-offset:1px;}
  textarea{resize:vertical;min-height:220px;line-height:1.6;padding:12px 14px;}
  .file-row{display:flex;align-items:center;gap:10px;}
  .file-row img{height:34px;border:1px solid var(--te-line);border-radius:6px;padding:2px;background:#fff;}

  /* Stacked client-logo previews: each row shows the thumbnail, its filename,
     and a remove button, one after another in upload order — mirrors the order
     they'll be stacked in on the generated cover page. */
  .logo-stack-preview{display:flex;flex-direction:column;gap:8px;margin-top:10px;}
  .logo-stack-row{
    display:flex;align-items:center;gap:10px;padding:6px 8px;
    background:#fafbf8;border:1px solid var(--te-line);border-radius:8px;
  }
  .logo-stack-row img{height:38px;width:auto;max-width:110px;object-fit:contain;border:1px solid var(--te-line);border-radius:6px;padding:3px;background:#fff;}
  .logo-stack-row .logo-name{flex:1;font-size:12px;color:var(--te-sub);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .logo-stack-row .btn-remove-logo{border:none;background:#fde8e8;color:#a12;border-radius:6px;padding:6px 10px;cursor:pointer;font-weight:700;}

  .section-card{
    background:var(--te-card);border:1px solid var(--te-line);border-radius:10px;
    margin-bottom:14px;overflow:hidden;
  }
  .section-head{
    display:flex;align-items:center;justify-content:space-between;gap:10px;
    padding:13px 18px;cursor:pointer;background:#fff;
  }
  .btn-delete-section{
    border:none;background:#fde8e8;color:#a12;border-radius:6px;
    width:26px;height:26px;flex:none;font-weight:800;font-size:15px;line-height:1;
    cursor:pointer;transition:background .15s;
  }
  .btn-delete-section:hover{background:#f8c9c9;}

  /* Small "insert a section here" control living right below every card's
     body (not just the last one), so a new section can be dropped in between
     any two existing ones — deliberately subtle since it repeats after each
     of the 27+ cards and shouldn't compete visually with the cards themselves. */
  .add-after-row{text-align:center;padding:5px 0;}
  .btn-add-after{
    border:1px dashed var(--te-line);background:#fafbf8;color:var(--te-sub);
    border-radius:6px;padding:3px 10px;font-family:var(--te-sans);font-size:11px;font-weight:700;
    cursor:pointer;transition:all .15s;
  }
  .btn-add-after:hover{border-color:var(--te-green);color:var(--te-green-dark);background:var(--te-green-pale);}
  .section-head:hover{background:var(--te-green-pale);}
  .section-head .num{
    font-family:var(--te-mono);color:var(--te-green);font-weight:600;font-size:12.5px;margin-right:10px;
  }
  .section-head .name{font-weight:700;font-size:14.5px;color:var(--te-ink);}
  .section-head>div:first-child{display:flex;align-items:center;gap:6px;flex:1;min-width:0;margin-right:14px;}
  .section-head .title-input{
    font-weight:700;font-size:14.5px;color:var(--te-ink);font-family:var(--te-sans);
    border:1px solid transparent;background:transparent;border-radius:6px;
    padding:3px 6px;flex:1;min-width:0;
  }
  .section-head .title-input:hover{border-color:var(--te-line);background:#fff;}
  .section-head .title-input:focus{outline:none;border-color:var(--te-green);background:#fff;}
  .section-head .chev{transition:transform .15s;color:var(--te-sub);}
  .section-card.open .chev{transform:rotate(90deg);}
  .section-body{display:none;padding:0 18px 16px;}
  .section-card.open .section-body{display:block;}
  .section-body .fmt-hint{
    font-size:11px;color:var(--te-sub);margin:0 0 6px;font-family:var(--te-mono);
  }

  .image-attach{margin-top:16px;padding-top:14px;border-top:1px dashed var(--te-line);}
  .image-attach>label{
    display:block;font-size:12px;font-weight:700;color:var(--te-green-dark);margin-bottom:6px;
  }
  .img-attach-row{
    display:flex;flex-direction:column;gap:8px;
    margin-top:8px;padding:8px;background:#fafbf8;border:1px solid var(--te-line);border-radius:8px;
  }
  .img-attach-main{
    display:grid;grid-template-columns:56px 1fr auto auto auto auto;gap:10px;align-items:center;
  }
  .img-attach-row img{
    width:56px;height:42px;object-fit:cover;border-radius:5px;border:1px solid var(--te-line);background:#fff;
  }
  .img-attach-row .img-name{font-size:12px;color:var(--te-sub);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .img-attach-row select{
    border:1px solid var(--te-line);border-radius:6px;padding:6px 8px;font-family:var(--te-sans);font-size:12.5px;
  }
  .img-attach-row .btn-insert-img{
    border:1px solid var(--te-green);background:var(--te-green-pale);color:var(--te-green-dark);
    border-radius:6px;padding:7px 10px;cursor:pointer;font-weight:700;font-size:12px;white-space:nowrap;
  }
  .img-attach-row .btn-remove-img{
    border:none;background:#fde8e8;color:#a12;border-radius:6px;padding:7px 10px;cursor:pointer;font-weight:700;
  }
  .img-attach-row .img-caption{
    width:100%;border:1px solid var(--te-line);border-radius:6px;padding:6px 8px;
    font-family:var(--te-sans);font-size:12px;color:var(--te-sub);font-style:italic;
  }

  /* ---------- Table attachments (build a quick grid, insert at the cursor) ---------- */
  .table-attach{margin-top:16px;padding-top:14px;border-top:1px dashed var(--te-line);}
  .table-attach>label{
    display:block;font-size:12px;font-weight:700;color:var(--te-green-dark);margin-bottom:6px;
  }
  .btn-add-table{
    border:1px solid var(--te-green);background:var(--te-green-pale);color:var(--te-green-dark);
    border-radius:6px;padding:7px 12px;cursor:pointer;font-weight:700;font-size:12.5px;margin-top:4px;
  }
  .tbl-attach-row{
    margin-top:10px;padding:10px;background:#fafbf8;border:1px solid var(--te-line);border-radius:8px;
  }
  .tbl-attach-toolbar{
    display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px;
  }
  .tbl-attach-toolbar .tbl-name{font-size:12px;font-weight:700;color:var(--te-sub);margin-right:4px;}
  .tbl-attach-toolbar label.tbl-header-toggle{
    display:flex;align-items:center;gap:5px;font-size:12px;color:var(--te-sub);cursor:pointer;
  }
  .tbl-attach-toolbar select.tbl-color{
    border:1px solid var(--te-line);border-radius:6px;padding:5px 7px;
    font-family:var(--te-sans);font-size:12px;color:var(--te-ink);background:#fff;cursor:pointer;
  }
  .tbl-attach-toolbar button{
    border:1px solid var(--te-line);background:#fff;color:var(--te-ink);
    border-radius:6px;padding:6px 9px;cursor:pointer;font-weight:700;font-size:12px;
  }
  .tbl-attach-toolbar .btn-insert-tbl{border-color:var(--te-green);background:var(--te-green-pale);color:var(--te-green-dark);}
  .tbl-attach-toolbar .btn-remove-tbl{border:none;background:#fde8e8;color:#a12;}
  .tbl-grid{display:grid;gap:6px;overflow-x:auto;}
  .tbl-grid input{
    border:1px solid var(--te-line);border-radius:5px;padding:6px 7px;
    font-family:var(--te-sans);font-size:12.5px;width:100%;min-width:90px;
  }
  .tbl-grid input.tbl-header-cell{font-weight:700;background:var(--te-green-pale);color:var(--te-green-dark);}

  .sticky-bar{
    position:fixed;left:0;right:0;bottom:0;background:#fff;border-top:2px solid var(--te-green);
    padding:12px 24px;display:flex;gap:12px;align-items:center;justify-content:flex-end;
    box-shadow:0 -4px 16px rgba(0,0,0,.06);z-index:50;
  }
  .sticky-bar .status{margin-right:auto;font-size:12.5px;color:var(--te-sub);font-family:var(--te-mono);}
  .btn{
    border:none;border-radius:9px;padding:12px 22px;font-weight:800;font-size:13.5px;
    cursor:pointer;font-family:var(--te-sans);display:inline-flex;align-items:center;gap:9px;
    transition:transform .15s ease, box-shadow .15s ease, background .15s ease;
    box-shadow:0 2px 6px rgba(0,0,0,.08);
  }
  .btn svg{width:16px;height:16px;flex:none;}
  .btn:hover{transform:translateY(-2px);}
  .btn:active{transform:translateY(0);}
  .btn-green{background:linear-gradient(135deg,var(--te-green),var(--te-green-dark));color:#fff;}
  .btn-green:hover{box-shadow:0 6px 16px rgba(91,140,42,.4);}
  .btn-blue{background:linear-gradient(135deg,var(--te-blue),var(--te-blue-dark));color:#fff;}
  .btn-blue:hover{box-shadow:0 6px 16px rgba(31,95,168,.4);}
  .btn-yellow{background:linear-gradient(135deg,var(--te-yellow),var(--te-yellow-dark));color:#3a2900;}
  .btn-yellow:hover{box-shadow:0 6px 16px rgba(245,180,0,.45);}
  .btn-outline{background:#fff;color:var(--te-green-dark);border:1.5px solid var(--te-green);box-shadow:none;}
  .btn-outline:hover{background:var(--te-green-pale);transform:translateY(-1px);}
  .btn-sky{background:linear-gradient(135deg,var(--te-sky),#1789ba);color:#fff;}
  .btn-sky:hover{box-shadow:0 6px 16px rgba(41,171,226,.45);}
  .btn:disabled{opacity:.5;cursor:not-allowed;transform:none;}

  .convert-card{
    background:var(--te-card);border:1px solid var(--te-line);border-radius:10px;padding:26px;
  }
  .dropzone{
    border:2px dashed var(--te-green);border-radius:10px;padding:36px;text-align:center;
    color:var(--te-sub);background:var(--te-green-pale);cursor:pointer;
  }
  .dropzone strong{color:var(--te-green-dark);}
  .extract-box{margin-top:18px;}
  .extract-box textarea{min-height:220px;font-family:var(--te-mono);font-size:12px;}
  .note{
    background:var(--te-blue-pale);border-left:3px solid var(--te-blue);padding:10px 14px;
    border-radius:6px;font-size:12.5px;color:#274a6b;margin-top:14px;line-height:1.5;
  }
  .toast{
    position:fixed;top:18px;right:18px;background:var(--te-ink);color:#fff;padding:11px 16px;
    border-radius:8px;font-size:13px;z-index:100;box-shadow:0 6px 20px rgba(0,0,0,.2);
    opacity:0;transform:translateY(-8px);transition:all .25s;pointer-events:none;
  }
  .toast.show{opacity:1;transform:translateY(0);}
  .toast.err{background:#8a2323;}

  /* ---------- Welcome screen ---------- */
  #welcome{position:relative;}
  #welcome.hidden{display:none;}

  .logo-chip{
    background:#fff;border-radius:8px;padding:5px 7px;display:flex;align-items:center;justify-content:center;
    box-shadow:0 2px 8px rgba(0,0,0,.08);border:1px solid var(--te-line);flex:none;
  }

  /* plain band: logo/brand nav + small tagline, sits on the page background */
  #welcome .hero-top{background:var(--te-bg);padding-bottom:6px;}
  #welcome .hero-nav{
    display:flex;align-items:center;justify-content:space-between;
    padding:16px 32px 0;gap:16px;flex-wrap:wrap;
  }
  #welcome .hero-nav .brand-mark{display:flex;align-items:center;gap:10px;}
  #welcome .hero-nav img.hero-logo{height:26px;width:auto;display:block;}
  #welcome .hero-nav .brand-name{font-family:var(--te-sans);font-weight:800;font-size:16px;letter-spacing:.2px;color:var(--te-green-dark);}
  #welcome .hero-top .eyebrow{
    text-align:center;font-family:var(--te-mono);letter-spacing:1.5px;text-transform:uppercase;font-size:11.5px;
    color:var(--te-green-dark);font-weight:700;padding:14px 24px 0;
  }

  /* colored band #1: just the headline */
  #welcome .hero-headline-band{
    position:relative;overflow:hidden;text-align:center;padding:34px 24px;
    background:linear-gradient(120deg,var(--te-green-dark) 0%, var(--te-green) 40%, var(--te-blue) 80%, var(--te-blue-dark) 100%);
  }
  #welcome .hero-headline-band::before{
    content:'';position:absolute;inset:0;
    background:radial-gradient(circle at 85% 15%, rgba(245,180,0,.3), transparent 45%);
    pointer-events:none;
  }
  #welcome .hero-headline-band h1{
    position:relative;z-index:2;
    font-family:var(--te-sans);font-weight:800;font-size:clamp(26px,4vw,42px);line-height:1.15;
    margin:0 auto;color:#fff;max-width:760px;
  }
  #welcome .hero-headline-band h1 .accent{
    font-family:var(--te-body);font-style:italic;font-weight:900;
    display:inline-block;line-height:1.3;padding:0 2px;
    color:#F2C230;
  }
  #welcome .hero-headline-band h1 .accent:hover{
    background:linear-gradient(90deg, #C98F00, #F2C230, #fff, #F2C230, #C98F00);
    background-size:300% 100%;background-position:0% 50%;
    -webkit-background-clip:text;background-clip:text;color:transparent;
    filter:drop-shadow(0 0 10px rgba(242,194,48,.55));
    animation:accent-shimmer 1.8s linear infinite;
  }
  @keyframes accent-shimmer{
    0%{background-position:0% 50%;}
    100%{background-position:300% 50%;}
  }

  /* plain band: lede + CTA buttons, back on the page background */
  #welcome .hero-sub{
    text-align:center;padding:22px 24px 8px;
    display:flex;flex-direction:column;align-items:center;background:var(--te-bg);
  }
  #welcome .hero-sub p.lede{
    font-size:15px;color:var(--te-sub);max-width:560px;line-height:1.55;margin:0;
  }
  #welcome .hero-cta{
    display:flex;gap:12px;flex-wrap:wrap;justify-content:center;margin-top:18px;
  }

  /* feature cards: plain background, soft low-opacity shadow keeps them bright */
  #welcome .features-band{
    padding:28px 24px 34px;background:var(--te-bg);
  }
  #welcome .features{
    display:flex;gap:16px;flex-wrap:wrap;justify-content:center;max-width:860px;margin:0 auto;
  }
  #welcome .feature-card{
    background:#fff;border:1px solid var(--te-line);border-radius:12px;padding:16px 18px;
    width:220px;text-align:left;box-shadow:0 10px 28px rgba(31,95,168,.22);
    transform:translateY(0);transition:transform .2s ease, box-shadow .2s ease;
  }
  #welcome .feature-card:hover{transform:translateY(-3px);box-shadow:0 16px 36px rgba(31,95,168,.3);}
  #welcome .feature-card .icon{
    width:34px;height:34px;border-radius:9px;display:flex;align-items:center;justify-content:center;
    margin-bottom:10px;
  }
  #welcome .feature-card:nth-child(1) .icon{background:var(--te-green-pale);color:var(--te-green-dark);}
  #welcome .feature-card:nth-child(2) .icon{background:var(--te-blue-pale);color:var(--te-blue-dark);}
  #welcome .feature-card:nth-child(3) .icon{background:var(--te-yellow-pale);color:var(--te-yellow-dark);}
  #welcome .feature-card .icon svg{width:18px;height:18px;}
  #welcome .feature-card b{display:block;font-size:13.5px;color:var(--te-sky);margin-bottom:6px;}
  #welcome .feature-card ul{margin:0;padding-left:16px;}
  #welcome .feature-card li{font-size:12px;color:var(--te-sub);line-height:1.5;margin-bottom:2px;}
  #welcome .feature-card li::marker{color:var(--te-green);}


