:root{
  --dw-blue:#1F4E79;
  --card:#ffffff;
  --bg:#f4f6f9;
  --muted:#6b7280;
  --border:#e5e7eb;
  --input:#fff2cc;
  --pill:#eef2f7;
  --pill-strong:#e2efda;
  --shadow: 0 6px 18px rgba(0,0,0,.06);
  --radius:14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family:var(--font);
  background:var(--bg);
  color:#111827;
}

.topbar{
  position:sticky; top:0;
  z-index:20;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px;
  background:var(--dw-blue);
  color:#fff;
}

.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width:42px; height:42px;
  border-radius:12px;
  background:rgba(255,255,255,.15);
  display:flex; align-items:center; justify-content:center;
  font-weight:800;
}
.title{ font-size:16px; font-weight:800; line-height:1.1; }
.subtitle{ font-size:12px; opacity:.85; }

.top-actions{ display:flex; gap:10px; }

.btn{
  border:0;
  border-radius:12px;
  padding:10px 12px;
  font-weight:700;
  background:#ffffff;
  color:var(--dw-blue);
}
.btn.secondary{
  background:rgba(255,255,255,.15);
  color:#fff;
  border:1px solid rgba(255,255,255,.25);
}

.container{
  max-width:1100px;
  margin:14px auto 60px;
  padding:0 12px;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:14px;
  margin-bottom:12px;
}

.grid2{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
}
.grid2 label{ font-size:12px; color:var(--muted); display:flex; flex-direction:column; gap:6px; }
.grid2 input{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  font-size:14px;
  background:#fff;
}
.grid2 .hint{
  grid-column: 1 / -1;
  font-size:12px;
  color:var(--muted);
  padding:10px 12px;
  border:1px dashed var(--border);
  border-radius:12px;
}

.summary{
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap:10px;
  margin-bottom:12px;
}
.pill{
  background:var(--pill);
  border:1px solid var(--border);
  border-radius:16px;
  padding:10px 12px;
}
.pill.strong{ background:var(--pill-strong); }
.pill .k{ font-size:12px; color:var(--muted); }
.pill .v{ font-size:18px; font-weight:900; margin-top:4px; }

.tabs{ display:flex; gap:8px; margin-bottom:10px; flex-wrap:wrap; }
.tab{
  border:1px solid var(--border);
  background:#fff;
  padding:10px 12px;
  border-radius:14px;
  font-weight:800;
  color:#111827;
}
.tab.active{
  background:var(--dw-blue);
  color:#fff;
  border-color:var(--dw-blue);
}

.hidden{ display:none; }

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:14px;
  border:1px solid var(--border);
}
.table th, .table td{
  padding:10px 10px;
  border-bottom:1px solid var(--border);
  font-size:14px;
}
.table th{
  text-align:left;
  background:#eef2f7;
  font-size:12px;
  color:var(--muted);
  letter-spacing:.02em;
}
.table tr:last-child td{ border-bottom:0; }
.table td.num{ text-align:right; font-variant-numeric: tabular-nums; }
.table input.qty, .table input.price, .table input.name{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:8px 10px;
  font-size:14px;
}
.table input.qty{ background:var(--input); text-align:right; }
.table input.price{ text-align:right; }
.badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
}
.catrow td{
  background:#f3f6fb;
  font-weight:900;
  font-size:12px;
  color:#111827;
}
.cat-UNDERLAG td{ background:#c6efce; }
.cat-PLÅT td{ background:#f8cbad; }
.cat-TRÄ td{ background:#bdd7ee; }
.cat-SPIK\ \&\ SKRUV td{ background:#e2f0d9; }
.cat-TAKAVVATTNING\ \(VAS\) td{ background:#d9d2e9; }
.cat-ÖVRIGT td{ background:#fce4d6; }
.cat-SPECIALMATERIAL td{ background:#fff2cc; }

.footer{
  padding:14px 16px;
  color:var(--muted);
  font-size:12px;
  text-align:center;
}

@media (max-width: 860px){
  .grid2{ grid-template-columns: 1fr; }
  .summary{ grid-template-columns: 1fr 1fr; }
  .top-actions{ display:none; }
}

/* Two-column layout */
.layout{ display:grid; grid-template-columns: 1fr 360px; gap:12px; align-items:start; }
.maincol{ min-width:0; }
.sidecol{ position:sticky; top:76px; height: calc(100vh - 92px); overflow:auto; }
.sidehead{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:10px; }
.sidetitle{ font-weight:900; font-size:16px; }
.sidesub{ color:var(--muted); font-size:12px; }
.sideactions{ display:flex; gap:8px; margin-bottom:10px; }
.sideinput{ flex:1; border:1px solid var(--border); border-radius:12px; padding:10px 10px; font-size:14px; }
.sidehint{ margin-top:10px; color:var(--muted); font-size:12px; }

.projectlist{ display:flex; flex-direction:column; gap:10px; }
.projcard{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}
.projmeta{ display:flex; flex-direction:column; gap:4px; }
.projtitle{ font-weight:900; }
.projsub{ color:var(--muted); font-size:12px; }
.projactions{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.btn.smallbtn{ padding:8px 10px; border-radius:12px; font-weight:800; }
.btn.danger{ background:#fee2e2; color:#991b1b; }
.btn.light{ background:#eef2f7; color:#111827; }
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .sidecol{ position:relative; top:auto; height:auto; }
}

.subhead{ grid-column:1/-1; font-weight:900; color:var(--dw-blue); margin-top:4px; }
