:root{--yellow:#ffcc00;--ink:#171717;--muted:#68717c;--line:#e6e8eb;--danger:#c92a2a;--ok:#16833b;--blue:#1769e0}
body{background:#f5f6f7}.purchases-shell{max-width:1500px;margin:auto;padding:38px 28px 80px}.hero{min-height:190px;padding:34px 40px;margin-bottom:24px;border-radius:24px;background:linear-gradient(120deg,#161616,#353535);color:#fff;display:flex;align-items:center;justify-content:space-between;gap:30px;box-shadow:0 16px 36px rgba(0,0,0,.18)}.hero h2{font-size:34px;margin:6px 0 8px}.hero p{color:#d9d9d9;max-width:750px}.eyebrow{font-size:11px;letter-spacing:.16em;font-weight:900;color:#9a6e00}.hero .eyebrow{color:var(--yellow)}.main-btn,.soft-btn,.danger-btn,.add-row-btn,.icon-btn{border:0;border-radius:11px;font-weight:800;cursor:pointer}.main-btn{padding:13px 20px;background:var(--yellow);color:#111;box-shadow:0 5px 14px rgba(255,204,0,.22)}.soft-btn{padding:10px 14px;background:#f0f1f3;color:#20242a;border:1px solid #dfe2e5}.danger-btn{padding:11px 16px;background:#ffe7e7;color:var(--danger)}.kpi-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:18px;margin-bottom:24px}.kpi-grid article,.panel{background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:0 5px 20px rgba(23,31,42,.05)}.kpi-grid article{padding:22px;border-top:5px solid var(--yellow)}.kpi-grid span{display:block;font-weight:700;color:var(--muted);font-size:13px}.kpi-grid strong{display:block;font-size:28px;margin:8px 0 4px}.kpi-grid small{color:#8a9097}.panel{padding:24px;margin-bottom:24px}.panel-head{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:20px}.panel-head h3{font-size:22px;margin-top:4px}.head-actions{display:flex;gap:8px}.filter-grid,.form-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.filter-grid label,.form-grid label,.modal label{display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:800;color:#454b53}.filter-grid input,.filter-grid select,.form-grid input,.form-grid select,.modal textarea,.modal input,.modal select{width:100%;min-height:42px;border:1px solid #ccd1d6;border-radius:9px;padding:9px 11px;background:#fff;color:#111}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;min-width:1040px}th{text-align:left;background:#1c1c1c;color:#fff;font-size:12px;padding:13px}td{padding:14px 13px;border-bottom:1px solid var(--line);vertical-align:top}tbody tr:hover{background:#fffbea}.status{display:inline-flex;border-radius:999px;padding:6px 9px;font-size:11px;font-weight:900;white-space:nowrap}.status-open{background:#fff3bf;color:#7a5700}.status-partial{background:#e7f0ff;color:#1552a3}.status-done{background:#dff5e5;color:#12642d}.status-late{background:#ffe3e3;color:#a61e1e}.status-cancel{background:#eceff1;color:#56606a}.row-actions{display:flex;gap:6px}.row-actions button{border:1px solid #d8dade;background:#fff;border-radius:8px;padding:7px 9px;cursor:pointer;font-weight:700}.count-pill{display:inline-grid;place-items:center;background:#fff2b3;border-radius:999px;min-width:30px;padding:3px 8px;font-size:13px}.chart-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:18px}.chart-grid article{border:1px solid var(--line);border-radius:14px;padding:18px;min-height:260px}.chart-grid h4{margin-bottom:18px}.bars{height:210px;display:flex;align-items:flex-end;gap:8px;border-bottom:1px solid #ccc;padding:0 4px}.month-col{height:100%;flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:5px}.month-col i{width:70%;min-height:2px;background:linear-gradient(#ffdd55,#ffbd00);border-radius:6px 6px 0 0}.month-col span{font-size:10px;color:#626870}.month-col b{font-size:9px;transform:rotate(-50deg);margin-bottom:4px;white-space:nowrap}.rank-row{display:grid;grid-template-columns:125px 1fr 90px;gap:10px;align-items:center;margin:11px 0;font-size:12px}.rank-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rank-track{height:12px;border-radius:99px;background:#edf0f2;overflow:hidden}.rank-fill{height:100%;background:var(--yellow);border-radius:99px}.rank-value{text-align:right;font-weight:800}.empty-state{text-align:center;padding:28px;color:#7a8188}.modal{position:fixed;inset:0;background:rgba(12,16,20,.66);z-index:1000;display:grid;place-items:center;padding:20px}.modal[hidden]{display:none}.modal-card{background:#fff;width:min(1180px,96vw);max-height:94vh;overflow:auto;border-radius:20px;padding:26px;box-shadow:0 24px 70px rgba(0,0,0,.32)}.receipt-card{width:min(850px,96vw)}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;border-bottom:1px solid var(--line);padding-bottom:16px;margin-bottom:20px}.icon-btn{font-size:28px;width:42px;height:42px;background:#f1f2f3}fieldset{border:1px solid var(--line);border-radius:14px;padding:18px;margin:0 0 18px}legend{padding:0 8px;font-weight:900}.material-row{display:grid;grid-template-columns:1.1fr 2fr 1.2fr .7fr .8fr .8fr 42px;gap:9px;align-items:end;border-bottom:1px dashed #ddd;padding:0 0 13px;margin-bottom:13px}.material-row label{font-size:11px}.remove-row{width:40px;height:42px;border:0;border-radius:9px;background:#ffe4e4;color:#b11;font-size:20px;cursor:pointer}.add-row-btn{padding:10px 14px;background:#fff7d1;color:#664c00;border:1px solid #f0d368}.order-total{text-align:right;font-size:17px;margin-top:14px}.order-total strong{font-size:24px;margin-left:12px}.upload-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.upload-grid label,.upload-ddt{padding:14px;border:2px dashed #ccd1d6;border-radius:12px;background:#fafbfb}.attachments{display:grid;gap:8px;margin:12px 0}.attachment-item{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:9px 11px;border:1px solid var(--line);border-radius:9px}.attachment-item button{border:0;background:#f0f1f2;padding:6px 9px;border-radius:7px;cursor:pointer}.form-actions{display:grid;grid-template-columns:auto 1fr auto auto;gap:10px;align-items:center;position:sticky;bottom:-26px;background:#fff;padding:15px 0 5px}.receipt-line{display:grid;grid-template-columns:1fr 110px 110px;gap:12px;align-items:center;padding:10px;border-bottom:1px solid var(--line)}.receipt-line input{text-align:right}.receipt-item{border:1px solid var(--line);border-radius:12px;padding:12px;margin:10px 0;display:flex;justify-content:space-between;gap:14px}.receipt-item button{border:0;border-radius:8px;padding:7px 10px;cursor:pointer}.year-dashboard{flex-direction:row!important;align-items:center}.year-dashboard select{width:auto}.late-date{color:var(--danger);font-weight:900}
.hero-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.hero-soft-btn{background:#fff;color:#181818;border-color:#fff}.panel-note,.field-help{color:var(--muted);font-size:12px;line-height:1.45;margin:6px 0 0}.field-help{padding:10px 12px;margin:0 0 14px;border-radius:9px;background:#fff9dc;border-left:4px solid var(--yellow)}.compact-search{min-width:250px;min-height:42px;border:1px solid #ccd1d6;border-radius:10px;padding:9px 12px}.articles-table{min-width:900px}.articles-table td:first-child{font-weight:900}.article-card{width:min(900px,96vw)}.article-form-grid{grid-template-columns:repeat(2,1fr)}.wide-label{grid-column:1/-1}.article-linked{outline:2px solid rgba(255,204,0,.65);background:#fffdf2!important}.article-match-note{grid-column:1/-1;font-size:11px;color:#5c626a;margin-top:-4px}
@media(max-width:1050px){.kpi-grid{grid-template-columns:repeat(2,1fr)}.filter-grid,.form-grid{grid-template-columns:repeat(2,1fr)}.material-row{grid-template-columns:repeat(3,1fr)}.chart-grid{grid-template-columns:1fr}}
@media(max-width:650px){.purchases-shell{padding:28px 12px}.hero{padding:25px 20px;align-items:flex-start;flex-direction:column}.hero h2{font-size:27px}.hero-actions{justify-content:flex-start}.kpi-grid,.filter-grid,.form-grid,.upload-grid,.article-form-grid{grid-template-columns:1fr}.panel{padding:16px}.panel-head{align-items:flex-start;flex-direction:column}.material-row{grid-template-columns:1fr}.head-actions{flex-wrap:wrap;width:100%}.compact-search,.article-supplier-filter,.article-supplier-filter select{min-width:0;width:100%}.home-return-btn{position:static;margin:10px 12px}.rank-row{grid-template-columns:95px 1fr 75px}}
@media print{.vink-header,.home-return-btn,.hero,.kpi-grid,.filters-panel,.chart-grid,.head-actions,.row-actions,.vink-watermark{display:none!important}.purchases-shell{padding:0}.panel{border:0;box-shadow:none}.table-wrap{overflow:visible}table{min-width:0;font-size:10px}}

.article-head-actions{align-items:flex-end;flex-wrap:wrap}.article-supplier-filter{display:flex;flex-direction:column;gap:5px;font-size:11px;font-weight:900;color:#4a5057}.article-supplier-filter select{min-width:220px;min-height:40px;border:1px solid #ccd1d6;border-radius:9px;padding:8px 10px;background:#fff;color:#111}.supplier-unassigned{display:inline-flex;padding:5px 8px;border-radius:999px;background:#fff1c7;color:#785500;font-size:11px;font-weight:900}

/* Categoria generale dell'ordine: campo combinato con menu esplicito. */
.material-row{grid-template-columns:1.05fr 1.9fr 1.65fr .6fr .7fr .85fr 42px}
.category-combobox{position:relative;display:grid;grid-template-columns:1fr 42px;gap:0}
.category-combobox input{border-radius:9px 0 0 9px!important;border-right:0!important;font-weight:800}
.category-toggle{min-height:42px;border:1px solid #ccd1d6;border-radius:0 9px 9px 0;background:#ffcc00;color:#151515;font-size:22px;font-weight:900;cursor:pointer}
.category-toggle:hover{background:#f2bd00}
.category-menu{position:absolute;z-index:30;left:0;right:0;top:calc(100% + 5px);max-height:210px;overflow:auto;padding:6px;background:#fff;border:1px solid #c9cdd2;border-radius:10px;box-shadow:0 12px 30px rgba(20,24,28,.18)}
.category-option,.category-empty{display:block;width:100%;border:0;border-radius:7px;padding:10px 11px;text-align:left;background:#fff;color:#20242a;font-size:12px;font-weight:800}
.category-option{cursor:pointer}
.category-option:hover,.category-option:focus{background:#fff3bf;outline:0}
.category-empty{color:#747a80;font-weight:600}
.category-hint{display:block;color:#757b82;font-weight:600;line-height:1.35}
@media(max-width:1050px){.material-row{grid-template-columns:repeat(3,1fr)}}
@media(max-width:650px){.material-row{grid-template-columns:1fr}}
/* Il numero d'ordine coincide con il progressivo del PDF ed è gestito dal sistema. */
#orderNumber[readonly]{
  background:#f2f4f6;
  color:#242424;
  font-weight:800;
  letter-spacing:.04em;
  cursor:not-allowed;
  border-color:#c8cdd2;
}

.archive-head-actions{align-items:flex-end;flex-wrap:wrap;justify-content:flex-end}
.archive-year-menu{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:142px;
  padding:7px 10px;
  border:1px solid #dfe2e5;
  border-radius:11px;
  background:#fff8d4;
  color:#20242a;
}
.archive-year-menu span{
  color:#725500;
  font-size:10px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.archive-year-menu select{
  width:100%;
  min-height:24px;
  padding:0 24px 0 0;
  border:0;
  outline:0;
  background:transparent;
  color:#171717;
  font-size:15px;
  font-weight:900;
  cursor:pointer;
}
@media(max-width:650px){
  .archive-head-actions{align-items:stretch}
  .archive-year-menu{width:100%}
}
@media print{
  .archive-year-menu{display:none!important}
}
