/* ── Reset & Base ──────────────────────────────────────── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --accent:        #2563eb;
    --accent-dark:   #0f1f5c;
    /* --accent-dark:   #1d4ed8; */
    --accent-pale:   #eff6ff;
    --text-dark:     #111827;
    --text-mid:      #374151;
    --text-muted:    #6b7280;
    --text-light:    #9ca3af;
    --border:        #e5e7eb;
    --bg-page:       #f3f4f6;
    --bg-card:       #ffffff;
    --shadow-card:   0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
    --shadow-heavy:  0 4px 24px rgba(0,0,0,.11);
    --radius:        10px;
    --radius-sm:     6px;
    --font:          'Inter', system-ui, -apple-system, sans-serif;
  }

  html { scroll-behavior: smooth; }
  body {
    font-family: var(--font);
    color: var(--text-dark);
    background: var(--bg-page);
    font-size: 14px;
    line-height: 1.5;
  }

  .big-font{
    font-size: 72px;
  }

  .border-radius{
    border-radius: var(--radius);
  }
  .main-heading{
    font-size: 42px;
    font-weight: 700;
    line-height: 50px;
  }
  .gradient-background {
    background: linear-gradient(to right, #0f1f5c, #1e3a8a, #2563eb);
  }
  @media screen and (max-width:572px) {
    .main-heading{
      font-size: 32px;
      line-height: 40px;
    }
  }
  .secondary-heading{
    font-size: 32px;
    font-weight: 700;
    line-height: 40px;
  }
  .font-400{
    font-weight: 400;
  }
  .font-500{
    font-weight: 500;
  }
  .font-700{
    font-weight: 700;
  }
  .card i, .card svg {
    font-size: 32px;
    margin-bottom: 20px;
  }
  .dark-heading {
    color: var(--accent-dark);
  }

  .simple-card {
    padding: 15px;
  }

    .simple-card .number {
      display: flex;
      width: 50px;
      height: 50px;
      background: var(--accent-dark);
      color: #fff;
      border-radius: 50%;
      font-size: 16px;
      font-weight: 700;
      justify-content: center;
      align-items: center;
      margin: 0px auto;
      margin-bottom: 20px;
  }
  .simple-card-ttl {
      font-size: 18px;
      font-weight: 500;
      color: var(--text-dark);
      margin-bottom: 10px;
  }
  .numbered-row{
    position: relative;
  }
  .numbered-row:after {
      content: "";
      display: block;
      width: 70%;
      height: 2px;
      background: #e2e8f0;
      position: absolute;
      top: 40px;
      z-index: -1;
      right: 15%;
  }

  @media screen and (max-width:768px) {
    .numbered-row:after {
      display: none;
    }
  }

    .custom-container{
      max-width: 1140px;
      margin: 0 auto;
    }
    .gradient-text {
      background: linear-gradient(to right, #0f1f5c, #1e3a8a, #2563eb);
      background-clip: text;
      -webkit-background-clip: text;
      color: transparent;
    }

    /* ── Hero ──────────────────────────────────────────────── */
    .hero {
      background: linear-gradient(140deg, #0f1f5c 0%, #1e3a8a 50%, #2563eb 100%);
      padding: 40px 24px 45px;
      text-align: center;
      position: relative;
      overflow: hidden;
    }
    .hero::after {
      content: '';
      position: absolute;
      bottom: -60px; left: 50%; transform: translateX(-50%);
      width: 600px; height: 120px;
      background: radial-gradient(ellipse, rgba(99,179,237,.22) 0%, transparent 70%);
      pointer-events: none;
    }
    .hero h1 {
      font-family: var(--font);
      font-size: clamp(26px, 4.5vw, 42px);
      font-weight: 700;
      color: #fff;
      margin-bottom: 14px;
      line-height: 1.2;
    }
    .hero p {
      color: rgba(255,255,255,.75);
      font-size: 15px;
      max-width: 485px;
      margin: 10px auto 12px;
      line-height: 1.7;
    }
    @media screen and (max-width:572px) {
    .hero p {
        font-size: 14px;
        max-width: 100%;
        line-height: 1.4;
      } 
      p.hero-meta{
        font-size: 10px;
      }
      .hero{
        padding: 25px 24px 18px;
      }
      .navbar-brand span{
        font-size: 0px;
      }
    }
    .hero-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: #fff;
      color: var(--accent);
      font-family: var(--font);
      font-size: 14px;
      font-weight: 600;
      padding: 12px 28px;
      border-radius: 8px;
      border: none;
      cursor: pointer;
      text-decoration: none;
      box-shadow: 0 2px 16px rgba(0,0,0,.2);
      transition: transform .15s, box-shadow .2s;
      margin-top: 8px;
    }
    .hero-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.26); }
    .hero-meta {
      margin-top: 14px;
      font-size: 12px;
      color: rgba(255,255,255,.45);
      letter-spacing: .3px;
    }

    /* ── Navbar ────────────────────────────────────────────── */
    .navbar-custom {
      position: sticky;
      top: 0;
      z-index: 200;
      height: 56px;
      background: #fff;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 24px;
      box-shadow: 0 1px 4px rgba(0,0,0,.05);
    }
    .navbar-brand {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 15px;
      font-weight: 600;
      color: var(--text-dark);
    }
    .navbar-brand svg { color: var(--accent); }
    .navbar-right { display: flex; align-items: center; gap: 8px; }

    .select-pill {
      appearance: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 6px 28px 6px 10px;
      font-family: var(--font);
      font-size: 13px;
      color: var(--text-mid);
      background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 8px center;
      cursor: pointer;
      outline: none;
    }
    .select-pill:focus { border-color: var(--accent); }

    .nbtn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 7px 13px;
      border-radius: var(--radius-sm);
      font-family: var(--font);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      border: 1px solid var(--border);
      background: #fff;
      color: var(--text-mid);
      transition: background .15s;
      white-space: nowrap;
      text-decoration: none;
    }
    .nbtn:hover { background: var(--bg-page); color: #fff; }
    .nbtn-primary { background: linear-gradient(to right, #0f1f5c, #1e3a8a, #2563eb); color: #fff; border-color: var(--accent); }
    .nbtn-primary:hover { background: linear-gradient(to right, #2563eb, #1e3a8a, #0f1f5c); border-color: var(--accent-dark); }

    /* ── App Layout ────────────────────────────────────────── */
    .app-wrap {
      display: grid;
      grid-template-columns: 315px 1fr;
      gap: 24px;
      max-width: 1140px;
      margin: 0 auto;
      padding: 28px 24px 50px;
      align-items: start;
    }

    .margin-spacing{
      margin-top: 50px;
      margin-bottom: 50px;
    }
    .spacer-10{
      height: 10px;
    }
    .spacer-20{
      height: 20px;
    }
    .spacer-30{
      height: 30px;
    }
    .spacer-40{
      height: 40px;
    }
    .spacer-50{
      height: 50px;
    }
    .spacer-60{
      height: 60px;
    }
    .spacer-70{
      height: 70px;
    }

    /* ── Form Panel ────────────────────────────────────────── */
    .form-col { display: flex; flex-direction: column; gap: 14px; }

    .card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 18px;
      box-shadow: var(--shadow-card);
    }
    .card-ttl {
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: .9px;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 14px;
    }

    /* Template picker */
    .tpl-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
    .tpl-item {
      border: 2px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 9px 7px 7px;
      cursor: pointer;
      text-align: center;
      position: relative;
      transition: border-color .18s, box-shadow .18s;
    }
    .tpl-item:hover { border-color: var(--accent); }
    .tpl-item.active {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(37,99,235,.13);
    }
    .tpl-check {
      display: none;
      position: absolute;
      top: 5px; right: 5px;
      width: 17px; height: 17px;
      background: var(--accent);
      border-radius: 50%;
      align-items: center;
      justify-content: center;
    }
    .tpl-item.active .tpl-check { display: flex; }
    .tpl-preview {
      height: 50px;
      border-radius: 4px;
      margin-bottom: 7px;
      background: #f8fafc;
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 6px 7px;
      overflow: hidden;
    }
    .tpl-bar { height: 4px; border-radius: 3px; background: #e2e8f0; }
    .tpl-bar.hi { background: var(--accent); }
    .tpl-preview-dark { background: #1e293b; }
    .tpl-preview-dark .tpl-bar { background: #334155; }
    .tpl-preview-dark .tpl-bar.hi { background: #60a5fa; }
    .tpl-preview-min { background: #fafafa; }
    .tpl-preview-min .tpl-bar { background: #e4e4e7; }
    .tpl-preview-min .tpl-bar.hi { background: #71717a; }
    .tpl-name { font-size: 12px; font-weight: 500; color: var(--text-mid); }

    /* Logo upload */
    .logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
    .logo-box {
      width: 54px; height: 54px;
      border: 1.5px dashed #d1d5db;
      border-radius: var(--radius-sm);
      background: var(--bg-page);
      display: flex; align-items: center; justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      overflow: hidden;
      transition: border-color .15s;
    }
    .logo-box:hover { border-color: var(--accent); }
    .logo-box img { width: 100%; height: 100%; object-fit: contain; }
    .logo-btn {
      padding: 7px 14px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: #fff;
      font-family: var(--font);
      font-size: 13px;
      font-weight: 500;
      color: var(--text-mid);
      cursor: pointer;
      transition: background .15s;
    }
    .logo-btn:hover { background: var(--bg-page); }

    /* Fields */
    .f { margin-bottom: 11px; }
    .f:last-child { margin-bottom: 0; }
    .f label {
      display: block;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-muted);
      margin-bottom: 4px;
    }
    .f input,
    .f textarea,
    .f select {
      width: 100%;
      padding: 8px 11px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      font-family: var(--font);
      font-size: 13px;
      color: var(--text-dark);
      background: #fff;
      outline: none;
      transition: border-color .15s, box-shadow .15s;
      appearance: none;
    }
    .f input:focus, .f textarea:focus, .f select:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(37,99,235,.09);
    }
    .f input::placeholder, .f textarea::placeholder { color: var(--text-light); }
    .f textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
    .f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
    .iicon { position: relative; }
    .iicon input { padding-right: 34px; }
    .iicon-el {
      position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
      color: #c3c8d0; pointer-events: none;
    }

    /* Items table */
    .items-hdr {
      display: grid;
      grid-template-columns: 1fr 45px 65px 63px;
      gap: 7px;
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: .5px;
      text-transform: uppercase;
      color: var(--text-muted);
      padding-bottom: 7px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 7px;
    }
    .item-row {
      display: grid;
      grid-template-columns: 1fr 45px 65px 63px;
      gap: 7px;
      align-items: center;
      margin-bottom: 7px;
    }
    .item-row input {
      padding: 7px 9px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      font-family: var(--font);
      font-size: 13px;
      color: var(--text-dark);
      width: 100%;
      outline: none;
      transition: border-color .15s, box-shadow .15s;
    }
    .item-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.09); }
    .item-amt { font-size: 13px; font-weight: 500; color: var(--text-mid); text-align: right; }
    .add-row-btn {
      width: 100%;
      margin-top: 4px;
      padding: 8px;
      border: 1.5px dashed #d1d5db;
      border-radius: var(--radius-sm);
      background: transparent;
      font-family: var(--font);
      font-size: 13px;
      font-weight: 500;
      color: var(--accent);
      cursor: pointer;
      transition: background .15s, border-color .15s;
    }
    .add-row-btn:hover { background: var(--accent-pale); border-color: var(--accent); }

    /* Discount toggle */
    .disc-toggle { display: flex; gap: 8px; margin-bottom: 11px; }
    .disc-opt {
      flex: 1;
      padding: 7px 8px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: #fff;
      font-family: var(--font);
      font-size: 12px;
      font-weight: 500;
      color: var(--text-muted);
      cursor: pointer;
      text-align: center;
      transition: all .15s;
    }
    .disc-opt.active { background: var(--accent); color: #fff; border-color: var(--accent); }

    /* ── Preview Panel ─────────────────────────────────────── */
    .preview-col { position: sticky; top: 76px; }
    .preview-outer {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 32px 36px;
      box-shadow: var(--shadow-heavy);
      min-height: 480px;
      position: relative;
    }

    /* Invoice preview elements */

    /* Loading overlay */
    .pv-loading {
      display: none;
      position: absolute; inset: 0;
      background: rgba(255,255,255,.65);
      border-radius: var(--radius);
      align-items: center; justify-content: center;
      z-index: 10;
    }
    .pv-loading.show { display: flex; }
    .spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ── Responsive ────────────────────────────────────────── */
    @media (max-width: 780px) {
      .app-wrap { grid-template-columns: 1fr; }
      .preview-col { position: static; }
      .nbtn:not(.nbtn-primary):not(#btn-export) { display: none; }
    }
    @media screen and (max-width:572px) {
      .app-wrap{
        display: block;
      }
    }

    .accordion-button {
      color: var(--text-dark);
      font-family: var(--font);
    }
    .accordion-body{
      font-family: var(--font);
      color: var(--text-muted);
      font-weight: 400;
    }
    .accordion-button:not(.collapsed) {
        color: #fff;
        background: linear-gradient(to right, #0f1f5c, #1e3a8a, #2563eb);
        box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .125);
    }