* {
    box-sizing: border-box
}

:root {
    --p: #5d00b7;
    --b: #e9e5ee;
    --muted: #777;
    --bg: #faf9fc
}

body {
    margin: 0;
    background: var(--bg);
    color: #19161d;
    font-family: Inter, Arial, sans-serif
}

.nav,
main {
    width: min(1450px, calc(100% - 30px));
    margin: auto
}

.nav {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--b)
}

.brand {
    font-size: 22px
}

.brand span,
.hero em {
    color: var(--p)
}

.nav small {
    background: #f1e9f8;
    color: var(--p);
    padding: 7px 10px;
    border-radius: 20px
}

.hero {
    text-align: center;
    padding: 40px 0 25px
}

.hero em {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px
}

.hero h1 {
    font-size: 50px;
    line-height: 1;
    margin: 10px 0;
    letter-spacing: -2px
}

.hero h1 span {
    color: var(--p)
}

.hero p {
    color: var(--muted)
}

.app {
    display: grid;
    grid-template-columns: 490px 1fr;
    gap: 18px
}

.editor,
.preview {
    background: white;
    border: 1px solid var(--b);
    border-radius: 15px;
    overflow: hidden
}

.head,
.toolbar {
    padding: 15px;
    border-bottom: 1px solid var(--b);
    display: flex;
    justify-content: space-between;
    align-items: center
}

.head button {
    border: 0;
    background: none;
    color: var(--p);
    font-weight: bold
}

.section {
    padding: 16px;
    border-bottom: 1px solid var(--b)
}

h3 {
    font-size: 13px;
    margin: 0 0 12px
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px
}

label {
    font-size: 10px;
    font-weight: bold;
    color: #554e59;
    margin-bottom: 9px;
    display: block
}

input,
textarea,
select {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 9px;
    border: 1px solid var(--b);
    border-radius: 7px;
    font: 12px inherit;
    outline: 0
}

textarea {
    resize: vertical
}

.add {
    width: 100%;
    height: 35px;
    border: 1px dashed #c7aed6;
    background: #fcf9fe;
    color: var(--p);
    font-weight: bold;
    border-radius: 7px
}

.item {
    position: relative;
    border: 1px solid var(--b);
    padding: 9px;
    border-radius: 8px;
    margin-bottom: 8px
}

.item button {
    position: absolute;
    right: 5px;
    top: 3px;
    border: 0;
    background: none;
    color: #aaa
}

.itemgrid {
    display: grid;
    grid-template-columns: 2fr .7fr 1fr;
    gap: 7px
}

.toolbar button {
    background: var(--p);
    color: #fff;
    border: 0;
    padding: 10px 14px;
    border-radius: 7px;
    font-weight: bold
}

.toolbar small {
    color: var(--muted);
    font-weight: normal;
    margin-left: 7px
}

.templates {
    display: flex;
    gap: 6px;
    padding: 10px;
    overflow: auto;
    border-bottom: 1px solid var(--b)
}

.tpl {
    white-space: nowrap;
    border: 1px solid var(--b);
    background: white;
    padding: 7px 9px;
    border-radius: 6px;
    font-size: 10px
}

.tpl.active {
    color: var(--p);
    background: #f1e9f8;
    border-color: #c4a1d5
}

.paper {
    background: #efedef;
    padding: 20px;
    overflow: auto;
    min-height: 750px
}

.invoice {
    width: 794px;
    height: 1123px;
    margin: auto;
    background: #fff;
    padding: 48px 50px;
    font-family: Arial, sans-serif;
    position: relative;
    box-shadow: 0 4px 20px #0001
}

.invhead {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--p);
    padding-bottom: 22px
}

.invhead h2 {
    color: var(--p);
    font-size: 24px;
    margin: 0 0 5px
}

.invhead p,
.meta span {
    font-size: 8.5px;
    color: #777;
    margin: 3px 0
}

.title {
    text-align: right;
    font-size: 9px;
    letter-spacing: 2px;
    color: #888
}

.title strong {
    display: block;
    color: #222;
    font-size: 17px;
    letter-spacing: 0;
    margin-top: 5px
}

.meta {
    display: grid;
    grid-template-columns: 1fr 180px;
    padding: 24px 0;
    gap: 30px
}

.meta div {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.meta b {
    font-size: 8px;
    color: var(--p);
    letter-spacing: 1px
}

.meta strong {
    font-size: 11px
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px
}

th {
    background: var(--p);
    color: #fff;
    text-align: left;
    padding: 10px
}

th:not(:first-child),
td:not(:first-child) {
    text-align: right
}

td {
    padding: 10px;
    border-bottom: 1px solid #eee
}

.bottom {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 30px;
    margin-top: 25px
}

.bottom>b {
    font-size: 8px;
    color: var(--p);
    letter-spacing: 1px
}

.bottom p {
    font-size: 8.5px;
    color: #666;
    line-height: 1.5
}

.totals div {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    padding: 6px 0
}

.totals .grand {
    font-size: 13px;
    font-weight: bold;
    border-top: 2px solid var(--p);
    margin-top: 6px;
    padding-top: 10px
}

.invoice footer {
    position: absolute;
    bottom: 28px;
    left: 50px;
    right: 50px;
    border-top: 1px solid #eee;
    padding-top: 10px;
    font-size: 8px;
    color: #888
}

.invoice.classic {
    font-family: Georgia, serif
}

.invoice.classic .invhead {
    border-color: #222
}

.invoice.classic .invhead h2,
.invoice.classic .meta b {
    color: #222
}

.invoice.classic th {
    background: #222
}

.invoice.minimal {
    padding: 55px 58px
}

.invoice.minimal .invhead {
    border: 0
}

.invoice.minimal .invhead h2 {
    color: #222;
    font-weight: 400
}

.invoice.minimal th {
    background: white;
    color: #222;
    border-bottom: 2px solid #222
}

.invoice.bold .invhead {
    background: #222;
    color: white;
    margin: -48px -50px 0;
    padding: 35px 50px;
    border: 0
}

.invoice.bold .invhead h2,
.invoice.bold .title {
    color: white
}

.invoice.bold .invhead p {
    color: #ccc
}

.invoice.bold th {
    background: #222
}

.invoice.corporate .invhead {
    border-bottom: 6px solid #222
}

.invoice.corporate .invhead h2,
.invoice.corporate .meta b {
    color: #222
}

.invoice.corporate th {
    background: #222
}

.invoice.creative .invhead {
    background: #f2eafb;
    padding: 25px;
    border: 0;
    border-left: 7px solid var(--p)
}

.invoice.elegant {
    font-family: Georgia, serif
}

.invoice.elegant .invhead {
    display: block;
    text-align: center;
    border: 0
}

.invoice.elegant .title {
    text-align: center;
    margin-top: 14px
}

.invoice.elegant .invhead h2 {
    color: #222;
    font-weight: 400;
    font-size: 30px
}

.invoice.elegant th {
    background: #fff;
    color: #222;
    border-bottom: 1px solid #222
}

.invoice.mono {
    font-family: "Courier New", monospace
}

.invoice.mono .invhead h2,
.invoice.mono .meta b {
    color: #222
}

.invoice.mono th {
    background: #222
}

.invoice.violet .invhead {
    background: var(--p);
    color: #fff;
    margin: -48px -50px 0;
    padding: 32px 50px;
    border: 0
}

.invoice.violet .invhead h2,
.invoice.violet .title {
    color: #fff
}

.invoice.violet .invhead p {
    color: #ddd
}

.invoice.violet th {
    background: #eee;
    color: #222
}

.invoice.green {
    --p: #16834d
}

.invoice.navy {
    --p: #173b66
}

.invoice.split {
    padding: 0
}

.invoice.split .invhead {
    height: 210px;
    background: #222;
    color: #fff;
    border: 0;
    padding: 48px 50px
}

.invoice.split .invhead h2,
.invoice.split .title {
    color: #fff
}

.invoice.split .invhead p {
    color: #ccc
}

.invoice.split .meta,
.invoice.split table,
.invoice.split .bottom {
    margin-left: 50px;
    width: calc(100% - 100px)
}

.invoice.bordered {
    border: 8px solid var(--p);
    box-shadow: none
}

.invoice.bordered .invhead {
    border: 0
}

.invoice.bordered th {
    background: #fff;
    color: #222;
    border-block: 2px solid #222
}

.invoice.luxury {
    font-family: Georgia, serif
}

.invoice.luxury .invhead {
    border-color: #222
}

.invoice.luxury .invhead h2,
.invoice.luxury .meta b {
    color: #222
}

.invoice.luxury th {
    background: #222
}

.invoice.compact {
    padding: 35px 42px
}

.invoice.compact .meta {
    padding: 15px 0
}

.invoice.compact td,
.invoice.compact th {
    padding: 7px
}

.invoice.compact .invhead {
    padding-bottom: 14px
}

.pdf-capture {
    width: 794px !important;
    height: 1123px !important;
    min-height: 1123px !important;
    max-height: 1123px !important;
    overflow: hidden !important;
    margin: 0 !important;
    box-shadow: none !important
}

@media(max-width:1050px) {
    .app {
        grid-template-columns: 1fr
    }
}

@media(max-width:650px) {

    .grid,
    .itemgrid {
        grid-template-columns: 1fr
    }

    .hero h1 {
        font-size: 38px
    }
}

.color-controls {
    display: flex;
    align-items: end;
    gap: 14px
}

.color-controls label {
    width: 105px;
    margin: 0
}

.color-controls input[type=color] {
    height: 38px;
    padding: 3px;
    cursor: pointer
}

.swatches {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    padding-bottom: 1px
}

.swatches button {
    width: 27px;
    height: 27px;
    border: 2px solid #fff;
    outline: 1px solid #ddd;
    border-radius: 50%;
    background: var(--sw);
    cursor: pointer
}

.swatches button:hover {
    transform: scale(1.08)
}

/* Refined invoice typography */
.invoice .invhead h2 {
    font-size: 26px
}

.invoice .title {
    font-size: 10px
}

.invoice .title strong {
    font-size: 22px
}

.invoice .meta b {
    font-size: 9px
}

.invoice .meta strong {
    font-size: 12px
}

.invoice .meta span {
    font-size: 10px
}

.invoice table {
    font-size: 10px
}

.invoice th {
    font-size: 10px
}

.invoice td {
    font-size: 10px
}

.invoice .bottom>b {
    font-size: 9px
}

.invoice .bottom p {
    font-size: 9.5px
}

.invoice .totals div {
    font-size: 10px
}

.invoice .totals .grand {
    font-size: 15px
}

.invoice footer {
    font-size: 9px
}

.invoice.compact .invhead h2 {
    font-size: 24px
}

.invoice.compact .meta span,
.invoice.compact td,
.invoice.compact th {
    font-size: 9.5px
}

.invoice.elegant .invhead h2 {
    font-size: 30px
}

.invoice.elegant .title strong {
    font-size: 21px
}

.invoice.minimal .title strong {
    font-size: 24px
}

.invoice.bold .invhead h2,
.invoice.violet .invhead h2 {
    font-size: 26px
}

.swatches button.selected {
    outline: 2px solid var(--p);
    outline-offset: 2px
}