@font-face{font-family:"Montserrat";font-style:normal;font-weight:100 900;font-display:swap;src:url("/static/fonts/Montserrat-Variable.woff2") format("woff2")}
:root{--bg:#f3f4f5;--surface:rgba(255,255,255,.94);--line:#dde1e5;--text:#24282d;--muted:#656d76;--accent:#46515d;--accent-soft:#e9ecef;--green:#16804f;--red:#bf3541;--shadow:0 8px 24px rgba(32,39,46,.06)}
*{box-sizing:border-box}html{background:#eceef0;font-family:"Montserrat",sans-serif}body{margin:0;font-family:inherit;background:var(--bg);color:var(--text);min-height:100vh;font-size:14px}button,input,select{font:inherit}textarea{font-family:inherit}button{transition:.18s ease}aside{position:fixed;inset:0 auto 0 0;width:248px;background:rgba(245,246,247,.94);backdrop-filter:blur(24px);border-right:1px solid rgba(210,215,220,.9);padding:18px 16px 16px;display:flex;flex-direction:column;z-index:5}.brand{display:flex;flex-direction:column;align-items:center;gap:10px;padding:12px 4px 28px}.brand-name{text-align:center;font-size:14px;font-weight:600;letter-spacing:-.3px;line-height:1.4}nav{display:grid;gap:5px}nav button{border:0;background:transparent;color:#434b55;text-align:left;padding:11px 12px;border-radius:11px;font-size:14px;cursor:pointer;display:flex;align-items:center;gap:12px}nav button span{width:20px;text-align:center;color:#68737f;font-size:19px}nav button:hover{background:#eef0f2}nav button.active{background:#e2e6ea;color:#2e3741;font-weight:600}nav button.active span{color:#46515d}.sidebar-foot{margin-top:auto;border-top:1px solid var(--line);padding:18px 8px 0}.profile{display:flex;align-items:center;gap:10px}.profile b{display:block;font-size:13px}.profile small{display:block;color:var(--muted);font-size:11px;margin-top:2px}.avatar{width:36px;height:36px;border-radius:50%;background:linear-gradient(145deg,#e9ecef,#cbd1d7);display:grid;place-items:center;font-size:11px;font-weight:700;color:#3d4650;border:1px solid #fff;box-shadow:0 2px 8px #505a6420}.version{color:#69737e;font-size:10px;margin-top:15px}main{margin-left:248px;min-height:100vh}.topbar{height:78px;border-bottom:1px solid rgba(215,220,225,.9);background:rgba(250,250,251,.9);backdrop-filter:blur(20px);display:flex;align-items:center;justify-content:space-between;padding:0 34px;position:sticky;top:0;z-index:4}.search-shell{height:39px;width:min(720px,60vw);border:1px solid #dfe3e7;background:rgba(255,255,255,.78);border-radius:22px;display:flex;align-items:center;gap:10px;padding:0 16px;color:#68727d;box-shadow:0 3px 15px rgba(32,39,46,.03)}.top-user{display:flex;align-items:center;gap:9px;color:#3e4751;font-size:12px}.small-avatar{width:32px;height:32px}.page{padding:30px 34px 46px;max-width:1680px;margin:auto}header{display:flex;justify-content:space-between;align-items:flex-end;margin-bottom:24px}h1{margin:0;font-size:30px;line-height:1.05;letter-spacing:-1px;font-weight:700}header p{margin:7px 0 0;color:var(--muted);font-size:14px}.primary{background:linear-gradient(180deg,#525c67,#3d4650);color:#fff;border:0;border-radius:10px;padding:10px 16px;font-weight:600;cursor:pointer;box-shadow:0 5px 14px rgba(32,39,46,.14)}.primary:hover{transform:translateY(-1px);box-shadow:0 7px 18px rgba(32,39,46,.2)}.cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}.card,.panel{background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);backdrop-filter:blur(12px)}.card{padding:19px 20px;min-height:112px;position:relative;overflow:hidden}.metric{font-size:26px;font-weight:700;letter-spacing:-.8px;margin-top:10px}.muted{color:var(--muted);font-size:12px;line-height:1.55}.positive{color:var(--green)}.grid2{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(280px,.65fr);gap:18px}.panel{padding:20px}.panel h3{margin:0 0 16px;font-size:17px;letter-spacing:-.3px}.panelhead{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:8px}.panelhead h3{margin:0}.dashboard-welcome{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin:0}.dashboard-welcome h2{font-size:28px;margin:0;letter-spacing:-.8px}.dashboard-date{flex-shrink:0;display:block;max-width:100%;color:var(--muted);font-size:13px}.dashboard-date time{white-space:nowrap;font-variant-numeric:tabular-nums}.dashboard-welcome>div{min-width:0}.quick-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}.quick-actions button{width:100%}.quick-actions button:hover{filter:brightness(.97);transform:translateY(-1px)}.system-stat{display:flex;justify-content:space-between;padding:12px 0;border-bottom:1px solid #e7eaed}.system-stat:last-child{border:0}.system-stat b{font-size:15px}table{width:100%;border-collapse:separate;border-spacing:0}th{text-align:left;color:#66727e;font-size:10px;letter-spacing:.25px;font-weight:600;padding:10px 9px;border-bottom:1px solid #e0e4e8}td{padding:12px 9px;border-bottom:1px solid #e7eaed;font-size:13px;vertical-align:middle}tbody tr:last-child td{border-bottom:0}.badge{display:inline-block;padding:5px 9px;border-radius:999px;background:var(--accent-soft);color:#46515d;font-size:10px;font-weight:600}.toolbar{display:flex;justify-content:flex-start;gap:7px;margin-bottom:14px;flex-wrap:nowrap}.empty{text-align:center;color:#68737f;padding:46px}.modal{display:none;position:fixed;inset:0;background:rgba(28,33,39,.32);backdrop-filter:blur(8px);align-items:center;justify-content:center;z-index:20;padding:24px}.modal.show{display:flex}.dialog{background:rgba(255,255,255,.97);width:min(650px,94vw);max-height:90vh;overflow:auto;border-radius:20px;padding:28px;position:relative;box-shadow:0 30px 80px rgba(28,33,39,.2);border:1px solid #fff}.dialog h2{margin:0 36px 20px 0;font-size:22px;letter-spacing:-.5px}.close{position:absolute;right:18px;top:15px;border:0;background:#edf0f2;width:29px;height:29px;border-radius:50%;font-size:20px;line-height:1;cursor:pointer;color:#626e7a}.close:hover{background:#e1e5e9}.field{display:grid;gap:6px;margin:13px 0}.field label{font-size:11px;color:#626d78;font-weight:500}.field input,.field select,.selectaction select,.uploadrow select,.uploadrow input{padding:10px 11px;border:1px solid #d7dde3;border-radius:10px;background:#fcfcfd;color:#242c34;outline:none}.field input:focus,.field select:focus{border-color:#85919e;box-shadow:0 0 0 3px #e3e7ec}.row{display:grid;grid-template-columns:1fr 1fr;gap:12px}.submit{margin-top:16px;width:100%}.click{cursor:pointer}.click:hover td{background:#f6f7f8}.link,.dangerlink{border:0;background:none;cursor:pointer;font-weight:600;padding:4px}.link{color:#46515d}.dangerlink{color:var(--red)}.secondary,.danger{border:1px solid #d7dde3;background:rgba(255,255,255,.9);border-radius:10px;padding:9px 13px;cursor:pointer;color:#424c57}.secondary:hover{background:#f3f5f6}.danger{color:var(--red);border-color:#e9c4c8}.timeline{border-left:2px solid #d9dfe5;margin-left:7px;padding-left:18px}.timeline div{margin:0 0 18px;position:relative}.timeline div:before{content:'';position:absolute;width:9px;height:9px;border-radius:50%;background:var(--accent);left:-24px;top:5px}.timeline small,.sub{display:block;color:#68737f;font-size:10px;margin-top:4px}hr{border:0;border-top:1px solid #e7eaed;margin:22px 0}.small{padding:7px 11px;font-size:12px}.selectaction{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center}.selectaction .secondary{margin:0;white-space:nowrap}.compact{padding:22px}.uploadrow{display:grid;grid-template-columns:110px 1fr auto;gap:7px;margin-bottom:14px}.docrow{display:grid;grid-template-columns:1fr auto auto;gap:8px;align-items:center;padding:8px 0;border-bottom:1px solid #e7eaed}.docrow span{font-size:10px;color:#68737f}.previewcard h3{font-size:18px;margin:4px 0 18px}.previewtype{display:inline-block;padding:5px 9px;border-radius:20px;background:var(--accent-soft);color:#46515d;font-size:10px;margin-bottom:6px}.previewrow{display:grid;grid-template-columns:190px 1fr;gap:16px;padding:9px 0;border-bottom:1px solid #e7eaed;align-items:start}.previewrow span{color:#64717d;font-size:12px}.previewrow b{font-size:13px;font-weight:600;word-break:break-word}.previewactions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}.projectdetails .detailgrid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:0;border:1px solid #e0e4e8;border-radius:12px;overflow:hidden}.projectdetails .detailgrid>div{padding:13px 14px;border-right:1px solid #e0e4e8}.projectdetails .detailgrid>div:last-child{border-right:0}.projectdetails .detailgrid span{display:block;color:#66727e;font-size:10px;margin-bottom:5px}.projectdetails .detailgrid b{font-size:13px;word-break:break-word}.notice{background:#f4f6f7;border:1px solid #dde3e8;border-radius:11px;padding:11px 13px;color:#56616d;font-size:12px;margin:10px 0}
@media(max-width:1100px){.cards{grid-template-columns:1fr 1fr}.grid2{grid-template-columns:1fr}.projectdetails .detailgrid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:760px){aside{width:74px;padding:18px 10px}.sidebar-foot{display:none}.brand{padding:8px 0 20px}.brand-name{font-size:9px;line-height:1.35;overflow-wrap:anywhere}nav button{font-size:0;justify-content:center;padding:11px}nav button span{font-size:20px}main{margin-left:74px}.topbar{padding:0 16px}.search-shell{width:auto;flex:1}.top-user b{display:none}.page{padding:22px 16px}.cards{grid-template-columns:1fr}.row{grid-template-columns:1fr}.projectdetails .detailgrid{grid-template-columns:1fr}.grid2{grid-template-columns:1fr}header{align-items:flex-start;gap:12px}h1{font-size:25px}}
@media(max-width:520px){.search-shell span{display:none}.quick-actions{grid-template-columns:1fr}.panel{overflow-x:auto}.dashboard-welcome{align-items:flex-start;gap:4px;flex-direction:column}}
:root .auth-screen{min-height:100vh;display:grid;place-items:center;padding:24px}
.auth-card{width:min(100%,380px);padding:32px;border:1px solid var(--line);border-radius:20px;background:var(--surface);box-shadow:var(--shadow);backdrop-filter:blur(24px)}
.auth-card h1{font-size:24px;line-height:1.2;text-wrap:balance}.auth-card form{margin-top:24px}.auth-card .primary{width:100%;margin-top:10px}.auth-card input{width:100%}#authMessage{min-height:36px;color:var(--muted);line-height:1.5;margin:16px 0 0}.auth-logout{font-size:12px;white-space:nowrap}
header.dashboard-header{flex-direction:column;align-items:flex-start;gap:20px;margin-bottom:20px}
#form .submit:disabled{opacity:.55;cursor:not-allowed;transform:none}
body:not(.authenticated)>aside,body:not(.authenticated)>main,body:not(.authenticated)>#modal{display:none!important}
body.authenticated>.auth-screen{display:none}

/* Steel Grey: responsive containment and keyboard focus. */
.brand-logo{display:block;width:104px;max-width:100%;height:auto;object-fit:contain;flex-shrink:0}
@media(max-width:760px){.brand-logo{width:44px}}
.grid2>div,.cards>div,main,.page{min-width:0}.panel{max-width:100%;overflow-x:auto}.topbar{gap:12px}.search-shell{min-width:0}.search-shell span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.top-user{flex-shrink:0}.field input,.field select{min-width:0;width:100%}button:focus-visible,a:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
@media(max-width:760px){.page{max-width:100%}.topbar{gap:8px}.panelhead{flex-wrap:wrap}.previewrow{grid-template-columns:1fr;gap:5px}.uploadrow{grid-template-columns:1fr}.uploadrow input{min-width:0;width:100%}.docrow{grid-template-columns:minmax(0,1fr) auto auto}.docrow a{overflow-wrap:anywhere}}

/* Shared creation actions; names and forms remain independent. */
.toolbar>.action-button{min-width:0;white-space:nowrap}
.action-button[hidden]{display:none}
.action-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:10px 16px;line-height:20px;font-weight:600;border-radius:10px;margin:0;text-align:center}.quick-actions{grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr))}

/* Equal modal actions, including narrow screens. */
.modal-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px}
.modal-actions>button{width:100%;min-width:0;height:44px;margin:0;padding:10px 12px;border:1px solid transparent;border-radius:10px;line-height:20px;font-weight:600;text-align:center}
.modal-actions>.secondary{background:#e9edf0;border-color:#d7dde3;color:#424c57}
.modal-actions>.secondary:hover{background:#dfe4e8}
.modal-actions>button:hover{transform:none}
/* UI FIX 03: native dialog provides focus trapping and modal semantics. */
.pdf-preview{color:var(--text,#24282d);background:#f5f6f7;border:1px solid #d6dbe1;border-radius:20px;width:min(1120px,94vw);height:90dvh;max-height:94dvh;padding:22px;box-sizing:border-box;overflow:hidden}
.pdf-preview::backdrop{background:#0009;backdrop-filter:blur(6px)}
.pdf-preview[open]{display:flex;flex-direction:column;gap:12px}
.pdf-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}.pdf-heading h2{margin:0 0 6px;overflow-wrap:anywhere}
.pdf-actions{display:flex;gap:10px;flex-wrap:wrap}.pdf-actions a{text-decoration:none;display:inline-block}.pdf-actions [aria-disabled=true]{opacity:.45;pointer-events:none}
.pdf-preview iframe{width:100%;flex:1;min-height:0;border:0;border-radius:8px;background:#444}.pdf-preview iframe[hidden]{display:none}
#previewStatus{font-size:13px;margin:0;color:var(--muted,#656d76)}body:not(.authenticated) #contractPreview{display:none!important}
@media(max-width:600px){.pdf-preview{width:98vw;height:96dvh;max-height:98dvh;padding:12px;border-radius:12px}.pdf-actions{gap:6px}.pdf-actions .secondary{padding:10px;font-size:12px}.pdf-heading h2{font-size:18px}}

/* Project plan shares the existing cards, panels and modal. */
.project-detail-actions button{min-height:30px;padding:7px 11px;font-size:11px;border-radius:8px;line-height:16px}
.contract-table{min-width:960px;width:100%}
#projectCosts .finance-table th:last-child{width:230px}
.projectdetails h2,.project-contracts h2,.project-documents h2,.project-notes h2,#projectCosts h2{font-size:20px;margin:0 0 12px}
#projectCosts,.project-contracts,.project-documents,.project-notes{margin-top:24px}
.notes-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}
.project-notes textarea{display:block;width:100%;max-width:100%;resize:vertical;font:inherit;border:1px solid var(--line);border-radius:10px;padding:12px;margin:8px 0 16px;background:var(--surface);color:var(--text)}
.project-notes textarea:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.project-notes [hidden]{display:none!important}
#projectCosts .finance-table{min-width:900px}
.finance-heading{margin-top:24px}.finance-heading h2,.legacy-settlement h2{font-size:21px;margin:0}.finance-heading p{margin:6px 0 0}
.finance-cards .metric{font-size:clamp(20px,2vw,26px);overflow-wrap:anywhere}.negative{color:var(--red)}
.finance-table-scroll{overflow-x:auto;max-width:100%}.finance-table{min-width:800px;width:100%;table-layout:fixed}.finance-table th:first-child{width:42px}.finance-table th:nth-child(5){width:155px}.finance-table th:last-child{width:230px}.finance-table td{overflow-wrap:anywhere}.finance-amount{white-space:nowrap}.finance-description{min-width:160px}
.finance-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.finance-actions button:disabled{opacity:.4;cursor:not-allowed}.finance-total{text-align:right;border-top:1px solid var(--line);padding-top:16px;margin-bottom:0}.finance-legacy-note{line-height:1.5}.legacy-settlement{margin-top:32px}.legacy-settlement>p{line-height:1.5}.project-toolbar{flex-wrap:wrap}
.finance-combo{position:relative}.finance-options{position:absolute;z-index:5;top:100%;left:0;right:0;background:var(--surface,#fff);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);max-height:200px;overflow:auto;padding:5px}.finance-options[hidden]{display:none}.finance-options button{display:block;background:transparent;border:0;width:100%;text-align:left;padding:10px;color:var(--text);overflow-wrap:anywhere}.finance-options button:hover,.finance-options button[aria-selected=true]{background:#e9edf0}.finance-options>span{display:block;padding:10px}
#financeEditorRefresh{margin:8px 0}#financePlan button:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:760px){.finance-heading{align-items:flex-start;gap:12px}.finance-heading h2{font-size:20px}.finance-cards .card{min-height:100px}.finance-cards .metric{font-size:24px}}
/* Display positions, never database identifiers. */
table .list-ordinal{width:42px;min-width:42px;text-align:right;color:var(--muted);font-variant-numeric:tabular-nums;font-weight:400;white-space:nowrap}
.contract-table th:last-child,.contract-table td:last-child{width:1%;white-space:nowrap}
/* Purchase document review remains in the existing application shell. */
.finance-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:18px}
.finance-tabs button{border:1px solid var(--line);padding:10px 14px;border-radius:10px;background:var(--surface);color:var(--text);cursor:pointer}
.finance-tabs [aria-selected="true"]{background:#e2e6ea;color:#2e3741;font-weight:600}
.purchase-review{display:grid;grid-template-columns:minmax(0,1fr) minmax(320px,1fr);gap:20px;align-items:start}
.purchase-review .panel{min-width:0}
.purchase-document{position:sticky;top:20px}
.purchase-document iframe{width:100%;height:680px;border:1px solid #ddd;background:#fff}
.purchase-document p,.purchase-confidence,.purchase-warnings{overflow-wrap:anywhere}
.purchase-confidence{display:block;color:#666;margin-top:4px}
.purchase-review label{display:block}
.purchase-review input[type=checkbox]{width:auto;margin-right:6px}
.purchase-save{margin-top:18px}
#purchaseDuplicates{margin:16px 0}
#purchaseMessage:empty{display:none}
.finance-tabs button:focus-visible,.purchase-review button:focus-visible{outline:3px solid #5848dc;outline-offset:3px}
@media(max-width:900px){.purchase-review{grid-template-columns:minmax(0,1fr)}.purchase-document{position:static}.purchase-document iframe{height:420px}}
.purchase-allocation{grid-column:1/-1}
#ksefQuery{display:flex;gap:12px;flex-wrap:wrap;align-items:end}
#ksefQuery label{display:flex;flex-direction:column;gap:6px}
#ksefPreview td{overflow-wrap:anywhere;max-width:300px}
.allocation-summary{display:flex;gap:20px;flex-wrap:wrap;margin:16px 0}
.allocation-row{border:1px solid var(--line);padding:14px;margin:12px 0;border-radius:10px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.allocation-row label,.purchase-allocation form label{display:block;min-width:0}
.purchase-allocation [hidden]{display:none}
.allocation-row p{grid-column:1/-1;overflow-wrap:anywhere}
.purchase-allocation fieldset{min-width:0;border:1px solid var(--line)}
.purchase-allocation details{margin:16px 0;padding:12px;border:1px solid var(--line);border-radius:10px}
.purchase-allocation summary{cursor:pointer;font-weight:600}
.purchase-allocation form{margin-top:14px;max-width:680px}
.purchase-allocation input,.purchase-allocation select{display:block;width:100%;min-width:0;margin-top:6px;padding:10px 11px;border:1px solid #d7dde3;border-radius:10px;background:#fcfcfd;color:#242c34}
.purchase-allocation form label{margin:12px 0}
.purchase-allocation button{min-height:40px;padding:9px 12px;margin:4px 4px 4px 0;border:1px solid #d7dde3;border-radius:10px;background:#fcfcfd;color:#424c57;cursor:pointer;white-space:normal}
.purchase-allocation button:disabled{opacity:.5;cursor:not-allowed}
.purchase-allocation input:focus,.purchase-allocation select:focus{outline:2px solid var(--accent);outline-offset:2px}
@media(max-width:900px){.allocation-row{grid-template-columns:minmax(0,1fr)}}
/* Stage 3A: compact integrated read-only KSeF controls. */
.purchase-actions{flex-wrap:wrap;gap:10px}.purchase-actions>.action-button{width:210px;height:40px}
.ksef-settings{border:1px solid var(--line);border-radius:12px;padding:16px;margin:0 0 16px;background:var(--surface)}
.ksef-settings h2{font-size:16px;margin:0 0 8px}.ksef-settings p{margin:8px 0}
#ksefQuery label{font-size:12px;color:var(--muted)}#ksefQuery input{padding:9px 10px;border:1px solid var(--line);border-radius:10px;background:#fcfcfd;color:var(--text);height:40px;box-sizing:border-box}
#ksefQuery>p{flex-basis:100%;margin:0}#ksefQuery button{height:40px}
#ksefStatus{font-size:12px;overflow-wrap:anywhere}#ksefStatus::before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:8px;background:#a77b24}
#ksefStatus[data-state=success]::before{background:var(--green)}#ksefStatus[data-state=failure]::before{background:var(--red)}
.purchase-filter{max-width:420px;margin:0 0 14px}.ksef-pagination{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.purchase-sort{border:0;background:none;padding:0;text-align:left;font:inherit;color:inherit;cursor:pointer}.purchase-sort span{opacity:.65}
.purchase-actions button:disabled,.ksef-pagination button:disabled,#ksefCheck:disabled{opacity:.55;cursor:not-allowed;transform:none}
/* Shared existing dark control style, scoped to the Finance navigation/preview. */
.finance-tabs .finance-control,.purchase-actions .finance-control,#ksefQuery .finance-control,.ksef-pagination .finance-control{width:210px;height:40px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--accent);border-radius:10px;background:linear-gradient(180deg,#525c67,#3d4650);color:#fff;padding:9px 12px;font:inherit;font-weight:600;cursor:pointer}
.finance-tabs .finance-control[aria-selected=true]{outline:2px solid var(--muted);outline-offset:2px}
#ksefQuery{align-items:center}#ksefQuery label{flex-direction:row;align-items:center;gap:8px}#ksefQuery input{width:150px}
.purchase-search{position:relative}.purchase-search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;fill:none;stroke:var(--muted);stroke-width:1.6;pointer-events:none}#purchaseFilter{padding-left:36px}
.dashboard-top{grid-template-columns:repeat(4,minmax(0,1fr))}
#subtitle:empty{display:none}
.dashboard-quick{padding:16px}.dashboard-quick h3{font-size:15px;margin-bottom:10px}
.status-all{color:#43658b}.status-produkcja{color:#886821}.status-zakończony{color:#397153}.status-rozliczony{color:#70538c}
.project-statuses .system-stat{border-radius:8px;padding:12px 8px}.project-statuses .system-stat span{color:inherit}
.project-filters{--filter-control-height:34px;display:flex;flex-wrap:wrap;gap:12px;margin-bottom:14px}.project-filters label{display:grid;gap:6px;font-size:12px;flex:1 1 140px}.project-filters input,.project-filters select{min-width:0;width:100%;padding:9px;border:1px solid var(--line);border-radius:10px}.project-filters p{width:100%;margin:0}
.search-shell{position:relative;min-width:0}.search-shell input{width:100%;min-width:0;border:0;outline:none;background:transparent;padding-left:18px}.search-shell:focus-within{border-color:#85919e}
#globalSearchResults{position:absolute;top:44px;left:0;right:0;max-height:360px;overflow:auto;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);padding:10px;color:var(--text)}
#globalSearchResults[hidden]{display:none}.global-search-result{display:block;width:100%;border:0;background:none;text-align:left;padding:10px;border-radius:8px;cursor:pointer;overflow-wrap:anywhere}.global-search-result:hover,.global-search-result:focus{background:var(--accent-soft)}.ksef-integration{margin-top:16px}
@media(max-width:700px){.dashboard-top{grid-template-columns:repeat(2,minmax(0,1fr))}.search-shell{width:min(450px,48vw)}}
#purchaseList .purchase-invoice-table{table-layout:fixed;min-width:0}#purchaseList .purchase-invoice-table th{position:relative;padding-right:18px}#purchaseList .purchase-invoice-table td{overflow-wrap:anywhere}
.purchase-resize{position:absolute;right:0;top:0;bottom:0;width:10px;cursor:col-resize;touch-action:none;user-select:none}.purchase-resize::after{content:"";position:absolute;right:4px;top:22%;bottom:22%;width:1px;background:var(--line)}.purchase-resize:hover::after{background:var(--muted)}.purchase-resizing{user-select:none;cursor:col-resize}
@media(max-width:600px){.finance-tabs,.purchase-actions,.ksef-pagination{align-items:flex-start}.finance-tabs .finance-control,.purchase-actions .finance-control,#ksefQuery .finance-control,.ksef-pagination .finance-control{width:min(210px,100%)}#ksefQuery label{flex:none;min-width:0}#ksefQuery input{width:150px}}

#purchaseList{width:100%;min-width:0}
#purchaseList .purchase-invoice-table{width:100%}

#salesCard{margin-top:18px} #hubConfig .field{max-width:320px}
/* Shared compact table system: app lists, finance and local FA(3) previews. */
table{font-variant-numeric:tabular-nums}
th{padding:7px 9px;line-height:18px;font-size:11px;vertical-align:middle}
td{padding:6px 9px;line-height:22px;font-size:13px}
/* Shared row feedback; keyboard focus remains visible without the heavy finance outline. */
tbody tr:hover>td{background:#f6f7f8}
tbody tr:is(.click,[tabindex="0"],.source-invoice-cost){cursor:pointer}
tbody tr:is(.click,[tabindex="0"],.source-invoice-cost):focus-visible{outline:1px solid #aeb8c2;outline-offset:-2px}
tbody tr:is(.click,[tabindex="0"],.source-invoice-cost):focus-visible>td{background:#eef1f3}
/* Data only: column headers, action controls and all non-table typography are unchanged. */
tbody td,tbody td :is(b,strong,.badge,[data-hub-open],[data-purchase-open]){font-weight:400}
table .badge{padding:2px 7px;line-height:18px}
table .link,table .dangerlink,table .purchase-sort{padding:0 4px;line-height:22px}
th.numeric,td.numeric{text-align:right;white-space:nowrap}
.table-toolbar{align-items:flex-end;flex-wrap:wrap;gap:10px;margin:10px 0 12px}
.table-toolbar:has(>.field:only-of-type){flex-wrap:nowrap}
.table-toolbar .field{margin:0;gap:4px;min-width:0;flex:1 1 100px}
.table-toolbar .field input,.table-toolbar .field select,.project-filters input,.project-filters select{height:var(--filter-control-height,34px);min-width:0;width:100%;padding:5px 9px;border:1px solid var(--line);border-radius:8px}
.table-toolbar-action{height:34px;display:flex;align-items:center}
.table-toolbar-action button{margin:0;max-height:34px;padding:6px 12px}
.finance-summary{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
.finance-projects,.ksef-integration{margin-top:18px}
#invoiceSyncResult{white-space:pre-line}
.invoice-preview{padding:14px;background:#fff;overflow-wrap:anywhere}
.invoice-lines th:not(:first-child),.invoice-lines td:not(:first-child){text-align:right}
.invoice-lines{min-width:420px}
/* Dashboard: KPI and main rows share the same four column tracks. */
.dashboard-kpi-grid .card{height:120px;min-height:120px;padding:14px 18px;display:flex;flex-direction:column;justify-content:center}
.dashboard-kpi-grid .card>span:first-child{display:block;padding-right:40px;line-height:16px}
.dashboard-kpi-grid .metric{margin-top:6px;line-height:30px}
.dashboard-kpi-grid .metric+span{display:block;margin-top:4px;line-height:15px}
.dashboard-kpi-icon{position:absolute;top:14px;right:14px;width:34px;height:34px;border-radius:10px;background:var(--accent-soft);color:#78838e;display:grid;place-items:center}
.dashboard-kpi-icon svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.dashboard-kpi-grid,.dashboard-main-grid{--dashboard-columns:repeat(4,minmax(0,1fr));grid-template-columns:var(--dashboard-columns);gap:18px}.dashboard-main-grid{display:grid;align-items:start}.dashboard-projects{grid-column:span 3}
.dashboard-projects,.dashboard-sidebar{min-width:0}
.dashboard-sidebar{display:grid;gap:18px}
.dashboard-sidebar>.panel{width:100%;margin:0}
.dashboard-sidebar .quick-actions{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.dashboard-sidebar .quick-actions .action-button{height:40px;min-height:40px;padding:10px 16px;font-size:14px;white-space:nowrap}
@media(max-width:1100px){.dashboard-projects{grid-column:auto}.dashboard-main-grid{grid-template-columns:minmax(0,1fr)}.dashboard-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){.dashboard-kpi-grid .card{padding:12px;height:auto}.dashboard-kpi-grid .metric{font-size:18px;letter-spacing:-.5px}.dashboard-kpi-icon{top:10px;right:10px;width:30px;height:30px}.dashboard-sidebar .quick-actions .action-button{padding:6px 4px;font-size:11px}}
.source-cost-table{table-layout:fixed;min-width:760px;width:100%}.source-cost-table th:nth-child(1){width:105px}.source-cost-table th:nth-child(2){width:18%}.source-cost-table th:nth-child(3){width:80px}.source-cost-table th:nth-child(4){width:20%}.source-cost-table th:nth-child(6){width:115px}.source-cost-table th:nth-child(7){width:65px}.source-cost-table td{overflow-wrap:anywhere}


@media(min-width:1101px) and (max-width:1550px){.dashboard-sidebar .dashboard-quick{padding-inline:12px}.dashboard-sidebar .quick-actions{column-gap:4px}.dashboard-sidebar .quick-actions .action-button{padding:10px 2px;font-size:12px;gap:2px;min-width:0}}
@media(min-width:1101px) and (max-width:1200px){.dashboard-sidebar .quick-actions .action-button{padding:10px 1px;font-size:10px;gap:2px}}

/* Only the requested table actions use this compact outlined variant. */
.record-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:5px;max-width:260px;min-width:140px}
table .record-action{display:inline-flex;align-items:center;justify-content:center;min-height:28px;padding:2px 8px;line-height:22px;border:1px solid #d7dde3;border-radius:7px;background:transparent;text-decoration:none;box-shadow:none;white-space:nowrap}
table .record-action:hover{background:#f0f2f4;text-decoration:none}
table .record-action.dangerlink{border-color:#e9c4c8}
.project-filters>.finance-actions{align-self:flex-end;height:var(--filter-control-height);align-items:center}
.project-filters>.finance-actions>button{height:100%;padding-top:0;padding-bottom:0;display:inline-flex;align-items:center;justify-content:center}

/* Contract actions keep their natural compact width and scroll with the table on narrow screens. */
.contract-table .record-actions{flex-wrap:nowrap;max-width:none;min-width:max-content}
/* Section and page headings follow the existing invoice hub reference. */
#content :is(h2,h3){font-family:inherit;font-size:21px;font-weight:700;color:var(--text);line-height:normal;letter-spacing:normal;margin:.83em 0}
.dashboard-welcome h2,#content .dashboard-welcome h2{font-family:inherit;font-size:30px;font-weight:700;color:var(--text);line-height:1.05;letter-spacing:-1px;margin:0}
#content .dashboard-quick h3{margin:0 0 10px}
#content .project-statuses h3{margin:0 0 10px}
.project-statuses .system-stat:last-child{padding-bottom:0}

/* Keep invoice dates readable on one line in the existing scrollable hub tables. */
#purchaseCard [data-hub-table] td:first-child,#salesCard [data-hub-table] td:first-child{white-space:nowrap}
