:root{--blue:#0052a1;--blue2:#0d6bc0;--ink:#17212b;--muted:#677482;--line:#e2e8ef;--bg:#f4f7fa;--card:#fff;--red:#b42318;--orange:#b54708;--green:#16794b;--nav:#0c2540}
*{box-sizing:border-box}body{margin:0;font:14px/1.45 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink);background:var(--bg)}a{color:var(--blue);text-decoration:none}a:hover{text-decoration:underline}h1{font-size:27px;margin:0 0 18px}h2{font-size:18px;margin:0 0 15px}h3{font-size:15px;margin:18px 0 10px}.app{display:flex;min-height:100vh}.sidebar{width:245px;background:var(--nav);color:#fff;padding:18px 14px;position:fixed;inset:0 auto 0 0;overflow:auto}.brand{font-weight:800;font-size:21px;letter-spacing:.4px;padding:8px 10px 20px}.brand small{display:block;font-size:11px;color:#aac2da;font-weight:600;letter-spacing:.9px}.nav-title{font-size:10px;text-transform:uppercase;letter-spacing:1.1px;color:#87a5c3;margin:19px 10px 7px}.nav a{display:block;color:#dbe7f2;padding:9px 10px;border-radius:8px;margin:2px 0;font-weight:600}.nav a:hover,.nav a.active{background:#ffffff13;color:#fff;text-decoration:none}.main{margin-left:245px;width:calc(100% - 245px)}.topbar{height:56px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:flex-end;padding:0 26px;position:sticky;top:0;z-index:5}.content{padding:26px;max-width:1500px;margin:auto}.muted,.hint{color:var(--muted)}.hint{font-size:12.5px}.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:18px;margin-bottom:18px;box-shadow:0 1px 2px #00000008}.cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}.metric{background:#fff;border:1px solid var(--line);border-radius:12px;padding:16px}.metric .k{color:var(--muted);font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.3px}.metric .v{font-size:25px;font-weight:800;margin-top:5px}.metric .s{font-size:12px;color:var(--muted);margin-top:4px}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:18px}.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:15px}.split{display:grid;grid-template-columns:1.35fr .65fr;gap:18px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.form-grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}.full,.span2{grid-column:1/-1}label{display:block;font-weight:700;margin-bottom:5px}input,select,textarea{width:100%;border:1px solid #c9d3de;border-radius:7px;background:#fff;padding:9px 10px;font:inherit;color:inherit}input:focus,select:focus,textarea:focus{outline:2px solid #0052a122;border-color:var(--blue)}textarea{min-height:95px;resize:vertical}.btn{display:inline-block;background:var(--blue);border:1px solid var(--blue);color:#fff!important;border-radius:7px;padding:8px 12px;font-weight:750;cursor:pointer;text-decoration:none}.btn:hover{background:var(--blue2);text-decoration:none}.btn.secondary{background:#fff;color:var(--blue)!important}.btn.danger{background:#fff;color:var(--red)!important;border-color:#e7b9b5}.btn.small{font-size:12px;padding:5px 8px}.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.toolbar{display:flex;gap:9px;align-items:end;flex-wrap:wrap;margin-bottom:14px}.toolbar>div{min-width:140px}.toolbar .grow{flex:1;min-width:240px}.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:9px}table{width:100%;border-collapse:collapse;background:#fff}th,td{padding:10px 11px;border-bottom:1px solid #e9eef3;text-align:left;vertical-align:middle;white-space:nowrap}th{position:sticky;top:0;background:#f8fafc;color:#475668;font-size:12px;text-transform:uppercase;letter-spacing:.25px;z-index:1}tr:last-child td{border-bottom:0}.num{text-align:right}.wrap{white-space:normal;min-width:220px}.product-cell{display:flex;align-items:center;gap:9px;white-space:normal}.thumb{width:44px;height:44px;object-fit:contain;border:1px solid var(--line);border-radius:6px;background:#fff}.badge{display:inline-block;padding:3px 7px;border-radius:20px;background:#eef3f7;color:#43576a;font-size:11px;font-weight:800}.status-critical{background:#fee9e7;color:var(--red)}.status-reorder{background:#fff2df;color:var(--orange)}.status-ok{background:#e8f6ee;color:var(--green)}.status-overstock{background:#e9f1fb;color:#265f97}.status-ordered,.status-production,.status-sea,.status-air,.status-customs{background:#edf4fb;color:#195a94}.status-delivered{background:#e7f6ed;color:#187045}.status-cancelled{background:#f2f3f5;color:#6d7680}.flash{padding:11px 13px;border-radius:8px;margin-bottom:14px;border:1px solid}.flash.success{background:#ecf8f0;border-color:#b9e1c7;color:#176a3c}.flash.error{background:#fff0ef;border-color:#efc0bc;color:#98281e}.flash.info{background:#edf5ff;border-color:#c8ddf4;color:#1d5e98}.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;background:#f5f7f9;padding:8px;border-radius:6px;overflow:auto}.login{max-width:410px;margin:9vh auto;padding:20px}.brandbox{text-align:center;color:var(--blue);font-size:26px;font-weight:900;margin-bottom:18px}.chat{display:flex;flex-direction:column;gap:10px;max-height:520px;overflow:auto;margin-bottom:14px}.bubble{max-width:85%;padding:10px 12px;border-radius:10px;background:#edf2f7}.bubble.user{align-self:flex-end;background:#dfeeff}.bubble.assistant{align-self:flex-start}.chat-form{display:flex;gap:8px}.chat-form textarea{min-height:70px}.empty{padding:30px;text-align:center;color:var(--muted)}.notice-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.notice{padding:14px;border:1px solid var(--line);border-radius:10px;background:#fff}.price{font-variant-numeric:tabular-nums}.stepper{display:flex;align-items:center;gap:6px}.stepper input{max-width:100px}.sticky-actions{position:sticky;bottom:0;background:#ffffffef;border-top:1px solid var(--line);padding:10px 0;margin-top:14px}.section-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.kpi-red{color:var(--red)}.kpi-green{color:var(--green)}.category-nav{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:12px}.category-nav a{padding:5px 9px;border:1px solid var(--line);border-radius:16px;background:#fff}.category-nav a.active{background:var(--blue);color:#fff;border-color:var(--blue)}
@media(max-width:1050px){.cards{grid-template-columns:repeat(2,1fr)}.grid2,.grid3,.split{grid-template-columns:1fr}.form-grid.three{grid-template-columns:1fr 1fr}}
@media(max-width:760px){.sidebar{position:static;width:100%}.app{display:block}.main{margin:0;width:100%}.content{padding:15px}.cards{grid-template-columns:1fr}.form-grid,.form-grid.three{grid-template-columns:1fr}.topbar{display:none}.chat-form{display:block}.chat-form .btn{margin-top:8px}.notice-grid{grid-template-columns:1fr}}
@media print{.sidebar,.topbar,.no-print{display:none!important}.main{margin:0;width:100%}.content{padding:0}.card{box-shadow:none;border:0}}

/* v2.1 category picker */
.category-filter{min-width:330px}
.category-picker{position:relative;min-width:300px}
.category-picker-button{width:100%;min-height:39px;text-align:left;background:#fff;border:1px solid #c9d3de;border-radius:7px;padding:9px 34px 9px 10px;font:inherit;color:var(--ink);cursor:pointer;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.category-picker-button:after{content:"⌄";position:absolute;right:11px;top:7px;font-size:18px;color:#5f6e7d}
.category-picker.open .category-picker-button{outline:2px solid #0052a122;border-color:var(--blue)}
.category-picker-menu{display:none;position:absolute;left:0;top:calc(100% + 5px);z-index:50;width:min(620px,80vw);background:#fff;border:1px solid #c9d3de;border-radius:9px;box-shadow:0 12px 30px #10182820;padding:9px}
.category-picker.open .category-picker-menu{display:block}
.category-picker-menu input[type="search"]{margin-bottom:8px}
.category-picker-options{max-height:310px;overflow:auto;border-top:1px solid #edf1f5}
.category-picker-options label{display:flex;align-items:flex-start;gap:8px;margin:0;padding:8px 7px;font-weight:500;cursor:pointer;border-bottom:1px solid #f0f3f6;white-space:normal}
.category-picker-options label:hover{background:#f5f9fd}
.category-picker-options input[type="radio"]{width:auto;margin-top:3px;flex:0 0 auto}
.category-picker-options .category-path{line-height:1.35}
.category-picker-empty{padding:14px 8px;color:var(--muted);display:none}
@media(max-width:760px){.category-filter,.category-picker{min-width:100%;width:100%}.category-picker-menu{width:min(94vw,620px)}}

/* v2.2 product details, inline stock editing and navigation */
.topbar{justify-content:space-between}
.topbar-nav{display:flex;gap:10px;align-items:center}
.back-link,.home-link{display:inline-flex;align-items:center;gap:5px;padding:6px 9px;border:1px solid var(--line);border-radius:7px;background:#fff;color:var(--ink);text-decoration:none;font-weight:700;font-size:13px}
.back-link:hover,.home-link:hover{border-color:#9fb5c9;background:#f8fbfe;text-decoration:none}
.product-title-row{display:flex;align-items:center;gap:18px;min-width:0}
.product-image-large{width:150px;height:150px;flex:0 0 150px;border:1px solid var(--line);border-radius:12px;background:#fff;display:flex;align-items:center;justify-content:center;overflow:hidden;color:var(--muted);font-size:13px}
.product-image-large img{width:100%;height:100%;object-fit:contain;padding:8px}
.product-meta{margin-top:6px;color:var(--muted);font-size:13px;max-width:760px}
.stock-inline{display:inline-flex;gap:6px;align-items:center;justify-content:flex-end}
.stock-inline input[type="number"]{width:96px;text-align:right;padding:6px 7px}
.currency-input{display:flex;align-items:center;border:1px solid #c9d3de;border-radius:7px;background:#fff;overflow:hidden}
.currency-input span{padding:9px 10px;background:#f5f7f9;border-right:1px solid #c9d3de;font-weight:800}
.currency-input input{border:0;border-radius:0;outline:0!important}
.readonly-field{border:1px solid #d8e0e8;background:#f7f9fb;border-radius:7px;padding:9px 10px;color:#4c5b69;font-weight:700;min-height:39px}
@media(max-width:760px){.topbar{display:flex;height:auto;padding:10px 15px;gap:10px;flex-wrap:wrap}.topbar>span{font-size:12px}.product-title-row{align-items:flex-start}.product-image-large{width:92px;height:92px;flex-basis:92px}.stock-inline{justify-content:flex-start}}

/* v2.4 partial inventory category selection + grouped inventory list */
.category-picker-options input[type="checkbox"]{width:auto;margin-top:3px;flex:0 0 auto}
.category-picker-tools{display:flex;justify-content:flex-end;margin-bottom:8px}
.category-picker-footer{display:flex;justify-content:flex-end;padding-top:9px;border-top:1px solid #edf1f5;margin-top:8px}
.inventory-scope{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.inventory-category-chip{display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;background:#eef5fb;color:#29445d;font-size:12px;font-weight:600}
.inventory-category-row td{background:#edf5fb!important;color:#183b59;font-weight:700;padding-top:11px!important;padding-bottom:11px!important;border-top:2px solid #c9dceb}
.inventory-category-row .category-breadcrumb{font-size:13px;font-weight:700}

/* v2.6 hierarchical category selection */
.toolbar .grow{flex:0 1 360px;min-width:260px}
.category-filter{min-width:480px;flex:1 1 520px}
.category-picker{min-width:420px}
.category-picker-menu{width:min(820px,88vw)}
.category-picker-head{display:grid;grid-template-columns:minmax(310px,1.5fr) minmax(210px,.8fr);gap:12px;align-items:end;margin-bottom:9px}
.category-picker-head label{font-size:12px;color:var(--muted);margin-bottom:4px}
.category-search-wrap input{max-width:270px}
.category-root-wrap select{width:100%}
.category-picker-options{max-height:390px}
.category-picker-options label[data-category-option]{padding-left:calc(8px + (var(--cat-depth,0) * 13px))}
.category-picker-options label[data-category-option] .category-path{display:block;min-width:0}
.category-picker-multi .category-picker-menu{width:min(900px,90vw)}
.category-picker-multi .category-picker-options{max-height:430px}
.month-quick{display:flex;gap:7px;align-items:end;flex-wrap:wrap}
.month-quick input[type="month"]{min-width:160px}
.print-options{display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin:0 0 12px}
.print-options>div{min-width:220px}
.update-card .upload-row{display:flex;gap:10px;align-items:end;flex-wrap:wrap}.update-card input[type=file]{max-width:520px}
@media(max-width:900px){.category-filter,.category-picker{min-width:100%;width:100%}.category-picker-menu{width:min(94vw,820px)}.category-picker-head{grid-template-columns:1fr}.category-search-wrap input{max-width:none}.toolbar .grow{flex:1 1 100%;min-width:100%}}

/* v2.6 usability + consistent controls */
.btn{min-height:40px;display:inline-flex;align-items:center;justify-content:center;line-height:1.15;vertical-align:middle}
.btn.small{min-height:30px;padding:5px 9px}
.toolbar{gap:12px}
.toolbar-actions{display:flex;align-items:center;gap:9px;flex:0 0 auto!important;min-width:0!important}
.report-toolbar .grow{flex:1 1 360px;min-width:280px}
.report-toolbar .category-filter{flex:1 1 430px;min-width:360px}
.report-toolbar .date-field{flex:0 0 145px;min-width:145px}
.report-toolbar .toolbar-actions{padding-bottom:0}

/* Category selector: visible text, hierarchy-first workflow and room for long paths. */
.category-picker-button{color:var(--ink)!important;background:#fff!important}
.category-picker-menu{width:min(980px,92vw);color:var(--ink);overflow:visible}
.category-picker-head{grid-template-columns:minmax(420px,1.7fr) minmax(220px,.7fr);gap:14px}
.category-root-wrap select,.category-search-wrap input{color:var(--ink)!important;background:#fff!important}
.category-search-wrap input{max-width:300px}
.category-picker-hint{font-size:12px;color:var(--muted);padding:2px 2px 9px}
.category-picker-options{max-height:430px;background:#fff}
.category-picker-options label[data-category-option]{color:var(--ink)!important;background:#fff;min-height:38px}
.category-picker-options label[data-category-option]:hover{background:#f5f9fd}
.category-picker-options .category-path{color:var(--ink)!important;opacity:1!important;visibility:visible!important;display:block!important;line-height:1.35;word-break:normal;overflow-wrap:anywhere}
.category-picker-multi .category-picker-menu{width:min(980px,92vw)}
.category-picker-empty{background:#fff}

/* Lager / Lagerschilder: category first, search deliberately smaller. */
.filter-toolbar.category-first{display:grid;grid-template-columns:minmax(430px,620px) minmax(220px,320px) auto;align-items:end;justify-content:start;gap:12px}
.filter-toolbar.category-first .category-filter{min-width:0;width:auto;flex:none}
.filter-toolbar.category-first .category-picker{min-width:0;width:100%}
.filter-toolbar.category-first .toolbar-search{min-width:0;width:auto}
.filter-toolbar.category-first .toolbar-actions{align-self:end}

/* Settings: separate save/update/test actions visually. */
.settings-actions{display:flex;align-items:center;gap:12px;margin:20px 0 28px;padding-top:2px}
.update-card{margin-top:0}
.update-card .upload-row{display:flex;gap:14px;align-items:flex-end;flex-wrap:wrap}
.update-card .upload-row>div{flex:1 1 520px}
.settings-footer-actions{display:flex;gap:10px;margin:18px 0 4px}

/* Chat send button stays a normal control instead of stretching to textarea height. */
.chat-form{align-items:flex-end}
.chat-form textarea{min-height:76px}
.chat-form .chat-send{height:40px;min-width:92px;align-self:flex-end}

/* Dashboard period controls */
.dashboard-header{display:flex;align-items:flex-start;justify-content:space-between;gap:22px;margin-bottom:18px}
.dashboard-header h1{margin-bottom:5px}
.dashboard-period{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px 14px;box-shadow:0 1px 2px #00000008}
.period-block>label{font-size:12px;color:var(--muted);margin-bottom:5px}
.period-inline{display:flex;align-items:center;gap:7px}
.period-month select[name="month_no"]{width:155px}
.period-month select[name="month_year"]{width:92px}
.period-block input[type="date"]{width:145px}
.period-to{color:var(--muted);font-size:12px}
.period-divider{width:1px;align-self:stretch;background:var(--line);margin:0 2px}
.period-quick{display:flex;align-items:center;gap:7px}
.month-quick{display:none}

@media(max-width:1200px){
  .dashboard-header{display:block}
  .dashboard-period{margin-top:14px}
  .filter-toolbar.category-first{grid-template-columns:minmax(360px,1fr) minmax(220px,300px) auto}
}
@media(max-width:900px){
  .category-picker-menu,.category-picker-multi .category-picker-menu{width:min(95vw,900px)}
  .category-picker-head{grid-template-columns:1fr}
  .category-search-wrap input{max-width:none}
  .filter-toolbar.category-first{display:flex;flex-wrap:wrap}
  .filter-toolbar.category-first .category-filter{width:100%}
  .filter-toolbar.category-first .toolbar-search{width:min(100%,360px)}
  .report-toolbar .category-filter,.report-toolbar .grow{min-width:100%;flex-basis:100%}
  .dashboard-period{align-items:stretch}
  .period-divider{display:none}
}
@media(max-width:620px){
  .period-inline{flex-wrap:wrap}
  .period-month select[name="month_no"],.period-month select[name="month_year"],.period-block input[type="date"]{width:100%}
  .period-block{width:100%}
  .period-quick{width:100%;flex-wrap:wrap}
}
