/**
 * Talon_Invoice — module UI (not in Talon_Core).
 * Uses v4 theme tokens (--space-*, --border, --text, …) from the active core theme.
 * Loaded for every Talon_Invoice request via Talon_Invoice_Main::init → require_CSS('talon_invoice/talon_invoice_theme.css').
 *
 * Covers: document stats tree, legacy year/month doc filter sidebar, options rail, E-Rechnung analysis layout,
 * document form inline actions (create/edit), draggable line-item cards, chart wrappers, muted list copy. Remove rules here only when
 * templates no longer use the matching classes.
 */

/* Document list statistics tree (left column) */
.document-statistics-tree .tree-link {
	color: inherit;
	text-decoration: none;
	display: block;
	width: 100%;
}

.document-statistics-tree .tree-link:hover {
	text-decoration: underline;
	color: var(--text);
}

.document-statistics-tree .tree-node {
	cursor: pointer;
}

.document-statistics-tree-wrap .section-h {
	margin-top: 0;
}

.talon-invoice-tree-empty {
	margin: 0;
	color: var(--text-2);
	font-size: 0.875rem;
}

/* Year grid filter (InvoiceList_Sidebar) */
.talon_invoice_docfilter_year {
	padding: var(--space-4);
	position: relative;
	flex-wrap: wrap;
	overflow: auto;
	min-height: 0;
}

.talon_invoice_docfilter_year > .col {
	width: 25%;
}

.talon_invoice_docfilter_title {
	font-weight: 600;
	border-top: 1px solid var(--border);
	margin-top: var(--space-2);
	padding-top: var(--space-2);
	color: var(--text);
}

/* Document detail / list rail actions (vertical stack in narrow rail) */
.invoice-document-rail-options {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--space-3);
	min-width: 0;
}

.invoice-document-rail-options .dynlist-rail-optionset {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--space-2);
	min-width: 0;
}

.invoice-document-rail-options .invoice-rail-optionset__actions {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--space-2);
}

.invoice-rail-selection {
	margin-bottom: var(--space-3);
	padding-bottom: var(--space-3);
	border-bottom: 1px solid var(--border);
}

.invoice-rail-selection__label {
	margin: 0 0 var(--space-1);
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.invoice-rail-selection__title {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.4;
	color: var(--text);
}

.invoice-list-table .invoice-row--active > td {
	background: var(--hl-teal-muted, rgba(45, 212, 191, 0.14));
}

.invoice-list-table .invoice-list-row {
	cursor: default;
}

.invoice-document-rail-options .dynlist-option-item-button {
	width: 100%;
	max-width: 100%;
	justify-content: flex-start;
	text-align: left;
	white-space: normal;
	box-sizing: border-box;
}

.invoice-document-rail-options a.dynlist-option-item-button {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.invoice-document-rail-options .editor_options_message {
	padding: 0;
	margin: 0;
	color: var(--text-2);
	font-size: 0.875rem;
	border-bottom: none;
}

/* E-Rechnung analysis stacked panels */
.talon-invoice-analysis-block {
	margin-bottom: var(--space-5);
}

.talon-invoice-analysis-block:last-child {
	margin-bottom: 0;
}

/* Document create/edit — flat sections (Document_Form.html) */
.document-form.document-form--compact {
	width: 100%;
	max-width: none;
}

.document-form--compact .form-fieldset {
	width: 100%;
	max-width: none;
}

.document-form--compact .document-form__section {
	width: 100%;
	max-width: none;
	box-sizing: border-box;
}

.document-form--compact .document-form__required-note {
	margin: 0 0 var(--space-3);
}

.document-form--compact .document-form__section {
	margin-bottom: var(--space-4);
	padding-bottom: var(--space-3);
	border-bottom: 1px solid var(--border);
}

.document-form--compact .document-form__section:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.document-form--compact .document-form__heading {
	margin: 0 0 var(--space-2);
	font-size: var(--font-size-sm);
	font-weight: 600;
}

.document-form--compact .document-form__grid.ltrow.pad {
	padding: 0;
	row-gap: var(--space-2);
}

.document-form--compact .document-form__grid .field {
	margin-bottom: 0;
}

.document-form__field-row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--space-2);
}

.document-form__field-grow {
	flex: 1 1 8rem;
	min-width: 0;
}

.document-form-inline-action {
	margin: 0;
	flex-shrink: 0;
	padding-bottom: var(--space-1);
}

/* List / detail line items */
.ltrow.listtable_header {
	font-weight: 600;
	border-bottom: 2px solid var(--border-strong, var(--border));
	flex-wrap: nowrap;
}

.invoice_document_listitem > .ltrow .col {
	padding: var(--space-3);
}

.invoice_document_listitem {
	background: var(--bg-subtle);
	position: relative;
	border: 1px solid var(--border);
	margin-bottom: var(--space-3);
	border-radius: var(--radius-md);
}

.invoice_document_listitem .mover {
	position: absolute;
	left: 0;
	top: 0;
	width: 20px;
	height: 20px;
	text-align: center;
	line-height: 20px;
	color: var(--text-3);
}

.ltrow.listtable_header .col {
	padding: var(--space-2);
}

.invoice_document_listitem.drophover {
	border-bottom: 8px solid var(--accent, var(--border-strong));
}

.invoice_document_listitem.dragging {
	width: 300px;
	overflow: hidden;
	position: absolute;
	border-bottom: 0;
	box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.15));
}

.talon-invoice-muted {
	font-size: 0.8125rem;
	color: var(--text-2);
	margin: var(--space-1) 0 0;
}

.talon-invoice-chart-wrap {
	display: flex;
	flex-direction: column;
	min-height: 300px;
	width: 100%;
	flex: 1;
	min-width: 0;
}
