* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; font-family: system-ui, Arial, sans-serif; color: #222; }
.topbar, .statusbar { background: #f6f7f9; border-bottom: 1px solid #e2e5ea; padding: .5rem 1rem; display: flex; align-items: center; gap: 1rem; }
.statusbar { border-top: 1px solid #e2e5ea; border-bottom: none; }
.logo { font-weight: 700; }
.board-controls button { margin-left: .25rem; }
.workspace { flex: 1; display: flex; min-height: 0; }
.toolbar { width: 260px; min-width: 200px; border-right: 1px solid #e2e5ea; padding: .75rem; overflow: auto; }
.toolgroup { margin-bottom: .75rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.toolgroup label { grid-column: span 2; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tool { padding: .5rem; border: 1px solid #ddd; border-radius: .5rem; background: white; cursor: pointer; }
.tool.active { outline: 2px solid #4f46e5; }
.upload { display: inline-block; padding: .5rem; border: 1px dashed #aaa; border-radius: .5rem; background: #fff; cursor: pointer; text-align: center; }
.canvas-wrap { position: relative; flex: 1; overflow: auto; background: #fff; touch-action: none; }
#bgCanvas, #drawCanvas { position: absolute; left: 0; top: 0; }
#revInfo { color: #666; margin-left: .5rem; }

@media (max-width: 900px) {
  .toolbar { width: 100%; min-width: 0; border-right: 0; border-bottom: 1px solid #e2e5ea; display: flex; flex-wrap: wrap; gap: .5rem; }
  .toolgroup { margin: 0; grid-template-columns: repeat(4, minmax(0,1fr)); }
  .workspace { flex-direction: column; }
}
