:root{--bg:#f5f4f1;--paper:#fff;--ink:#252421;--muted:#726d65;--line:#e5e1d9;--gold:#b79b59;--gold-dark:#8f773d;--dark:#20201e;--green:#4c6951;--orange:#9b672c;--red:#a13d35}
*{box-sizing:border-box}body{margin:0;color:var(--ink);background:var(--bg);font:14px/1.5 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif}button,input,textarea,select{font:inherit}button{cursor:pointer}a{color:inherit;text-decoration:none}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible{outline:2px solid var(--gold-dark);outline-offset:2px}[hidden]{display:none!important}
.topbar{background:var(--dark);color:#f6f5f0;min-height:74px;padding:13px clamp(16px,3vw,42px);display:flex;align-items:center;gap:26px;justify-content:space-between}.brand{display:flex;align-items:center;gap:9px;font-weight:770;letter-spacing:.1em;font-size:17px;white-space:nowrap}.brand .mark{border:1px solid #6b6456;color:var(--gold);border-radius:11px;width:39px;height:39px;display:grid;place-items:center;font-size:26px}.brand .gold{color:var(--gold)}.brand small{display:block;color:#aaa49a;letter-spacing:.18em;font-size:8px}.nav{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.nav a,.nav span{font-size:12px;padding:9px 11px;border-radius:8px;color:#c8c3b9}.nav a:hover,.nav span{background:#3d3b34;color:#fff}.user{display:flex;align-items:center;gap:12px;font-size:12px;white-space:nowrap}.user a,.user button{color:#eee;background:transparent;border:1px solid #55524c;border-radius:8px;padding:8px 10px}.user a:hover,.user button:hover{border-color:#b79b59}main{max-width:1660px;padding:30px clamp(15px,3vw,48px) 42px;margin:auto}.page-head{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:20px}.page-head h1{font-size:31px;letter-spacing:-.045em;margin:1px 0 5px}.eyebrow{font-size:11px;color:var(--gold-dark);letter-spacing:.14em;font-weight:800;margin:0}.subhead,.helper{color:var(--muted);margin:0}.button{display:inline-flex;gap:8px;align-items:center;justify-content:center;border:1px solid #ccc5b9;background:#fff;border-radius:9px;padding:10px 14px;min-height:43px;color:var(--ink);font-weight:650;text-align:center;white-space:normal}.button.primary{background:var(--dark);color:#fff;border-color:var(--dark)}.button:hover{box-shadow:0 0 0 2px #b79b5934}.button:disabled{opacity:.45;cursor:wait}.button.small{padding:6px 9px;min-height:34px;font-size:12px}.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:18px}.stat{border:1px solid var(--line);border-radius:13px;background:#fff;padding:15px 19px;display:flex;flex-direction:column;gap:3px}.stat span{color:var(--muted);font-size:12px}.stat strong{font-size:27px;line-height:1.2}.layout{display:grid;grid-template-columns:minmax(260px,360px) minmax(0,1fr);gap:15px;align-items:start}.panel{border:1px solid var(--line);background:var(--paper);border-radius:14px;box-shadow:0 4px 16px #16120d09;min-width:0;overflow:hidden}.panel-heading{padding:17px 18px;border-bottom:1px solid var(--line);display:flex;gap:12px;justify-content:space-between;align-items:center}.panel-heading h2{font-size:16px;letter-spacing:-.02em;margin:0}.counter{color:var(--muted);font-size:11px}.project-filters{padding:13px;display:grid;gap:9px;border-bottom:1px solid var(--line)}input,select,textarea{background:#fff;border:1px solid #d5d0c6;border-radius:8px;padding:10px 11px;color:var(--ink);width:100%;min-width:0;min-height:42px}input[type="checkbox"]{width:18px;height:18px;min-height:0;accent-color:var(--gold-dark)}textarea{min-height:100px;resize:vertical}.project-list{max-height:calc(100vh - 325px);min-height:200px;overflow:auto}.project-tile{display:block;padding:16px 18px;text-align:left;width:100%;background:#fff;border:0;border-bottom:1px solid var(--line)}.project-tile:hover,.project-tile.current{background:#f6f2e8}.project-tile.current{border-left:4px solid var(--gold);padding-left:14px}.tile-first{display:flex;justify-content:space-between;gap:8px;font-size:12px;font-weight:750}.tile-first .ref{color:var(--gold-dark)}.tile-name{font-weight:720;font-size:14px;margin-top:5px}.tile-meta{color:var(--muted);font-size:11px;margin-top:5px}.progress{margin-top:10px;height:5px;background:#e5e1d8;border-radius:10px;overflow:hidden}.progress>span{display:block;background:#7b9b7d;height:100%}.detail-header{padding:20px 22px;border-bottom:1px solid var(--line);display:flex;align-items:start;justify-content:space-between;gap:14px}.detail-header h2{font-size:23px;letter-spacing:-.03em;margin:3px 0}.detail-header p{color:var(--muted);font-size:12px;margin:3px 0}.detail-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.mini-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:16px 20px}.mini-stat{background:#f8f7f3;border:1px solid #edeae3;border-radius:10px;padding:12px}.mini-stat strong{display:block;font-size:20px}.mini-stat span{color:var(--muted);font-size:11px}.item-tools{padding:12px 20px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);display:flex;gap:10px;justify-content:space-between;align-items:center}.item-tools input{max-width:320px}.item-tools select{max-width:205px}.item-list{padding:3px 12px 10px}.item-row{width:100%;text-align:left;background:#fff;border:0;border-bottom:1px solid var(--line);display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1.1fr) minmax(110px,.7fr) minmax(112px,.8fr) 19px;gap:12px;align-items:center;padding:15px 10px}.item-row:hover{background:#fbfaf7}.item-title{font-weight:700;display:block}.item-sub,.item-meta{color:var(--muted);font-size:11px;display:block;margin-top:3px;line-height:1.4}.item-tech{overflow-wrap:anywhere;font-size:12px}.item-chevron{font-size:21px;color:#aaa}.status{display:inline-flex;align-items:center;justify-content:center;text-align:center;border-radius:20px;padding:6px 9px;font-size:11px;font-weight:700;background:#ebeae5;color:#56544e;line-height:1.3}.status.freigegeben,.status.bestellt{background:#e4efe6;color:#34563b}.status.freigabe_ausstehend{background:#f9ecd1;color:#866022}.status.late{background:#f6dbd6;color:#92392f}.status.nicht_erforderlich{background:#eee;color:#777}.date-late{color:var(--red);font-weight:700}.empty-project,.empty-list{padding:60px 24px;text-align:center;color:var(--muted)}.empty-project h2{color:var(--ink)}.empty-icon{font-size:42px;color:var(--gold-dark)}.empty-list{padding:27px 18px}.message-panel{margin:55px auto;padding:30px;background:white;border:1px solid var(--line);border-radius:15px;max-width:680px;text-align:center}.message-panel h1{font-size:24px}.message-panel p{color:var(--muted)}#notice{background:#ede5d2;color:#614e2c;border:1px solid #d6c293;margin-bottom:15px;padding:12px 16px;border-radius:9px}.footer{font-size:11px;color:#9c968c;margin:22px 0}.hint{margin:0;padding:12px 20px;background:#fbfaf7;color:#8a8172;font-size:11px;border-top:1px solid var(--line)}
dialog{border:1px solid var(--line);border-radius:16px;background:white;box-shadow:0 30px 80px #0003;padding:0;width:min(96vw,850px);max-height:90dvh}dialog::backdrop{background:#16161188}.dialog-form{padding:22px 24px;max-height:90dvh;overflow:auto}.dialog-head{display:flex;align-items:start;justify-content:space-between;gap:15px;margin-bottom:10px}.dialog-head h2{font-size:23px;letter-spacing:-.03em;margin:0}.icon-button{background:transparent;border:1px solid var(--line);border-radius:8px;min-width:34px;min-height:34px;font-size:21px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;margin:18px 0}.form-grid label{display:flex;flex-direction:column;gap:5px;font-size:12px;font-weight:700}.form-grid .full{grid-column:1/-1}.checkline{display:flex;align-items:center;gap:10px;font-size:12px}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;border-top:1px solid var(--line);padding-top:18px;margin-top:18px}.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:1040px){.nav a,.nav span{padding:8px}.layout{grid-template-columns:270px minmax(0,1fr)}.item-row{grid-template-columns:1.5fr 1fr 120px 16px}.item-row .item-meta-column{display:none}}
@media(max-width:760px){.topbar{flex-wrap:wrap;gap:5px;padding:12px 14px}.brand{font-size:15px}.brand .mark{width:34px;height:34px}.nav{order:3;width:100%;justify-content:space-between}.nav a,.nav span{font-size:11px;padding:8px 6px}.user{margin-left:auto}.desktop-only{display:none}main{padding:17px 12px 35px}.page-head{flex-direction:column;align-items:stretch}.page-head h1{font-size:27px}.stats{grid-template-columns:repeat(2,1fr);gap:8px}.stat{padding:12px 14px;align-items:center;text-align:center}.stat strong{font-size:25px}.layout{grid-template-columns:1fr}.project-list{max-height:220px;min-height:0}.detail-header{padding:15px;flex-direction:column}.detail-actions{justify-content:stretch;width:100%}.detail-actions .button{flex:1}.mini-stats{padding:10px;gap:5px}.mini-stat{padding:10px 8px}.item-tools{padding:10px;flex-wrap:wrap}.item-tools input,.item-tools select{max-width:100%;flex:1}.item-row{grid-template-columns:minmax(0,1fr) minmax(105px,.6fr) 14px;gap:7px;padding:13px 5px}.item-row .item-tech-column,.item-row .item-meta-column{display:none}.item-list{padding-inline:7px}.item-row .status{font-size:10px}.form-grid{grid-template-columns:1fr}.dialog-form{padding:16px}.dialog-actions{position:sticky;bottom:-16px;background:white;z-index:1;padding-bottom:14px}.footer{padding-inline:4px}}

/* BauSelect V2.0: zentral vorgegebene Bemusterungsfristen aus BAutomat. */
.bauselect-deadlines{padding:14px 17px;background:#f9f6ee;border:1px solid #e1d6ba;border-radius:12px;margin:14px}
.bauselect-deadlines-head{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:8px}
.bauselect-deadlines-head h3{margin:0;font-size:15px}.bauselect-deadlines-head a{font-size:12px;color:#81652c}
.bauselect-deadline{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 3px;border-top:1px solid #e1d6ba;font-size:13px}
.bauselect-deadline small{display:block;margin-top:4px;color:#777;font-size:11px}
.bauselect-deadline span{font-weight:650;white-space:nowrap}.bauselect-deadline .due-late{color:#a53a32}
@media(max-width:600px){.bauselect-deadlines{margin:12px 8px;padding:12px}.bauselect-deadline{align-items:flex-start}}

/* BauSelect V2.7 – zwei getrennte Ansichten: zuerst Projekte, danach Projektakte.
   Vorhandene Supabase-Tabellen, Formulare und Materialaktionen bleiben unverändert. */
.project-overview{max-width:1220px;margin:0 auto}
.project-overview .panel-heading{padding:20px 23px}
.project-overview .panel-heading h2{font-size:21px;margin:3px 0 0}
.project-overview .project-filters{display:grid;grid-template-columns:minmax(0,1fr) minmax(185px,245px);gap:12px;padding:17px 22px}
.project-overview .project-list{max-height:none;min-height:120px;overflow:visible;display:grid;grid-template-columns:repeat(auto-fill,minmax(275px,1fr));gap:14px;padding:20px;background:#faf9f7}
.project-overview .project-tile{border:1px solid var(--line);border-left:4px solid var(--gold);border-radius:13px;padding:18px 18px 16px;box-shadow:0 3px 10px #18140d08;transition:background .15s,border-color .15s,transform .15s}
.project-overview .project-tile:hover{background:#f8f5ed;border-color:#cdbb8e;transform:translateY(-1px)}
.project-overview .project-tile:focus-visible{outline:3px solid var(--gold-dark);outline-offset:3px}
.project-overview .tile-first{font-size:12px}.project-overview .tile-progress-label{color:var(--gold-dark)}
.project-overview .tile-name{font-size:17px;line-height:1.3;margin-top:10px}.project-overview .tile-meta{font-size:12px}
.project-overview .progress{margin-top:15px}.project-overview .tile-bottom{display:flex;justify-content:space-between;align-items:center;gap:12px;color:var(--muted);font-size:11px;margin-top:10px}
.project-overview .tile-open{color:var(--gold-dark);font-weight:750;white-space:nowrap}
.project-overview .empty-list{grid-column:1/-1}
.project-detail-view{max-width:1540px;margin:0 auto}
.project-breadcrumb{display:flex;align-items:center;gap:13px;margin:0 0 15px;min-height:42px}
.back-to-projects{display:inline-flex;align-items:center;gap:9px;border:1px solid var(--line);background:white;color:var(--ink);min-height:42px;padding:8px 14px;border-radius:9px;font-weight:680}
.back-to-projects:hover{background:#f7f1e7;border-color:#cdbb8e}
.back-to-projects span{font-size:19px;color:var(--gold-dark);line-height:1}
.detail-crumb{color:var(--muted);font-size:12px;letter-spacing:.04em}
.project-detail-view .detail{overflow:hidden}
@media(max-width:760px){
 .project-overview .panel-heading{padding:15px 16px}.project-overview .panel-heading h2{font-size:18px}
 .project-overview .project-filters{grid-template-columns:1fr;gap:9px;padding:12px 14px}
 .project-overview .project-list{grid-template-columns:1fr;gap:11px;padding:13px;min-height:0}
 .project-overview .project-tile{padding:15px 15px 13px}
 .project-overview .tile-name{font-size:16px}
 .project-overview .tile-bottom{font-size:11px;flex-wrap:wrap}
 .project-breadcrumb{margin-bottom:11px}
 .back-to-projects{min-height:42px}
 .project-detail-view .detail-header{padding:15px}
 .project-detail-view .detail-header h2{font-size:22px}
 .project-detail-view .detail-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:7px}
 .project-detail-view .detail-actions .button{min-width:0;min-height:41px}
 .project-detail-view .detail-actions .button[data-action="add-item"]{grid-column:1/-1}
}
@media(max-width:380px){.project-detail-view .detail-actions{grid-template-columns:1fr}}
