/* Invoice & quote maker (/invoice-quote-maker): the document paper, line table and totals.
   Stage, panels, fields and buttons come from the app kit (css/app-kit, docs/app-kit.md);
   the accent is the finance category's emerald. Loaded only on this app's page (StylePaths). */
.inv-landing-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-height: 32rem;
    background:
        radial-gradient(1200px 400px at 50% -10%, color-mix(in srgb, var(--ak-accent, #059669) 14%, transparent), transparent 70%),
        var(--ak-bg, #f8fafc);
    padding: 1.2rem 0.8rem 1.6rem;
}

.inv-paper {
    width: min(100%, 46rem);
}

.inv-sheet {
    background: #fff;
    color: #0f172a;
    color-scheme: light;
    border: 1px solid #d6e4dd;
    border-radius: 4px;
    box-shadow: 0 18px 40px rgba(6, 40, 30, 0.12), 0 1px 0 rgba(255,255,255,0.8) inset;
    padding: 2rem 2.1rem 1.8rem;
    min-height: 28rem;
}

.inv-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.4rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #059669;
}

.inv-doctype {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #047857;
    text-align: right;
}

.inv-docno {
    margin: 0.15rem 0 0.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.inv-kicker {
    margin: 0 0 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.inv-addr { font-size: 0.95rem; line-height: 1.4; }
.inv-muted { color: #94a3b8; margin: 0; }

.inv-meta { margin: 0; }
.inv-meta-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 0.8rem;
    font-size: 0.9rem;
}
.inv-meta-row dt { color: #64748b; margin: 0; }
.inv-meta-row dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.inv-to { margin: 0 0 1.2rem; }

.inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.inv-table th, .inv-table td {
    padding: 0.45rem 0.4rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: start;
    vertical-align: top;
}
.inv-table thead th {
    border-bottom: 2px solid #059669;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #334155;
}
.inv-table .inv-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.inv-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: 1.2rem;
    margin-top: 1.2rem;
    align-items: start;
}
.inv-note { margin: 0 0 0.8rem; white-space: pre-wrap; font-size: 0.9rem; }
.inv-totals { width: 100%; border-collapse: collapse; }
.inv-totals th, .inv-totals td {
    padding: 0.28rem 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}
.inv-totals th { text-align: start; font-weight: 500; color: #475569; }
.inv-totals td { text-align: right; font-variant-numeric: tabular-nums; }
.inv-totals tr.is-total th, .inv-totals tr.is-total td {
    border-bottom: none;
    border-top: 2px solid #059669;
    font-weight: 800;
    font-size: 1.05rem;
    padding-top: 0.55rem;
    color: #064e3b;
}

.inv-empty {
    background: #fff;
    border: 1px dashed #99c6b5;
    border-radius: 8px;
    padding: 3rem 1.5rem;
    text-align: center;
}
.inv-empty-title { margin: 0 0 1rem; }
.inv-empty-actions { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }

.inv-doc-actions, .inv-city-row, .inv-item-grid {
    display: grid;
    gap: 0.4rem;
}
.inv-doc-actions { grid-template-columns: 1fr 1fr; margin-bottom: 0.5rem; }
.inv-city-row { grid-template-columns: 1fr 1fr; }
.inv-item-grid { grid-template-columns: 1fr 1fr; }

.inv-docs, .inv-items, .inv-parties {
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}
.inv-doc, .inv-party {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.inv-doc-pick {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    background: none;
    border: 1px solid var(--ak-border, #e2e8f0);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    text-align: start;
    cursor: pointer;
}
.inv-doc.is-on .inv-doc-pick {
    border-color: var(--ak-accent, #059669);
    box-shadow: 0 0 0 1px var(--ak-accent, #059669);
}
.inv-doc-who, .inv-party-kind { font-size: 0.8rem; color: var(--ak-muted, #64748b); }
.inv-party-name { flex: 1 1 auto; }
.inv-item {
    border: 1px solid var(--ak-border, #e2e8f0);
    border-radius: 8px;
    padding: 0.5rem;
    display: grid;
    gap: 0.35rem;
}
.inv-item-foot { display: flex; justify-content: space-between; align-items: center; }
.inv-item-amt { font-weight: 700; font-variant-numeric: tabular-nums; }

.inv-table-scroller { width: 100%; }

@media (max-width: 700px) {
    .inv-sheet { padding: 0.9rem 0.7rem; }
    .inv-head { margin-bottom: 0.8rem; padding-bottom: 0.6rem; }
    .inv-head, .inv-foot { grid-template-columns: 1fr; }
    .inv-doctype { font-size: 1.25rem; }
    .inv-doctype, .inv-docno, .inv-meta-row dd { text-align: start; }
    .inv-to { margin-bottom: 0.7rem; }
    .inv-addr { font-size: 0.85rem; line-height: 1.3; }
    .inv-table-scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .inv-sheet { padding-left: 0.55rem; padding-right: 0.55rem; }
    .inv-table { width: 100%; font-size: 0.66rem; }
    .inv-table th, .inv-table td { padding: 0.28rem 0.12rem; }
    .inv-table th:nth-child(3), .inv-table td:nth-child(3) { display: none; }
    .inv-note { font-size: 0.82rem; margin-bottom: 0.5rem; }
    .inv-foot { margin-top: 0.7rem; gap: 0.6rem; }
}
