/* ==========================================================================
   Invoice generator — full-screen inline editor (Canva-style)
   Site palette: navy #024263, teal #198ea8, greys from Bootstrap
   ========================================================================== */

:root {
    --ig-navy: #024263;
    --ig-teal: #198ea8;
    --ig-ink: #1f2937;
    --ig-muted: #6b7280;
    --ig-line: #e2e8f0;
    --ig-bg: #f8fafc;
    --ig-canvas: #e6ebf1;
    --ig-card: #ffffff;
    --ig-shadow: 0 10px 30px rgba(2, 66, 99, 0.08);
    --ig-topbar-h: 58px;
    --ig-panel-w: 312px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body.ig-body { height: 100%; margin: 0; }
body.ig-body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px; color: var(--ig-ink); background: var(--ig-canvas);
    overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; }

.ig-app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* --- Top bar ------------------------------------------------------------ */
.ig-topbar {
    flex: 0 0 var(--ig-topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 0 16px; background: #fff; border-bottom: 1px solid var(--ig-line); z-index: 40;
}
.ig-topbar__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ig-brand { display: inline-flex; align-items: center; }
.ig-brand img { display: block; height: 32px; width: auto; }
.ig-topbar__divider { width: 1px; height: 26px; background: var(--ig-line); }
.ig-topbar__title { margin: 0; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ig-topbar__title-text { font-size: 15px; font-weight: 700; color: var(--ig-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ig-topbar__hint { font-size: 11px; color: var(--ig-muted); font-weight: 400; }
.ig-topbar__right { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }

/* --- Buttons ------------------------------------------------------------ */
.ig-btn {
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 9px;
    font-size: 13px; font-weight: 600; line-height: 1; border: 1px solid var(--ig-line); background: #fff; color: var(--ig-navy);
    cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s;
}
.ig-btn:hover { background: #f1f5f9; color: var(--ig-navy); text-decoration: none; }
.ig-btn:active { transform: translateY(1px); }
.ig-btn--primary { background: var(--ig-navy); border-color: var(--ig-navy); color: #fff; }
.ig-btn--primary:hover { background: #03365a; color: #fff; }
.ig-btn--sm { padding: 7px 11px; font-size: 12px; }
.ig-btn[disabled] { opacity: .6; cursor: progress; }
.ig-link-btn { background: none; border: 0; color: var(--ig-teal); font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 6px; }
.ig-link-btn:hover { text-decoration: underline; }
.ig-badge { display: inline-block; min-width: 18px; padding: 2px 5px; border-radius: 999px; background: var(--ig-teal); color: #fff; font-size: 11px; text-align: center; }
.ig-mobile-only { display: none; }

/* status line (floats under top bar) */
.ig-status {
    position: absolute; top: calc(var(--ig-topbar-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 50;
    padding: 8px 14px; border-radius: 999px; background: #1f2937; color: #fff; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.18);
    pointer-events: none; opacity: 0; transition: opacity .2s;
}
.ig-status:not(:empty) { opacity: 1; }
.ig-status.is-error { background: #b91c1c; }
.ig-status.is-success { background: #047857; }

/* saved dropdown */
.ig-dropdown { position: relative; }
.ig-dropdown__menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 300px; max-height: 340px; overflow: auto;
    background: #fff; border: 1px solid var(--ig-line); border-radius: 10px; box-shadow: var(--ig-shadow); padding: 6px;
}
.ig-dropdown__menu ul { list-style: none; margin: 0; padding: 0; }
.ig-dropdown__menu li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.ig-dropdown__menu li:hover { background: var(--ig-bg); }
.ig-dropdown__menu .ig-saved__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-weight: 600; }
.ig-dropdown__menu .ig-saved__meta { color: var(--ig-muted); font-size: 12px; white-space: nowrap; }
.ig-dropdown__menu li button { border: 0; background: none; color: #9ca3af; cursor: pointer; font-size: 16px; }
.ig-dropdown__menu li button:hover { color: #dc2626; }
.ig-dropdown__empty { padding: 12px; font-size: 13px; color: var(--ig-muted); text-align: center; }

/* --- Body: panel + canvas ---------------------------------------------- */
.ig-body-grid { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }

.ig-panel {
    flex: 0 0 var(--ig-panel-w); background: linear-gradient(180deg, #ffffff 0%, #f6f9fb 100%); border-right: 1px solid var(--ig-line);
    display: flex; flex-direction: column; min-height: 0; z-index: 30;
}
.ig-panel__scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 14px 24px; scrollbar-width: thin; }
.ig-panel__section {
    background: #fff; border: 1px solid var(--ig-line); border-radius: 14px; padding: 14px; margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(2, 66, 99, 0.04), 0 8px 24px -18px rgba(2, 66, 99, 0.25);
}
.ig-panel__title { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; color: var(--ig-navy); text-transform: none; }
.ig-panel__icon { width: 26px; height: 26px; border-radius: 8px; background: rgba(25, 142, 168, .12); color: var(--ig-teal); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ig-panel__icon svg { width: 14px; height: 14px; }
.ig-panel__tip { font-size: 12px; color: var(--ig-muted); margin: 2px 4px 14px; line-height: 1.5; padding-left: 22px; position: relative; }
.ig-panel__tip::before { content: "✦"; position: absolute; left: 4px; top: 0; color: var(--ig-teal); }

/* template picker */
.ig-template-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.ig-template {
    position: relative; background: var(--ig-bg); border: 2px solid transparent; border-radius: 12px; padding: 7px 6px 6px;
    cursor: pointer; text-align: center; transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
}
.ig-template:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -10px rgba(2, 66, 99, 0.45); background: #fff; }
.ig-template.is-active { border-color: var(--ig-navy); background: #fff; box-shadow: 0 6px 18px -8px rgba(2, 66, 99, 0.5); }
.ig-template.is-active::after {
    content: "✓"; position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--ig-navy); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px #fff;
}
.ig-template__name { display: block; margin-top: 6px; font-size: 11px; font-weight: 600; color: var(--ig-muted); }
.ig-template.is-active .ig-template__name { color: var(--ig-navy); }

.ig-thumb {
    --t: var(--ig-accent-preview, #024263);
    display: block; aspect-ratio: 1 / 1.3; background: #fff; border: 1px solid var(--ig-line);
    border-radius: 5px; padding: 10% 9%; position: relative; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.ig-thumb > span { display: block; border-radius: 2px; }
.ig-thumb__bar { height: 8%; background: var(--t); margin-bottom: 8%; }
.ig-thumb__title { height: 6%; width: 45%; background: var(--t); margin-bottom: 6%; opacity: .9; }
.ig-thumb__meta { height: 4%; width: 70%; background: #cbd5e1; margin-bottom: 12%; }
.ig-thumb__rows i { display: block; height: 4%; background: #e2e8f0; margin-bottom: 5%; }
.ig-thumb__rows i:first-child { background: var(--t); opacity: .35; }
.ig-thumb__total { position: absolute; right: 9%; bottom: 10%; width: 35%; height: 7%; background: var(--t); }
.ig-thumb--modern { padding-top: 0; }
.ig-thumb--modern .ig-thumb__bar { height: 22%; margin: 0 -11% 10%; border-radius: 0; }
.ig-thumb--minimal .ig-thumb__bar { height: 2%; background: #e2e8f0; }
.ig-thumb--minimal .ig-thumb__total { background: transparent; border-bottom: 2px solid var(--t); }
.ig-thumb--bold { padding-left: 22%; }
.ig-thumb--bold::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 13%; background: var(--t); }
.ig-thumb--bold .ig-thumb__bar { display: none; }
.ig-thumb--elegant .ig-thumb__bar { height: 1.5%; background: var(--t); margin-top: 6%; }
.ig-thumb--elegant .ig-thumb__title, .ig-thumb--elegant .ig-thumb__meta { margin-left: auto; margin-right: auto; }

.ig-accent { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px; background: var(--ig-bg); border-radius: 10px; }
.ig-accent__label { flex: 0 0 100%; font-size: 11px; font-weight: 600; color: var(--ig-muted); margin-bottom: -2px; }
.ig-swatch {
    width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: var(--swatch);
    box-shadow: 0 0 0 1px var(--ig-line), 0 2px 4px rgba(0,0,0,.12); cursor: pointer; padding: 0; position: relative;
    display: inline-flex; align-items: center; justify-content: center; transition: transform .12s;
}
.ig-swatch:hover { transform: scale(1.12); }
.ig-swatch.is-active { box-shadow: 0 0 0 2px var(--ig-navy), 0 2px 4px rgba(0,0,0,.12); }
.ig-swatch.is-active::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.ig-swatch--custom { background: conic-gradient(#f87171, #fbbf24, #34d399, #60a5fa, #a78bfa, #f87171); color: #fff; font-size: 14px; font-weight: 700; }
.ig-swatch--custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* logo */
.ig-logo { display: flex; align-items: center; gap: 12px; }
.ig-logo__preview {
    width: 76px; height: 76px; border-radius: 12px; border: 1.5px dashed #cbd5e1; flex: 0 0 auto;
    background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 12px 12px;
    display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--ig-muted); font-size: 11px;
}
.ig-logo__preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ig-logo__actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }

/* settings fields */
.ig-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ig-field { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 12px; }
.ig-field > span { font-weight: 600; color: var(--ig-muted); font-size: 11px; }
.ig-field input, .ig-field select {
    width: 100%; border: 1px solid var(--ig-line); border-radius: 8px; padding: 8px 9px; font-size: 13px; color: var(--ig-ink); background: var(--ig-bg);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.ig-field select { appearance: none; -webkit-appearance: none; padding-right: 26px;
    background-image: 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.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 9px center; }
.ig-field input:hover, .ig-field select:hover { border-color: #cbd5e1; background-color: #fff; }
.ig-field input:focus, .ig-field select:focus { outline: none; border-color: var(--ig-teal); background-color: #fff; box-shadow: 0 0 0 3px rgba(25, 142, 168, 0.15); }
.ig-input-group { display: flex; }
.ig-input-group input { border-radius: 8px 0 0 8px; min-width: 0; }
.ig-input-group select { width: 62px; border-radius: 0 8px 8px 0; border-left: 0; }

/* toggle switches */
.ig-toggles { margin-top: 12px; border-top: 1px solid var(--ig-line); padding-top: 6px; }
.ig-check { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; margin: 0; cursor: pointer; padding: 7px 2px; color: var(--ig-ink); }
.ig-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.ig-switch { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #cbd5e1; transition: background .15s; flex: 0 0 auto; }
.ig-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.ig-check input:checked + .ig-switch { background: var(--ig-teal); }
.ig-check input:checked + .ig-switch::after { transform: translateX(14px); }
.ig-check input:focus-visible + .ig-switch { box-shadow: 0 0 0 3px rgba(25, 142, 168, 0.25); }

/* CTA */
.ig-cta {
    display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; margin-bottom: 12px;
    background: linear-gradient(135deg, #024263 0%, #0b6a86 60%, #198ea8 100%); color: #fff; text-decoration: none;
    box-shadow: 0 10px 24px -12px rgba(2, 66, 99, 0.7); transition: transform .15s, box-shadow .15s;
}
.ig-cta:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -12px rgba(2, 66, 99, 0.8); color: #fff; text-decoration: none; }
.ig-cta__icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.16); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.ig-cta__text { display: flex; flex-direction: column; gap: 3px; font-size: 12px; line-height: 1.4; color: rgba(255,255,255,.85); }
.ig-cta__text strong { color: #fff; font-size: 13.5px; }
.ig-ad-slot { margin-top: 4px; }

/* --- Canvas -------------------------------------------------------------- */
.ig-canvas { flex: 1 1 auto; min-width: 0; position: relative; overflow: auto; background: var(--ig-canvas); }
.ig-zoom {
    position: absolute; right: 16px; bottom: 16px; z-index: 20; display: inline-flex; align-items: center;
    background: #fff; border: 1px solid var(--ig-line); border-radius: 999px; box-shadow: var(--ig-shadow); padding: 3px;
}
.ig-zoom__btn { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; color: var(--ig-navy); }
.ig-zoom__btn:hover { background: var(--ig-bg); }
.ig-zoom__value { border: 0; background: transparent; font-size: 12px; font-weight: 600; min-width: 52px; cursor: pointer; color: var(--ig-ink); }
.ig-stage { padding: 28px; min-height: 100%; }
.ig-page-wrap { width: 794px; transform-origin: top left; }
.ig-doc {
    width: 794px; min-height: 1123px; background: #fff; color: #1f2937;
    box-shadow: 0 10px 40px rgba(2, 66, 99, 0.18);
    padding: 48px 52px; font-size: 13px; line-height: 1.45;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
    display: flex; flex-direction: column; position: relative;
}

/* ==========================================================================
   INLINE EDITING
   ========================================================================== */
.ig-edit {
    display: inline-block; min-width: 1.5em; outline: none; border-radius: 3px; cursor: text;
    box-shadow: 0 0 0 1px transparent; transition: box-shadow .12s, background .12s; white-space: pre-wrap; word-break: break-word;
}
.ig-edit--multi { display: block; }
.ig-edit--upper { text-transform: uppercase; }
.ig-edit--num { min-width: 2.5em; text-align: right; }
.ig-edit--unit { min-width: 2em; }
.ig-doc:not(.is-exporting) .ig-edit:hover { box-shadow: 0 0 0 1px rgba(25, 142, 168, .45); background: rgba(25, 142, 168, .05); }
.ig-doc:not(.is-exporting) .ig-edit:focus { box-shadow: 0 0 0 2px var(--ig-teal); background: rgba(25, 142, 168, .06); }
.ig-doc:not(.is-exporting) .ig-edit:empty::before { content: attr(data-placeholder); color: #a1a1aa; font-weight: 400; pointer-events: none; }
.ig-doc:not(.is-exporting) .ig-edit--upper:empty::before { text-transform: none; }

.ig-doc__logo-btn { display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; padding: 0; cursor: pointer; }
.ig-doc__logo-hint { display: none; width: 88px; height: 64px; border: 1px dashed #cbd5e1; border-radius: 8px; color: #9ca3af; font-size: 12px; align-items: center; justify-content: center; }
.ig-doc:not(.is-exporting) .ig-doc__logo-btn.is-empty .ig-doc__logo-hint { display: inline-flex; }
.ig-doc:not(.is-exporting) .ig-doc__logo-btn.is-empty:hover .ig-doc__logo-hint { border-color: var(--ig-teal); color: var(--ig-teal); }
.ig-doc.is-exporting .ig-doc__logo-btn.is-empty { display: none; }

.ig-date { border: 0; background: transparent; padding: 0; font: inherit; color: inherit; cursor: pointer; position: relative; border-radius: 3px; }
.ig-date input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; pointer-events: none; }
.ig-doc:not(.is-exporting) .ig-date:hover { box-shadow: 0 0 0 1px rgba(25, 142, 168, .45); }
.ig-doc:not(.is-exporting) .ig-date__text--empty { color: #a1a1aa; font-weight: 400; }

.ig-doc__dot { margin: 0 6px; color: #9ca3af; }
.ig-doc__prefix { color: #6b7280; }

/* optional lines: visible (greyed) while editing, hidden in export when empty */
.ig-doc.is-exporting .ig-ui-only { display: none !important; }
.ig-export-only { display: none; }
.ig-doc.is-exporting .ig-export-only { display: inline; }
.ig-doc.is-exporting .ig-optional.is-empty { display: none !important; }
.ig-doc.is-exporting .ig-edit:empty { display: none; }
.ig-doc.is-exporting .ig-doc__contact.is-empty { display: none; }
.ig-doc.is-exporting .ig-doc__dot.is-hidden { display: none; }
.ig-doc.is-exporting .ig-doc__bank.is-empty, .ig-doc.is-exporting .ig-doc__notes.is-empty { display: none !important; }
.ig-doc.is-exporting .ig-doc__prefix.is-hidden { display: none; }
.ig-doc.is-exporting .ig-date__text--empty { display: none; }

/* add-item row + row remove */
.ig-doc__add-row { padding: 6px 0 0; }
.ig-doc__add-btn { border: 1px dashed #cbd5e1; background: transparent; color: var(--ig-teal); font-weight: 600; font-size: 12px; padding: 6px 12px; border-radius: 6px; cursor: pointer; width: 100%; }
.ig-doc__add-btn:hover { border-color: var(--ig-teal); background: rgba(25, 142, 168, .05); }
.ig-row-remove {
    position: absolute; left: -26px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid var(--ig-line); background: #fff; color: #9ca3af; font-size: 14px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s;
}
.ig-item-row:hover .ig-row-remove { opacity: 1; }
.ig-row-remove:hover { color: #dc2626; border-color: #dc2626; }
.ig-item-row td.ig-c-idx { position: relative; }
.ig-gst-select { border: 0; background: transparent; font: inherit; font-size: 10.5px; color: #6b7280; padding: 0; cursor: pointer; text-align: right; }
.ig-gst-select:focus { outline: 1px solid var(--ig-teal); border-radius: 3px; }

/* ==========================================================================
   INVOICE DOCUMENT — shared layout
   ========================================================================== */
.ig-doc__header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.ig-doc__brand { display: flex; gap: 16px; align-items: flex-start; min-width: 0; flex: 1 1 auto; }
.ig-doc__business { min-width: 0; flex: 1 1 auto; max-width: 340px; }
.ig-doc__logo { max-width: 140px; max-height: 72px; object-fit: contain; display: block; }
.ig-doc__business-name { font-size: 20px; font-weight: 700; color: var(--ig-accent); line-height: 1.2; margin-bottom: 4px; }
.ig-doc__muted { color: #4b5563; font-size: 12px; }
.ig-doc__title-block { text-align: right; flex: 0 0 auto; max-width: 300px; }
.ig-doc__title { font-size: 26px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ig-accent); line-height: 1.1; margin-bottom: 8px; min-width: 120px; }
.ig-doc__meta { margin-left: auto; font-size: 12px; border-collapse: collapse; }
.ig-doc__meta th { text-align: left; color: #6b7280; font-weight: 600; padding: 2px 10px 2px 0; white-space: nowrap; }
.ig-doc__meta td { text-align: right; font-weight: 600; padding: 2px 0; }

.ig-doc__parties { display: flex; gap: 32px; margin-top: 28px; }
.ig-doc__party { flex: 1 1 0; min-width: 0; }
.ig-doc__label { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6b7280; margin-bottom: 4px; }
.ig-doc__party-name { font-weight: 700; font-size: 14px; margin-bottom: 2px; }

.ig-doc__items { width: 100%; border-collapse: collapse; margin-top: 24px; font-size: 12.5px; }
.ig-doc__items th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 9px 8px; background: var(--ig-accent); color: #fff; font-weight: 700; }
.ig-doc__items td { padding: 9px 8px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.ig-doc__items .ig-c-idx { width: 28px; }
.ig-doc__items .ig-c-hsn { width: 80px; }
.ig-doc__items .ig-c-qty { width: 84px; text-align: right; }
.ig-doc__items .ig-c-rate { width: 90px; text-align: right; }
.ig-doc__items .ig-c-tax { width: 96px; text-align: right; }
.ig-doc__items .ig-c-amt { width: 100px; text-align: right; }
.ig-doc__items td.ig-c-qty, .ig-doc__items td.ig-c-rate, .ig-doc__items td.ig-c-tax, .ig-doc__items td.ig-c-amt { text-align: right; white-space: nowrap; }
.ig-doc__items .ig-item-tax { display: block; font-size: 10.5px; color: #6b7280; }
.ig-doc.ig-no-tax .ig-tax-col { display: none; }

.ig-doc__summary { display: flex; justify-content: space-between; gap: 24px; margin-top: 18px; align-items: flex-start; }
.ig-doc__words { flex: 1 1 0; font-size: 12px; padding-top: 6px; }
.ig-doc__totals { flex: 0 0 300px; border-collapse: collapse; font-size: 12.5px; }
.ig-doc__totals th { text-align: left; font-weight: 500; color: #4b5563; padding: 5px 8px; }
.ig-doc__totals td { text-align: right; padding: 5px 8px; font-weight: 600; white-space: nowrap; }
.ig-doc__grand th, .ig-doc__grand td { font-size: 15px; font-weight: 800; color: var(--ig-accent); border-top: 2px solid var(--ig-accent); padding-top: 8px; }

.ig-doc__footer { margin-top: auto; padding-top: 28px; display: flex; gap: 24px; align-items: flex-end; font-size: 12px; }
.ig-doc__bank, .ig-doc__notes { flex: 1 1 0; min-width: 0; color: #4b5563; }
.ig-doc__bank div:not(.ig-doc__label) { line-height: 1.55; }
.ig-doc__sign { flex: 0 0 180px; text-align: center; font-size: 12px; color: #4b5563; }
.ig-doc__sign-for { font-weight: 700; color: #1f2937; }
.ig-doc__sign-line { height: 44px; border-bottom: 1px solid #9ca3af; margin: 6px 0; }
[data-show-out]:not(.is-visible) { display: none !important; }

/* ==========================================================================
   DESIGN VARIANTS
   ========================================================================== */
.ig-doc[data-template="classic"] { border-top: 8px solid var(--ig-accent); }

.ig-doc[data-template="modern"] { padding-top: 0; }
.ig-doc[data-template="modern"] .ig-doc__header { background: var(--ig-accent); color: #fff; margin: 0 -52px; padding: 40px 52px 32px; }
.ig-doc[data-template="modern"] .ig-doc__business-name, .ig-doc[data-template="modern"] .ig-doc__title { color: #fff; }
.ig-doc[data-template="modern"] .ig-doc__header .ig-doc__muted, .ig-doc[data-template="modern"] .ig-doc__meta th,
.ig-doc[data-template="modern"] .ig-doc__header .ig-doc__prefix, .ig-doc[data-template="modern"] .ig-doc__header .ig-doc__dot { color: rgba(255, 255, 255, 0.82); }
.ig-doc[data-template="modern"]:not(.is-exporting) .ig-doc__header .ig-edit:empty::before,
.ig-doc[data-template="modern"]:not(.is-exporting) .ig-doc__header .ig-date__text--empty { color: rgba(255, 255, 255, 0.55); }
.ig-doc[data-template="modern"]:not(.is-exporting) .ig-doc__header .ig-edit:hover { background: rgba(255,255,255,.12); box-shadow: 0 0 0 1px rgba(255,255,255,.5); }
.ig-doc[data-template="modern"]:not(.is-exporting) .ig-doc__header .ig-edit:focus { background: rgba(255,255,255,.16); box-shadow: 0 0 0 2px #fff; }
.ig-doc[data-template="modern"] .ig-doc__logo { background: #fff; padding: 6px; border-radius: 8px; }
.ig-doc[data-template="modern"] .ig-doc__logo-hint { border-color: rgba(255,255,255,.6); color: rgba(255,255,255,.8); }
.ig-doc[data-template="modern"] .ig-doc__items th { background: #f1f5f9; color: var(--ig-accent); border-bottom: 2px solid var(--ig-accent); }
.ig-doc[data-template="modern"] .ig-doc__items tbody tr:nth-child(even) td { background: #f8fafc; }
.ig-doc[data-template="modern"] .ig-doc__grand th, .ig-doc[data-template="modern"] .ig-doc__grand td { background: var(--ig-accent); color: #fff; border-top: 0; padding: 9px 8px; }

.ig-doc[data-template="minimal"] { padding: 56px 60px; }
.ig-doc[data-template="minimal"] .ig-doc__title { font-weight: 300; letter-spacing: .18em; color: #1f2937; }
.ig-doc[data-template="minimal"] .ig-doc__business-name { color: #1f2937; }
.ig-doc[data-template="minimal"] .ig-doc__header { border-bottom: 1px solid #1f2937; padding-bottom: 20px; }
.ig-doc[data-template="minimal"] .ig-doc__items th { background: transparent; color: #6b7280; border-bottom: 1px solid #1f2937; padding-left: 0; padding-right: 0; }
.ig-doc[data-template="minimal"] .ig-doc__items td { border-bottom: 1px solid #f1f5f9; padding-left: 0; padding-right: 0; }
.ig-doc[data-template="minimal"] .ig-doc__totals td, .ig-doc[data-template="minimal"] .ig-doc__totals th { padding-right: 0; }
.ig-doc[data-template="minimal"] .ig-doc__grand th, .ig-doc[data-template="minimal"] .ig-doc__grand td { color: #1f2937; border-top: 1px solid #1f2937; }
.ig-doc[data-template="minimal"] .ig-doc__label { color: var(--ig-accent); }

.ig-doc[data-template="bold"] { padding-left: 76px; }
.ig-doc[data-template="bold"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 18px; background: var(--ig-accent); }
.ig-doc[data-template="bold"] .ig-doc__title { font-size: 34px; }
.ig-doc[data-template="bold"] .ig-doc__header { flex-direction: row-reverse; }
.ig-doc[data-template="bold"] .ig-doc__title-block { text-align: left; }
.ig-doc[data-template="bold"] .ig-doc__meta { margin-left: 0; }
.ig-doc[data-template="bold"] .ig-doc__meta td { text-align: left; padding-left: 6px; }
.ig-doc[data-template="bold"] .ig-doc__brand { text-align: right; flex-direction: row-reverse; }
.ig-doc[data-template="bold"] .ig-doc__items th { background: #111827; }
.ig-doc[data-template="bold"] .ig-doc__items td { border-bottom: 1px solid #d1d5db; }
.ig-doc[data-template="bold"] .ig-doc__grand th, .ig-doc[data-template="bold"] .ig-doc__grand td { font-size: 17px; }

.ig-doc[data-template="elegant"] .ig-doc__header { flex-direction: column; align-items: center; text-align: center; gap: 12px; padding-bottom: 16px; border-bottom: 3px double var(--ig-accent); }
.ig-doc[data-template="elegant"] .ig-doc__brand { flex-direction: column; align-items: center; text-align: center; }
.ig-doc[data-template="elegant"] .ig-doc__title-block { text-align: center; }
.ig-doc[data-template="elegant"] .ig-doc__title { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: .2em; font-size: 24px; }
.ig-doc[data-template="elegant"] .ig-doc__business-name { font-family: Georgia, "Times New Roman", serif; font-size: 22px; }
.ig-doc[data-template="elegant"] .ig-doc__meta { margin: 0 auto; }
.ig-doc[data-template="elegant"] .ig-doc__meta th, .ig-doc[data-template="elegant"] .ig-doc__meta td { text-align: center; padding: 2px 8px; }
.ig-doc[data-template="elegant"] .ig-doc__items th { background: transparent; color: var(--ig-accent); border-top: 1px solid var(--ig-accent); border-bottom: 1px solid var(--ig-accent); }
.ig-doc[data-template="elegant"] .ig-doc__grand th, .ig-doc[data-template="elegant"] .ig-doc__grand td { border-top: 3px double var(--ig-accent); }

/* credit line (free / anonymous users) */
.ig-doc__credit { margin-top: 18px; padding-top: 8px; border-top: 1px solid #e5e7eb; font-size: 10px; color: #9ca3af; text-align: center; letter-spacing: .02em; }
.ig-doc__credit a { color: #6b7280; text-decoration: underline; }

/* ad slots on the canvas */
.ig-ad-slot--top { padding: 12px 28px 0; }
.ig-ad-slot--bottom { padding: 0 28px 28px; max-width: 850px; margin: 0 auto; }

/* SEO content below the page (reuses the site's seo_content include) */
.ig-canvas .seo-content-section { padding: 8px 28px 48px; }
.ig-canvas .seo-content-section .container { max-width: 850px; margin: 0 auto; }
.ig-canvas .seo-content-card { background: #fff; border: 1px solid var(--ig-line); border-radius: 12px; padding: 24px 28px; font-size: 14px; line-height: 1.6; color: var(--ig-ink); }
.ig-canvas .seo-content-card h2 { font-size: 20px; color: var(--ig-navy); margin: 0 0 10px; }
.ig-canvas .seo-content-card h3 { font-size: 15px; color: var(--ig-navy); margin: 22px 0 8px; }
.ig-canvas .seo-content-card ul { padding-left: 20px; margin: 10px 0; }
.ig-canvas .seo-content-card li { margin: 4px 0; }
.ig-canvas .seo-content-card details { border-top: 1px solid var(--ig-line); padding: 10px 0; }
.ig-canvas .seo-content-card summary { cursor: pointer; font-weight: 600; }
.ig-canvas .seo-content-card details p { margin: 8px 0 0; color: #4b5563; }
.ig-canvas .seo-content-card a { color: var(--ig-teal); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
    .ig-topbar__hint { display: none; }
    .ig-btn { padding: 9px 11px; }
}
@media (max-width: 900px) {
    .ig-mobile-only { display: inline-flex; }
    .ig-topbar__divider, .ig-topbar__title { display: none; }
    .ig-panel {
        position: absolute; inset: 0 auto 0 0; width: min(var(--ig-panel-w), 88vw); transform: translateX(-105%);
        transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.25);
    }
    .ig-app[data-panel="open"] .ig-panel { transform: translateX(0); }
    .ig-stage { padding: 12px; }
    .ig-row-remove { opacity: 1; left: -22px; }
}
@media (max-width: 600px) {
    .ig-topbar { padding: 0 10px; gap: 6px; }
    .ig-topbar__right { gap: 5px; }
    .ig-btn { padding: 8px 9px; font-size: 12px; }
    .ig-btn svg { display: none; }
    #ig-print { display: none; }
    .ig-zoom { right: 10px; bottom: 10px; }
}

/* ==========================================================================
   Print — only the invoice
   ========================================================================== */
@media print {
    @page { size: A4; margin: 0; }
    body.ig-body { overflow: visible; background: #fff; }
    body * { visibility: hidden !important; }
    #ig-doc, #ig-doc * { visibility: visible !important; }
    #ig-doc { position: absolute; left: 0; top: 0; width: 210mm; min-height: 297mm; box-shadow: none; margin: 0; }
    .ig-page-wrap { transform: none !important; }
    .ig-ui-only { display: none !important; }
    .ig-export-only { display: inline !important; }
    .ig-optional.is-empty, .ig-doc__contact.is-empty, .ig-doc__logo-btn.is-empty, .ig-date__text--empty, .ig-doc__bank.is-empty, .ig-doc__notes.is-empty, .ig-doc__dot.is-hidden { display: none !important; }
    .ig-edit:empty { display: none !important; }
    .ig-doc__credit { display: block !important; }
}
