:root {
	--bg: #f6f4ef;
	--surface: #ffffff;
	--surface-2: #faf8f3;
	--ink: #0d2231;
	--ink-soft: #34404b;
	--muted: #6b7580;
	--border: #e7e2d8;
	--border-strong: #d8d2c4;
	--gold: #cfaf3e;
	--gold-text: #8a6e1f;
	--danger: #c0392b;
	--radius: 10px;
	--radius-sm: 6px;
	--shadow: 0 1px 2px rgba(13,34,49,0.04), 0 6px 20px rgba(13,34,49,0.05);
	--font: 'Montserrat', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--gold-text); }
:focus-visible { outline: 2px solid rgba(176,136,32,0.5); outline-offset: 2px; }
.tnum { font-variant-numeric: tabular-nums; }

/* Flash */
.flash { padding: 11px 18px; margin: 0; font-size: 0.9rem; text-align: center; border-bottom: 1px solid var(--border); }
.flash--ok { background: #e6f2ea; color: #256844; }
.flash--error { background: #fbeceb; color: #a1291c; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth__card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 34px; box-shadow: var(--shadow); }
.auth__eyebrow { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-text); font-weight: 700; margin: 0 0 6px; }
.auth__title { margin: 0 0 18px; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.auth__notice { color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; }
.auth__error { color: var(--danger); font-size: 0.9rem; margin: 0 0 16px; }
.auth__form { display: flex; flex-direction: column; gap: 10px; }
.auth__label { font-size: 0.85rem; color: var(--muted); }
.auth__input { padding: 13px 15px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--ink); font: inherit; }
.auth__input:focus { outline: none; border-color: var(--gold); background: var(--surface); }
.auth__btn { margin-top: 8px; padding: 13px 16px; background: var(--ink); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 700; font-size: 1rem; cursor: pointer; font-family: var(--font); }
.auth__btn:hover { background: #0a1a26; }

/* Topbar + shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar__brand { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.topbar__search { flex: 1; max-width: 460px; }
.topbar__search input { width: 100%; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; color: var(--ink); }
.topbar__search input:focus { outline: none; border-color: var(--gold); background: var(--surface); }
.topbar__user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--muted); }
.topbar__email { white-space: nowrap; }
.topbar__logout { background: none; border: none; font: inherit; color: var(--muted); cursor: pointer; padding: 8px 10px; border-radius: var(--radius-sm); }
.topbar__logout:hover { color: var(--ink); background: var(--surface-2); }
.shell__main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.shell__head h1 { margin: 0 0 18px; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; }

/* Status pill (semantic language, used list + detail) */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pill--pending { background: #fdf3e2; color: #8a5a12; } .pill--pending .dot { background: #c98a1e; }
.pill--unsure { background: #efecfb; color: #4b3fa0; } .pill--unsure .dot { background: #6d5bd0; }
.pill--manual_submission_required { background: #fbeceb; color: #a1291c; } .pill--manual_submission_required .dot { background: #c0392b; }
.pill--hold { background: #eef1f4; color: #3f4a55; } .pill--hold .dot { background: #52606d; }
.pill--sent_for_signing { background: #e8f0f9; color: #1e4e82; } .pill--sent_for_signing .dot { background: #2b6cb0; }
.pill--signed { background: #e3f2f0; color: #0b5a53; } .pill--signed .dot { background: #0f766e; }
.pill--faxed_to_irs { background: #e6f2ea; color: #256844; } .pill--faxed_to_irs .dot { background: #2f855a; }
.pill--removed { background: #f0f1f2; color: #79818a; } .pill--removed .dot { background: #8a929b; }

/* Buttons */
.btn { font: inherit; font-weight: 600; font-size: 0.85rem; padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--primary:hover { background: #0a1a26; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Stats chips (Welle-1 list; superseded by cockpit strip in Welle 2) */
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 0.85rem; color: var(--muted); }
.stat b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stat--chip { color: var(--gold-text); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.filters__input { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--ink); font: inherit; font-size: 0.9rem; }
.filters__input:focus { outline: none; border-color: var(--gold); }
.filters__btn { padding: 10px 18px; background: var(--ink); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; font-family: var(--font); }
.filters__btn:hover { background: #0a1a26; }
.filters__reset { align-self: center; font-size: 0.85rem; color: var(--muted); }

/* Table */
.tablewrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th { text-align: left; padding: 11px 16px; color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table tbody tr { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table__empty { text-align: center; color: var(--muted); padding: 40px; }
.cell-key { color: var(--ink); font-weight: 700; }
.badge { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; color: var(--ink-soft); }
.pager { margin-top: 16px; }

/* Detail */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.detail__col { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 14px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; color: var(--ink); }
.kv--dense { font-size: 0.82rem; gap: 4px 14px; }
.forms { list-style: none; padding: 0; margin: 0 0 14px; }
.forms li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.forms li:last-child { border-bottom: none; }
.forms .dl { color: var(--muted); }
.forms .dl:hover { color: var(--gold-text); }
.pdfframe { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }

/* Edit fields */
.fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 0.85rem; color: var(--muted); }
.fld span { font-size: 0.8rem; }
.fld select, .fld input[type="text"] { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--ink); font: inherit; font-size: 0.9rem; }
.fld select:focus, .fld input:focus { outline: none; border-color: var(--gold); }
.fld--check { flex-direction: row; align-items: center; gap: 10px; }
.fld--check input { width: 18px; height: 18px; accent-color: var(--ink); }

.notice { background: #fdf3e2; color: #8a5a12; border: 1px solid #f0dcae; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.85rem; margin-bottom: 16px; }

/* Cockpit strip + list bar (Welle 2) */
.listbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; flex: 1; }
.tile { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; transition: border-color .12s, box-shadow .12s; font-family: var(--font); }
.tile:hover { border-color: var(--border-strong); }
.tile.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tile__n { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }
.tile__l { font-size: 0.82rem; color: var(--muted); }
.tile--attention .tile__n { color: #b7791f; }
.tile--progress .tile__n { color: #2b6cb0; }
.tile--done .tile__n { color: #2f855a; }
.finefilter { margin-bottom: 18px; }
.finefilter > summary { cursor: pointer; font-size: 0.82rem; color: var(--muted); font-weight: 600; list-style: none; padding: 4px 0; }
.finefilter > summary::-webkit-details-marker { display: none; }
.finefilter[open] > summary { margin-bottom: 10px; }
.bulkbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px 14px; background: var(--ink); border-radius: var(--radius); color: #fff; flex-wrap: wrap; }
.bulkbar[hidden] { display: none; }
.bulkbar__count { font-size: 0.85rem; font-weight: 600; }
.bulkbar .filters__input { background: var(--surface); color: var(--ink); }
.bulkbar .btn--primary { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.bulkbar .btn--primary:hover { background: #dcc054; }
.bulkbar .btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); }
.bulkbar .btn--ghost:hover { border-color: #fff; }
.col-check { width: 36px; text-align: center; }
.col-check input { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; vertical-align: middle; }
.cell-llc__name { display: block; font-weight: 700; color: var(--ink); }
.cell-llc__sub { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.cell-date { color: var(--ink-soft); }
.table--dense th { cursor: pointer; user-select: none; }
.table--dense th[data-sort]:hover { color: var(--ink); }

/* Detail (Welle 2) */
.detail { grid-template-columns: 1fr 1.1fr; }
.backlink { margin: 0 0 14px; }
.backlink a { color: var(--muted); }
.backlink a:hover { color: var(--ink); }
.card--head h2 { margin: 10px 0 2px; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; }
.head__meta { font-size: 0.82rem; margin: 0 0 14px; }
.quickstatus { display: flex; flex-direction: column; gap: 5px; border-top: 1px solid var(--border); padding-top: 14px; }
.quickstatus__label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.quickstatus select { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--ink); font: inherit; font-size: 0.9rem; }
.quickstatus select:focus { outline: none; border-color: var(--gold); }
.quickstatus select:disabled { opacity: 0.55; cursor: not-allowed; }
.lock { font-size: 0.82rem; color: #a1291c; background: #fbeceb; border-radius: var(--radius-sm); padding: 8px 10px; margin: -2px 0 14px; }
.raw > summary, .edit > summary { cursor: pointer; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; list-style: none; }
.raw > summary::-webkit-details-marker, .edit > summary::-webkit-details-marker { display: none; }
.raw[open] > summary, .edit[open] > summary { margin-bottom: 14px; }
.edit > summary:hover { color: var(--ink); }
.pdftabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.pdftab { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 12px; font: inherit; font-size: 0.82rem; cursor: pointer; color: var(--ink-soft); }
.pdftab:hover { border-color: var(--border-strong); }
.pdftab.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pdfdl { color: var(--muted); padding: 0 6px; }
.pdfdl:hover { color: var(--gold-text); }
.pdfframe { height: 640px; }

/* Empty / error */
.empty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; color: var(--muted); box-shadow: var(--shadow); }
.empty__who { margin-top: 10px; font-size: 0.85rem; color: var(--gold-text); }
.error { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 8px; }
.error h1 { font-size: 3rem; margin: 0; color: var(--ink); }

@media (max-width: 720px) {
	.topbar { flex-wrap: wrap; }
	.topbar__search { order: 3; flex-basis: 100%; max-width: none; }
	.detail { grid-template-columns: 1fr; }
	.tablewrap { overflow-x: auto; }
	.listbar { flex-direction: column; }
	.strip { grid-template-columns: repeat(2, 1fr); width: 100%; }
	.table--dense { min-width: 620px; }
}
