/* Accounting setup screens. Theme tokens only: no literal colours. */

.accounting-table th,
.accounting-table td {
  vertical-align: middle;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* The list outline's header rule (global, DataGrid.css: .cosmos-datagrid thead tr.cosmos-datagrid-header-row > th = 0,2,3)
   sets text-align: left over .accounting-amount; this is 0,3,4 (the extra class), so an amount header sits over its values. */
table.cosmos-datagrid thead tr.cosmos-datagrid-header-row > th.accounting-amount {
  text-align: right;
}

/* Fiscal-year pickers: the whole "2026-01-01 – 2026-12-31 · Trial" text, with the arrow clear of it. */
select[id$="_year"] {
  min-width: 18rem;
  padding-right: 2.25rem;
  text-overflow: clip;
}

.accounting-table tbody tr {
  cursor: pointer;
}

.accounting-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The reports and Opening balances are plain tables in the list outline (cosmos-datagrid inside
   cosmos-datagrid-container). DataGrid.css forces table-layout: fixed and, on every body cell, single-line ellipsis and
   hover/pointer: fixed layout splits unsized columns evenly, so each table names its column widths in a <colgroup>
   (the one unsized column takes the rest), and the rules below give back wrapping and a plain cursor. Selectors
   are 0,3,4 against the global 0,3,3 (both !important). */
.accounting-report col.accounting-col-code {
  width: 8rem;
}

.accounting-report col.accounting-col-date {
  width: 7rem;
}

.accounting-report col.accounting-col-amount {
  width: 9rem;
}

.accounting-report col.accounting-col-input {
  width: 15rem;
}

table.cosmos-datagrid.accounting-report tbody > tr:not(.cosmos-datagrid-extended-row) > td {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
}

table.cosmos-datagrid.accounting-report tbody > tr:hover > td {
  cursor: default;
}

/* Section and subtotal rows: the global cell rule sets weight 400 and no top border on every body cell. */
table.cosmos-datagrid.accounting-report tbody > tr.accounting-total > td,
table.cosmos-datagrid.accounting-report tbody > tr.accounting-total > th {
  font-weight: 600 !important;
}

table.cosmos-datagrid.accounting-report tbody > tr.accounting-total > td {
  border-top: 1px solid var(--cosmos-border-strong) !important;
}

/* Cells the global rules do not reach (th in a body or foot row). */
table.cosmos-datagrid.accounting-report tbody > tr > th,
table.cosmos-datagrid.accounting-report tfoot > tr > th {
  padding: var(--cosmos-table-cell-pad-y) var(--cosmos-table-cell-pad-x);
  border-bottom: 1px solid var(--cosmos-border-strong);
  text-align: left;
}

table.cosmos-datagrid.accounting-report tbody > tr > th.accounting-amount,
table.cosmos-datagrid.accounting-report tfoot > tr > th.accounting-amount {
  text-align: right;
}

.accounting-amount-input {
  text-align: right;
  max-width: 12rem;
  margin-left: auto;
}

.accounting-field-error {
  display: block;
  color: var(--cosmos-status-bad);
  font-size: 0.75rem;
}

.accounting-hint {
  color: var(--cosmos-fg-muted);
  font-size: 0.8rem;
}

.accounting-note {
  border: 1px solid var(--cosmos-border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.accounting-note-warn {
  background: var(--cosmos-status-warn-soft);
  border-color: var(--cosmos-status-warn);
  color: var(--cosmos-fg);
}

.accounting-note-info {
  background: var(--cosmos-status-info-soft);
  border-color: var(--cosmos-status-info);
  color: var(--cosmos-fg);
}

.accounting-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.accounting-badge-trial {
  background: var(--cosmos-status-warn-soft);
  color: var(--cosmos-fg);
  border: 1px solid var(--cosmos-status-warn);
}

.accounting-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
}

.accounting-form-grid label,
.accounting-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--cosmos-fg-muted);
}

.accounting-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
}

.accounting-filter-number {
  max-width: 12rem;
}

.accounting-card {
  border: 1px solid var(--cosmos-border);
  border-radius: 6px;
  background: var(--cosmos-surface);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.accounting-total {
  font-weight: 600;
  border-top: 1px solid var(--cosmos-border);
}

/* The dashboard (/Accounting): its action strip, and the two panels carried across the landing page's KPI strip. */
.accounting-dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem 0;
}

/* The "Exported to Visma" card's date (2026-11-18) must not break at its hyphens in a narrow card. The wrapper is
   display: contents, so the KPI grid still sees the card itself; the card's value carries an inline font-size, hence
   !important. The class exists only in this view, so no other module's stat card is touched. */
.accounting-dashboard-exported {
  display: contents;
}

.accounting-dashboard-exported .tnum {
  white-space: nowrap;
  font-size: 20px !important;
}

.accounting-dashboard-panels {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 0.75rem;
}

.accounting-dashboard-panel {
  background: var(--cosmos-surface);
  border: 1px solid var(--cosmos-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  min-width: 0;
}

.accounting-dashboard-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cosmos-fg-subtle);
}

.accounting-dashboard-attention {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--cosmos-border);
}

.accounting-dashboard-attention:first-of-type {
  border-top: 0;
}

.accounting-dashboard-row {
  cursor: pointer;
}

.accounting-company-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.accounting-company-header h3 {
  margin: 0;
}

.accounting-company-header .accounting-hint {
  display: block;
}

.accounting-company-edit {
  margin-left: auto;
}

.accounting-company-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 0.75rem;
}

.accounting-company-card {
  background: var(--cosmos-surface, #fff);
  border: 1px solid var(--cosmos-border);
  border-radius: 7px;
  padding: 0.75rem 1rem;
}

.accounting-company-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cosmos-fg-muted);
}

.accounting-company-card dl {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
}

.accounting-company-card dt {
  font-weight: 400;
  color: var(--cosmos-fg-muted);
}

.accounting-company-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.accounting-company-missing {
  font-style: italic;
  color: var(--cosmos-status-warn);
}

/* Dimensions: the dimension grid and its objects side by side, stacked below 900 px. */
.accounting-master-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 899px) {
  .accounting-master-detail {
    grid-template-columns: 1fr;
  }
}

.accounting-logo {
  display: block;
  max-width: 100%;
  max-height: 6rem;
  object-fit: contain;
}

/* A draft invoice's lines (design D): an overview table that reads like the PDF, codes with their names under them,
   and the chosen line edited below it in labelled full-width fields. */
.accounting-lines td {
  vertical-align: top;
}

.accounting-lines tbody tr.is-selected > td {
  background: var(--cosmos-row-selected);
}

.accounting-lines tbody tr.is-selected > td:first-child {
  box-shadow: inset 3px 0 0 var(--cosmos-brand);
}

.accounting-line-open {
  padding: 0;
  border: 0;
  background: none;
  color: var(--cosmos-fg);
  font: inherit;
  font-weight: 600;
  text-align: left;
}

.accounting-line-open:focus-visible {
  outline: 2px solid var(--cosmos-focus-ring);
  outline-offset: 2px;
}

.accounting-line-sub {
  display: block;
  font-size: 0.85em;
  color: var(--cosmos-fg-muted);
}

.accounting-line-missing {
  color: var(--cosmos-status-warn-ink);
  font-weight: 600;
}

.accounting-line-editor {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.25rem 0 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--cosmos-border-strong);
  border-radius: 6px;
  background: var(--cosmos-surface-raised);
}

.accounting-line-editor-title {
  font-weight: 600;
}

.accounting-line-editor-row {
  display: grid;
  gap: 0.75rem;
}

.accounting-line-editor-row-wide {
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
}

.accounting-line-editor-row-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.accounting-line-editor-row-auto {
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.accounting-line-editor label {
  display: block;
  min-width: 0;
  margin: 0;
}

/* A number field fills its grid cell under its label (the table-cell style caps it and pushes it right). */
.accounting-line-editor .accounting-amount-input {
  max-width: none;
  margin-left: 0;
}

.accounting-line-label {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--cosmos-fg-muted);
}

.accounting-line-editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .accounting-line-editor-row-wide,
  .accounting-line-editor-row-four {
    grid-template-columns: 1fr;
  }
}
