/* APower Flex — Rechnungen Module styles */

/* ─── Summary Cards (list page) ─────────────────────────────────── */
.rech-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .rech-summary { grid-template-columns: repeat(2, 1fr); }
}

.rech-summary-card {
    background: var(--apf-bg-card);
    border: 1px solid var(--apf-border);
    border-radius: 8px;
    padding: 14px 16px;
    border-left: 3px solid var(--apf-primary);
}

.rech-summary-card.rech-warning { border-left-color: var(--apf-warning-text); }
.rech-summary-card.rech-danger { border-left-color: var(--apf-danger-text); }
.rech-summary-card.rech-success { border-left-color: var(--apf-success-text); }

.rech-summary-label {
    font-size: 11px;
    color: var(--apf-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 500;
}

.rech-summary-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--apf-text-primary);
}

/* ─── Status badges ─────────────────────────────────────────────── */
.rech-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.rech-status-Offen      { background: var(--apf-warning-bg); color: var(--apf-warning-text); }
.rech-status-Bezahlt    { background: var(--apf-success-bg); color: var(--apf-success-text); }
.rech-status-Mahnung    { background: var(--apf-danger-bg);  color: var(--apf-danger-text); }
.rech-status-Storniert  { background: var(--apf-bg-hover);   color: var(--apf-text-tertiary); text-decoration: line-through; }

.rech-overdue-flag {
    color: var(--apf-danger-text);
    font-size: 11px;
    margin-left: 6px;
}

/* ─── Invoice builder — positionen table ────────────────────────── */
.positionen-wrapper {
    overflow-x: auto;
    border: 1px solid var(--apf-border);
    border-radius: 6px;
}

.positionen-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.positionen-table thead {
    background: var(--apf-bg-hover);
}

.positionen-table th {
    text-align: left;
    padding: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--apf-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--apf-border);
    white-space: nowrap;
}

.positionen-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--apf-border);
    vertical-align: middle;
}

.positionen-table tbody tr:last-child td {
    border-bottom: none;
}

/* ─── Hide empty rows in print view ────────────────────────────── */
@media print {
    .positionen-table tbody tr:has(td:not(:has(*)):not(:has(*)):not(:has(*)):not(:has(*)):not(:has(*)):not(:has(*))) {
        display: none;
    }
}

.positionen-table input,
.positionen-table select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    font-size: 13px;
    font-family: inherit;
    color: var(--apf-text-primary);
    box-sizing: border-box;
}

.positionen-table input:focus,
.positionen-table select:focus {
    outline: none;
    border-color: var(--apf-primary);
    background: var(--apf-bg-input);
    box-shadow: 0 0 0 3px var(--apf-primary-tint);
}

.positionen-table td.col-nr {
    text-align: center;
    color: var(--apf-text-tertiary);
    font-size: 12px;
    padding: 8px;
}

.positionen-table td.col-price,
.positionen-table td.col-total {
    text-align: right;
}

.positionen-table td.col-total {
    font-weight: 600;
    padding: 8px 12px;
    color: var(--apf-text-primary);
}

.positionen-table td.col-total input {
    text-align: right;
    font-weight: 600;
}

.positionen-table td.col-price input {
    text-align: right;
}

.btn-remove-row {
    background: transparent;
    border: none;
    color: var(--apf-text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-remove-row:hover {
    background: var(--apf-danger-bg);
    color: var(--apf-danger-text);
}

.btn-remove-row svg {
    width: 14px;
    height: 14px;
}

.positionen-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--apf-text-tertiary);
    font-size: 13px;
}

/* ─── Summary panel (right side of builder) ─────────────────────── */
.rech-summary-panel {
    background: var(--apf-bg-card);
    position: sticky;
    top: 76px;
    align-self: flex-start;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    color: var(--apf-text-primary);
}

.summary-line.summary-deduction {
    color: var(--apf-text-secondary);
}

.summary-line.summary-total {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 0;
}

.summary-line.summary-final {
    font-size: 18px;
    font-weight: 600;
    padding: 12px 0;
    color: var(--apf-primary);
}

.summary-value {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.summary-total .summary-value {
    font-weight: 600;
}

.summary-final .summary-value {
    font-weight: 700;
}

.summary-divider {
    height: 1px;
    background: var(--apf-border);
    margin: 6px 0;
}

.summary-skonto {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--apf-border);
}

/* ─── Action buttons color hints (Invoice builder quick-imports) ─ */
#btn-from-tickets    { border-left: 3px solid #7F77DD; }
#btn-from-auftraege  { border-left: 3px solid #1A2A42; }
#btn-from-ladeliste  { border-left: 3px solid #5DCAA5; }
