/* E-invoice page (portal/erechnung/). Tokens from /css/tokens.css. */
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--surface-sunken); }
.hidden { display: none !important; }

.er-header { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-3) var(--sp-4); background: var(--surface); box-shadow: var(--shadow); }
.er-brand { font-weight: 700; color: var(--primary); }
.er-brand__sub { font-weight: 400; color: var(--muted); }
.er-main { max-width: 60rem; margin: 0 auto; padding: var(--sp-4); }

.er-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--sp-4); margin-bottom: var(--sp-4); }
[data-role="auth"] { max-width: 28rem; margin: var(--sp-5) auto; }
.er-title { font-size: 1.25rem; margin: 0 0 var(--sp-3); }
.er-subtitle { font-size: 1.05rem; margin: 0; }
.er-muted { color: var(--muted); font-size: 0.9rem; }
.er-empty { color: var(--muted); }

.er-tabs { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); border-bottom: 1px solid var(--border); }
.er-tabs button { background: none; border: 0; padding: var(--sp-2) var(--sp-3); font: inherit; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.er-tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }

.er-form { display: grid; gap: var(--sp-3); }
.er-form label { display: grid; gap: var(--sp-1); font-size: 0.9rem; }
.er-form input:not([type="checkbox"]) { font: inherit; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.er-check { grid-template-columns: auto 1fr; align-items: start; }
.er-trap { position: absolute; left: -10000px; }

.er-button { font: inherit; background: var(--primary); color: #fff; border: 0; border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-4); cursor: pointer; }
.er-button:hover { background: var(--primary-dark); }
.er-button:disabled { opacity: 0.5; cursor: default; }
.er-button--small { padding: var(--sp-1) var(--sp-3); font-size: 0.9rem; }
.er-link { background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; }
.er-link--left { justify-self: start; padding: 0; font-size: 0.9rem; }
.er-signed-in { background: var(--surface-sunken); border-left: 4px solid var(--warning); padding: var(--sp-3); border-radius: var(--radius-sm); }
.er-signed-in .er-link { padding: 0; }

.er-notice { background: var(--surface); border-left: 4px solid var(--primary); padding: var(--sp-3); border-radius: var(--radius-sm); }
.er-notice--error { border-left-color: var(--danger); }

.er-address { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; font-size: 1.05rem; }
.er-address code { background: var(--surface-sunken); padding: var(--sp-1) var(--sp-2); border-radius: var(--radius-sm); word-break: break-all; }

.er-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.er-table-wrap { overflow-x: auto; }
.er-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.er-table th, .er-table td { text-align: left; padding: var(--sp-2); border-bottom: 1px solid var(--border); vertical-align: top; }
.er-table th { background: var(--panel-head); font-weight: 600; }
.er-num { text-align: right !important; white-space: nowrap; }
.er-ok { color: var(--success); }
.er-warn { color: var(--warning); }
.er-warn summary { cursor: pointer; }
.er-warn ul { margin: var(--sp-1) 0 0; padding-left: var(--sp-4); color: var(--text); }
/* links wrap one by one (three on a ZUGFeRD invoice), so the table never needs a side scroll */
.er-actions a { display: inline-block; white-space: nowrap; margin-right: var(--sp-2); color: var(--primary); }

/* phone and tablet: one card per invoice (cells: 1 pick, 2 received, 3 supplier, 4 no., 5 date, 6 amount, 7 check, 8 files) */
@media (max-width: 820px) {
    .er-table, .er-table tbody, .er-table thead { display: block; }
    .er-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-1) var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
    .er-table td, .er-table th { border: 0; padding: 0; background: none; }
    .er-table thead th:not(:first-child), .er-table td:nth-child(4), .er-table td:nth-child(5) { display: none; }
    .er-table thead th:first-child::after { content: " Alle"; font-weight: 400; }
    .er-table td:nth-child(1) { grid-column: 1; grid-row: 1 / span 4; }
    .er-table td:nth-child(3) { grid-column: 2; grid-row: 1; font-weight: 600; }
    .er-table td:nth-child(6) { grid-column: 3; grid-row: 1; }
    .er-table td:nth-child(2) { grid-column: 2 / 4; grid-row: 2; color: var(--muted); }
    .er-table td:nth-child(7) { grid-column: 2 / 4; grid-row: 3; }
    .er-table td:nth-child(8) { grid-column: 2 / 4; grid-row: 4; }
    .er-actions a { margin-right: var(--sp-3); }
}
